Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ echo "Applying PHP-specific fixes..."
sed -i '' '/public ?string $role = null,/{N;s/public ?string $role = null,\n public ?string $role = null,/public ?string $role = null,/;}' src/GeneratedModels/CallParticipant.php

# Fix queryUsers method to use proper namespace and required parameter
sed -i '' 's/QueryUsersPayload \$payload/GeneratedModels\\QueryUsersPayload \$payload/' src/Generated/CommonClient.php
sed -i '' 's/QueryUsersPayload \$payload/GeneratedModels\\QueryUsersPayload \$payload/' src/Generated/CommonTrait.php

# Run PHP CS Fixer to ensure code style compliance
if [ -f ".php-cs-fixer.php" ]; then
Expand Down
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
use GetStream\Http\HttpClientInterface;
use GetStream\Http\GuzzleHttpClient;
use GetStream\Auth\JWTGenerator;
use GetStream\Generated\CommonClient;
use GetStream\Generated\CommonTrait;

/**
* Main GetStream client for interacting with the API
*/
class Client
{
use CommonClient;
use CommonTrait;
private string $apiKey;
private string $apiSecret;
private string $baseUrl;
Expand Down
9 changes: 9 additions & 0 deletions src/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ public function buildFeedsClient(): FeedsV3Client{
return new FeedsV3Client($this->apiKey, $this->apiSecret, $this->baseUrl, $this->httpClient);
}

/**
* @throws StreamException
*/
public function buildModerationClient(): ModerationClient{
$this->loadCreds();
return new ModerationClient($this->apiKey, $this->apiSecret, $this->baseUrl, $this->httpClient);
}


public function loadCreds(): void
{
// Load environment variables if enabled
Expand Down
4 changes: 2 additions & 2 deletions src/FeedsV3Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace GetStream;

use GetStream\Generated\FeedsClient;
use GetStream\Generated\FeedsTrait;

class FeedsV3Client extends Client
{
// function __construct(Client $client){
// parent::__construct($client);
// }
use FeedsClient;
use FeedsTrait;

}

Expand Down
54 changes: 53 additions & 1 deletion src/Generated/CommonClient.php → src/Generated/CommonTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This trait contains auto-generated methods from the OpenAPI specification.
* Include this trait in your Client class to add these methods.
*/
trait CommonClient
trait CommonTrait
{
/**
* This Method returns the application settings
Expand Down Expand Up @@ -682,6 +682,21 @@ public function queryPollVotes(string $pollID, string $userID, GeneratedModels\Q
// Use the provided request data array directly
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\PollVotesResponse::class);
}
/**
* Upserts the push preferences for a user and or channel member. Set to all, mentions or none
*
*
* @param GeneratedModels\UpsertPushPreferencesRequest $requestData
* @return StreamResponse<GeneratedModels\UpsertPushPreferencesResponse>
* @throws StreamException
*/
public function updatePushNotificationPreferences(GeneratedModels\UpsertPushPreferencesRequest $requestData): StreamResponse {
$path = '/api/v2/push_preferences';

$queryParams = [];
// Use the provided request data array directly
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\UpsertPushPreferencesResponse::class);
}
/**
* List details of all push providers.
*
Expand Down Expand Up @@ -729,6 +744,43 @@ public function deletePushProvider(string $type, string $name): StreamResponse {
$requestData = null;
return StreamResponse::fromJson($this->makeRequest('DELETE', $path, $queryParams, $requestData), GeneratedModels\Response::class);
}
/**
* Retrieve push notification templates for Chat.
*
*
* @param string $pushProviderType
* @param string $pushProviderName
* @return StreamResponse<GeneratedModels\GetPushTemplatesResponse>
* @throws StreamException
*/
public function getPushTemplates(string $pushProviderType, string $pushProviderName): StreamResponse {
$path = '/api/v2/push_templates';

$queryParams = [];
if ($pushProviderType !== null) {
$queryParams['push_provider_type'] = $pushProviderType;
}
if ($pushProviderName !== null) {
$queryParams['push_provider_name'] = $pushProviderName;
}
$requestData = null;
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\GetPushTemplatesResponse::class);
}
/**
* Create or update a push notification template for a specific event type and push provider
*
*
* @param GeneratedModels\UpsertPushTemplateRequest $requestData
* @return StreamResponse<GeneratedModels\UpsertPushTemplateResponse>
* @throws StreamException
*/
public function upsertPushTemplate(GeneratedModels\UpsertPushTemplateRequest $requestData): StreamResponse {
$path = '/api/v2/push_templates';

$queryParams = [];
// Use the provided request data array directly
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\UpsertPushTemplateResponse::class);
}
/**
* Get rate limits usage and quotas
*
Expand Down
34 changes: 32 additions & 2 deletions src/Generated/FeedsClient.php → src/Generated/FeedsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This trait contains auto-generated methods from the OpenAPI specification.
* Include this trait in your Client class to add these methods.
*/
trait FeedsClient
trait FeedsTrait
{
/**
* Create a new activity or update an existing one
Expand Down Expand Up @@ -1057,6 +1057,36 @@ public function updateFeedView(string $id, GeneratedModels\UpdateFeedViewRequest
// Use the provided request data array directly
return StreamResponse::fromJson($this->makeRequest('PUT', $path, $queryParams, $requestData), GeneratedModels\UpdateFeedViewResponse::class);
}
/**
* Gets all available feed visibility configurations and their permissions
*
*
* @return StreamResponse<GeneratedModels\ListFeedVisibilitiesResponse>
* @throws StreamException
*/
public function listFeedVisibilities(): StreamResponse {
$path = '/api/v2/feeds/feed_visibilities';

$queryParams = [];
$requestData = null;
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\ListFeedVisibilitiesResponse::class);
}
/**
* Gets feed visibility configuration and permissions
*
*
* @param string $name
* @return StreamResponse<GeneratedModels\GetFeedVisibilityResponse>
* @throws StreamException
*/
public function getFeedVisibility(string $name): StreamResponse {
$path = '/api/v2/feeds/feed_visibilities/{name}';
$path = str_replace('{name}', (string) $name, $path);

$queryParams = [];
$requestData = null;
return StreamResponse::fromJson($this->makeRequest('GET', $path, $queryParams, $requestData), GeneratedModels\GetFeedVisibilityResponse::class);
}
/**
* Create multiple feeds at once for a given feed group
*
Expand Down Expand Up @@ -1088,7 +1118,7 @@ public function queryFeeds(GeneratedModels\QueryFeedsRequest $requestData): Stre
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\QueryFeedsResponse::class);
}
/**
* Updates a follow's custom data, push preference, and follower role. Source owner can update custom data and push preference. Target owner can update follower role.
* Updates a follow's custom data, push preference, and follower role. Source owner can update custom data and push preference. Follower role can only be updated via server-side requests.
*
*
* @param GeneratedModels\UpdateFollowRequest $requestData
Expand Down
Loading