-
Notifications
You must be signed in to change notification settings - Fork 451
/
UsersUserRoutes.cs
293 lines (262 loc) · 13.7 KB
/
UsersUserRoutes.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
// <auto-generated>
// Auto-generated by StoneAPI, do not modify.
// </auto-generated>
namespace Dropbox.Api.Users.Routes
{
using sys = System;
using io = System.IO;
using col = System.Collections.Generic;
using t = System.Threading.Tasks;
using enc = Dropbox.Api.Stone;
/// <summary>
/// <para>The routes for the <see cref="N:Dropbox.Api.Users"/> namespace</para>
/// </summary>
public class UsersUserRoutes
{
/// <summary>
/// <para>Initializes a new instance of the <see cref="UsersUserRoutes" />
/// class.</para>
/// </summary>
/// <param name="transport">The transport to use</param>
internal UsersUserRoutes(enc.ITransport transport)
{
this.Transport = transport;
}
/// <summary>
/// <para>Gets the transport used for these routes</para>
/// </summary>
internal enc.ITransport Transport { get; private set; }
/// <summary>
/// <para>Get information about a user's account.</para>
/// </summary>
/// <param name="getAccountArg">The request parameters</param>
/// <returns>The task that represents the asynchronous send operation. The TResult
/// parameter contains the response from the server.</returns>
/// <exception cref="Dropbox.Api.ApiException{TError}">Thrown if there is an error
/// processing the request; This will contain a <see
/// cref="GetAccountError"/>.</exception>
public t.Task<BasicAccount> GetAccountAsync(GetAccountArg getAccountArg)
{
return this.Transport.SendRpcRequestAsync<GetAccountArg, BasicAccount, GetAccountError>(getAccountArg, "api", "/users/get_account", "user", global::Dropbox.Api.Users.GetAccountArg.Encoder, global::Dropbox.Api.Users.BasicAccount.Decoder, global::Dropbox.Api.Users.GetAccountError.Decoder);
}
/// <summary>
/// <para>Begins an asynchronous send to the get account route.</para>
/// </summary>
/// <param name="getAccountArg">The request parameters.</param>
/// <param name="callback">The method to be called when the asynchronous send is
/// completed.</param>
/// <param name="state">A user provided object that distinguished this send from other
/// send requests.</param>
/// <returns>An object that represents the asynchronous send request.</returns>
public sys.IAsyncResult BeginGetAccount(GetAccountArg getAccountArg, sys.AsyncCallback callback, object state = null)
{
var task = this.GetAccountAsync(getAccountArg);
return enc.Util.ToApm(task, callback, state);
}
/// <summary>
/// <para>Get information about a user's account.</para>
/// </summary>
/// <param name="accountId">A user's account identifier.</param>
/// <returns>The task that represents the asynchronous send operation. The TResult
/// parameter contains the response from the server.</returns>
/// <exception cref="Dropbox.Api.ApiException{TError}">Thrown if there is an error
/// processing the request; This will contain a <see
/// cref="GetAccountError"/>.</exception>
public t.Task<BasicAccount> GetAccountAsync(string accountId)
{
var getAccountArg = new GetAccountArg(accountId);
return this.GetAccountAsync(getAccountArg);
}
/// <summary>
/// <para>Begins an asynchronous send to the get account route.</para>
/// </summary>
/// <param name="accountId">A user's account identifier.</param>
/// <param name="callback">The method to be called when the asynchronous send is
/// completed.</param>
/// <param name="callbackState">A user provided object that distinguished this send
/// from other send requests.</param>
/// <returns>An object that represents the asynchronous send request.</returns>
public sys.IAsyncResult BeginGetAccount(string accountId,
sys.AsyncCallback callback,
object callbackState = null)
{
var getAccountArg = new GetAccountArg(accountId);
return this.BeginGetAccount(getAccountArg, callback, callbackState);
}
/// <summary>
/// <para>Waits for the pending asynchronous send to the get account route to
/// complete</para>
/// </summary>
/// <param name="asyncResult">The reference to the pending asynchronous send
/// request</param>
/// <returns>The response to the send request</returns>
/// <exception cref="Dropbox.Api.ApiException{TError}">Thrown if there is an error
/// processing the request; This will contain a <see
/// cref="GetAccountError"/>.</exception>
public BasicAccount EndGetAccount(sys.IAsyncResult asyncResult)
{
var task = asyncResult as t.Task<BasicAccount>;
if (task == null)
{
throw new sys.InvalidOperationException();
}
return task.Result;
}
/// <summary>
/// <para>Get information about multiple user accounts. At most 300 accounts may be
/// queried per request.</para>
/// </summary>
/// <param name="getAccountBatchArg">The request parameters</param>
/// <returns>The task that represents the asynchronous send operation. The TResult
/// parameter contains the response from the server.</returns>
/// <exception cref="Dropbox.Api.ApiException{TError}">Thrown if there is an error
/// processing the request; This will contain a <see
/// cref="GetAccountBatchError"/>.</exception>
public t.Task<col.List<BasicAccount>> GetAccountBatchAsync(GetAccountBatchArg getAccountBatchArg)
{
return this.Transport.SendRpcRequestAsync<GetAccountBatchArg, col.List<BasicAccount>, GetAccountBatchError>(getAccountBatchArg, "api", "/users/get_account_batch", "user", global::Dropbox.Api.Users.GetAccountBatchArg.Encoder, enc.Decoder.CreateListDecoder(global::Dropbox.Api.Users.BasicAccount.Decoder), global::Dropbox.Api.Users.GetAccountBatchError.Decoder);
}
/// <summary>
/// <para>Begins an asynchronous send to the get account batch route.</para>
/// </summary>
/// <param name="getAccountBatchArg">The request parameters.</param>
/// <param name="callback">The method to be called when the asynchronous send is
/// completed.</param>
/// <param name="state">A user provided object that distinguished this send from other
/// send requests.</param>
/// <returns>An object that represents the asynchronous send request.</returns>
public sys.IAsyncResult BeginGetAccountBatch(GetAccountBatchArg getAccountBatchArg, sys.AsyncCallback callback, object state = null)
{
var task = this.GetAccountBatchAsync(getAccountBatchArg);
return enc.Util.ToApm(task, callback, state);
}
/// <summary>
/// <para>Get information about multiple user accounts. At most 300 accounts may be
/// queried per request.</para>
/// </summary>
/// <param name="accountIds">List of user account identifiers. Should not contain any
/// duplicate account IDs.</param>
/// <returns>The task that represents the asynchronous send operation. The TResult
/// parameter contains the response from the server.</returns>
/// <exception cref="Dropbox.Api.ApiException{TError}">Thrown if there is an error
/// processing the request; This will contain a <see
/// cref="GetAccountBatchError"/>.</exception>
public t.Task<col.List<BasicAccount>> GetAccountBatchAsync(col.IEnumerable<string> accountIds)
{
var getAccountBatchArg = new GetAccountBatchArg(accountIds);
return this.GetAccountBatchAsync(getAccountBatchArg);
}
/// <summary>
/// <para>Begins an asynchronous send to the get account batch route.</para>
/// </summary>
/// <param name="accountIds">List of user account identifiers. Should not contain any
/// duplicate account IDs.</param>
/// <param name="callback">The method to be called when the asynchronous send is
/// completed.</param>
/// <param name="callbackState">A user provided object that distinguished this send
/// from other send requests.</param>
/// <returns>An object that represents the asynchronous send request.</returns>
public sys.IAsyncResult BeginGetAccountBatch(col.IEnumerable<string> accountIds,
sys.AsyncCallback callback,
object callbackState = null)
{
var getAccountBatchArg = new GetAccountBatchArg(accountIds);
return this.BeginGetAccountBatch(getAccountBatchArg, callback, callbackState);
}
/// <summary>
/// <para>Waits for the pending asynchronous send to the get account batch route to
/// complete</para>
/// </summary>
/// <param name="asyncResult">The reference to the pending asynchronous send
/// request</param>
/// <returns>The response to the send request</returns>
/// <exception cref="Dropbox.Api.ApiException{TError}">Thrown if there is an error
/// processing the request; This will contain a <see
/// cref="GetAccountBatchError"/>.</exception>
public col.List<BasicAccount> EndGetAccountBatch(sys.IAsyncResult asyncResult)
{
var task = asyncResult as t.Task<col.List<BasicAccount>>;
if (task == null)
{
throw new sys.InvalidOperationException();
}
return task.Result;
}
/// <summary>
/// <para>Get information about the current user's account.</para>
/// </summary>
/// <returns>The task that represents the asynchronous send operation. The TResult
/// parameter contains the response from the server.</returns>
public t.Task<FullAccount> GetCurrentAccountAsync()
{
return this.Transport.SendRpcRequestAsync<enc.Empty, FullAccount, enc.Empty>(enc.Empty.Instance, "api", "/users/get_current_account", "user", enc.EmptyEncoder.Instance, global::Dropbox.Api.Users.FullAccount.Decoder, enc.EmptyDecoder.Instance);
}
/// <summary>
/// <para>Begins an asynchronous send to the get current account route.</para>
/// </summary>
/// <param name="callback">The method to be called when the asynchronous send is
/// completed.</param>
/// <param name="state">A user provided object that distinguished this send from other
/// send requests.</param>
/// <returns>An object that represents the asynchronous send request.</returns>
public sys.IAsyncResult BeginGetCurrentAccount(sys.AsyncCallback callback, object state = null)
{
var task = this.GetCurrentAccountAsync();
return enc.Util.ToApm(task, callback, state);
}
/// <summary>
/// <para>Waits for the pending asynchronous send to the get current account route to
/// complete</para>
/// </summary>
/// <param name="asyncResult">The reference to the pending asynchronous send
/// request</param>
/// <returns>The response to the send request</returns>
public FullAccount EndGetCurrentAccount(sys.IAsyncResult asyncResult)
{
var task = asyncResult as t.Task<FullAccount>;
if (task == null)
{
throw new sys.InvalidOperationException();
}
return task.Result;
}
/// <summary>
/// <para>Get the space usage information for the current user's account.</para>
/// </summary>
/// <returns>The task that represents the asynchronous send operation. The TResult
/// parameter contains the response from the server.</returns>
public t.Task<SpaceUsage> GetSpaceUsageAsync()
{
return this.Transport.SendRpcRequestAsync<enc.Empty, SpaceUsage, enc.Empty>(enc.Empty.Instance, "api", "/users/get_space_usage", "user", enc.EmptyEncoder.Instance, global::Dropbox.Api.Users.SpaceUsage.Decoder, enc.EmptyDecoder.Instance);
}
/// <summary>
/// <para>Begins an asynchronous send to the get space usage route.</para>
/// </summary>
/// <param name="callback">The method to be called when the asynchronous send is
/// completed.</param>
/// <param name="state">A user provided object that distinguished this send from other
/// send requests.</param>
/// <returns>An object that represents the asynchronous send request.</returns>
public sys.IAsyncResult BeginGetSpaceUsage(sys.AsyncCallback callback, object state = null)
{
var task = this.GetSpaceUsageAsync();
return enc.Util.ToApm(task, callback, state);
}
/// <summary>
/// <para>Waits for the pending asynchronous send to the get space usage route to
/// complete</para>
/// </summary>
/// <param name="asyncResult">The reference to the pending asynchronous send
/// request</param>
/// <returns>The response to the send request</returns>
public SpaceUsage EndGetSpaceUsage(sys.IAsyncResult asyncResult)
{
var task = asyncResult as t.Task<SpaceUsage>;
if (task == null)
{
throw new sys.InvalidOperationException();
}
return task.Result;
}
}
}