@@ -4,7 +4,6 @@ package gitpod
4
4
5
5
import (
6
6
"context"
7
- "fmt"
8
7
"net/http"
9
8
"net/url"
10
9
@@ -13,6 +12,7 @@ import (
13
12
"github.com/stainless-sdks/gitpod-go/internal/param"
14
13
"github.com/stainless-sdks/gitpod-go/internal/requestconfig"
15
14
"github.com/stainless-sdks/gitpod-go/option"
15
+ "github.com/stainless-sdks/gitpod-go/packages/pagination"
16
16
)
17
17
18
18
// AccountService contains methods and other services that help with interacting
@@ -35,61 +35,53 @@ func NewAccountService(opts ...option.RequestOption) (r *AccountService) {
35
35
}
36
36
37
37
// GetAccount retrieves a single Account.
38
- func (r * AccountService ) Get (ctx context.Context , params AccountGetParams , opts ... option.RequestOption ) (res * AccountGetResponse , err error ) {
39
- if params .ConnectProtocolVersion .Present {
40
- opts = append (opts , option .WithHeader ("Connect-Protocol-Version" , fmt .Sprintf ("%s" , params .ConnectProtocolVersion )))
41
- }
42
- if params .ConnectTimeoutMs .Present {
43
- opts = append (opts , option .WithHeader ("Connect-Timeout-Ms" , fmt .Sprintf ("%s" , params .ConnectTimeoutMs )))
44
- }
38
+ func (r * AccountService ) Get (ctx context.Context , body AccountGetParams , opts ... option.RequestOption ) (res * AccountGetResponse , err error ) {
45
39
opts = append (r .Options [:], opts ... )
46
40
path := "gitpod.v1.AccountService/GetAccount"
47
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , params , & res , opts ... )
41
+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
48
42
return
49
43
}
50
44
51
45
// DeleteAccount deletes an Account. To Delete an Account, the Account must not be
52
46
// an active member of any Organization.
53
- func (r * AccountService ) Delete (ctx context.Context , params AccountDeleteParams , opts ... option.RequestOption ) (res * AccountDeleteResponse , err error ) {
54
- if params .ConnectProtocolVersion .Present {
55
- opts = append (opts , option .WithHeader ("Connect-Protocol-Version" , fmt .Sprintf ("%s" , params .ConnectProtocolVersion )))
56
- }
57
- if params .ConnectTimeoutMs .Present {
58
- opts = append (opts , option .WithHeader ("Connect-Timeout-Ms" , fmt .Sprintf ("%s" , params .ConnectTimeoutMs )))
59
- }
47
+ func (r * AccountService ) Delete (ctx context.Context , body AccountDeleteParams , opts ... option.RequestOption ) (res * AccountDeleteResponse , err error ) {
60
48
opts = append (r .Options [:], opts ... )
61
49
path := "gitpod.v1.AccountService/DeleteAccount"
62
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , params , & res , opts ... )
50
+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
63
51
return
64
52
}
65
53
66
54
// GetSSOLoginURL returns the URL to redirect the user to for SSO login.
67
- func (r * AccountService ) GetSSOLoginURL (ctx context.Context , params AccountGetSSOLoginURLParams , opts ... option.RequestOption ) (res * AccountGetSSOLoginURLResponse , err error ) {
68
- if params .ConnectProtocolVersion .Present {
69
- opts = append (opts , option .WithHeader ("Connect-Protocol-Version" , fmt .Sprintf ("%s" , params .ConnectProtocolVersion )))
70
- }
71
- if params .ConnectTimeoutMs .Present {
72
- opts = append (opts , option .WithHeader ("Connect-Timeout-Ms" , fmt .Sprintf ("%s" , params .ConnectTimeoutMs )))
73
- }
55
+ func (r * AccountService ) GetSSOLoginURL (ctx context.Context , body AccountGetSSOLoginURLParams , opts ... option.RequestOption ) (res * AccountGetSSOLoginURLResponse , err error ) {
74
56
opts = append (r .Options [:], opts ... )
75
57
path := "gitpod.v1.AccountService/GetSSOLoginURL"
76
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , params , & res , opts ... )
58
+ err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , body , & res , opts ... )
77
59
return
78
60
}
79
61
80
62
// ListLoginProviders returns the list of login providers matching the provided
81
63
// filters.
82
- func (r * AccountService ) ListLoginProviders (ctx context.Context , params AccountListLoginProvidersParams , opts ... option.RequestOption ) (res * AccountListLoginProvidersResponse , err error ) {
83
- if params .ConnectProtocolVersion .Present {
84
- opts = append (opts , option .WithHeader ("Connect-Protocol-Version" , fmt .Sprintf ("%s" , params .ConnectProtocolVersion )))
85
- }
86
- if params .ConnectTimeoutMs .Present {
87
- opts = append (opts , option .WithHeader ("Connect-Timeout-Ms" , fmt .Sprintf ("%s" , params .ConnectTimeoutMs )))
88
- }
64
+ func (r * AccountService ) ListLoginProviders (ctx context.Context , params AccountListLoginProvidersParams , opts ... option.RequestOption ) (res * pagination.PersonalAccessTokensPage [AccountListLoginProvidersResponse ], err error ) {
65
+ var raw * http.Response
89
66
opts = append (r .Options [:], opts ... )
67
+ opts = append ([]option.RequestOption {option .WithResponseInto (& raw )}, opts ... )
90
68
path := "gitpod.v1.AccountService/ListLoginProviders"
91
- err = requestconfig .ExecuteNewRequest (ctx , http .MethodGet , path , params , & res , opts ... )
92
- return
69
+ cfg , err := requestconfig .NewRequestConfig (ctx , http .MethodPost , path , params , & res , opts ... )
70
+ if err != nil {
71
+ return nil , err
72
+ }
73
+ err = cfg .Execute ()
74
+ if err != nil {
75
+ return nil , err
76
+ }
77
+ res .SetPageConfig (cfg , raw )
78
+ return res , nil
79
+ }
80
+
81
+ // ListLoginProviders returns the list of login providers matching the provided
82
+ // filters.
83
+ func (r * AccountService ) ListLoginProvidersAutoPaging (ctx context.Context , params AccountListLoginProvidersParams , opts ... option.RequestOption ) * pagination.PersonalAccessTokensPageAutoPager [AccountListLoginProvidersResponse ] {
84
+ return pagination .NewPersonalAccessTokensPageAutoPager (r .ListLoginProviders (ctx , params , opts ... ))
93
85
}
94
86
95
87
type AccountGetResponse struct {
@@ -210,9 +202,8 @@ func (r accountListLoginProvidersResponseLoginProviderJSON) RawJSON() string {
210
202
}
211
203
212
204
type AccountListLoginProvidersResponsePagination struct {
213
- // Token passed for retreiving the next set of results. Empty if there are no
214
- //
215
- // more results
205
+ // Token passed for retreiving the next set of results. Empty if there are no more
206
+ // results
216
207
NextToken string `json:"nextToken"`
217
208
JSON accountListLoginProvidersResponsePaginationJSON `json:"-"`
218
209
}
@@ -235,103 +226,42 @@ func (r accountListLoginProvidersResponsePaginationJSON) RawJSON() string {
235
226
236
227
type AccountGetParams struct {
237
228
Body interface {} `json:"body,required"`
238
- // Define the version of the Connect protocol
239
- ConnectProtocolVersion param.Field [AccountGetParamsConnectProtocolVersion ] `header:"Connect-Protocol-Version,required"`
240
- // Define the timeout, in ms
241
- ConnectTimeoutMs param.Field [float64 ] `header:"Connect-Timeout-Ms"`
242
229
}
243
230
244
231
func (r AccountGetParams ) MarshalJSON () (data []byte , err error ) {
245
232
return apijson .MarshalRoot (r .Body )
246
233
}
247
234
248
- // Define the version of the Connect protocol
249
- type AccountGetParamsConnectProtocolVersion float64
250
-
251
- const (
252
- AccountGetParamsConnectProtocolVersion1 AccountGetParamsConnectProtocolVersion = 1
253
- )
254
-
255
- func (r AccountGetParamsConnectProtocolVersion ) IsKnown () bool {
256
- switch r {
257
- case AccountGetParamsConnectProtocolVersion1 :
258
- return true
259
- }
260
- return false
261
- }
262
-
263
235
type AccountDeleteParams struct {
264
- // Define the version of the Connect protocol
265
- ConnectProtocolVersion param.Field [AccountDeleteParamsConnectProtocolVersion ] `header:"Connect-Protocol-Version,required"`
266
- AccountID param.Field [string ] `json:"accountId" format:"uuid"`
267
- // Define the timeout, in ms
268
- ConnectTimeoutMs param.Field [float64 ] `header:"Connect-Timeout-Ms"`
236
+ AccountID param.Field [string ] `json:"accountId" format:"uuid"`
269
237
}
270
238
271
239
func (r AccountDeleteParams ) MarshalJSON () (data []byte , err error ) {
272
240
return apijson .MarshalRoot (r )
273
241
}
274
242
275
- // Define the version of the Connect protocol
276
- type AccountDeleteParamsConnectProtocolVersion float64
277
-
278
- const (
279
- AccountDeleteParamsConnectProtocolVersion1 AccountDeleteParamsConnectProtocolVersion = 1
280
- )
281
-
282
- func (r AccountDeleteParamsConnectProtocolVersion ) IsKnown () bool {
283
- switch r {
284
- case AccountDeleteParamsConnectProtocolVersion1 :
285
- return true
286
- }
287
- return false
288
- }
289
-
290
243
type AccountGetSSOLoginURLParams struct {
291
244
// return_to is the URL the user will be redirected to after login
292
245
ReturnTo param.Field [string ] `json:"returnTo,required" format:"uri"`
293
- // Define the version of the Connect protocol
294
- ConnectProtocolVersion param.Field [AccountGetSSOLoginURLParamsConnectProtocolVersion ] `header:"Connect-Protocol-Version,required"`
295
246
// email is the email the user wants to login with
296
247
Email param.Field [string ] `json:"email" format:"email"`
297
- // Define the timeout, in ms
298
- ConnectTimeoutMs param.Field [float64 ] `header:"Connect-Timeout-Ms"`
299
248
}
300
249
301
250
func (r AccountGetSSOLoginURLParams ) MarshalJSON () (data []byte , err error ) {
302
251
return apijson .MarshalRoot (r )
303
252
}
304
253
305
- // Define the version of the Connect protocol
306
- type AccountGetSSOLoginURLParamsConnectProtocolVersion float64
307
-
308
- const (
309
- AccountGetSSOLoginURLParamsConnectProtocolVersion1 AccountGetSSOLoginURLParamsConnectProtocolVersion = 1
310
- )
311
-
312
- func (r AccountGetSSOLoginURLParamsConnectProtocolVersion ) IsKnown () bool {
313
- switch r {
314
- case AccountGetSSOLoginURLParamsConnectProtocolVersion1 :
315
- return true
316
- }
317
- return false
254
+ type AccountListLoginProvidersParams struct {
255
+ Token param.Field [string ] `query:"token"`
256
+ PageSize param.Field [int64 ] `query:"pageSize"`
257
+ // filter contains the filter options for listing login methods
258
+ Filter param.Field [AccountListLoginProvidersParamsFilter ] `json:"filter"`
259
+ // pagination contains the pagination options for listing login methods
260
+ Pagination param.Field [AccountListLoginProvidersParamsPagination ] `json:"pagination"`
318
261
}
319
262
320
- type AccountListLoginProvidersParams struct {
321
- // Define which encoding or 'Message-Codec' to use
322
- Encoding param.Field [AccountListLoginProvidersParamsEncoding ] `query:"encoding,required"`
323
- // Define the version of the Connect protocol
324
- ConnectProtocolVersion param.Field [AccountListLoginProvidersParamsConnectProtocolVersion ] `header:"Connect-Protocol-Version,required"`
325
- // Specifies if the message query param is base64 encoded, which may be required
326
- // for binary data
327
- Base64 param.Field [bool ] `query:"base64"`
328
- // Which compression algorithm to use for this request
329
- Compression param.Field [AccountListLoginProvidersParamsCompression ] `query:"compression"`
330
- // Define the version of the Connect protocol
331
- Connect param.Field [AccountListLoginProvidersParamsConnect ] `query:"connect"`
332
- Message param.Field [string ] `query:"message"`
333
- // Define the timeout, in ms
334
- ConnectTimeoutMs param.Field [float64 ] `header:"Connect-Timeout-Ms"`
263
+ func (r AccountListLoginProvidersParams ) MarshalJSON () (data []byte , err error ) {
264
+ return apijson .MarshalRoot (r )
335
265
}
336
266
337
267
// URLQuery serializes [AccountListLoginProvidersParams]'s query parameters as
@@ -343,65 +273,26 @@ func (r AccountListLoginProvidersParams) URLQuery() (v url.Values) {
343
273
})
344
274
}
345
275
346
- // Define which encoding or 'Message-Codec' to use
347
- type AccountListLoginProvidersParamsEncoding string
348
-
349
- const (
350
- AccountListLoginProvidersParamsEncodingProto AccountListLoginProvidersParamsEncoding = "proto"
351
- AccountListLoginProvidersParamsEncodingJson AccountListLoginProvidersParamsEncoding = "json"
352
- )
353
-
354
- func (r AccountListLoginProvidersParamsEncoding ) IsKnown () bool {
355
- switch r {
356
- case AccountListLoginProvidersParamsEncodingProto , AccountListLoginProvidersParamsEncodingJson :
357
- return true
358
- }
359
- return false
276
+ // filter contains the filter options for listing login methods
277
+ type AccountListLoginProvidersParamsFilter struct {
278
+ // invite_id is the ID of the invite URL the user wants to login with
279
+ InviteID param.Field [string ] `json:"inviteId" format:"uuid"`
360
280
}
361
281
362
- // Define the version of the Connect protocol
363
- type AccountListLoginProvidersParamsConnectProtocolVersion float64
364
-
365
- const (
366
- AccountListLoginProvidersParamsConnectProtocolVersion1 AccountListLoginProvidersParamsConnectProtocolVersion = 1
367
- )
368
-
369
- func (r AccountListLoginProvidersParamsConnectProtocolVersion ) IsKnown () bool {
370
- switch r {
371
- case AccountListLoginProvidersParamsConnectProtocolVersion1 :
372
- return true
373
- }
374
- return false
282
+ func (r AccountListLoginProvidersParamsFilter ) MarshalJSON () (data []byte , err error ) {
283
+ return apijson .MarshalRoot (r )
375
284
}
376
285
377
- // Which compression algorithm to use for this request
378
- type AccountListLoginProvidersParamsCompression string
379
-
380
- const (
381
- AccountListLoginProvidersParamsCompressionIdentity AccountListLoginProvidersParamsCompression = "identity"
382
- AccountListLoginProvidersParamsCompressionGzip AccountListLoginProvidersParamsCompression = "gzip"
383
- AccountListLoginProvidersParamsCompressionBr AccountListLoginProvidersParamsCompression = "br"
384
- )
385
-
386
- func (r AccountListLoginProvidersParamsCompression ) IsKnown () bool {
387
- switch r {
388
- case AccountListLoginProvidersParamsCompressionIdentity , AccountListLoginProvidersParamsCompressionGzip , AccountListLoginProvidersParamsCompressionBr :
389
- return true
390
- }
391
- return false
286
+ // pagination contains the pagination options for listing login methods
287
+ type AccountListLoginProvidersParamsPagination struct {
288
+ // Token for the next set of results that was returned as next_token of a
289
+ // PaginationResponse
290
+ Token param.Field [string ] `json:"token"`
291
+ // Page size is the maximum number of results to retrieve per page. Defaults to 25.
292
+ // Maximum 100.
293
+ PageSize param.Field [int64 ] `json:"pageSize"`
392
294
}
393
295
394
- // Define the version of the Connect protocol
395
- type AccountListLoginProvidersParamsConnect string
396
-
397
- const (
398
- AccountListLoginProvidersParamsConnectV1 AccountListLoginProvidersParamsConnect = "v1"
399
- )
400
-
401
- func (r AccountListLoginProvidersParamsConnect ) IsKnown () bool {
402
- switch r {
403
- case AccountListLoginProvidersParamsConnectV1 :
404
- return true
405
- }
406
- return false
296
+ func (r AccountListLoginProvidersParamsPagination ) MarshalJSON () (data []byte , err error ) {
297
+ return apijson .MarshalRoot (r )
407
298
}
0 commit comments