Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.6.1"
".": "0.7.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 119
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-ca9a49ac7fbb63f55611fd7cd48a22a3ff8b38a797125c8513e891d9b7345550.yml
openapi_spec_hash: fd6ffbdfaefcc555e61ca1c565e05214
config_hash: 7fb76543ceafd4a116473f647f8d63b1
configured_endpoints: 159
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d62ef4b9187c1f3d36f428abc4b31d8a09ffd36e93d39b8136c60c8f463c838e.yml
openapi_spec_hash: d7f01b6f24e88eb46d744ecd28061f26
config_hash: 26e4a10dfc6ec809322e60d889d15414
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.7.0 (2025-12-15)

Full Changelog: [v0.6.1...v0.7.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.6.1...v0.7.0)

### Features

* **api:** RBAC APIs ([dfee19e](https://github.com/gitpod-io/gitpod-sdk-go/commit/dfee19e63c7697876819a9bf516ec4466a3179ee))

## 0.6.1 (2025-12-06)

Full Changelog: [v0.6.0...v0.6.1](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.6.0...v0.6.1)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<a href="https://pkg.go.dev/github.com/gitpod-io/gitpod-sdk-go"><img src="https://pkg.go.dev/badge/github.com/gitpod-io/gitpod-sdk-go.svg" alt="Go Reference"></a>

The Gitpod Go library provides convenient access to the [Gitpod REST API](https://docs.ona.com)
The Gitpod Go library provides convenient access to the [Gitpod REST API](https://docs.gitpod.io)
from applications written in Go.

It is generated with [Stainless](https://www.stainless.com/).
Expand All @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.6.1'
go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.7.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ or products provided by Gitpod, please follow the respective company's security

### Gitpod Terms and Policies

Please contact dev-feedback@ona.com for any questions or concerns regarding the security of our services.
Please contact dev-feedback@gitpod.com for any questions or concerns regarding the security of our services.

---

Expand Down
146 changes: 131 additions & 15 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,42 @@ func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOL
// ```yaml
// {}
// ```
func (r *AccountService) ListJoinableOrganizations(ctx context.Context, params AccountListJoinableOrganizationsParams, opts ...option.RequestOption) (res *AccountListJoinableOrganizationsResponse, err error) {
func (r *AccountService) ListJoinableOrganizations(ctx context.Context, params AccountListJoinableOrganizationsParams, opts ...option.RequestOption) (res *pagination.JoinableOrganizationsPage[JoinableOrganization], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "gitpod.v1.AccountService/ListJoinableOrganizations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}

// Lists organizations that the currently authenticated account can join.
//
// Use this method to:
//
// - Discover organizations associated with the account's email domain.
// - Allow users to join existing organizations.
// - Display potential organizations during onboarding.
//
// ### Examples
//
// - List joinable organizations:
//
// Retrieves a list of organizations the account can join.
//
// ```yaml
// {}
// ```
func (r *AccountService) ListJoinableOrganizationsAutoPaging(ctx context.Context, params AccountListJoinableOrganizationsParams, opts ...option.RequestOption) *pagination.JoinableOrganizationsPageAutoPager[JoinableOrganization] {
return pagination.NewJoinableOrganizationsPageAutoPager(r.ListJoinableOrganizations(ctx, params, opts...))
}

// Lists available login providers with optional filtering.
Expand Down Expand Up @@ -224,6 +255,29 @@ func (r *AccountService) ListLoginProvidersAutoPaging(ctx context.Context, param
return pagination.NewLoginProvidersPageAutoPager(r.ListLoginProviders(ctx, params, opts...))
}

// ListSSOLogins
func (r *AccountService) ListSSOLogins(ctx context.Context, params AccountListSSOLoginsParams, opts ...option.RequestOption) (res *pagination.LoginsPage[AccountListSSOLoginsResponse], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "gitpod.v1.AccountService/ListSSOLogins"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}

// ListSSOLogins
func (r *AccountService) ListSSOLoginsAutoPaging(ctx context.Context, params AccountListSSOLoginsParams, opts ...option.RequestOption) *pagination.LoginsPageAutoPager[AccountListSSOLoginsResponse] {
return pagination.NewLoginsPageAutoPager(r.ListSSOLogins(ctx, params, opts...))
}

type Account struct {
ID string `json:"id,required" format:"uuid"`
// A Timestamp represents a point in time independent of any time zone or local
Expand Down Expand Up @@ -580,24 +634,29 @@ func (r accountGetSSOLoginURLResponseJSON) RawJSON() string {
return r.raw
}

type AccountListJoinableOrganizationsResponse struct {
JoinableOrganizations []JoinableOrganization `json:"joinableOrganizations"`
JSON accountListJoinableOrganizationsResponseJSON `json:"-"`
type AccountListSSOLoginsResponse struct {
// provider is the provider used by this login method, e.g. "github", "google",
// "custom"
DisplayName string `json:"displayName,required"`
// login_url is the URL to redirect the user to for SSO login
LoginURL string `json:"loginUrl,required"`
JSON accountListSSOLoginsResponseJSON `json:"-"`
}

// accountListJoinableOrganizationsResponseJSON contains the JSON metadata for the
// struct [AccountListJoinableOrganizationsResponse]
type accountListJoinableOrganizationsResponseJSON struct {
JoinableOrganizations apijson.Field
raw string
ExtraFields map[string]apijson.Field
// accountListSSOLoginsResponseJSON contains the JSON metadata for the struct
// [AccountListSSOLoginsResponse]
type accountListSSOLoginsResponseJSON struct {
DisplayName apijson.Field
LoginURL apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccountListJoinableOrganizationsResponse) UnmarshalJSON(data []byte) (err error) {
func (r *AccountListSSOLoginsResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r accountListJoinableOrganizationsResponseJSON) RawJSON() string {
func (r accountListSSOLoginsResponseJSON) RawJSON() string {
return r.raw
}

Expand All @@ -611,6 +670,8 @@ func (r AccountGetParams) MarshalJSON() (data []byte, err error) {

type AccountDeleteParams struct {
AccountID param.Field[string] `json:"accountId,required" format:"uuid"`
// reason is an optional field for the reason for account deletion
Reason param.Field[string] `json:"reason"`
}

func (r AccountDeleteParams) MarshalJSON() (data []byte, err error) {
Expand All @@ -631,7 +692,8 @@ func (r AccountGetSSOLoginURLParams) MarshalJSON() (data []byte, err error) {
type AccountListJoinableOrganizationsParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
Empty param.Field[bool] `json:"empty"`
// pagination contains the pagination options for listing joinable organizations
Pagination param.Field[AccountListJoinableOrganizationsParamsPagination] `json:"pagination"`
}

func (r AccountListJoinableOrganizationsParams) MarshalJSON() (data []byte, err error) {
Expand All @@ -647,6 +709,20 @@ func (r AccountListJoinableOrganizationsParams) URLQuery() (v url.Values) {
})
}

// pagination contains the pagination options for listing joinable organizations
type AccountListJoinableOrganizationsParamsPagination struct {
// Token for the next set of results that was returned as next_token of a
// PaginationResponse
Token param.Field[string] `json:"token"`
// Page size is the maximum number of results to retrieve per page. Defaults to 25.
// Maximum 100.
PageSize param.Field[int64] `json:"pageSize"`
}

func (r AccountListJoinableOrganizationsParamsPagination) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type AccountListLoginProvidersParams struct {
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
Expand All @@ -671,6 +747,8 @@ func (r AccountListLoginProvidersParams) URLQuery() (v url.Values) {

// filter contains the filter options for listing login methods
type AccountListLoginProvidersParamsFilter struct {
// email is the email address to filter SSO providers by
Email param.Field[string] `json:"email"`
// invite_id is the ID of the invite URL the user wants to login with
InviteID param.Field[string] `json:"inviteId" format:"uuid"`
}
Expand All @@ -692,3 +770,41 @@ type AccountListLoginProvidersParamsPagination struct {
func (r AccountListLoginProvidersParamsPagination) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

type AccountListSSOLoginsParams struct {
// email is the email the user wants to login with
Email param.Field[string] `json:"email,required" format:"email"`
Token param.Field[string] `query:"token"`
PageSize param.Field[int64] `query:"pageSize"`
// pagination contains the pagination options for listing SSO logins
Pagination param.Field[AccountListSSOLoginsParamsPagination] `json:"pagination"`
// return_to is the URL the user will be redirected to after login
ReturnTo param.Field[string] `json:"returnTo" format:"uri"`
}

func (r AccountListSSOLoginsParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}

// URLQuery serializes [AccountListSSOLoginsParams]'s query parameters as
// `url.Values`.
func (r AccountListSSOLoginsParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}

// pagination contains the pagination options for listing SSO logins
type AccountListSSOLoginsParamsPagination struct {
// Token for the next set of results that was returned as next_token of a
// PaginationResponse
Token param.Field[string] `json:"token"`
// Page size is the maximum number of results to retrieve per page. Defaults to 25.
// Maximum 100.
PageSize param.Field[int64] `json:"pageSize"`
}

func (r AccountListSSOLoginsParamsPagination) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
41 changes: 39 additions & 2 deletions account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestAccountGetWithOptionalParams(t *testing.T) {
}
}

func TestAccountDelete(t *testing.T) {
func TestAccountDeleteWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
Expand All @@ -53,6 +53,7 @@ func TestAccountDelete(t *testing.T) {
)
_, err := client.Accounts.Delete(context.TODO(), gitpod.AccountDeleteParams{
AccountID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"),
Reason: gitpod.F("reason"),
})
if err != nil {
var apierr *gitpod.Error
Expand Down Expand Up @@ -105,7 +106,10 @@ func TestAccountListJoinableOrganizationsWithOptionalParams(t *testing.T) {
_, err := client.Accounts.ListJoinableOrganizations(context.TODO(), gitpod.AccountListJoinableOrganizationsParams{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Empty: gitpod.F(true),
Pagination: gitpod.F(gitpod.AccountListJoinableOrganizationsParamsPagination{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(100)),
}),
})
if err != nil {
var apierr *gitpod.Error
Expand Down Expand Up @@ -133,6 +137,7 @@ func TestAccountListLoginProvidersWithOptionalParams(t *testing.T) {
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Filter: gitpod.F(gitpod.AccountListLoginProvidersParamsFilter{
Email: gitpod.F("email"),
InviteID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"),
}),
Pagination: gitpod.F(gitpod.AccountListLoginProvidersParamsPagination{
Expand All @@ -148,3 +153,35 @@ func TestAccountListLoginProvidersWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAccountListSSOLoginsWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
client := gitpod.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
)
_, err := client.Accounts.ListSSOLogins(context.TODO(), gitpod.AccountListSSOLoginsParams{
Email: gitpod.F("dev@stainless.com"),
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(0)),
Pagination: gitpod.F(gitpod.AccountListSSOLoginsParamsPagination{
Token: gitpod.F("token"),
PageSize: gitpod.F(int64(100)),
}),
ReturnTo: gitpod.F("https://example.com"),
})
if err != nil {
var apierr *gitpod.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
t.Fatalf("err should be nil: %s", err.Error())
}
}
Loading