Skip to content

Commit 94304f9

Browse files
feat(api): update via SDK Studio
1 parent 7df303b commit 94304f9

File tree

5 files changed

+380
-1
lines changed

5 files changed

+380
-1
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 48
1+
configured_endpoints: 51
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-a56421de8c29e0197c90fcbce09d837e8736c3a808b36b242b5c317231ce91fe.yml

api.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ Methods:
7878
- <code title="post /gitpod.v1.EnvironmentAutomationService/StartService">client.Environments.Automations.Services.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#EnvironmentAutomationServiceService.Start">Start</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#EnvironmentAutomationServiceStartParams">EnvironmentAutomationServiceStartParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#EnvironmentAutomationServiceStartResponse">EnvironmentAutomationServiceStartResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
7979
- <code title="post /gitpod.v1.EnvironmentAutomationService/StopService">client.Environments.Automations.Services.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#EnvironmentAutomationServiceService.Stop">Stop</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#EnvironmentAutomationServiceStopParams">EnvironmentAutomationServiceStopParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#EnvironmentAutomationServiceStopResponse">EnvironmentAutomationServiceStopResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
8080

81+
# Identity
82+
83+
Response Types:
84+
85+
- <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityExchangeTokenResponse">IdentityExchangeTokenResponse</a>
86+
- <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityGetAuthenticatedIdentityResponse">IdentityGetAuthenticatedIdentityResponse</a>
87+
- <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityGetIDTokenResponse">IdentityGetIDTokenResponse</a>
88+
89+
Methods:
90+
91+
- <code title="post /gitpod.v1.IdentityService/ExchangeToken">client.Identity.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityService.ExchangeToken">ExchangeToken</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityExchangeTokenParams">IdentityExchangeTokenParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityExchangeTokenResponse">IdentityExchangeTokenResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
92+
- <code title="post /gitpod.v1.IdentityService/GetAuthenticatedIdentity">client.Identity.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityService.GetAuthenticatedIdentity">GetAuthenticatedIdentity</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityGetAuthenticatedIdentityParams">IdentityGetAuthenticatedIdentityParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityGetAuthenticatedIdentityResponse">IdentityGetAuthenticatedIdentityResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
93+
- <code title="post /gitpod.v1.IdentityService/GetIDToken">client.Identity.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityService.GetIDToken">GetIDToken</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityGetIDTokenParams">IdentityGetIDTokenParams</a>) (<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go">gitpod</a>.<a href="https://pkg.go.dev/github.com/stainless-sdks/gitpod-go#IdentityGetIDTokenResponse">IdentityGetIDTokenResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
94+
8195
# EnvironmentClasses
8296

8397
Response Types:

client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Client struct {
1919
AutomationsFiles *AutomationsFileService
2020
Editors *EditorService
2121
Environments *EnvironmentService
22+
Identity *IdentityService
2223
EnvironmentClasses *EnvironmentClassService
2324
Organizations *OrganizationService
2425
Projects *ProjectService
@@ -43,6 +44,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) {
4344
r.AutomationsFiles = NewAutomationsFileService(opts...)
4445
r.Editors = NewEditorService(opts...)
4546
r.Environments = NewEnvironmentService(opts...)
47+
r.Identity = NewIdentityService(opts...)
4648
r.EnvironmentClasses = NewEnvironmentClassService(opts...)
4749
r.Organizations = NewOrganizationService(opts...)
4850
r.Projects = NewProjectService(opts...)

identity.go

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
package gitpod
4+
5+
import (
6+
"context"
7+
"fmt"
8+
"net/http"
9+
10+
"github.com/stainless-sdks/gitpod-go/internal/apijson"
11+
"github.com/stainless-sdks/gitpod-go/internal/param"
12+
"github.com/stainless-sdks/gitpod-go/internal/requestconfig"
13+
"github.com/stainless-sdks/gitpod-go/option"
14+
)
15+
16+
// IdentityService contains methods and other services that help with interacting
17+
// with the gitpod API.
18+
//
19+
// Note, unlike clients, this service does not read variables from the environment
20+
// automatically. You should not instantiate this service directly, and instead use
21+
// the [NewIdentityService] method instead.
22+
type IdentityService struct {
23+
Options []option.RequestOption
24+
}
25+
26+
// NewIdentityService generates a new service that applies the given options to
27+
// each request. These options are applied after the parent client's options (if
28+
// there is one), and before any request-specific options.
29+
func NewIdentityService(opts ...option.RequestOption) (r *IdentityService) {
30+
r = &IdentityService{}
31+
r.Options = opts
32+
return
33+
}
34+
35+
// ExchangeToken trades an exchange token for a new access token.
36+
func (r *IdentityService) ExchangeToken(ctx context.Context, params IdentityExchangeTokenParams, opts ...option.RequestOption) (res *IdentityExchangeTokenResponse, err error) {
37+
if params.ConnectProtocolVersion.Present {
38+
opts = append(opts, option.WithHeader("Connect-Protocol-Version", fmt.Sprintf("%s", params.ConnectProtocolVersion)))
39+
}
40+
if params.ConnectTimeoutMs.Present {
41+
opts = append(opts, option.WithHeader("Connect-Timeout-Ms", fmt.Sprintf("%s", params.ConnectTimeoutMs)))
42+
}
43+
opts = append(r.Options[:], opts...)
44+
path := "gitpod.v1.IdentityService/ExchangeToken"
45+
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
46+
return
47+
}
48+
49+
// GetAuthenticatedIdentity allows to retrieve the current identity.
50+
func (r *IdentityService) GetAuthenticatedIdentity(ctx context.Context, params IdentityGetAuthenticatedIdentityParams, opts ...option.RequestOption) (res *IdentityGetAuthenticatedIdentityResponse, err error) {
51+
if params.ConnectProtocolVersion.Present {
52+
opts = append(opts, option.WithHeader("Connect-Protocol-Version", fmt.Sprintf("%s", params.ConnectProtocolVersion)))
53+
}
54+
if params.ConnectTimeoutMs.Present {
55+
opts = append(opts, option.WithHeader("Connect-Timeout-Ms", fmt.Sprintf("%s", params.ConnectTimeoutMs)))
56+
}
57+
opts = append(r.Options[:], opts...)
58+
path := "gitpod.v1.IdentityService/GetAuthenticatedIdentity"
59+
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
60+
return
61+
}
62+
63+
// GetIDToken returns a token that can be used to authenticate the user against the
64+
// other services.
65+
func (r *IdentityService) GetIDToken(ctx context.Context, params IdentityGetIDTokenParams, opts ...option.RequestOption) (res *IdentityGetIDTokenResponse, err error) {
66+
if params.ConnectProtocolVersion.Present {
67+
opts = append(opts, option.WithHeader("Connect-Protocol-Version", fmt.Sprintf("%s", params.ConnectProtocolVersion)))
68+
}
69+
if params.ConnectTimeoutMs.Present {
70+
opts = append(opts, option.WithHeader("Connect-Timeout-Ms", fmt.Sprintf("%s", params.ConnectTimeoutMs)))
71+
}
72+
opts = append(r.Options[:], opts...)
73+
path := "gitpod.v1.IdentityService/GetIDToken"
74+
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
75+
return
76+
}
77+
78+
type IdentityExchangeTokenResponse struct {
79+
// access_token is the new access token
80+
AccessToken string `json:"accessToken"`
81+
JSON identityExchangeTokenResponseJSON `json:"-"`
82+
}
83+
84+
// identityExchangeTokenResponseJSON contains the JSON metadata for the struct
85+
// [IdentityExchangeTokenResponse]
86+
type identityExchangeTokenResponseJSON struct {
87+
AccessToken apijson.Field
88+
raw string
89+
ExtraFields map[string]apijson.Field
90+
}
91+
92+
func (r *IdentityExchangeTokenResponse) UnmarshalJSON(data []byte) (err error) {
93+
return apijson.UnmarshalRoot(data, r)
94+
}
95+
96+
func (r identityExchangeTokenResponseJSON) RawJSON() string {
97+
return r.raw
98+
}
99+
100+
type IdentityGetAuthenticatedIdentityResponse struct {
101+
OrganizationID string `json:"organizationId"`
102+
// subject is the identity of the current user
103+
Subject IdentityGetAuthenticatedIdentityResponseSubject `json:"subject"`
104+
JSON identityGetAuthenticatedIdentityResponseJSON `json:"-"`
105+
}
106+
107+
// identityGetAuthenticatedIdentityResponseJSON contains the JSON metadata for the
108+
// struct [IdentityGetAuthenticatedIdentityResponse]
109+
type identityGetAuthenticatedIdentityResponseJSON struct {
110+
OrganizationID apijson.Field
111+
Subject apijson.Field
112+
raw string
113+
ExtraFields map[string]apijson.Field
114+
}
115+
116+
func (r *IdentityGetAuthenticatedIdentityResponse) UnmarshalJSON(data []byte) (err error) {
117+
return apijson.UnmarshalRoot(data, r)
118+
}
119+
120+
func (r identityGetAuthenticatedIdentityResponseJSON) RawJSON() string {
121+
return r.raw
122+
}
123+
124+
// subject is the identity of the current user
125+
type IdentityGetAuthenticatedIdentityResponseSubject struct {
126+
// id is the UUID of the subject
127+
ID string `json:"id"`
128+
// Principal is the principal of the subject
129+
Principal IdentityGetAuthenticatedIdentityResponseSubjectPrincipal `json:"principal"`
130+
JSON identityGetAuthenticatedIdentityResponseSubjectJSON `json:"-"`
131+
}
132+
133+
// identityGetAuthenticatedIdentityResponseSubjectJSON contains the JSON metadata
134+
// for the struct [IdentityGetAuthenticatedIdentityResponseSubject]
135+
type identityGetAuthenticatedIdentityResponseSubjectJSON struct {
136+
ID apijson.Field
137+
Principal apijson.Field
138+
raw string
139+
ExtraFields map[string]apijson.Field
140+
}
141+
142+
func (r *IdentityGetAuthenticatedIdentityResponseSubject) UnmarshalJSON(data []byte) (err error) {
143+
return apijson.UnmarshalRoot(data, r)
144+
}
145+
146+
func (r identityGetAuthenticatedIdentityResponseSubjectJSON) RawJSON() string {
147+
return r.raw
148+
}
149+
150+
// Principal is the principal of the subject
151+
type IdentityGetAuthenticatedIdentityResponseSubjectPrincipal string
152+
153+
const (
154+
IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUnspecified IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_UNSPECIFIED"
155+
IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalAccount IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_ACCOUNT"
156+
IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUser IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_USER"
157+
IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalRunner IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_RUNNER"
158+
IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalEnvironment IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_ENVIRONMENT"
159+
IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalServiceAccount IdentityGetAuthenticatedIdentityResponseSubjectPrincipal = "PRINCIPAL_SERVICE_ACCOUNT"
160+
)
161+
162+
func (r IdentityGetAuthenticatedIdentityResponseSubjectPrincipal) IsKnown() bool {
163+
switch r {
164+
case IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUnspecified, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalAccount, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalUser, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalRunner, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalEnvironment, IdentityGetAuthenticatedIdentityResponseSubjectPrincipalPrincipalServiceAccount:
165+
return true
166+
}
167+
return false
168+
}
169+
170+
type IdentityGetIDTokenResponse struct {
171+
Token string `json:"token"`
172+
JSON identityGetIDTokenResponseJSON `json:"-"`
173+
}
174+
175+
// identityGetIDTokenResponseJSON contains the JSON metadata for the struct
176+
// [IdentityGetIDTokenResponse]
177+
type identityGetIDTokenResponseJSON struct {
178+
Token apijson.Field
179+
raw string
180+
ExtraFields map[string]apijson.Field
181+
}
182+
183+
func (r *IdentityGetIDTokenResponse) UnmarshalJSON(data []byte) (err error) {
184+
return apijson.UnmarshalRoot(data, r)
185+
}
186+
187+
func (r identityGetIDTokenResponseJSON) RawJSON() string {
188+
return r.raw
189+
}
190+
191+
type IdentityExchangeTokenParams struct {
192+
// Define the version of the Connect protocol
193+
ConnectProtocolVersion param.Field[IdentityExchangeTokenParamsConnectProtocolVersion] `header:"Connect-Protocol-Version,required"`
194+
// exchange_token is the token to exchange
195+
ExchangeToken param.Field[string] `json:"exchangeToken"`
196+
// Define the timeout, in ms
197+
ConnectTimeoutMs param.Field[float64] `header:"Connect-Timeout-Ms"`
198+
}
199+
200+
func (r IdentityExchangeTokenParams) MarshalJSON() (data []byte, err error) {
201+
return apijson.MarshalRoot(r)
202+
}
203+
204+
// Define the version of the Connect protocol
205+
type IdentityExchangeTokenParamsConnectProtocolVersion float64
206+
207+
const (
208+
IdentityExchangeTokenParamsConnectProtocolVersion1 IdentityExchangeTokenParamsConnectProtocolVersion = 1
209+
)
210+
211+
func (r IdentityExchangeTokenParamsConnectProtocolVersion) IsKnown() bool {
212+
switch r {
213+
case IdentityExchangeTokenParamsConnectProtocolVersion1:
214+
return true
215+
}
216+
return false
217+
}
218+
219+
type IdentityGetAuthenticatedIdentityParams struct {
220+
Body interface{} `json:"body,required"`
221+
// Define the version of the Connect protocol
222+
ConnectProtocolVersion param.Field[IdentityGetAuthenticatedIdentityParamsConnectProtocolVersion] `header:"Connect-Protocol-Version,required"`
223+
// Define the timeout, in ms
224+
ConnectTimeoutMs param.Field[float64] `header:"Connect-Timeout-Ms"`
225+
}
226+
227+
func (r IdentityGetAuthenticatedIdentityParams) MarshalJSON() (data []byte, err error) {
228+
return apijson.MarshalRoot(r.Body)
229+
}
230+
231+
// Define the version of the Connect protocol
232+
type IdentityGetAuthenticatedIdentityParamsConnectProtocolVersion float64
233+
234+
const (
235+
IdentityGetAuthenticatedIdentityParamsConnectProtocolVersion1 IdentityGetAuthenticatedIdentityParamsConnectProtocolVersion = 1
236+
)
237+
238+
func (r IdentityGetAuthenticatedIdentityParamsConnectProtocolVersion) IsKnown() bool {
239+
switch r {
240+
case IdentityGetAuthenticatedIdentityParamsConnectProtocolVersion1:
241+
return true
242+
}
243+
return false
244+
}
245+
246+
type IdentityGetIDTokenParams struct {
247+
// Define the version of the Connect protocol
248+
ConnectProtocolVersion param.Field[IdentityGetIDTokenParamsConnectProtocolVersion] `header:"Connect-Protocol-Version,required"`
249+
Audience param.Field[[]string] `json:"audience"`
250+
// Define the timeout, in ms
251+
ConnectTimeoutMs param.Field[float64] `header:"Connect-Timeout-Ms"`
252+
}
253+
254+
func (r IdentityGetIDTokenParams) MarshalJSON() (data []byte, err error) {
255+
return apijson.MarshalRoot(r)
256+
}
257+
258+
// Define the version of the Connect protocol
259+
type IdentityGetIDTokenParamsConnectProtocolVersion float64
260+
261+
const (
262+
IdentityGetIDTokenParamsConnectProtocolVersion1 IdentityGetIDTokenParamsConnectProtocolVersion = 1
263+
)
264+
265+
func (r IdentityGetIDTokenParamsConnectProtocolVersion) IsKnown() bool {
266+
switch r {
267+
case IdentityGetIDTokenParamsConnectProtocolVersion1:
268+
return true
269+
}
270+
return false
271+
}

0 commit comments

Comments
 (0)