Skip to content

Commit dc13cd8

Browse files
author
SDKgen-Bot
committed
Operation "retweet.getAll" was added
1 parent 0d00345 commit dc13cd8

File tree

10 files changed

+61
-106
lines changed

10 files changed

+61
-106
lines changed

sdkgen.lock

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/SdkFabric.Twitter/BookmarkTag.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ public async Task<TweetCollection> GetAll(string userId, string expansions, stri
4545
return this.Parser.Parse<TweetCollection>(response.Content);
4646
}
4747

48-
if (response.ErrorException != null)
49-
{
50-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
51-
}
52-
5348
throw (int) response.StatusCode switch
5449
{
5550
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -76,11 +71,6 @@ public async Task<BookmarkResponse> Create(string userId, SingleTweet payload)
7671
return this.Parser.Parse<BookmarkResponse>(response.Content);
7772
}
7873

79-
if (response.ErrorException != null)
80-
{
81-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
82-
}
83-
8474
throw (int) response.StatusCode switch
8575
{
8676
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -107,11 +97,6 @@ public async Task<BookmarkResponse> Delete(string userId, string tweetId)
10797
return this.Parser.Parse<BookmarkResponse>(response.Content);
10898
}
10999

110-
if (response.ErrorException != null)
111-
{
112-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
113-
}
114-
115100
throw (int) response.StatusCode switch
116101
{
117102
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),

src/SdkFabric.Twitter/Client.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ public TrendsTag Trends()
7676
);
7777
}
7878

79+
public RetweetTag Retweet()
80+
{
81+
return new RetweetTag(
82+
this.HttpClient,
83+
this.Parser
84+
);
85+
}
86+
7987

8088

8189
public static Client Build(string token)

src/SdkFabric.Twitter/QuoteTag.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ public async Task<TweetCollection> GetAll(string tweetId, string exclude, string
4747
return this.Parser.Parse<TweetCollection>(response.Content);
4848
}
4949

50-
if (response.ErrorException != null)
51-
{
52-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
53-
}
54-
5550
throw (int) response.StatusCode switch
5651
{
5752
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* RetweetTag automatically generated by SDKgen please do not edit this file manually
3+
* @see https://sdkgen.app
4+
*/
5+
6+
7+
using System.Collections.Generic;
8+
using System.Text.Json;
9+
using System.Threading.Tasks;
10+
using RestSharp;
11+
using Sdkgen.Client;
12+
using Sdkgen.Client.Exception;
13+
14+
namespace SdkFabric.Twitter;
15+
16+
public class RetweetTag : TagAbstract {
17+
public RetweetTag(RestClient httpClient, Parser parser): base(httpClient, parser)
18+
{
19+
}
20+
21+
22+
public async Task<TweetCollection> GetAll(string tweetId, string expansions, int maxResults, Fields fields)
23+
{
24+
Dictionary<string, object> pathParams = new();
25+
pathParams.Add("tweet_id", tweetId);
26+
27+
Dictionary<string, object> queryParams = new();
28+
queryParams.Add("expansions", expansions);
29+
queryParams.Add("max_results", maxResults);
30+
queryParams.Add("fields", fields);
31+
32+
List<string> queryStructNames = new();
33+
queryStructNames.Add("fields");
34+
35+
RestRequest request = new(this.Parser.Url("/2/tweets/:tweet_id/retweets", pathParams), Method.Get);
36+
this.Parser.Query(request, queryParams, queryStructNames);
37+
38+
RestResponse response = await this.HttpClient.ExecuteAsync(request);
39+
40+
if (response.IsSuccessful)
41+
{
42+
return this.Parser.Parse<TweetCollection>(response.Content);
43+
}
44+
45+
throw (int) response.StatusCode switch
46+
{
47+
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
48+
};
49+
}
50+
51+
52+
}

src/SdkFabric.Twitter/SearchTag.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public async Task<TweetCollection> GetRecent(string query, string sortOrder, str
4444
return this.Parser.Parse<TweetCollection>(response.Content);
4545
}
4646

47-
if (response.ErrorException != null)
48-
{
49-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
50-
}
51-
5247
throw (int) response.StatusCode switch
5348
{
5449
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),

src/SdkFabric.Twitter/TrendsTag.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ public async Task<TrendCollection> GetByWoeid(string woeid)
4141
return this.Parser.Parse<TrendCollection>(response.Content);
4242
}
4343

44-
if (response.ErrorException != null)
45-
{
46-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
47-
}
48-
4944
throw (int) response.StatusCode switch
5045
{
5146
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),

src/SdkFabric.Twitter/TweetTag.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public async Task<TweetCollection> GetAll(string ids, string expansions, Fields
4444
return this.Parser.Parse<TweetCollection>(response.Content);
4545
}
4646

47-
if (response.ErrorException != null)
48-
{
49-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
50-
}
51-
5247
throw (int) response.StatusCode switch
5348
{
5449
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -80,11 +75,6 @@ public async Task<TweetEntity> Get(string tweetId, string expansions, Fields fie
8075
return this.Parser.Parse<TweetEntity>(response.Content);
8176
}
8277

83-
if (response.ErrorException != null)
84-
{
85-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
86-
}
87-
8878
throw (int) response.StatusCode switch
8979
{
9080
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -113,11 +103,6 @@ public async Task<TweetCreateResponse> Create(Tweet payload)
113103
return this.Parser.Parse<TweetCreateResponse>(response.Content);
114104
}
115105

116-
if (response.ErrorException != null)
117-
{
118-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
119-
}
120-
121106
throw (int) response.StatusCode switch
122107
{
123108
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -146,11 +131,6 @@ public async Task<TweetDeleteResponse> Delete(string tweetId)
146131
return this.Parser.Parse<TweetDeleteResponse>(response.Content);
147132
}
148133

149-
if (response.ErrorException != null)
150-
{
151-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
152-
}
153-
154134
throw (int) response.StatusCode switch
155135
{
156136
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -180,11 +160,6 @@ public async Task<HideReplyResponse> HideReply(string tweetId, HideReply payload
180160
return this.Parser.Parse<HideReplyResponse>(response.Content);
181161
}
182162

183-
if (response.ErrorException != null)
184-
{
185-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
186-
}
187-
188163
throw (int) response.StatusCode switch
189164
{
190165
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -216,11 +191,6 @@ public async Task<UserCollection> GetLikingUsers(string tweetId, string expansio
216191
return this.Parser.Parse<UserCollection>(response.Content);
217192
}
218193

219-
if (response.ErrorException != null)
220-
{
221-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
222-
}
223-
224194
throw (int) response.StatusCode switch
225195
{
226196
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),

src/SdkFabric.Twitter/UsageTag.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ public async Task<TweetUsageResponse> GetTweets()
4040
return this.Parser.Parse<TweetUsageResponse>(response.Content);
4141
}
4242

43-
if (response.ErrorException != null)
44-
{
45-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
46-
}
47-
4843
throw (int) response.StatusCode switch
4944
{
5045
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),

src/SdkFabric.Twitter/UserTag.cs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public async Task<UserCollection> GetAll(string ids, string expansions, Fields f
4444
return this.Parser.Parse<UserCollection>(response.Content);
4545
}
4646

47-
if (response.ErrorException != null)
48-
{
49-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
50-
}
51-
5247
throw (int) response.StatusCode switch
5348
{
5449
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -80,11 +75,6 @@ public async Task<User> Get(string userId, string expansions, Fields fields)
8075
return this.Parser.Parse<User>(response.Content);
8176
}
8277

83-
if (response.ErrorException != null)
84-
{
85-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
86-
}
87-
8878
throw (int) response.StatusCode switch
8979
{
9080
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -119,11 +109,6 @@ public async Task<TweetCollection> GetTimeline(string userId, string exclude, st
119109
return this.Parser.Parse<TweetCollection>(response.Content);
120110
}
121111

122-
if (response.ErrorException != null)
123-
{
124-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
125-
}
126-
127112
throw (int) response.StatusCode switch
128113
{
129114
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -157,11 +142,6 @@ public async Task<TweetCollection> GetLikedTweets(string userId, string expansio
157142
return this.Parser.Parse<TweetCollection>(response.Content);
158143
}
159144

160-
if (response.ErrorException != null)
161-
{
162-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
163-
}
164-
165145
throw (int) response.StatusCode switch
166146
{
167147
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -191,11 +171,6 @@ public async Task<LikeResponse> RemoveLike(string userId, string tweetId)
191171
return this.Parser.Parse<LikeResponse>(response.Content);
192172
}
193173

194-
if (response.ErrorException != null)
195-
{
196-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
197-
}
198-
199174
throw (int) response.StatusCode switch
200175
{
201176
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -225,11 +200,6 @@ public async Task<LikeResponse> CreateLike(string userId, SingleTweet payload)
225200
return this.Parser.Parse<LikeResponse>(response.Content);
226201
}
227202

228-
if (response.ErrorException != null)
229-
{
230-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
231-
}
232-
233203
throw (int) response.StatusCode switch
234204
{
235205
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -261,11 +231,6 @@ public async Task<UserCollection> FindByName(string usernames, string expansions
261231
return this.Parser.Parse<UserCollection>(response.Content);
262232
}
263233

264-
if (response.ErrorException != null)
265-
{
266-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
267-
}
268-
269234
throw (int) response.StatusCode switch
270235
{
271236
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
@@ -295,11 +260,6 @@ public async Task<User> GetMe(string expansions, string fields)
295260
return this.Parser.Parse<User>(response.Content);
296261
}
297262

298-
if (response.ErrorException != null)
299-
{
300-
throw new ClientException("An unknown error occurred: " + response.ErrorException.Message, response.ErrorException);
301-
}
302-
303263
throw (int) response.StatusCode switch
304264
{
305265
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),

0 commit comments

Comments
 (0)