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
95 changes: 95 additions & 0 deletions src/ChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}

// Delete campaign
public async Task<StreamResponse<DeleteCampaignResponse>> DeleteCampaignAsync(string id, object request = null,

Check warning on line 67 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand All @@ -80,7 +80,7 @@
}

// Get campaign by ID.
public async Task<StreamResponse<GetCampaignResponse>> GetCampaignAsync(string id, object request = null,

Check warning on line 83 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand Down Expand Up @@ -260,7 +260,7 @@

// Sends events:
// - channel.deleted
public async Task<StreamResponse<DeleteChannelResponse>> DeleteChannelAsync(string type, string id, object request = null,

Check warning on line 263 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand All @@ -278,7 +278,7 @@
}

// Returns a channel by its CID without creating it. Responds with 404 when the channel does not exist, so it doubles as an existence check. Pass state=true to also load messages, read state and watchers, and the messages_id_* parameters to page those messages by message ID.
public async Task<StreamResponse<ChannelStateResponse>> GetChannelAsync(string type, string id, object request = null,

Check warning on line 281 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand Down Expand Up @@ -343,7 +343,7 @@

// Sends events:
// - draft.deleted
public async Task<StreamResponse<Response>> DeleteDraftAsync(string type, string id, object request = null,

Check warning on line 346 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand All @@ -361,7 +361,7 @@
}

// Get a draft
public async Task<StreamResponse<GetDraftResponse>> GetDraftAsync(string type, string id, object request = null,

Check warning on line 364 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand Down Expand Up @@ -396,7 +396,7 @@
}

// Deletes previously uploaded file
public async Task<StreamResponse<Response>> DeleteChannelFileAsync(string type, string id, object request = null,

Check warning on line 399 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand Down Expand Up @@ -451,7 +451,7 @@
}

// Deletes previously uploaded image
public async Task<StreamResponse<Response>> DeleteChannelImageAsync(string type, string id, object request = null,

Check warning on line 454 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand Down Expand Up @@ -526,7 +526,7 @@
}

// Returns list messages found by IDs
public async Task<StreamResponse<GetManyMessagesResponse>> GetManyMessagesAsync(string type, string id, object request = null,

Check warning on line 529 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand All @@ -543,6 +543,24 @@
return result;
}

// Returns pinned messages for the channel
public async Task<StreamResponse<GetPinnedMessagesResponse>> GetPinnedMessagesAsync(string type, string id, object request = null,

Check warning on line 547 in src/ChatClient.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["type"] = type,
["id"] = id,
};
var queryParams = ExtractQueryParams(request);

var result = await _client.MakeRequestAsync<object, GetPinnedMessagesResponse>(
"GET",
"/api/v2/chat/channels/{type}/{id}/pinned_messages", queryParams, null, pathParams,
cancellationToken);
return result;
}

// This Method creates a channel or returns an existing one with matching attributes

// Sends events:
Expand Down Expand Up @@ -1258,6 +1276,79 @@
return result;
}

// Get all predefined filters with optional sorting by created_at, updated_at, name, or operation
public async Task<StreamResponse<QueryPredefinedFiltersResponse>> GetPredefinedFiltersAsync(object request = null,
CancellationToken cancellationToken = default)
{
var queryParams = ExtractQueryParams(request);

var result = await _client.MakeRequestAsync<object, QueryPredefinedFiltersResponse>(
"GET",
"/api/v2/chat/predefined_filters", queryParams, null, null,
cancellationToken);
return result;
}

// Create a predefined filter that can be used in Query endpoints
public async Task<StreamResponse<CreatePredefinedFilterResponse>> CreatePredefinedFilterAsync(CreatePredefinedFilterRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<CreatePredefinedFilterRequest, CreatePredefinedFilterResponse>(
"POST",
"/api/v2/chat/predefined_filters", null, request, null,
cancellationToken);
return result;
}

// Delete a predefined filter by name
public async Task<StreamResponse<Response>> DeletePredefinedFilterAsync(string name, object request = null,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["name"] = name,
};

var result = await _client.MakeRequestAsync<object, Response>(
"DELETE",
"/api/v2/chat/predefined_filters/{name}", null, null, pathParams,
cancellationToken);
return result;
}

// Get a predefined filter by name
public async Task<StreamResponse<GetPredefinedFilterResponse>> GetPredefinedFilterAsync(string name, object request = null,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["name"] = name,
};

var result = await _client.MakeRequestAsync<object, GetPredefinedFilterResponse>(
"GET",
"/api/v2/chat/predefined_filters/{name}", null, null, pathParams,
cancellationToken);
return result;
}

// Update a predefined filter by name
public async Task<StreamResponse<UpdatePredefinedFilterResponse>> UpdatePredefinedFilterAsync(string name, UpdatePredefinedFilterRequest request,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["name"] = name,
};

var result = await _client.MakeRequestAsync<UpdatePredefinedFilterRequest, UpdatePredefinedFilterResponse>(
"PUT",
"/api/v2/chat/predefined_filters/{name}", null, request, pathParams,
cancellationToken);
return result;
}

// Find and filter channel scoped or global user bans
public async Task<StreamResponse<QueryBannedUsersResponse>> QueryBannedUsersAsync(object request = null,
CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -1517,6 +1608,10 @@
// - Use 'start_date'/'end_date' parameters (YYYY-MM-DD format) for daily breakdown
// - If neither provided, defaults to current month (monthly mode)

// **Team Filter:**
// - Use 'team' to return a single team's stats (empty string selects users not assigned to any team)
// - Mutually exclusive with the 'next' pagination cursor

// This endpoint is server-side only.
public async Task<StreamResponse<QueryTeamUsageStatsResponse>> QueryTeamUsageStatsAsync(QueryTeamUsageStatsRequest request,
CancellationToken cancellationToken = default)
Expand Down
41 changes: 41 additions & 0 deletions src/CommonClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,32 @@ public async Task<StreamResponse<ListPermissionsResponse>> ListPermissionsAsync(

return result;
}
public async Task<StreamResponse<Response>> CreatePermissionAsync(CreatePermissionRequest request,
CancellationToken cancellationToken = default)
{

var result = await MakeRequestAsync<CreatePermissionRequest, Response>(
"POST",
"/api/v2/permissions", null, request, null,
cancellationToken);

return result;
}
public async Task<StreamResponse<Response>> DeletePermissionAsync(string id, object request = null,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["id"] = id,
};

var result = await MakeRequestAsync<object, Response>(
"DELETE",
"/api/v2/permissions/{id}", null, null, pathParams,
cancellationToken);

return result;
}
public async Task<StreamResponse<GetCustomPermissionResponse>> GetPermissionAsync(string id, object request = null,
CancellationToken cancellationToken = default)
{
Expand All @@ -521,6 +547,21 @@ public async Task<StreamResponse<GetCustomPermissionResponse>> GetPermissionAsyn

return result;
}
public async Task<StreamResponse<Response>> UpdatePermissionAsync(string id, PermissionRequest request,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["id"] = id,
};

var result = await MakeRequestAsync<PermissionRequest, Response>(
"PUT",
"/api/v2/permissions/{id}", null, request, pathParams,
cancellationToken);

return result;
}
public async Task<StreamResponse<PollResponse>> CreatePollAsync(CreatePollRequest request,
CancellationToken cancellationToken = default)
{
Expand Down
9 changes: 9 additions & 0 deletions src/Feed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// Delete a single feed by its ID
public async Task<StreamResponse<DeleteFeedResponse>> DeleteFeedAsync(
object request = null,

Check warning on line 15 in src/Feed.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
return await _client.DeleteFeedAsync(_feedGroup, _feedId,
Expand Down Expand Up @@ -48,7 +48,7 @@

// Unpin an activity from a feed. This removes the pin, so the activity will no longer be displayed at the top of the feed.
public async Task<StreamResponse<UnpinActivityResponse>> UnpinActivityAsync(string activityID,
object request = null,

Check warning on line 51 in src/Feed.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
return await _client.UnpinActivityAsync(_feedGroup, _feedId,
Expand All @@ -73,6 +73,15 @@
request, cancellationToken);
}

// Returns the number of activities in a feed, the total number of comments on those activities (including nested replies), and the sum of both. The comment total is cached for a few seconds on large feeds.
public async Task<StreamResponse<GetFeedCountsResponse>> GetFeedCountsAsync(
object request = null,

Check warning on line 78 in src/Feed.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
return await _client.GetFeedCountsAsync(_feedGroup, _feedId,
request, cancellationToken);
}

// Add, remove, or set members for a feed
public async Task<StreamResponse<UpdateFeedMembersResponse>> UpdateFeedMembersAsync(
UpdateFeedMembersRequest request,
Expand Down
16 changes: 16 additions & 0 deletions src/FeedsV3Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

return result;
}
public async Task<StreamResponse<DeleteBookmarkResponse>> DeleteBookmarkAsync(string activityID, object request = null,

Check warning on line 127 in src/FeedsV3Client.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand Down Expand Up @@ -201,7 +201,7 @@

return result;
}
public async Task<StreamResponse<PollVoteResponse>> DeletePollVoteAsync(string activityID, string pollID, string voteID, object request = null,

Check warning on line 204 in src/FeedsV3Client.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Cannot convert null literal to non-nullable reference type.
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
Expand Down Expand Up @@ -894,6 +894,22 @@

return result;
}
public async Task<StreamResponse<GetFeedCountsResponse>> GetFeedCountsAsync(string feedGroupID, string feedID, object request = null,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["feed_group_id"] = feedGroupID,
["feed_id"] = feedID,
};

var result = await _client.MakeRequestAsync<object, GetFeedCountsResponse>(
"GET",
"/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}/counts", null, null, pathParams,
cancellationToken);

return result;
}
public async Task<StreamResponse<UpdateFeedMembersResponse>> UpdateFeedMembersAsync(string feedGroupID, string feedID, UpdateFeedMembersRequest request,
CancellationToken cancellationToken = default)
{
Expand Down
Loading
Loading