@@ -12,6 +12,7 @@ import (
1212 "github.com/stainless-sdks/gitpod-go/internal/param"
1313 "github.com/stainless-sdks/gitpod-go/internal/requestconfig"
1414 "github.com/stainless-sdks/gitpod-go/option"
15+ "github.com/stainless-sdks/gitpod-go/packages/pagination"
1516)
1617
1718// AccountService contains methods and other services that help with interacting
@@ -60,11 +61,27 @@ func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOL
6061
6162// ListLoginProviders returns the list of login providers matching the provided
6263// filters.
63- func (r * AccountService ) ListLoginProviders (ctx context.Context , params AccountListLoginProvidersParams , opts ... option.RequestOption ) (res * AccountListLoginProvidersResponse , err error ) {
64+ func (r * AccountService ) ListLoginProviders (ctx context.Context , params AccountListLoginProvidersParams , opts ... option.RequestOption ) (res * pagination.LoginProvidersPage [AccountListLoginProvidersResponse ], err error ) {
65+ var raw * http.Response
6466 opts = append (r .Options [:], opts ... )
67+ opts = append ([]option.RequestOption {option .WithResponseInto (& raw )}, opts ... )
6568 path := "gitpod.v1.AccountService/ListLoginProviders"
66- err = requestconfig .ExecuteNewRequest (ctx , http .MethodPost , path , params , & res , opts ... )
67- 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.LoginProvidersPageAutoPager [AccountListLoginProvidersResponse ] {
84+ return pagination .NewLoginProvidersPageAutoPager (r .ListLoginProviders (ctx , params , opts ... ))
6885}
6986
7087type AccountGetResponse struct {
@@ -136,74 +153,28 @@ func (r accountGetSSOLoginURLResponseJSON) RawJSON() string {
136153}
137154
138155type AccountListLoginProvidersResponse struct {
139- LoginProviders []AccountListLoginProvidersResponseLoginProvider `json:"loginProviders"`
140- Pagination AccountListLoginProvidersResponsePagination `json:"pagination"`
141- JSON accountListLoginProvidersResponseJSON `json:"-"`
142- }
143-
144- // accountListLoginProvidersResponseJSON contains the JSON metadata for the struct
145- // [AccountListLoginProvidersResponse]
146- type accountListLoginProvidersResponseJSON struct {
147- LoginProviders apijson.Field
148- Pagination apijson.Field
149- raw string
150- ExtraFields map [string ]apijson.Field
151- }
152-
153- func (r * AccountListLoginProvidersResponse ) UnmarshalJSON (data []byte ) (err error ) {
154- return apijson .UnmarshalRoot (data , r )
155- }
156-
157- func (r accountListLoginProvidersResponseJSON ) RawJSON () string {
158- return r .raw
159- }
160-
161- type AccountListLoginProvidersResponseLoginProvider struct {
162156 // login_url is the URL to redirect the browser agent to for login
163157 LoginURL string `json:"loginUrl"`
164158 // provider is the provider used by this login method, e.g. "github", "google",
165159 // "custom"
166- Provider string `json:"provider"`
167- JSON accountListLoginProvidersResponseLoginProviderJSON `json:"-"`
160+ Provider string `json:"provider"`
161+ JSON accountListLoginProvidersResponseJSON `json:"-"`
168162}
169163
170- // accountListLoginProvidersResponseLoginProviderJSON contains the JSON metadata
171- // for the struct [AccountListLoginProvidersResponseLoginProvider ]
172- type accountListLoginProvidersResponseLoginProviderJSON struct {
164+ // accountListLoginProvidersResponseJSON contains the JSON metadata for the struct
165+ // [AccountListLoginProvidersResponse ]
166+ type accountListLoginProvidersResponseJSON struct {
173167 LoginURL apijson.Field
174168 Provider apijson.Field
175169 raw string
176170 ExtraFields map [string ]apijson.Field
177171}
178172
179- func (r * AccountListLoginProvidersResponseLoginProvider ) UnmarshalJSON (data []byte ) (err error ) {
180- return apijson .UnmarshalRoot (data , r )
181- }
182-
183- func (r accountListLoginProvidersResponseLoginProviderJSON ) RawJSON () string {
184- return r .raw
185- }
186-
187- type AccountListLoginProvidersResponsePagination struct {
188- // Token passed for retreiving the next set of results. Empty if there are no more
189- // results
190- NextToken string `json:"nextToken"`
191- JSON accountListLoginProvidersResponsePaginationJSON `json:"-"`
192- }
193-
194- // accountListLoginProvidersResponsePaginationJSON contains the JSON metadata for
195- // the struct [AccountListLoginProvidersResponsePagination]
196- type accountListLoginProvidersResponsePaginationJSON struct {
197- NextToken apijson.Field
198- raw string
199- ExtraFields map [string ]apijson.Field
200- }
201-
202- func (r * AccountListLoginProvidersResponsePagination ) UnmarshalJSON (data []byte ) (err error ) {
173+ func (r * AccountListLoginProvidersResponse ) UnmarshalJSON (data []byte ) (err error ) {
203174 return apijson .UnmarshalRoot (data , r )
204175}
205176
206- func (r accountListLoginProvidersResponsePaginationJSON ) RawJSON () string {
177+ func (r accountListLoginProvidersResponseJSON ) RawJSON () string {
207178 return r .raw
208179}
209180
0 commit comments