@@ -4,7 +4,6 @@ package gitpod
44
55import (
66 "context"
7- "fmt"
87 "net/http"
98 "net/url"
109
@@ -13,6 +12,7 @@ import (
1312 "github.com/stainless-sdks/gitpod-go/internal/param"
1413 "github.com/stainless-sdks/gitpod-go/internal/requestconfig"
1514 "github.com/stainless-sdks/gitpod-go/option"
15+ "github.com/stainless-sdks/gitpod-go/packages/pagination"
1616)
1717
1818// AccountService contains methods and other services that help with interacting
@@ -35,61 +35,53 @@ func NewAccountService(opts ...option.RequestOption) (r *AccountService) {
3535}
3636
3737// 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 ) {
4539 opts = append (r .Options [:], opts ... )
4640 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 ... )
4842 return
4943}
5044
5145// DeleteAccount deletes an Account. To Delete an Account, the Account must not be
5246// 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 ) {
6048 opts = append (r .Options [:], opts ... )
6149 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 ... )
6351 return
6452}
6553
6654// 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 ) {
7456 opts = append (r .Options [:], opts ... )
7557 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 ... )
7759 return
7860}
7961
8062// ListLoginProviders returns the list of login providers matching the provided
8163// 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
8966 opts = append (r .Options [:], opts ... )
67+ opts = append ([]option.RequestOption {option .WithResponseInto (& raw )}, opts ... )
9068 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 ... ))
9385}
9486
9587type AccountGetResponse struct {
@@ -210,9 +202,8 @@ func (r accountListLoginProvidersResponseLoginProviderJSON) RawJSON() string {
210202}
211203
212204type 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
216207 NextToken string `json:"nextToken"`
217208 JSON accountListLoginProvidersResponsePaginationJSON `json:"-"`
218209}
@@ -235,103 +226,42 @@ func (r accountListLoginProvidersResponsePaginationJSON) RawJSON() string {
235226
236227type AccountGetParams struct {
237228 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"`
242229}
243230
244231func (r AccountGetParams ) MarshalJSON () (data []byte , err error ) {
245232 return apijson .MarshalRoot (r .Body )
246233}
247234
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-
263235type 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"`
269237}
270238
271239func (r AccountDeleteParams ) MarshalJSON () (data []byte , err error ) {
272240 return apijson .MarshalRoot (r )
273241}
274242
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-
290243type AccountGetSSOLoginURLParams struct {
291244 // return_to is the URL the user will be redirected to after login
292245 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"`
295246 // email is the email the user wants to login with
296247 Email param.Field [string ] `json:"email" format:"email"`
297- // Define the timeout, in ms
298- ConnectTimeoutMs param.Field [float64 ] `header:"Connect-Timeout-Ms"`
299248}
300249
301250func (r AccountGetSSOLoginURLParams ) MarshalJSON () (data []byte , err error ) {
302251 return apijson .MarshalRoot (r )
303252}
304253
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"`
318261}
319262
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 )
335265}
336266
337267// URLQuery serializes [AccountListLoginProvidersParams]'s query parameters as
@@ -343,65 +273,26 @@ func (r AccountListLoginProvidersParams) URLQuery() (v url.Values) {
343273 })
344274}
345275
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"`
360280}
361281
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 )
375284}
376285
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"`
392294}
393295
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 )
407298}
0 commit comments