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
8 changes: 7 additions & 1 deletion .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ jobs:
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
sed -i "s/<Version>.*<\/Version>/<Version>$NEW_VERSION<\/Version>/" src/stream-feed-net.csproj
echo "Updated version to $NEW_VERSION"

- name: Update version in Client.cs
run: |
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
sed -i "s/private const string VersionName = \".*\";/private const string VersionName = \"$NEW_VERSION\";/" src/Client.cs
echo "Updated version constant in Client.cs to $NEW_VERSION"

- name: Run tests
env:
Expand All @@ -98,7 +104,7 @@ jobs:
VERSION_TYPE="${{ github.event.inputs.version_type }}"
RELEASE_NOTES="${{ github.event.inputs.release_notes }}"

git add src/stream-feed-net.csproj
git add src/stream-feed-net.csproj src/Client.cs
git commit -m "Bump version to $NEW_VERSION

Version type: $VERSION_TYPE
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ jobs:
sed -i "s/<Version>.*<\/Version>/<Version>$NEW_VERSION<\/Version>/" src/stream-feed-net.csproj
echo "Updated version to $NEW_VERSION"

- name: Update version in Client.cs
run: |
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
sed -i "s/private const string VersionName = \".*\";/private const string VersionName = \"$NEW_VERSION\";/" src/Client.cs
echo "Updated version constant in Client.cs to $NEW_VERSION"

- name: Create NuGet package
run: |
dotnet pack src/stream-feed-net.csproj --configuration Release --no-build --output ./packages
Expand Down Expand Up @@ -194,7 +200,7 @@ jobs:
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add src/stream-feed-net.csproj
git add src/stream-feed-net.csproj src/Client.cs
git commit -m "chore: bump version to $NEW_VERSION [skip ci]" || exit 0
git push

Expand Down
5 changes: 5 additions & 0 deletions src/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace GetStream
{
public class BaseClient :IClient
{
private const string VersionName = "2.1.0";
private static readonly string VersionHeader = $"getstream-net-{VersionName}";

private readonly HttpClient _httpClient;
protected string ApiKey;
protected string ApiSecret;
Expand Down Expand Up @@ -51,6 +54,7 @@ public async Task<StreamResponse<TResponse>> MakeRequestAsync<TRequest, TRespons
var token = GenerateServerSideToken();
request.Headers.Add("Authorization", token);
request.Headers.Add("stream-auth-type", "jwt");
request.Headers.Add("X-Stream-Client", VersionHeader);

// Add request body if provided
if (requestBody != null)
Expand Down Expand Up @@ -93,6 +97,7 @@ public async Task<StreamResponse<TResponse>> MakeRequestAsyncDebug<TRequest, TRe
var token = GenerateServerSideToken();
request.Headers.Add("Authorization", token);
request.Headers.Add("stream-auth-type", "jwt");
request.Headers.Add("X-Stream-Client", VersionHeader);

// Add request body if provided
if (requestBody != null)
Expand Down
153 changes: 147 additions & 6 deletions src/FeedsV3Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

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

Check warning on line 93 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 @@ -167,7 +167,7 @@

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

Check warning on line 170 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 @@ -215,7 +215,7 @@

return result;
}
public async Task<StreamResponse<DeleteActivityReactionResponse>> DeleteActivityReactionAsync(string activityID, string type,object request = null,

Check warning on line 218 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 All @@ -232,7 +232,7 @@

return result;
}
public async Task<StreamResponse<DeleteActivityResponse>> DeleteActivityAsync(string id,object request = null,

Check warning on line 235 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 All @@ -248,7 +248,7 @@

return result;
}
public async Task<StreamResponse<GetActivityResponse>> GetActivityAsync(string id,object request = null,

Check warning on line 251 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 @@ -304,7 +304,7 @@

return result;
}
public async Task<StreamResponse<DeleteBookmarkFolderResponse>> DeleteBookmarkFolderAsync(string folderID,object request = null,

Check warning on line 307 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 @@ -345,6 +345,63 @@

return result;
}
public async Task<StreamResponse<DeleteCollectionsResponse>> DeleteCollectionsAsync(object request = null,

Check warning on line 348 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 queryParams = ExtractQueryParams(request);

var result = await _client.MakeRequestAsync<object, DeleteCollectionsResponse>(
"DELETE",
"/api/v2/feeds/collections",queryParams,null,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<ReadCollectionsResponse>> ReadCollectionsAsync(object request = null,

Check warning on line 360 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 queryParams = ExtractQueryParams(request);

var result = await _client.MakeRequestAsync<object, ReadCollectionsResponse>(
"GET",
"/api/v2/feeds/collections",queryParams,null,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<UpdateCollectionsResponse>> UpdateCollectionsAsync(UpdateCollectionsRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<UpdateCollectionsRequest, UpdateCollectionsResponse>(
"PATCH",
"/api/v2/feeds/collections",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<CreateCollectionsResponse>> CreateCollectionsAsync(CreateCollectionsRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<CreateCollectionsRequest, CreateCollectionsResponse>(
"POST",
"/api/v2/feeds/collections",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<UpsertCollectionsResponse>> UpsertCollectionsAsync(UpsertCollectionsRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<UpsertCollectionsRequest, UpsertCollectionsResponse>(
"PUT",
"/api/v2/feeds/collections",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<GetCommentsResponse>> GetCommentsAsync(object request = null,
CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -502,10 +559,11 @@
public async Task<StreamResponse<ListFeedGroupsResponse>> ListFeedGroupsAsync(object request = null,
CancellationToken cancellationToken = default)
{
var queryParams = ExtractQueryParams(request);

var result = await _client.MakeRequestAsync<object, ListFeedGroupsResponse>(
"GET",
"/api/v2/feeds/feed_groups",null,null,null,
"/api/v2/feeds/feed_groups",queryParams,null,null,
cancellationToken);

return result;
Expand Down Expand Up @@ -724,10 +782,11 @@
{
["id"] = id,
};
var queryParams = ExtractQueryParams(request);

var result = await _client.MakeRequestAsync<object, GetFeedGroupResponse>(
"GET",
"/api/v2/feeds/feed_groups/{id}",null,null,pathParams,
"/api/v2/feeds/feed_groups/{id}",queryParams,null,pathParams,
cancellationToken);

return result;
Expand Down Expand Up @@ -870,6 +929,21 @@

return result;
}
public async Task<StreamResponse<UpdateFeedVisibilityResponse>> UpdateFeedVisibilityAsync(string name,UpdateFeedVisibilityRequest request,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["name"] = name,
};

var result = await _client.MakeRequestAsync<UpdateFeedVisibilityRequest, UpdateFeedVisibilityResponse>(
"PUT",
"/api/v2/feeds/feed_visibilities/{name}",null,request,pathParams,
cancellationToken);

return result;
}
public async Task<StreamResponse<CreateFeedsBatchResponse>> CreateFeedsBatchAsync(CreateFeedsBatchRequest request,
CancellationToken cancellationToken = default)
{
Expand All @@ -881,6 +955,28 @@

return result;
}
public async Task<StreamResponse<DeleteFeedsBatchResponse>> DeleteFeedsBatchAsync(DeleteFeedsBatchRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<DeleteFeedsBatchRequest, DeleteFeedsBatchResponse>(
"POST",
"/api/v2/feeds/feeds/delete",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<OwnBatchResponse>> OwnBatchAsync(OwnBatchRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<OwnBatchRequest, OwnBatchResponse>(
"POST",
"/api/v2/feeds/feeds/own/batch",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<QueryFeedsResponse>> QueryFeedsAsync(QueryFeedsRequest request,
CancellationToken cancellationToken = default)
{
Expand All @@ -892,6 +988,18 @@

return result;
}
public async Task<StreamResponse<GetFeedsRateLimitsResponse>> GetFeedsRateLimitsAsync(object request = null,
CancellationToken cancellationToken = default)
{
var queryParams = ExtractQueryParams(request);

var result = await _client.MakeRequestAsync<object, GetFeedsRateLimitsResponse>(
"GET",
"/api/v2/feeds/feeds/rate_limits",queryParams,null,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<UpdateFollowResponse>> UpdateFollowAsync(UpdateFollowRequest request,
CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -936,6 +1044,17 @@

return result;
}
public async Task<StreamResponse<FollowBatchResponse>> GetOrCreateFollowsAsync(FollowBatchRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<FollowBatchRequest, FollowBatchResponse>(
"POST",
"/api/v2/feeds/follows/batch/upsert",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<QueryFollowsResponse>> QueryFollowsAsync(QueryFollowsRequest request,
CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -1026,6 +1145,17 @@

return result;
}
public async Task<StreamResponse<QueryFeedsUsageStatsResponse>> QueryFeedsUsageStatsAsync(QueryFeedsUsageStatsRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<QueryFeedsUsageStatsRequest, QueryFeedsUsageStatsResponse>(
"POST",
"/api/v2/feeds/stats/usage",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<UnfollowBatchResponse>> UnfollowBatchAsync(UnfollowBatchRequest request,
CancellationToken cancellationToken = default)
{
Expand All @@ -1037,17 +1167,28 @@

return result;
}
public async Task<StreamResponse<DeleteFeedUserDataResponse>> DeleteFeedUserDataAsync(string userID,object request = null,
public async Task<StreamResponse<UnfollowBatchResponse>> GetOrCreateUnfollowsAsync(UnfollowBatchRequest request,
CancellationToken cancellationToken = default)
{

var result = await _client.MakeRequestAsync<UnfollowBatchRequest, UnfollowBatchResponse>(
"POST",
"/api/v2/feeds/unfollow/batch/upsert",null,request,null,
cancellationToken);

return result;
}
public async Task<StreamResponse<DeleteFeedUserDataResponse>> DeleteFeedUserDataAsync(string userID,DeleteFeedUserDataRequest request,
CancellationToken cancellationToken = default)
{
var pathParams = new Dictionary<string, string>
{
["user_id"] = userID,
};

var result = await _client.MakeRequestAsync<object, DeleteFeedUserDataResponse>(
"DELETE",
"/api/v2/feeds/users/{user_id}/delete",null,null,pathParams,
var result = await _client.MakeRequestAsync<DeleteFeedUserDataRequest, DeleteFeedUserDataResponse>(
"POST",
"/api/v2/feeds/users/{user_id}/delete",null,request,pathParams,
cancellationToken);

return result;
Expand Down
Loading
Loading