diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5547f83..10f3091 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.1" + ".": "0.2.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 4f2abc7..296014e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-27f7bd641de1e4657ad8ce84a456fe0c5e8f1e14779bf1f567a4bc8667eba4da.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-f6598ab5d6827f66b642201769e92590ea32af84ebbf24b18cc32b33dee5107e.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 7574da1..bea532e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.2.0 (2025-02-18) + +Full Changelog: [v0.1.1...v0.2.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.1.1...v0.2.0) + +### Features + +* **api:** manual updates ([#33](https://github.com/gitpod-io/gitpod-sdk-go/issues/33)) ([8b18e3a](https://github.com/gitpod-io/gitpod-sdk-go/commit/8b18e3af0ace255d515d1f53e9d8573a57ba8617)) +* **api:** manual updates ([#36](https://github.com/gitpod-io/gitpod-sdk-go/issues/36)) ([9612bdb](https://github.com/gitpod-io/gitpod-sdk-go/commit/9612bdbb4a43b3fdc23e72b446b0ac0b295fb326)) +* **api:** Organizations Open API docs ([#31](https://github.com/gitpod-io/gitpod-sdk-go/issues/31)) ([8c99874](https://github.com/gitpod-io/gitpod-sdk-go/commit/8c99874c9c17e63becdbd0fb30a45d77c51bdf2f)) + + +### Bug Fixes + +* **client:** don't truncate manually specified filenames ([#34](https://github.com/gitpod-io/gitpod-sdk-go/issues/34)) ([bb87acd](https://github.com/gitpod-io/gitpod-sdk-go/commit/bb87acddf4cf002b37c63e8a74bb2f044deac221)) + ## 0.1.1 (2025-02-14) Full Changelog: [v0.1.0-alpha.3...v0.1.1](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.1.0-alpha.3...v0.1.1) diff --git a/README.md b/README.md index c8899c0..0671e9a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.1.1' +go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.2.0' ``` diff --git a/account.go b/account.go index 2e2d199..86bdf78 100644 --- a/account.go +++ b/account.go @@ -36,7 +36,24 @@ func NewAccountService(opts ...option.RequestOption) (r *AccountService) { return } -// GetAccount retrieves a single Account. +// Gets information about the currently authenticated account. +// +// Use this method to: +// +// - Retrieve account profile information +// - Check organization memberships +// - View account settings +// - Get joinable organizations +// +// ### Examples +// +// - Get account details: +// +// Retrieves information about the authenticated account. +// +// ```yaml +// {} +// ``` func (r *AccountService) Get(ctx context.Context, body AccountGetParams, opts ...option.RequestOption) (res *AccountGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.AccountService/GetAccount" @@ -44,8 +61,25 @@ func (r *AccountService) Get(ctx context.Context, body AccountGetParams, opts .. return } -// DeleteAccount deletes an Account. To Delete an Account, the Account must not be -// an active member of any Organization. +// Deletes an account permanently. +// +// Use this method to: +// +// - Remove unused accounts +// - Clean up test accounts +// - Complete account deletion requests +// +// The account must not be an active member of any organization. +// +// ### Examples +// +// - Delete account: +// +// Permanently removes an account. +// +// ```yaml +// accountId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// ``` func (r *AccountService) Delete(ctx context.Context, body AccountDeleteParams, opts ...option.RequestOption) (res *AccountDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.AccountService/DeleteAccount" @@ -53,7 +87,32 @@ func (r *AccountService) Delete(ctx context.Context, body AccountDeleteParams, o return } -// GetSSOLoginURL returns the URL to redirect the user to for SSO login. +// Gets the SSO login URL for a specific email domain. +// +// Use this method to: +// +// - Initiate SSO authentication +// - Get organization-specific login URLs +// - Handle SSO redirects +// +// ### Examples +// +// - Get login URL: +// +// Retrieves SSO URL for email domain. +// +// ```yaml +// email: "user@company.com" +// ``` +// +// - Get URL with return path: +// +// Gets SSO URL with specific return location. +// +// ```yaml +// email: "user@company.com" +// returnTo: "https://gitpod.io/workspaces" +// ``` func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOLoginURLParams, opts ...option.RequestOption) (res *AccountGetSSOLoginURLResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.AccountService/GetSSOLoginURL" @@ -61,8 +120,35 @@ func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOL return } -// ListLoginProviders returns the list of login providers matching the provided -// filters. +// Lists available login providers with optional filtering. +// +// Use this method to: +// +// - View supported authentication methods +// - Get provider-specific login URLs +// - Filter providers by invite +// +// ### Examples +// +// - List all providers: +// +// Shows all available login providers. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - List for specific invite: +// +// Shows providers available for an invite. +// +// ```yaml +// filter: +// inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// pagination: +// pageSize: 20 +// ``` func (r *AccountService) ListLoginProviders(ctx context.Context, params AccountListLoginProvidersParams, opts ...option.RequestOption) (res *pagination.LoginProvidersPage[LoginProvider], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -80,8 +166,35 @@ func (r *AccountService) ListLoginProviders(ctx context.Context, params AccountL return res, nil } -// ListLoginProviders returns the list of login providers matching the provided -// filters. +// Lists available login providers with optional filtering. +// +// Use this method to: +// +// - View supported authentication methods +// - Get provider-specific login URLs +// - Filter providers by invite +// +// ### Examples +// +// - List all providers: +// +// Shows all available login providers. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` +// +// - List for specific invite: +// +// Shows providers available for an invite. +// +// ```yaml +// filter: +// inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// pagination: +// pageSize: 20 +// ``` func (r *AccountService) ListLoginProvidersAutoPaging(ctx context.Context, params AccountListLoginProvidersParams, opts ...option.RequestOption) *pagination.LoginProvidersPageAutoPager[LoginProvider] { return pagination.NewLoginProvidersPageAutoPager(r.ListLoginProviders(ctx, params, opts...)) } diff --git a/account_test.go b/account_test.go index ad0d804..67acb95 100644 --- a/account_test.go +++ b/account_test.go @@ -52,7 +52,7 @@ func TestAccountDelete(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Accounts.Delete(context.TODO(), gitpod.AccountDeleteParams{ - AccountID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + AccountID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), }) if err != nil { var apierr *gitpod.Error @@ -77,7 +77,7 @@ func TestAccountGetSSOLoginURLWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Accounts.GetSSOLoginURL(context.TODO(), gitpod.AccountGetSSOLoginURLParams{ - Email: gitpod.F("dev@stainlessapi.com"), + Email: gitpod.F("user@company.com"), ReturnTo: gitpod.F("https://example.com"), }) if err != nil { @@ -110,7 +110,7 @@ func TestAccountListLoginProvidersWithOptionalParams(t *testing.T) { }), Pagination: gitpod.F(gitpod.AccountListLoginProvidersParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { diff --git a/aliases.go b/aliases.go index 85a555d..528b72f 100644 --- a/aliases.go +++ b/aliases.go @@ -8,6 +8,30 @@ import ( ) type Error = apierror.Error +type ErrorCode = apierror.ErrorCode + +const ErrorCodeCanceled = apierror.ErrorCodeCanceled +const ErrorCodeUnknown = apierror.ErrorCodeUnknown +const ErrorCodeInvalidArgument = apierror.ErrorCodeInvalidArgument +const ErrorCodeDeadlineExceeded = apierror.ErrorCodeDeadlineExceeded +const ErrorCodeNotFound = apierror.ErrorCodeNotFound +const ErrorCodeAlreadyExists = apierror.ErrorCodeAlreadyExists +const ErrorCodePermissionDenied = apierror.ErrorCodePermissionDenied +const ErrorCodeResourceExhausted = apierror.ErrorCodeResourceExhausted +const ErrorCodeFailedPrecondition = apierror.ErrorCodeFailedPrecondition +const ErrorCodeAborted = apierror.ErrorCodeAborted +const ErrorCodeOutOfRange = apierror.ErrorCodeOutOfRange +const ErrorCodeUnimplemented = apierror.ErrorCodeUnimplemented +const ErrorCodeInternal = apierror.ErrorCodeInternal +const ErrorCodeUnavailable = apierror.ErrorCodeUnavailable +const ErrorCodeDataLoss = apierror.ErrorCodeDataLoss +const ErrorCodeUnauthenticated = apierror.ErrorCodeUnauthenticated + +type ArbitraryData = apierror.ArbitraryData +type ArbitraryDataDebug = apierror.ArbitraryDataDebug +type ArbitraryDataType = apierror.ArbitraryDataType +type ArbitraryDataValue = apierror.ArbitraryDataValue +type ArbitraryData = apierror.ArbitraryData // An AutomationTrigger represents a trigger for an automation action. The // `post_environment_start` field indicates that the automation should be triggered diff --git a/editor.go b/editor.go index 3f43458..0b634d5 100644 --- a/editor.go +++ b/editor.go @@ -34,7 +34,22 @@ func NewEditorService(opts ...option.RequestOption) (r *EditorService) { return } -// GetEditor returns the editor with the given ID +// Gets details about a specific editor. +// +// Use this method to: +// +// - View editor information +// - Get editor configuration +// +// ### Examples +// +// - Get editor details: +// +// Retrieves information about a specific editor. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EditorService) Get(ctx context.Context, body EditorGetParams, opts ...option.RequestOption) (res *EditorGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EditorService/GetEditor" @@ -42,7 +57,25 @@ func (r *EditorService) Get(ctx context.Context, body EditorGetParams, opts ...o return } -// ListEditors lists all editors available to the caller +// Lists all available code editors. +// +// Use this method to: +// +// - View supported editors +// - Get editor capabilities +// - Browse editor options +// - Check editor availability +// +// ### Examples +// +// - List editors: +// +// Shows all available editors with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` func (r *EditorService) List(ctx context.Context, params EditorListParams, opts ...option.RequestOption) (res *pagination.EditorsPage[Editor], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -60,12 +93,49 @@ func (r *EditorService) List(ctx context.Context, params EditorListParams, opts return res, nil } -// ListEditors lists all editors available to the caller +// Lists all available code editors. +// +// Use this method to: +// +// - View supported editors +// - Get editor capabilities +// - Browse editor options +// - Check editor availability +// +// ### Examples +// +// - List editors: +// +// Shows all available editors with pagination. +// +// ```yaml +// pagination: +// pageSize: 20 +// ``` func (r *EditorService) ListAutoPaging(ctx context.Context, params EditorListParams, opts ...option.RequestOption) *pagination.EditorsPageAutoPager[Editor] { return pagination.NewEditorsPageAutoPager(r.List(ctx, params, opts...)) } -// ResolveEditorURL resolves the editor's URL for an environment +// Resolves the URL for accessing an editor in a specific environment. +// +// Use this method to: +// +// - Get editor access URLs +// - Launch editors for environments +// - Set up editor connections +// - Configure editor access +// +// ### Examples +// +// - Resolve editor URL: +// +// Gets the URL for accessing an editor in an environment. +// +// ```yaml +// editorId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// ``` func (r *EditorService) ResolveURL(ctx context.Context, body EditorResolveURLParams, opts ...option.RequestOption) (res *EditorResolveURLResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EditorService/ResolveEditorURL" diff --git a/editor_test.go b/editor_test.go index eb59d95..88c1933 100644 --- a/editor_test.go +++ b/editor_test.go @@ -27,7 +27,7 @@ func TestEditorGet(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Editors.Get(context.TODO(), gitpod.EditorGetParams{ - ID: gitpod.F("id"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -56,7 +56,7 @@ func TestEditorListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.EditorListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -82,9 +82,9 @@ func TestEditorResolveURL(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Editors.ResolveURL(context.TODO(), gitpod.EditorResolveURLParams{ - EditorID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EditorID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), + EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error diff --git a/environment.go b/environment.go index 10851d6..2c39b87 100644 --- a/environment.go +++ b/environment.go @@ -464,7 +464,7 @@ func (r AdmissionLevel) IsKnown() bool { type Environment struct { // ID is a unique identifier of this environment. No other environment with the // same name must be managed by this environment manager - ID string `json:"id"` + ID string `json:"id,required"` // EnvironmentMetadata is data associated with an environment that's required for // other parts of the system to function Metadata EnvironmentMetadata `json:"metadata"` diff --git a/environmentautomation.go b/environmentautomation.go index 97a5e94..f1726f4 100644 --- a/environmentautomation.go +++ b/environmentautomation.go @@ -36,7 +36,40 @@ func NewEnvironmentAutomationService(opts ...option.RequestOption) (r *Environme return } -// UpsertAutomationsFile upserts the automations file for the given environment. +// Upserts the automations file for the given environment. +// +// Use this method to: +// +// - Configure environment automations +// - Update automation settings +// - Manage automation files +// +// ### Examples +// +// - Update automations file: +// +// Updates or creates the automations configuration. +// +// ```yaml +// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" +// automationsFile: +// services: +// web-server: +// name: "Web Server" +// description: "Development web server" +// commands: +// start: "npm run dev" +// ready: "curl -s http://localhost:3000" +// triggeredBy: +// - postDevcontainerStart +// tasks: +// build: +// name: "Build Project" +// description: "Builds the project artifacts" +// command: "npm run build" +// triggeredBy: +// - postEnvironmentStart +// ``` func (r *EnvironmentAutomationService) Upsert(ctx context.Context, body EnvironmentAutomationUpsertParams, opts ...option.RequestOption) (res *EnvironmentAutomationUpsertResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/UpsertAutomationsFile" diff --git a/environmentautomation_test.go b/environmentautomation_test.go index a550b2b..948ceea 100644 --- a/environmentautomation_test.go +++ b/environmentautomation_test.go @@ -30,14 +30,14 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) { _, err := client.Environments.Automations.Upsert(context.TODO(), gitpod.EnvironmentAutomationUpsertParams{ AutomationsFile: gitpod.F(gitpod.AutomationsFileParam{ Services: gitpod.F(map[string]gitpod.AutomationsFileServiceParam{ - "foo": { + "web-server": { Commands: gitpod.F(gitpod.AutomationsFileServicesCommandsParam{ - Ready: gitpod.F("ready"), - Start: gitpod.F("x"), + Ready: gitpod.F("curl -s http://localhost:3000"), + Start: gitpod.F("npm run dev"), Stop: gitpod.F("stop"), }), - Description: gitpod.F("description"), - Name: gitpod.F("x"), + Description: gitpod.F("Development web server"), + Name: gitpod.F("Web Server"), RunsOn: gitpod.F(shared.RunsOnParam{ Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), @@ -48,11 +48,11 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) { }, }), Tasks: gitpod.F(map[string]gitpod.AutomationsFileTaskParam{ - "foo": { - Command: gitpod.F("x"), + "build": { + Command: gitpod.F("npm run build"), DependsOn: gitpod.F([]string{"string"}), - Description: gitpod.F("description"), - Name: gitpod.F("x"), + Description: gitpod.F("Builds the project artifacts"), + Name: gitpod.F("Build Project"), RunsOn: gitpod.F(shared.RunsOnParam{ Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), @@ -63,7 +63,7 @@ func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) { }, }), }), - EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), }) if err != nil { var apierr *gitpod.Error diff --git a/environmentautomationservice.go b/environmentautomationservice.go index 69b4e16..3c0c88d 100644 --- a/environmentautomationservice.go +++ b/environmentautomationservice.go @@ -36,7 +36,52 @@ func NewEnvironmentAutomationServiceService(opts ...option.RequestOption) (r *En return } -// CreateService +// Creates a new automation service for an environment. +// +// Use this method to: +// +// - Set up long-running services +// - Configure service triggers +// - Define service dependencies +// - Specify runtime environments +// +// ### Examples +// +// - Create basic service: +// +// Creates a simple service with start command. +// +// ```yaml +// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" +// metadata: +// reference: "web-server" +// name: "Web Server" +// description: "Runs the development web server" +// triggeredBy: +// - postDevcontainerStart: true +// spec: +// commands: +// start: "npm run dev" +// ready: "curl -s http://localhost:3000" +// ``` +// +// - Create Docker-based service: +// +// Creates a service running in a specific container. +// +// ```yaml +// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" +// metadata: +// reference: "redis" +// name: "Redis Server" +// description: "Redis cache service" +// spec: +// commands: +// start: "redis-server" +// runsOn: +// docker: +// image: "redis:7" +// ``` func (r *EnvironmentAutomationServiceService) New(ctx context.Context, body EnvironmentAutomationServiceNewParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/CreateService" @@ -44,7 +89,24 @@ func (r *EnvironmentAutomationServiceService) New(ctx context.Context, body Envi return } -// GetService +// Gets details about a specific automation service. +// +// Use this method to: +// +// - Check service status +// - View service configuration +// - Monitor service health +// - Retrieve service metadata +// +// ### Examples +// +// - Get service details: +// +// Retrieves information about a specific service. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationServiceService) Get(ctx context.Context, body EnvironmentAutomationServiceGetParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/GetService" @@ -52,7 +114,41 @@ func (r *EnvironmentAutomationServiceService) Get(ctx context.Context, body Envi return } -// UpdateService +// Updates an automation service configuration. +// +// Use this method to: +// +// - Modify service commands +// - Update triggers +// - Change runtime settings +// - Adjust dependencies +// +// ### Examples +// +// - Update commands: +// +// Changes service start and ready commands. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// spec: +// commands: +// start: "npm run start:dev" +// ready: "curl -s http://localhost:8080" +// ``` +// +// - Update triggers: +// +// Modifies when the service starts. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// metadata: +// triggeredBy: +// trigger: +// - postDevcontainerStart: true +// - manual: true +// ``` func (r *EnvironmentAutomationServiceService) Update(ctx context.Context, body EnvironmentAutomationServiceUpdateParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/UpdateService" @@ -60,7 +156,37 @@ func (r *EnvironmentAutomationServiceService) Update(ctx context.Context, body E return } -// ListServices +// Lists automation services with optional filtering. +// +// Use this method to: +// +// - View all services in an environment +// - Filter services by reference +// - Monitor service status +// +// ### Examples +// +// - List environment services: +// +// Shows all services for an environment. +// +// ```yaml +// filter: +// environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by reference: +// +// Lists services matching specific references. +// +// ```yaml +// filter: +// references: ["web-server", "database"] +// pagination: +// pageSize: 20 +// ``` func (r *EnvironmentAutomationServiceService) List(ctx context.Context, params EnvironmentAutomationServiceListParams, opts ...option.RequestOption) (res *pagination.ServicesPage[Service], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -78,13 +204,69 @@ func (r *EnvironmentAutomationServiceService) List(ctx context.Context, params E return res, nil } -// ListServices +// Lists automation services with optional filtering. +// +// Use this method to: +// +// - View all services in an environment +// - Filter services by reference +// - Monitor service status +// +// ### Examples +// +// - List environment services: +// +// Shows all services for an environment. +// +// ```yaml +// filter: +// environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by reference: +// +// Lists services matching specific references. +// +// ```yaml +// filter: +// references: ["web-server", "database"] +// pagination: +// pageSize: 20 +// ``` func (r *EnvironmentAutomationServiceService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationServiceListParams, opts ...option.RequestOption) *pagination.ServicesPageAutoPager[Service] { return pagination.NewServicesPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteService deletes a service. This call does not block until the service is +// Deletes an automation service. This call does not block until the service is // deleted. If the service is not stopped it will be stopped before deletion. +// +// Use this method to: +// +// - Remove unused services +// - Clean up service configurations +// - Stop and delete services +// +// ### Examples +// +// - Delete service: +// +// Removes a service after stopping it. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// force: false +// ``` +// +// - Force delete: +// +// Immediately removes a service. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// force: true +// ``` func (r *EnvironmentAutomationServiceService) Delete(ctx context.Context, body EnvironmentAutomationServiceDeleteParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/DeleteService" @@ -92,9 +274,25 @@ func (r *EnvironmentAutomationServiceService) Delete(ctx context.Context, body E return } -// StartService starts a service. This call does not block until the service is +// Starts an automation service. This call does not block until the service is // started. This call will not error if the service is already running or has been // started. +// +// Use this method to: +// +// - Start stopped services +// - Resume service operations +// - Trigger service initialization +// +// ### Examples +// +// - Start service: +// +// Starts a previously stopped service. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationServiceService) Start(ctx context.Context, body EnvironmentAutomationServiceStartParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceStartResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/StartService" @@ -102,9 +300,25 @@ func (r *EnvironmentAutomationServiceService) Start(ctx context.Context, body En return } -// StopService stops a service. This call does not block until the service is +// Stops an automation service. This call does not block until the service is // stopped. This call will not error if the service is already stopped or has been // stopped. +// +// Use this method to: +// +// - Pause service operations +// - Gracefully stop services +// - Prepare for updates +// +// ### Examples +// +// - Stop service: +// +// Gracefully stops a running service. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationServiceService) Stop(ctx context.Context, body EnvironmentAutomationServiceStopParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceStopResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/StopService" @@ -113,7 +327,7 @@ func (r *EnvironmentAutomationServiceService) Stop(ctx context.Context, body Env } type Service struct { - ID string `json:"id" format:"uuid"` + ID string `json:"id,required" format:"uuid"` EnvironmentID string `json:"environmentId" format:"uuid"` Metadata ServiceMetadata `json:"metadata"` Spec ServiceSpec `json:"spec"` diff --git a/environmentautomationservice_test.go b/environmentautomationservice_test.go index 2a88e92..6699738 100644 --- a/environmentautomationservice_test.go +++ b/environmentautomationservice_test.go @@ -29,16 +29,16 @@ func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Services.New(context.TODO(), gitpod.EnvironmentAutomationServiceNewParams{ - EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), Metadata: gitpod.F(gitpod.ServiceMetadataParam{ CreatedAt: gitpod.F(time.Now()), Creator: gitpod.F(shared.SubjectParam{ ID: gitpod.F("id"), Principal: gitpod.F(shared.PrincipalUnspecified), }), - Description: gitpod.F("description"), - Name: gitpod.F("x"), - Reference: gitpod.F("reference"), + Description: gitpod.F("Runs the development web server"), + Name: gitpod.F("Web Server"), + Reference: gitpod.F("web-server"), TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{{ Manual: gitpod.F(true), PostDevcontainerStart: gitpod.F(true), @@ -47,8 +47,8 @@ func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) { }), Spec: gitpod.F(gitpod.ServiceSpecParam{ Commands: gitpod.F(gitpod.ServiceSpecCommandsParam{ - Ready: gitpod.F("ready"), - Start: gitpod.F("x"), + Ready: gitpod.F("curl -s http://localhost:3000"), + Start: gitpod.F("npm run dev"), Stop: gitpod.F("stop"), }), DesiredPhase: gitpod.F(gitpod.ServicePhaseUnspecified), @@ -85,7 +85,7 @@ func TestEnvironmentAutomationServiceGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Services.Get(context.TODO(), gitpod.EnvironmentAutomationServiceGetParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -110,7 +110,7 @@ func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Services.Update(context.TODO(), gitpod.EnvironmentAutomationServiceUpdateParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Metadata: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsMetadata{ Description: gitpod.F("description"), Name: gitpod.F("x"), @@ -124,8 +124,8 @@ func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) { }), Spec: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsSpec{ Commands: gitpod.F(gitpod.EnvironmentAutomationServiceUpdateParamsSpecCommands{ - Ready: gitpod.F("ready"), - Start: gitpod.F("start"), + Ready: gitpod.F("curl -s http://localhost:8080"), + Start: gitpod.F("npm run start:dev"), Stop: gitpod.F("stop"), }), RunsOn: gitpod.F(shared.RunsOnParam{ @@ -169,12 +169,12 @@ func TestEnvironmentAutomationServiceListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.EnvironmentAutomationServiceListParamsFilter{ EnvironmentIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - References: gitpod.F([]string{"x"}), + References: gitpod.F([]string{"web-server", "database"}), ServiceIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), }), Pagination: gitpod.F(gitpod.EnvironmentAutomationServiceListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -200,8 +200,8 @@ func TestEnvironmentAutomationServiceDeleteWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Services.Delete(context.TODO(), gitpod.EnvironmentAutomationServiceDeleteParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Force: gitpod.F(true), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), + Force: gitpod.F(false), }) if err != nil { var apierr *gitpod.Error @@ -226,7 +226,7 @@ func TestEnvironmentAutomationServiceStartWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Services.Start(context.TODO(), gitpod.EnvironmentAutomationServiceStartParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -251,7 +251,7 @@ func TestEnvironmentAutomationServiceStopWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Services.Stop(context.TODO(), gitpod.EnvironmentAutomationServiceStopParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/environmentautomationtask.go b/environmentautomationtask.go index e1292dc..20ccb1d 100644 --- a/environmentautomationtask.go +++ b/environmentautomationtask.go @@ -37,7 +37,47 @@ func NewEnvironmentAutomationTaskService(opts ...option.RequestOption) (r *Envir return } -// CreateTask +// Creates a new automation task. +// +// Use this method to: +// +// - Define one-off or scheduled tasks +// - Set up build or test automation +// - Configure task dependencies +// - Specify execution environments +// +// ### Examples +// +// - Create basic task: +// +// Creates a simple build task. +// +// ```yaml +// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" +// metadata: +// reference: "build" +// name: "Build Project" +// description: "Builds the project artifacts" +// triggeredBy: +// - postEnvironmentStart: true +// spec: +// command: "npm run build" +// ``` +// +// - Create task with dependencies: +// +// Creates a task that depends on other services. +// +// ```yaml +// environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" +// metadata: +// reference: "test" +// name: "Run Tests" +// description: "Runs the test suite" +// spec: +// command: "npm test" +// dependsOn: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] +// ``` func (r *EnvironmentAutomationTaskService) New(ctx context.Context, body EnvironmentAutomationTaskNewParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/CreateTask" @@ -45,7 +85,23 @@ func (r *EnvironmentAutomationTaskService) New(ctx context.Context, body Environ return } -// GetTask +// Gets details about a specific automation task. +// +// Use this method to: +// +// - Check task configuration +// - View task dependencies +// - Monitor task status +// +// ### Examples +// +// - Get task details: +// +// Retrieves information about a specific task. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationTaskService) Get(ctx context.Context, body EnvironmentAutomationTaskGetParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/GetTask" @@ -53,7 +109,38 @@ func (r *EnvironmentAutomationTaskService) Get(ctx context.Context, body Environ return } -// UpdateTask +// Updates an automation task configuration. +// +// Use this method to: +// +// - Modify task commands +// - Update task triggers +// - Change dependencies +// - Adjust execution settings +// +// ### Examples +// +// - Update command: +// +// Changes the task's command. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// spec: +// command: "npm run test:coverage" +// ``` +// +// - Update triggers: +// +// Modifies when the task runs. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// metadata: +// triggeredBy: +// trigger: +// - postEnvironmentStart: true +// ``` func (r *EnvironmentAutomationTaskService) Update(ctx context.Context, body EnvironmentAutomationTaskUpdateParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/UpdateTask" @@ -61,7 +148,37 @@ func (r *EnvironmentAutomationTaskService) Update(ctx context.Context, body Envi return } -// ListTasks +// Lists automation tasks with optional filtering. +// +// Use this method to: +// +// - View all tasks in an environment +// - Filter tasks by reference +// - Monitor task status +// +// ### Examples +// +// - List environment tasks: +// +// Shows all tasks for an environment. +// +// ```yaml +// filter: +// environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by reference: +// +// Lists tasks matching specific references. +// +// ```yaml +// filter: +// references: ["build", "test"] +// pagination: +// pageSize: 20 +// ``` func (r *EnvironmentAutomationTaskService) List(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) (res *pagination.TasksPage[shared.Task], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -79,12 +196,58 @@ func (r *EnvironmentAutomationTaskService) List(ctx context.Context, params Envi return res, nil } -// ListTasks +// Lists automation tasks with optional filtering. +// +// Use this method to: +// +// - View all tasks in an environment +// - Filter tasks by reference +// - Monitor task status +// +// ### Examples +// +// - List environment tasks: +// +// Shows all tasks for an environment. +// +// ```yaml +// filter: +// environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by reference: +// +// Lists tasks matching specific references. +// +// ```yaml +// filter: +// references: ["build", "test"] +// pagination: +// pageSize: 20 +// ``` func (r *EnvironmentAutomationTaskService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) *pagination.TasksPageAutoPager[shared.Task] { return pagination.NewTasksPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteTask +// Deletes an automation task. +// +// Use this method to: +// +// - Remove unused tasks +// - Clean up task configurations +// - Delete obsolete automations +// +// ### Examples +// +// - Delete task: +// +// Removes a task and its configuration. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationTaskService) Delete(ctx context.Context, body EnvironmentAutomationTaskDeleteParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/DeleteTask" @@ -92,8 +255,24 @@ func (r *EnvironmentAutomationTaskService) Delete(ctx context.Context, body Envi return } -// StartTask starts a task, i.e. creates a task execution. This call does not block -// until the task is started; the task will be started asynchronously. +// Starts a task by creating a new task execution. This call does not block until +// the task is started; the task will be started asynchronously. +// +// Use this method to: +// +// - Trigger task execution +// - Run one-off tasks +// - Start scheduled tasks immediately +// +// ### Examples +// +// - Start task: +// +// Creates a new execution of a task. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationTaskService) Start(ctx context.Context, body EnvironmentAutomationTaskStartParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskStartResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/StartTask" diff --git a/environmentautomationtask_test.go b/environmentautomationtask_test.go index 901819c..fed5a5e 100644 --- a/environmentautomationtask_test.go +++ b/environmentautomationtask_test.go @@ -30,16 +30,16 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) { ) _, err := client.Environments.Automations.Tasks.New(context.TODO(), gitpod.EnvironmentAutomationTaskNewParams{ DependsOn: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - EnvironmentID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"), Metadata: gitpod.F(shared.TaskMetadataParam{ CreatedAt: gitpod.F(time.Now()), Creator: gitpod.F(shared.SubjectParam{ ID: gitpod.F("id"), Principal: gitpod.F(shared.PrincipalUnspecified), }), - Description: gitpod.F("description"), - Name: gitpod.F("x"), - Reference: gitpod.F("reference"), + Description: gitpod.F("Builds the project artifacts"), + Name: gitpod.F("Build Project"), + Reference: gitpod.F("build"), TriggeredBy: gitpod.F([]shared.AutomationTriggerParam{{ Manual: gitpod.F(true), PostDevcontainerStart: gitpod.F(true), @@ -47,7 +47,7 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) { }}), }), Spec: gitpod.F(shared.TaskSpecParam{ - Command: gitpod.F("command"), + Command: gitpod.F("npm run build"), RunsOn: gitpod.F(shared.RunsOnParam{ Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), @@ -79,7 +79,7 @@ func TestEnvironmentAutomationTaskGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Tasks.Get(context.TODO(), gitpod.EnvironmentAutomationTaskGetParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -104,7 +104,7 @@ func TestEnvironmentAutomationTaskUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Tasks.Update(context.TODO(), gitpod.EnvironmentAutomationTaskUpdateParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), DependsOn: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), Metadata: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsMetadata{ Description: gitpod.F("description"), @@ -118,7 +118,7 @@ func TestEnvironmentAutomationTaskUpdateWithOptionalParams(t *testing.T) { }), }), Spec: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsSpec{ - Command: gitpod.F("command"), + Command: gitpod.F("npm run test:coverage"), RunsOn: gitpod.F(shared.RunsOnParam{ Docker: gitpod.F(shared.RunsOnDockerParam{ Environment: gitpod.F([]string{"string"}), @@ -154,12 +154,12 @@ func TestEnvironmentAutomationTaskListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.EnvironmentAutomationTaskListParamsFilter{ EnvironmentIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - References: gitpod.F([]string{"x"}), + References: gitpod.F([]string{"build", "test"}), TaskIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), }), Pagination: gitpod.F(gitpod.EnvironmentAutomationTaskListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -185,7 +185,7 @@ func TestEnvironmentAutomationTaskDeleteWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Tasks.Delete(context.TODO(), gitpod.EnvironmentAutomationTaskDeleteParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -210,7 +210,7 @@ func TestEnvironmentAutomationTaskStartWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Tasks.Start(context.TODO(), gitpod.EnvironmentAutomationTaskStartParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/environmentautomationtaskexecution.go b/environmentautomationtaskexecution.go index b86be3a..21dc735 100644 --- a/environmentautomationtaskexecution.go +++ b/environmentautomationtaskexecution.go @@ -36,7 +36,24 @@ func NewEnvironmentAutomationTaskExecutionService(opts ...option.RequestOption) return } -// GetTaskExecution +// Gets details about a specific task execution. +// +// Use this method to: +// +// - Monitor execution progress +// - View execution logs +// - Check execution status +// - Debug failed executions +// +// ### Examples +// +// - Get execution details: +// +// Retrieves information about a specific task execution. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationTaskExecutionService) Get(ctx context.Context, body EnvironmentAutomationTaskExecutionGetParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskExecutionGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/GetTaskExecution" @@ -44,7 +61,37 @@ func (r *EnvironmentAutomationTaskExecutionService) Get(ctx context.Context, bod return } -// ListTaskExecutions +// Lists executions of automation tasks. +// +// Use this method to: +// +// - View task execution history +// - Monitor running tasks +// - Track task completion status +// +// ### Examples +// +// - List all executions: +// +// Shows execution history for all tasks. +// +// ```yaml +// filter: +// environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by phase: +// +// Lists executions in specific phases. +// +// ```yaml +// filter: +// phases: ["TASK_EXECUTION_PHASE_RUNNING", "TASK_EXECUTION_PHASE_FAILED"] +// pagination: +// pageSize: 20 +// ``` func (r *EnvironmentAutomationTaskExecutionService) List(ctx context.Context, params EnvironmentAutomationTaskExecutionListParams, opts ...option.RequestOption) (res *pagination.TaskExecutionsPage[shared.TaskExecution], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -62,12 +109,58 @@ func (r *EnvironmentAutomationTaskExecutionService) List(ctx context.Context, pa return res, nil } -// ListTaskExecutions +// Lists executions of automation tasks. +// +// Use this method to: +// +// - View task execution history +// - Monitor running tasks +// - Track task completion status +// +// ### Examples +// +// - List all executions: +// +// Shows execution history for all tasks. +// +// ```yaml +// filter: +// environmentIds: ["07e03a28-65a5-4d98-b532-8ea67b188048"] +// pagination: +// pageSize: 20 +// ``` +// +// - Filter by phase: +// +// Lists executions in specific phases. +// +// ```yaml +// filter: +// phases: ["TASK_EXECUTION_PHASE_RUNNING", "TASK_EXECUTION_PHASE_FAILED"] +// pagination: +// pageSize: 20 +// ``` func (r *EnvironmentAutomationTaskExecutionService) ListAutoPaging(ctx context.Context, params EnvironmentAutomationTaskExecutionListParams, opts ...option.RequestOption) *pagination.TaskExecutionsPageAutoPager[shared.TaskExecution] { return pagination.NewTaskExecutionsPageAutoPager(r.List(ctx, params, opts...)) } -// StopTaskExecution +// Stops a running task execution. +// +// Use this method to: +// +// - Cancel long-running tasks +// - Stop failed executions +// - Interrupt task processing +// +// ### Examples +// +// - Stop execution: +// +// Stops a running task execution. +// +// ```yaml +// id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *EnvironmentAutomationTaskExecutionService) Stop(ctx context.Context, body EnvironmentAutomationTaskExecutionStopParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskExecutionStopResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.EnvironmentAutomationService/StopTaskExecution" diff --git a/environmentautomationtaskexecution_test.go b/environmentautomationtaskexecution_test.go index a8d3863..849eed1 100644 --- a/environmentautomationtaskexecution_test.go +++ b/environmentautomationtaskexecution_test.go @@ -28,7 +28,7 @@ func TestEnvironmentAutomationTaskExecutionGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Tasks.Executions.Get(context.TODO(), gitpod.EnvironmentAutomationTaskExecutionGetParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -57,13 +57,13 @@ func TestEnvironmentAutomationTaskExecutionListWithOptionalParams(t *testing.T) PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.EnvironmentAutomationTaskExecutionListParamsFilter{ EnvironmentIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), - Phases: gitpod.F([]shared.TaskExecutionPhase{shared.TaskExecutionPhaseUnspecified}), + Phases: gitpod.F([]shared.TaskExecutionPhase{shared.TaskExecutionPhaseUnspecified, shared.TaskExecutionPhasePending}), TaskIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), TaskReferences: gitpod.F([]string{"string"}), }), Pagination: gitpod.F(gitpod.EnvironmentAutomationTaskExecutionListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -89,7 +89,7 @@ func TestEnvironmentAutomationTaskExecutionStopWithOptionalParams(t *testing.T) option.WithBearerToken("My Bearer Token"), ) _, err := client.Environments.Automations.Tasks.Executions.Stop(context.TODO(), gitpod.EnvironmentAutomationTaskExecutionStopParams{ - ID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/field.go b/field.go index f9e8c69..a5be755 100644 --- a/field.go +++ b/field.go @@ -46,5 +46,5 @@ type file struct { contentType string } -func (f *file) Name() string { return f.name } func (f *file) ContentType() string { return f.contentType } +func (f *file) Filename() string { return f.name } diff --git a/identity.go b/identity.go index ebe78ab..b8a642b 100644 --- a/identity.go +++ b/identity.go @@ -32,7 +32,23 @@ func NewIdentityService(opts ...option.RequestOption) (r *IdentityService) { return } -// ExchangeToken trades an exchange token for a new access token. +// Exchanges an exchange token for a new access token. +// +// Use this method to: +// +// - Convert exchange tokens to access tokens +// - Obtain new access credentials +// - Complete token exchange flows +// +// ### Examples +// +// - Exchange token: +// +// Trades an exchange token for an access token. +// +// ```yaml +// exchangeToken: "exchange-token-value" +// ``` func (r *IdentityService) ExchangeToken(ctx context.Context, body IdentityExchangeTokenParams, opts ...option.RequestOption) (res *IdentityExchangeTokenResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.IdentityService/ExchangeToken" @@ -40,7 +56,24 @@ func (r *IdentityService) ExchangeToken(ctx context.Context, body IdentityExchan return } -// GetAuthenticatedIdentity allows to retrieve the current identity. +// Retrieves information about the currently authenticated identity. +// +// Use this method to: +// +// - Get current user information +// - Check authentication status +// - Retrieve organization context +// - Validate authentication principal +// +// ### Examples +// +// - Get current identity: +// +// Retrieves details about the authenticated user. +// +// ```yaml +// {} +// ``` func (r *IdentityService) GetAuthenticatedIdentity(ctx context.Context, body IdentityGetAuthenticatedIdentityParams, opts ...option.RequestOption) (res *IdentityGetAuthenticatedIdentityResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.IdentityService/GetAuthenticatedIdentity" @@ -48,8 +81,34 @@ func (r *IdentityService) GetAuthenticatedIdentity(ctx context.Context, body Ide return } -// GetIDToken returns a token that can be used to authenticate the user against the -// other services. +// Gets an ID token for authenticating with other services. +// +// Use this method to: +// +// - Obtain authentication tokens for service-to-service calls +// - Access protected resources +// - Generate scoped access tokens +// +// ### Examples +// +// - Get token for single service: +// +// Retrieves a token for authenticating with one service. +// +// ```yaml +// audience: +// - "https://api.gitpod.io" +// ``` +// +// - Get token for multiple services: +// +// Retrieves a token valid for multiple services. +// +// ```yaml +// audience: +// - "https://api.gitpod.io" +// - "https://ws.gitpod.io" +// ``` func (r *IdentityService) GetIDToken(ctx context.Context, body IdentityGetIDTokenParams, opts ...option.RequestOption) (res *IdentityGetIDTokenResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.IdentityService/GetIDToken" diff --git a/identity_test.go b/identity_test.go index a1e8128..67c6417 100644 --- a/identity_test.go +++ b/identity_test.go @@ -27,7 +27,7 @@ func TestIdentityExchangeTokenWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Identity.ExchangeToken(context.TODO(), gitpod.IdentityExchangeTokenParams{ - ExchangeToken: gitpod.F("exchangeToken"), + ExchangeToken: gitpod.F("exchange-token-value"), }) if err != nil { var apierr *gitpod.Error @@ -77,7 +77,7 @@ func TestIdentityGetIDTokenWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Identity.GetIDToken(context.TODO(), gitpod.IdentityGetIDTokenParams{ - Audience: gitpod.F([]string{"string"}), + Audience: gitpod.F([]string{"https://api.gitpod.io", "https://ws.gitpod.io"}), }) if err != nil { var apierr *gitpod.Error diff --git a/internal/apierror/apierror.go b/internal/apierror/apierror.go index fa27a49..641967b 100644 --- a/internal/apierror/apierror.go +++ b/internal/apierror/apierror.go @@ -8,20 +8,36 @@ import ( "net/http/httputil" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" + "github.com/gitpod-io/gitpod-sdk-go/shared" ) // Error represents an error that originates from the API, i.e. when a request is // made and the API returns a response with a HTTP status code. Other errors are // not wrapped by this SDK. type Error struct { - JSON errorJSON `json:"-"` - StatusCode int - Request *http.Request - Response *http.Response + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + Code shared.ErrorCode `json:"code"` + // Contains an arbitrary serialized message along with a @type that describes the + // type of the serialized message. + Detail shared.ArbitraryData `json:"detail"` + // A developer-facing error message, which should be in English. Any user-facing + // error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by + // the client. + Message string `json:"message"` + ExtraFields map[string]interface{} `json:"-,extras"` + JSON errorJSON `json:"-"` + StatusCode int + Request *http.Request + Response *http.Response } // errorJSON contains the JSON metadata for the struct [Error] type errorJSON struct { + Code apijson.Field + Detail apijson.Field + Message apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/internal/apiform/encoder.go b/internal/apiform/encoder.go index 41da20a..9528f58 100644 --- a/internal/apiform/encoder.go +++ b/internal/apiform/encoder.go @@ -315,7 +315,9 @@ func (e *encoder) newReaderTypeEncoder() encoderFunc { reader := value.Convert(reflect.TypeOf((*io.Reader)(nil)).Elem()).Interface().(io.Reader) filename := "anonymous_file" contentType := "application/octet-stream" - if named, ok := reader.(interface{ Name() string }); ok { + if named, ok := reader.(interface{ Filename() string }); ok { + filename = named.Filename() + } else if named, ok := reader.(interface{ Name() string }); ok { filename = path.Base(named.Name()) } if typed, ok := reader.(interface{ ContentType() string }); ok { diff --git a/internal/version.go b/internal/version.go index 969450e..774c6c4 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.1" // x-release-please-version +const PackageVersion = "0.2.0" // x-release-please-version diff --git a/organization.go b/organization.go index e9887c2..41dca1b 100644 --- a/organization.go +++ b/organization.go @@ -42,7 +42,35 @@ func NewOrganizationService(opts ...option.RequestOption) (r *OrganizationServic return } -// CreateOrganization creates a new Organization. +// Creates a new organization with the specified name and settings. +// +// Use this method to: +// +// - Create a new organization for team collaboration +// - Set up automatic domain-based invites for team members +// - Join the organization immediately upon creation +// +// ### Examples +// +// - Create a basic organization: +// +// Creates an organization with just a name. +// +// ```yaml +// name: "Acme Corp Engineering" +// joinOrganization: true +// ``` +// +// - Create with domain-based invites: +// +// Creates an organization that automatically invites users with matching email +// domains. +// +// ```yaml +// name: "Acme Corp" +// joinOrganization: true +// inviteAccountsWithMatchingDomain: true +// ``` func (r *OrganizationService) New(ctx context.Context, body OrganizationNewParams, opts ...option.RequestOption) (res *OrganizationNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/CreateOrganization" @@ -50,7 +78,23 @@ func (r *OrganizationService) New(ctx context.Context, body OrganizationNewParam return } -// GetOrganization retrieves a single Organization. +// Gets details about a specific organization. +// +// Use this method to: +// +// - Retrieve organization settings and configuration +// - Check organization membership status +// - View domain verification settings +// +// ### Examples +// +// - Get organization details: +// +// Retrieves information about a specific organization. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// ``` func (r *OrganizationService) Get(ctx context.Context, body OrganizationGetParams, opts ...option.RequestOption) (res *OrganizationGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/GetOrganization" @@ -58,7 +102,40 @@ func (r *OrganizationService) Get(ctx context.Context, body OrganizationGetParam return } -// UpdateOrganization updates the properties of an Organization. +// Updates an organization's settings including name, invite domains, and member +// policies. +// +// Use this method to: +// +// - Modify organization display name +// - Configure email domain restrictions +// - Update organization-wide settings +// - Manage member access policies +// +// ### Examples +// +// - Update basic settings: +// +// Changes organization name and invite domains. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// name: "New Company Name" +// inviteDomains: +// domains: +// - "company.com" +// - "subsidiary.com" +// ``` +// +// - Remove domain restrictions: +// +// Clears all domain-based invite restrictions. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// inviteDomains: +// domains: [] +// ``` func (r *OrganizationService) Update(ctx context.Context, body OrganizationUpdateParams, opts ...option.RequestOption) (res *OrganizationUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/UpdateOrganization" @@ -66,7 +143,35 @@ func (r *OrganizationService) Update(ctx context.Context, body OrganizationUpdat return } -// ListOrganizations lists all organization the caller has access to. +// Lists all organizations the caller has access to with optional filtering. +// +// Use this method to: +// +// - View organizations you're a member of +// - Browse all available organizations +// - Paginate through organization results +// +// ### Examples +// +// - List member organizations: +// +// Shows organizations where the caller is a member. +// +// ```yaml +// pagination: +// pageSize: 20 +// scope: SCOPE_MEMBER +// ``` +// +// - List all organizations: +// +// Shows all organizations visible to the caller. +// +// ```yaml +// pagination: +// pageSize: 50 +// scope: SCOPE_ALL +// ``` func (r *OrganizationService) List(ctx context.Context, params OrganizationListParams, opts ...option.RequestOption) (res *pagination.OrganizationsPage[Organization], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -84,12 +189,56 @@ func (r *OrganizationService) List(ctx context.Context, params OrganizationListP return res, nil } -// ListOrganizations lists all organization the caller has access to. +// Lists all organizations the caller has access to with optional filtering. +// +// Use this method to: +// +// - View organizations you're a member of +// - Browse all available organizations +// - Paginate through organization results +// +// ### Examples +// +// - List member organizations: +// +// Shows organizations where the caller is a member. +// +// ```yaml +// pagination: +// pageSize: 20 +// scope: SCOPE_MEMBER +// ``` +// +// - List all organizations: +// +// Shows all organizations visible to the caller. +// +// ```yaml +// pagination: +// pageSize: 50 +// scope: SCOPE_ALL +// ``` func (r *OrganizationService) ListAutoPaging(ctx context.Context, params OrganizationListParams, opts ...option.RequestOption) *pagination.OrganizationsPageAutoPager[Organization] { return pagination.NewOrganizationsPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteOrganization deletes the specified organization. +// Permanently deletes an organization. +// +// Use this method to: +// +// - Remove unused organizations +// - Clean up test organizations +// - Complete organization migration +// +// ### Examples +// +// - Delete organization: +// +// Permanently removes an organization and all its data. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// ``` func (r *OrganizationService) Delete(ctx context.Context, body OrganizationDeleteParams, opts ...option.RequestOption) (res *OrganizationDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/DeleteOrganization" @@ -97,7 +246,32 @@ func (r *OrganizationService) Delete(ctx context.Context, body OrganizationDelet return } -// JoinOrganization lets accounts join an Organization. +// Allows users to join an organization through direct ID, invite link, or +// domain-based auto-join. +// +// Use this method to: +// +// - Join an organization via direct ID or invite +// - Join automatically based on email domain +// - Accept organization invitations +// +// ### Examples +// +// - Join via organization ID: +// +// Joins an organization directly when you have the ID. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// ``` +// +// - Join via invite: +// +// Accepts an organization invitation link. +// +// ```yaml +// inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *OrganizationService) Join(ctx context.Context, body OrganizationJoinParams, opts ...option.RequestOption) (res *OrganizationJoinResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/JoinOrganization" @@ -105,7 +279,26 @@ func (r *OrganizationService) Join(ctx context.Context, body OrganizationJoinPar return } -// LeaveOrganization lets the passed user leave an Organization. +// Removes a user from an organization while preserving organization data. +// +// Use this method to: +// +// - Remove yourself from an organization +// - Clean up inactive memberships +// - Transfer project ownership before leaving +// - Manage team transitions +// +// ### Examples +// +// - Leave organization: +// +// Removes user from organization membership. +// +// ```yaml +// userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// ``` +// +// Note: Ensure all projects and resources are transferred before leaving. func (r *OrganizationService) Leave(ctx context.Context, body OrganizationLeaveParams, opts ...option.RequestOption) (res *OrganizationLeaveResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/LeaveOrganization" @@ -113,7 +306,36 @@ func (r *OrganizationService) Leave(ctx context.Context, body OrganizationLeaveP return } -// ListMembers lists all members of the specified organization. +// Lists and filters organization members with optional pagination. +// +// Use this method to: +// +// - View all organization members +// - Monitor member activity +// - Manage team membership +// +// ### Examples +// +// - List active members: +// +// Retrieves active members with pagination. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` +// +// - List with pagination: +// +// Retrieves next page of members. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 50 +// token: "next-page-token-from-previous-response" +// ``` func (r *OrganizationService) ListMembers(ctx context.Context, params OrganizationListMembersParams, opts ...option.RequestOption) (res *pagination.MembersPage[OrganizationMember], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -131,12 +353,70 @@ func (r *OrganizationService) ListMembers(ctx context.Context, params Organizati return res, nil } -// ListMembers lists all members of the specified organization. +// Lists and filters organization members with optional pagination. +// +// Use this method to: +// +// - View all organization members +// - Monitor member activity +// - Manage team membership +// +// ### Examples +// +// - List active members: +// +// Retrieves active members with pagination. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` +// +// - List with pagination: +// +// Retrieves next page of members. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 50 +// token: "next-page-token-from-previous-response" +// ``` func (r *OrganizationService) ListMembersAutoPaging(ctx context.Context, params OrganizationListMembersParams, opts ...option.RequestOption) *pagination.MembersPageAutoPager[OrganizationMember] { return pagination.NewMembersPageAutoPager(r.ListMembers(ctx, params, opts...)) } -// SetRole +// Manages organization membership and roles by setting a user's role within the +// organization. +// +// Use this method to: +// +// - Promote members to admin role +// - Change member permissions +// - Demote admins to regular members +// +// ### Examples +// +// - Promote to admin: +// +// Makes a user an organization administrator. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// role: ORGANIZATION_ROLE_ADMIN +// ``` +// +// - Change to member: +// +// Changes a user's role to regular member. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// role: ORGANIZATION_ROLE_MEMBER +// ``` func (r *OrganizationService) SetRole(ctx context.Context, body OrganizationSetRoleParams, opts ...option.RequestOption) (res *OrganizationSetRoleResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/SetRole" diff --git a/organization_test.go b/organization_test.go index 7f401ac..2a28e90 100644 --- a/organization_test.go +++ b/organization_test.go @@ -28,7 +28,7 @@ func TestOrganizationNewWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.New(context.TODO(), gitpod.OrganizationNewParams{ - Name: gitpod.F("xxx"), + Name: gitpod.F("Acme Corp Engineering"), InviteAccountsWithMatchingDomain: gitpod.F(true), JoinOrganization: gitpod.F(true), }) @@ -55,7 +55,7 @@ func TestOrganizationGet(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Get(context.TODO(), gitpod.OrganizationGetParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -80,7 +80,7 @@ func TestOrganizationUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Update(context.TODO(), gitpod.OrganizationUpdateParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), InviteDomains: gitpod.F(gitpod.InviteDomainsParam{ Domains: gitpod.F([]string{"sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB"}), }), @@ -113,7 +113,7 @@ func TestOrganizationListWithOptionalParams(t *testing.T) { PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.OrganizationListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(50)), }), Scope: gitpod.F(gitpod.ScopeUnspecified), }) @@ -140,7 +140,7 @@ func TestOrganizationDelete(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Delete(context.TODO(), gitpod.OrganizationDeleteParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -165,7 +165,7 @@ func TestOrganizationJoinWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Join(context.TODO(), gitpod.OrganizationJoinParams{ - InviteID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + InviteID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), }) if err != nil { @@ -191,7 +191,7 @@ func TestOrganizationLeave(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Leave(context.TODO(), gitpod.OrganizationLeaveParams{ - UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), }) if err != nil { var apierr *gitpod.Error @@ -216,12 +216,12 @@ func TestOrganizationListMembersWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.ListMembers(context.TODO(), gitpod.OrganizationListMembersParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.OrganizationListMembersParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -247,8 +247,8 @@ func TestOrganizationSetRoleWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.SetRole(context.TODO(), gitpod.OrganizationSetRoleParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), + UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), Role: gitpod.F(shared.OrganizationRoleUnspecified), }) if err != nil { diff --git a/organizationdomainverification.go b/organizationdomainverification.go index 4e31234..5d24bb6 100644 --- a/organizationdomainverification.go +++ b/organizationdomainverification.go @@ -35,7 +35,34 @@ func NewOrganizationDomainVerificationService(opts ...option.RequestOption) (r * return } -// CreateDomainVerification creates a new domain verification request +// Initiates domain verification process to enable organization features. +// +// Use this method to: +// +// - Start domain ownership verification +// - Enable automatic team joining +// - Set up SSO restrictions +// - Configure email-based policies +// +// ### Examples +// +// - Verify primary domain: +// +// Starts verification for main company domain. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// domain: "acme-corp.com" +// ``` +// +// - Verify subsidiary domain: +// +// Adds verification for additional company domain. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// domain: "acme-subsidiary.com" +// ``` func (r *OrganizationDomainVerificationService) New(ctx context.Context, body OrganizationDomainVerificationNewParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/CreateDomainVerification" @@ -43,7 +70,23 @@ func (r *OrganizationDomainVerificationService) New(ctx context.Context, body Or return } -// GetDomainVerification retrieves a domain verification request +// Retrieves the status of a domain verification request. +// +// Use this method to: +// +// - Check verification progress +// - View verification requirements +// - Monitor domain status +// +// ### Examples +// +// - Get verification status: +// +// Checks the current state of a domain verification. +// +// ```yaml +// domainVerificationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *OrganizationDomainVerificationService) Get(ctx context.Context, body OrganizationDomainVerificationGetParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/GetDomainVerification" @@ -51,7 +94,37 @@ func (r *OrganizationDomainVerificationService) Get(ctx context.Context, body Or return } -// ListDomainVerifications lists all domain verifications for an organization +// Lists and monitors domain verification status across an organization. +// +// Use this method to: +// +// - Track verification progress +// - View all verified domains +// - Monitor pending verifications +// - Audit domain settings +// +// ### Examples +// +// - List all verifications: +// +// Shows all domain verifications regardless of status. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` +// +// - List with pagination: +// +// Retrieves next page of verifications. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// token: "next-page-token-from-previous-response" +// ``` func (r *OrganizationDomainVerificationService) List(ctx context.Context, params OrganizationDomainVerificationListParams, opts ...option.RequestOption) (res *pagination.DomainVerificationsPage[DomainVerification], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -69,12 +142,58 @@ func (r *OrganizationDomainVerificationService) List(ctx context.Context, params return res, nil } -// ListDomainVerifications lists all domain verifications for an organization +// Lists and monitors domain verification status across an organization. +// +// Use this method to: +// +// - Track verification progress +// - View all verified domains +// - Monitor pending verifications +// - Audit domain settings +// +// ### Examples +// +// - List all verifications: +// +// Shows all domain verifications regardless of status. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` +// +// - List with pagination: +// +// Retrieves next page of verifications. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// token: "next-page-token-from-previous-response" +// ``` func (r *OrganizationDomainVerificationService) ListAutoPaging(ctx context.Context, params OrganizationDomainVerificationListParams, opts ...option.RequestOption) *pagination.DomainVerificationsPageAutoPager[DomainVerification] { return pagination.NewDomainVerificationsPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteDomainVerification deletes a domain verification request +// Removes a domain verification request. +// +// Use this method to: +// +// - Cancel pending verifications +// - Remove verified domains +// - Clean up unused domain records +// +// ### Examples +// +// - Delete verification: +// +// Removes a domain verification request. +// +// ```yaml +// domainVerificationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *OrganizationDomainVerificationService) Delete(ctx context.Context, body OrganizationDomainVerificationDeleteParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/DeleteDomainVerification" @@ -82,7 +201,23 @@ func (r *OrganizationDomainVerificationService) Delete(ctx context.Context, body return } -// VerifyDomain verifies a domain ownership +// Verifies domain ownership for an organization. +// +// Use this method to: +// +// - Complete domain verification process +// - Enable domain-based features +// - Validate DNS configuration +// +// ### Examples +// +// - Verify domain ownership: +// +// Verifies ownership after DNS records are configured. +// +// ```yaml +// domainVerificationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *OrganizationDomainVerificationService) Verify(ctx context.Context, body OrganizationDomainVerificationVerifyParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationVerifyResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/VerifyDomain" diff --git a/organizationdomainverification_test.go b/organizationdomainverification_test.go index d90cf92..4794dbf 100644 --- a/organizationdomainverification_test.go +++ b/organizationdomainverification_test.go @@ -27,8 +27,8 @@ func TestOrganizationDomainVerificationNew(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.DomainVerifications.New(context.TODO(), gitpod.OrganizationDomainVerificationNewParams{ - Domain: gitpod.F("xxxx"), - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Domain: gitpod.F("acme-corp.com"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -53,7 +53,7 @@ func TestOrganizationDomainVerificationGet(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.DomainVerifications.Get(context.TODO(), gitpod.OrganizationDomainVerificationGetParams{ - DomainVerificationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + DomainVerificationID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -78,12 +78,12 @@ func TestOrganizationDomainVerificationListWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.DomainVerifications.List(context.TODO(), gitpod.OrganizationDomainVerificationListParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.OrganizationDomainVerificationListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -109,7 +109,7 @@ func TestOrganizationDomainVerificationDelete(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.DomainVerifications.Delete(context.TODO(), gitpod.OrganizationDomainVerificationDeleteParams{ - DomainVerificationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + DomainVerificationID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -134,7 +134,7 @@ func TestOrganizationDomainVerificationVerify(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.DomainVerifications.Verify(context.TODO(), gitpod.OrganizationDomainVerificationVerifyParams{ - DomainVerificationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + DomainVerificationID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/organizationinvite.go b/organizationinvite.go index 2e700c7..cb80ea2 100644 --- a/organizationinvite.go +++ b/organizationinvite.go @@ -31,8 +31,24 @@ func NewOrganizationInviteService(opts ...option.RequestOption) (r *Organization return } -// CreateOrganizationInvite creates an invite for the organization. Any existing +// Creates an invite link for joining an organization. Any existing // OrganizationInvites are invalidated and can no longer be used. +// +// Use this method to: +// +// - Generate shareable invite links +// - Manage team growth +// - Control organization access +// +// ### Examples +// +// - Create organization invite: +// +// Generates a new invite link for the organization. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// ``` func (r *OrganizationInviteService) New(ctx context.Context, body OrganizationInviteNewParams, opts ...option.RequestOption) (res *OrganizationInviteNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/CreateOrganizationInvite" @@ -40,8 +56,7 @@ func (r *OrganizationInviteService) New(ctx context.Context, body OrganizationIn return } -// GetOrganizationInvite retrieves invite for the organization. If no invite -// exists, a new one is created. +// GetOrganizationInvite func (r *OrganizationInviteService) Get(ctx context.Context, body OrganizationInviteGetParams, opts ...option.RequestOption) (res *OrganizationInviteGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/GetOrganizationInvite" @@ -49,8 +64,24 @@ func (r *OrganizationInviteService) Get(ctx context.Context, body OrganizationIn return } -// GetOrganizationInviteSummary retrieves a summary of the organization based on an -// Invite ID. Used to discover which organization an invite is for. +// Retrieves organization details and membership info based on an invite link. +// +// Use this method to: +// +// - Preview organization details before joining +// - Validate invite link authenticity +// - Check organization size and activity +// - View team information before accepting +// +// ### Examples +// +// - Get invite summary: +// +// Retrieves organization information from an invite. +// +// ```yaml +// inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *OrganizationInviteService) GetSummary(ctx context.Context, body OrganizationInviteGetSummaryParams, opts ...option.RequestOption) (res *OrganizationInviteGetSummaryResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/GetOrganizationInviteSummary" diff --git a/organizationinvite_test.go b/organizationinvite_test.go index b439088..f4b786d 100644 --- a/organizationinvite_test.go +++ b/organizationinvite_test.go @@ -27,7 +27,7 @@ func TestOrganizationInviteNew(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Invites.New(context.TODO(), gitpod.OrganizationInviteNewParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -77,7 +77,7 @@ func TestOrganizationInviteGetSummary(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.Invites.GetSummary(context.TODO(), gitpod.OrganizationInviteGetSummaryParams{ - InviteID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + InviteID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/organizationssoconfiguration.go b/organizationssoconfiguration.go index 156cbbd..340a068 100644 --- a/organizationssoconfiguration.go +++ b/organizationssoconfiguration.go @@ -34,7 +34,40 @@ func NewOrganizationSSOConfigurationService(opts ...option.RequestOption) (r *Or return } -// CreateSSOConfiguration creates a new SSO configuration for the organization. +// Creates or updates SSO configuration for organizational authentication. +// +// Use this method to: +// +// - Configure OIDC-based SSO providers +// - Set up built-in providers (Google, GitHub, etc.) +// - Define custom identity providers +// - Manage authentication policies +// +// ### Examples +// +// - Configure built-in Google SSO: +// +// Sets up SSO using Google Workspace. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// clientId: "012345678-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com" +// clientSecret: "GOCSPX-abcdefghijklmnopqrstuvwxyz123456" +// issuerUrl: "https://accounts.google.com" +// emailDomain: "acme-corp.com" +// ``` +// +// - Configure custom OIDC provider: +// +// Sets up SSO with a custom identity provider. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// clientId: "acme-corp-gitpod" +// clientSecret: "secret-token-value" +// issuerUrl: "https://sso.acme-corp.com" +// emailDomain: "acme-corp.com" +// ``` func (r *OrganizationSSOConfigurationService) New(ctx context.Context, body OrganizationSSOConfigurationNewParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/CreateSSOConfiguration" @@ -42,7 +75,23 @@ func (r *OrganizationSSOConfigurationService) New(ctx context.Context, body Orga return } -// GetSSOConfiguration returns an SSO configuration. +// Retrieves a specific SSO configuration. +// +// Use this method to: +// +// - View SSO provider details +// - Check configuration status +// - Verify SSO settings +// +// ### Examples +// +// - Get SSO configuration: +// +// Retrieves details of a specific SSO configuration. +// +// ```yaml +// ssoConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *OrganizationSSOConfigurationService) Get(ctx context.Context, body OrganizationSSOConfigurationGetParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/GetSSOConfiguration" @@ -50,7 +99,36 @@ func (r *OrganizationSSOConfigurationService) Get(ctx context.Context, body Orga return } -// UpdateSSOConfiguration updates the SSO configuration for the organization. +// Updates SSO provider settings and authentication rules. +// +// Use this method to: +// +// - Rotate client credentials +// - Update provider endpoints +// - Modify claim mappings +// - Change authentication policies +// - Toggle SSO enforcement +// +// ### Examples +// +// - Update credentials: +// +// Rotates client ID and secret. +// +// ```yaml +// ssoConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// clientId: "new-client-id" +// clientSecret: "new-client-secret" +// ``` +// +// - Update provider status: +// +// Activates or deactivates SSO provider. +// +// ```yaml +// ssoConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// state: SSO_CONFIGURATION_STATE_ACTIVE +// ``` func (r *OrganizationSSOConfigurationService) Update(ctx context.Context, body OrganizationSSOConfigurationUpdateParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationUpdateResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/UpdateSSOConfiguration" @@ -58,7 +136,37 @@ func (r *OrganizationSSOConfigurationService) Update(ctx context.Context, body O return } -// ListSSOConfigurations lists all SSO configurations matching provided filters. +// Lists and filters SSO configurations for an organization. +// +// Use this method to: +// +// - View all SSO providers +// - Monitor authentication status +// - Audit security settings +// - Manage provider configurations +// +// ### Examples +// +// - List active configurations: +// +// Shows all active SSO providers. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` +// +// - List by provider type: +// +// Shows custom SSO configurations. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// token: "next-page-token-from-previous-response" +// ``` func (r *OrganizationSSOConfigurationService) List(ctx context.Context, params OrganizationSSOConfigurationListParams, opts ...option.RequestOption) (res *pagination.SSOConfigurationsPage[SSOConfiguration], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -76,12 +184,58 @@ func (r *OrganizationSSOConfigurationService) List(ctx context.Context, params O return res, nil } -// ListSSOConfigurations lists all SSO configurations matching provided filters. +// Lists and filters SSO configurations for an organization. +// +// Use this method to: +// +// - View all SSO providers +// - Monitor authentication status +// - Audit security settings +// - Manage provider configurations +// +// ### Examples +// +// - List active configurations: +// +// Shows all active SSO providers. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// ``` +// +// - List by provider type: +// +// Shows custom SSO configurations. +// +// ```yaml +// organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// pagination: +// pageSize: 20 +// token: "next-page-token-from-previous-response" +// ``` func (r *OrganizationSSOConfigurationService) ListAutoPaging(ctx context.Context, params OrganizationSSOConfigurationListParams, opts ...option.RequestOption) *pagination.SSOConfigurationsPageAutoPager[SSOConfiguration] { return pagination.NewSSOConfigurationsPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteSSOConfiguration deletes an SSO configuration. +// Removes an SSO configuration from an organization. +// +// Use this method to: +// +// - Disable SSO authentication +// - Remove outdated providers +// - Clean up unused configurations +// +// ### Examples +// +// - Delete SSO configuration: +// +// Removes a specific SSO configuration. +// +// ```yaml +// ssoConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *OrganizationSSOConfigurationService) Delete(ctx context.Context, body OrganizationSSOConfigurationDeleteParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.OrganizationService/DeleteSSOConfiguration" diff --git a/organizationssoconfiguration_test.go b/organizationssoconfiguration_test.go index c75078b..5559d43 100644 --- a/organizationssoconfiguration_test.go +++ b/organizationssoconfiguration_test.go @@ -27,11 +27,11 @@ func TestOrganizationSSOConfigurationNew(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.SSOConfigurations.New(context.TODO(), gitpod.OrganizationSSOConfigurationNewParams{ - ClientID: gitpod.F("x"), - ClientSecret: gitpod.F("x"), - EmailDomain: gitpod.F("xxxx"), - IssuerURL: gitpod.F("https://example.com"), - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + ClientID: gitpod.F("012345678-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com"), + ClientSecret: gitpod.F("GOCSPX-abcdefghijklmnopqrstuvwxyz123456"), + EmailDomain: gitpod.F("acme-corp.com"), + IssuerURL: gitpod.F("https://accounts.google.com"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), }) if err != nil { var apierr *gitpod.Error @@ -56,7 +56,7 @@ func TestOrganizationSSOConfigurationGet(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.SSOConfigurations.Get(context.TODO(), gitpod.OrganizationSSOConfigurationGetParams{ - SSOConfigurationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + SSOConfigurationID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -81,12 +81,12 @@ func TestOrganizationSSOConfigurationUpdateWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.SSOConfigurations.Update(context.TODO(), gitpod.OrganizationSSOConfigurationUpdateParams{ - SSOConfigurationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + SSOConfigurationID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), Claims: gitpod.F(map[string]string{ "foo": "string", }), - ClientID: gitpod.F("x"), - ClientSecret: gitpod.F("x"), + ClientID: gitpod.F("new-client-id"), + ClientSecret: gitpod.F("new-client-secret"), EmailDomain: gitpod.F("xxxx"), IssuerURL: gitpod.F("https://example.com"), State: gitpod.F(gitpod.SSOConfigurationStateUnspecified), @@ -114,12 +114,12 @@ func TestOrganizationSSOConfigurationListWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.SSOConfigurations.List(context.TODO(), gitpod.OrganizationSSOConfigurationListParams{ - OrganizationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrganizationID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Pagination: gitpod.F(gitpod.OrganizationSSOConfigurationListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -145,7 +145,7 @@ func TestOrganizationSSOConfigurationDelete(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Organizations.SSOConfigurations.Delete(context.TODO(), gitpod.OrganizationSSOConfigurationDeleteParams{ - SSOConfigurationID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + SSOConfigurationID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error diff --git a/runner.go b/runner.go index b4e8682..7c9bd01 100644 --- a/runner.go +++ b/runner.go @@ -362,11 +362,12 @@ type RunnerCapability string const ( RunnerCapabilityUnspecified RunnerCapability = "RUNNER_CAPABILITY_UNSPECIFIED" RunnerCapabilityFetchLocalScmIntegrations RunnerCapability = "RUNNER_CAPABILITY_FETCH_LOCAL_SCM_INTEGRATIONS" + RunnerCapabilitySecretContainerRegistry RunnerCapability = "RUNNER_CAPABILITY_SECRET_CONTAINER_REGISTRY" ) func (r RunnerCapability) IsKnown() bool { switch r { - case RunnerCapabilityUnspecified, RunnerCapabilityFetchLocalScmIntegrations: + case RunnerCapabilityUnspecified, RunnerCapabilityFetchLocalScmIntegrations, RunnerCapabilitySecretContainerRegistry: return true } return false @@ -714,11 +715,20 @@ type RunnerUpdateResponse = interface{} type RunnerDeleteResponse = interface{} type RunnerCheckAuthenticationForHostResponse struct { - Authenticated bool `json:"authenticated"` - AuthenticationURL string `json:"authenticationUrl"` - PatSupported bool `json:"patSupported"` - ScmID string `json:"scmId"` - JSON runnerCheckAuthenticationForHostResponseJSON `json:"-"` + Authenticated bool `json:"authenticated"` + AuthenticationURL string `json:"authenticationUrl"` + PatSupported bool `json:"patSupported"` + // scm_id is the unique identifier of the SCM provider + ScmID string `json:"scmId"` + // scm_name is the human-readable name of the SCM provider (e.g., "GitHub", + // "GitLab") + ScmName string `json:"scmName"` + // supports_oauth2 indicates that the host supports OAuth2 authentication + SupportsOauth2 RunnerCheckAuthenticationForHostResponseSupportsOauth2 `json:"supportsOauth2"` + // supports_pat indicates that the host supports Personal Access Token + // authentication + SupportsPat RunnerCheckAuthenticationForHostResponseSupportsPat `json:"supportsPat"` + JSON runnerCheckAuthenticationForHostResponseJSON `json:"-"` } // runnerCheckAuthenticationForHostResponseJSON contains the JSON metadata for the @@ -728,6 +738,9 @@ type runnerCheckAuthenticationForHostResponseJSON struct { AuthenticationURL apijson.Field PatSupported apijson.Field ScmID apijson.Field + ScmName apijson.Field + SupportsOauth2 apijson.Field + SupportsPat apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -740,6 +753,66 @@ func (r runnerCheckAuthenticationForHostResponseJSON) RawJSON() string { return r.raw } +// supports_oauth2 indicates that the host supports OAuth2 authentication +type RunnerCheckAuthenticationForHostResponseSupportsOauth2 struct { + // auth_url is the URL where users can authenticate + AuthURL string `json:"authUrl"` + // docs_url is the URL to the documentation explaining this authentication method + DocsURL string `json:"docsUrl"` + JSON runnerCheckAuthenticationForHostResponseSupportsOauth2JSON `json:"-"` +} + +// runnerCheckAuthenticationForHostResponseSupportsOauth2JSON contains the JSON +// metadata for the struct [RunnerCheckAuthenticationForHostResponseSupportsOauth2] +type runnerCheckAuthenticationForHostResponseSupportsOauth2JSON struct { + AuthURL apijson.Field + DocsURL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerCheckAuthenticationForHostResponseSupportsOauth2) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerCheckAuthenticationForHostResponseSupportsOauth2JSON) RawJSON() string { + return r.raw +} + +// supports_pat indicates that the host supports Personal Access Token +// authentication +type RunnerCheckAuthenticationForHostResponseSupportsPat struct { + // create_url is the URL where users can create a new Personal Access Token + CreateURL string `json:"createUrl"` + // docs_url is the URL to the documentation explaining PAT usage for this host + DocsURL string `json:"docsUrl"` + // example is an example of a Personal Access Token + Example string `json:"example"` + // required_scopes is the list of permissions required for the Personal Access + // Token + RequiredScopes []string `json:"requiredScopes"` + JSON runnerCheckAuthenticationForHostResponseSupportsPatJSON `json:"-"` +} + +// runnerCheckAuthenticationForHostResponseSupportsPatJSON contains the JSON +// metadata for the struct [RunnerCheckAuthenticationForHostResponseSupportsPat] +type runnerCheckAuthenticationForHostResponseSupportsPatJSON struct { + CreateURL apijson.Field + DocsURL apijson.Field + Example apijson.Field + RequiredScopes apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RunnerCheckAuthenticationForHostResponseSupportsPat) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r runnerCheckAuthenticationForHostResponseSupportsPatJSON) RawJSON() string { + return r.raw +} + type RunnerNewRunnerTokenResponse struct { // deprecated, will be removed. Use exchange_token instead. AccessToken string `json:"accessToken"` diff --git a/secret.go b/secret.go index 49c9ea6..4809af0 100644 --- a/secret.go +++ b/secret.go @@ -36,7 +36,49 @@ func NewSecretService(opts ...option.RequestOption) (r *SecretService) { return } -// CreateSecret creates a new secret. +// Creates a new secret for a project. +// +// Use this method to: +// +// - Store sensitive configuration values +// - Set up environment variables +// - Configure registry authentication +// - Add file-based secrets +// +// ### Examples +// +// - Create environment variable: +// +// Creates a secret that will be available as an environment variable. +// +// ```yaml +// name: "DATABASE_URL" +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// value: "postgresql://user:pass@localhost:5432/db" +// environmentVariable: true +// ``` +// +// - Create file secret: +// +// Creates a secret that will be mounted as a file. +// +// ```yaml +// name: "SSH_KEY" +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// value: "-----BEGIN RSA PRIVATE KEY-----\n..." +// filePath: "/home/gitpod/.ssh/id_rsa" +// ``` +// +// - Create registry auth: +// +// Creates credentials for private container registry. +// +// ```yaml +// name: "DOCKER_AUTH" +// projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" +// value: "username:password" +// containerRegistryBasicAuthHost: "https://registry.example.com" +// ``` func (r *SecretService) New(ctx context.Context, body SecretNewParams, opts ...option.RequestOption) (res *SecretNewResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.SecretService/CreateSecret" @@ -44,7 +86,25 @@ func (r *SecretService) New(ctx context.Context, body SecretNewParams, opts ...o return } -// ListSecrets lists secrets. +// Lists secrets with optional filtering. +// +// Use this method to: +// +// - View all project secrets +// - Filter secrets by project +// +// ### Examples +// +// - List project secrets: +// +// Shows all secrets for a project. +// +// ```yaml +// filter: +// projectIds: ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"] +// pagination: +// pageSize: 20 +// ``` func (r *SecretService) List(ctx context.Context, params SecretListParams, opts ...option.RequestOption) (res *pagination.SecretsPage[Secret], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -62,12 +122,45 @@ func (r *SecretService) List(ctx context.Context, params SecretListParams, opts return res, nil } -// ListSecrets lists secrets. +// Lists secrets with optional filtering. +// +// Use this method to: +// +// - View all project secrets +// - Filter secrets by project +// +// ### Examples +// +// - List project secrets: +// +// Shows all secrets for a project. +// +// ```yaml +// filter: +// projectIds: ["b0e12f6c-4c67-429d-a4a6-d9838b5da047"] +// pagination: +// pageSize: 20 +// ``` func (r *SecretService) ListAutoPaging(ctx context.Context, params SecretListParams, opts ...option.RequestOption) *pagination.SecretsPageAutoPager[Secret] { return pagination.NewSecretsPageAutoPager(r.List(ctx, params, opts...)) } -// DeleteSecret deletes a secret. +// Deletes a secret permanently. +// +// Use this method to: +// +// - Remove unused secrets +// - Clean up old credentials +// +// ### Examples +// +// - Delete secret: +// +// Permanently removes a secret. +// +// ```yaml +// secretId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *SecretService) Delete(ctx context.Context, body SecretDeleteParams, opts ...option.RequestOption) (res *SecretDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.SecretService/DeleteSecret" @@ -75,8 +168,23 @@ func (r *SecretService) Delete(ctx context.Context, body SecretDeleteParams, opt return } -// GetSecretValue retrieves the value of a secret Only Environments can perform -// this operation, and only for secrets specified on the EnvironmentSpec. +// Gets the value of a secret. Only available to environments that are authorized +// to access the secret. +// +// Use this method to: +// +// - Retrieve secret values +// - Access credentials +// +// ### Examples +// +// - Get secret value: +// +// Retrieves the value of a specific secret. +// +// ```yaml +// secretId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *SecretService) GetValue(ctx context.Context, body SecretGetValueParams, opts ...option.RequestOption) (res *SecretGetValueResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.SecretService/GetSecretValue" @@ -84,7 +192,23 @@ func (r *SecretService) GetValue(ctx context.Context, body SecretGetValueParams, return } -// UpdateSecretValue updates the value of a secret. +// Updates the value of an existing secret. +// +// Use this method to: +// +// - Rotate secret values +// - Update credentials +// +// ### Examples +// +// - Update secret value: +// +// Changes the value of an existing secret. +// +// ```yaml +// secretId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// value: "new-secret-value" +// ``` func (r *SecretService) UpdateValue(ctx context.Context, body SecretUpdateValueParams, opts ...option.RequestOption) (res *SecretUpdateValueResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.SecretService/UpdateSecretValue" diff --git a/secret_test.go b/secret_test.go index 14ccb17..4d09a07 100644 --- a/secret_test.go +++ b/secret_test.go @@ -30,9 +30,9 @@ func TestSecretNewWithOptionalParams(t *testing.T) { ContainerRegistryBasicAuthHost: gitpod.F("https://example.com"), EnvironmentVariable: gitpod.F(true), FilePath: gitpod.F("filePath"), - Name: gitpod.F("name"), - ProjectID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Value: gitpod.F("x"), + Name: gitpod.F("DATABASE_URL"), + ProjectID: gitpod.F("b0e12f6c-4c67-429d-a4a6-d9838b5da047"), + Value: gitpod.F("postgresql://user:pass@localhost:5432/db"), }) if err != nil { var apierr *gitpod.Error @@ -60,11 +60,11 @@ func TestSecretListWithOptionalParams(t *testing.T) { Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.SecretListParamsFilter{ - ProjectIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), + ProjectIDs: gitpod.F([]string{"b0e12f6c-4c67-429d-a4a6-d9838b5da047"}), }), Pagination: gitpod.F(gitpod.SecretListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -90,7 +90,7 @@ func TestSecretDeleteWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Secrets.Delete(context.TODO(), gitpod.SecretDeleteParams{ - SecretID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + SecretID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -115,7 +115,7 @@ func TestSecretGetValueWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Secrets.GetValue(context.TODO(), gitpod.SecretGetValueParams{ - SecretID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + SecretID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -140,8 +140,8 @@ func TestSecretUpdateValueWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Secrets.UpdateValue(context.TODO(), gitpod.SecretUpdateValueParams{ - SecretID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), - Value: gitpod.F("x"), + SecretID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), + Value: gitpod.F("new-secret-value"), }) if err != nil { var apierr *gitpod.Error diff --git a/shared/shared.go b/shared/shared.go index e174c8f..894d650 100644 --- a/shared/shared.go +++ b/shared/shared.go @@ -54,7 +54,7 @@ func (r AutomationTriggerParam) MarshalJSON() (data []byte, err error) { type EnvironmentClass struct { // id is the unique identifier of the environment class - ID string `json:"id"` + ID string `json:"id,required"` // configuration describes the configuration of the environment class Configuration []FieldValue `json:"configuration"` // description is a human readable description of the environment class @@ -93,7 +93,7 @@ func (r environmentClassJSON) RawJSON() string { type EnvironmentClassParam struct { // id is the unique identifier of the environment class - ID param.Field[string] `json:"id"` + ID param.Field[string] `json:"id,required"` // configuration describes the configuration of the environment class Configuration param.Field[[]FieldValueParam] `json:"configuration"` // description is a human readable description of the environment class @@ -273,7 +273,7 @@ func (r SubjectParam) MarshalJSON() (data []byte, err error) { } type Task struct { - ID string `json:"id" format:"uuid"` + ID string `json:"id,required" format:"uuid"` // dependencies specifies the IDs of the automations this task depends on. DependsOn []string `json:"dependsOn" format:"uuid"` EnvironmentID string `json:"environmentId" format:"uuid"` diff --git a/user.go b/user.go index 5fadf90..7bf5eb9 100644 --- a/user.go +++ b/user.go @@ -35,7 +35,24 @@ func NewUserService(opts ...option.RequestOption) (r *UserService) { return } -// GetAuthenticatedUser allows to retrieve the current user. +// Gets information about the currently authenticated user. +// +// Use this method to: +// +// - Get user profile information +// - Check authentication status +// - Retrieve user settings +// - Verify account details +// +// ### Examples +// +// - Get current user: +// +// Retrieves details about the authenticated user. +// +// ```yaml +// {} +// ``` func (r *UserService) GetAuthenticatedUser(ctx context.Context, body UserGetAuthenticatedUserParams, opts ...option.RequestOption) (res *UserGetAuthenticatedUserResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.UserService/GetAuthenticatedUser" @@ -43,7 +60,33 @@ func (r *UserService) GetAuthenticatedUser(ctx context.Context, body UserGetAuth return } -// SetSuspended sets the suspended state of the user. +// Sets whether a user account is suspended. +// +// Use this method to: +// +// - Suspend problematic users +// - Reactivate suspended accounts +// - Manage user access +// +// ### Examples +// +// - Suspend user: +// +// Suspends a user account. +// +// ```yaml +// userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// suspended: true +// ``` +// +// - Reactivate user: +// +// Removes suspension from a user account. +// +// ```yaml +// userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" +// suspended: false +// ``` func (r *UserService) SetSuspended(ctx context.Context, body UserSetSuspendedParams, opts ...option.RequestOption) (res *UserSetSuspendedResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.UserService/SetSuspended" diff --git a/user_test.go b/user_test.go index 3b5ae21..f4f33c4 100644 --- a/user_test.go +++ b/user_test.go @@ -52,8 +52,8 @@ func TestUserSetSuspendedWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Users.SetSuspended(context.TODO(), gitpod.UserSetSuspendedParams{ - Suspended: gitpod.F(true), - UserID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + Suspended: gitpod.F(false), + UserID: gitpod.F("f53d2330-3795-4c5d-a1f3-453121af9c60"), }) if err != nil { var apierr *gitpod.Error diff --git a/userpat.go b/userpat.go index f5bdece..7b0b195 100644 --- a/userpat.go +++ b/userpat.go @@ -36,7 +36,26 @@ func NewUserPatService(opts ...option.RequestOption) (r *UserPatService) { return } -// ListPersonalAccessTokens +// Lists personal access tokens with optional filtering. +// +// Use this method to: +// +// - View all active tokens +// - Audit token usage +// - Manage token lifecycle +// +// ### Examples +// +// - List user tokens: +// +// Shows all tokens for specific users. +// +// ```yaml +// filter: +// userIds: ["f53d2330-3795-4c5d-a1f3-453121af9c60"] +// pagination: +// pageSize: 20 +// ``` func (r *UserPatService) List(ctx context.Context, params UserPatListParams, opts ...option.RequestOption) (res *pagination.PersonalAccessTokensPage[PersonalAccessToken], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -54,12 +73,47 @@ func (r *UserPatService) List(ctx context.Context, params UserPatListParams, opt return res, nil } -// ListPersonalAccessTokens +// Lists personal access tokens with optional filtering. +// +// Use this method to: +// +// - View all active tokens +// - Audit token usage +// - Manage token lifecycle +// +// ### Examples +// +// - List user tokens: +// +// Shows all tokens for specific users. +// +// ```yaml +// filter: +// userIds: ["f53d2330-3795-4c5d-a1f3-453121af9c60"] +// pagination: +// pageSize: 20 +// ``` func (r *UserPatService) ListAutoPaging(ctx context.Context, params UserPatListParams, opts ...option.RequestOption) *pagination.PersonalAccessTokensPageAutoPager[PersonalAccessToken] { return pagination.NewPersonalAccessTokensPageAutoPager(r.List(ctx, params, opts...)) } -// DeletePersonalAccessToken +// Deletes a personal access token. +// +// Use this method to: +// +// - Revoke token access +// - Remove unused tokens +// - Rotate credentials +// +// ### Examples +// +// - Delete token: +// +// Permanently revokes a token. +// +// ```yaml +// personalAccessTokenId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *UserPatService) Delete(ctx context.Context, body UserPatDeleteParams, opts ...option.RequestOption) (res *UserPatDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.UserService/DeletePersonalAccessToken" @@ -67,7 +121,23 @@ func (r *UserPatService) Delete(ctx context.Context, body UserPatDeleteParams, o return } -// GetPersonalAccessToken +// Gets details about a specific personal access token. +// +// Use this method to: +// +// - View token metadata +// - Check token expiration +// - Monitor token usage +// +// ### Examples +// +// - Get token details: +// +// Retrieves information about a specific token. +// +// ```yaml +// personalAccessTokenId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" +// ``` func (r *UserPatService) Get(ctx context.Context, body UserPatGetParams, opts ...option.RequestOption) (res *UserPatGetResponse, err error) { opts = append(r.Options[:], opts...) path := "gitpod.v1.UserService/GetPersonalAccessToken" diff --git a/userpat_test.go b/userpat_test.go index 5a0dc2e..52c8336 100644 --- a/userpat_test.go +++ b/userpat_test.go @@ -30,11 +30,11 @@ func TestUserPatListWithOptionalParams(t *testing.T) { Token: gitpod.F("token"), PageSize: gitpod.F(int64(0)), Filter: gitpod.F(gitpod.UserPatListParamsFilter{ - UserIDs: gitpod.F([]string{"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}), + UserIDs: gitpod.F([]string{"f53d2330-3795-4c5d-a1f3-453121af9c60"}), }), Pagination: gitpod.F(gitpod.UserPatListParamsPagination{ Token: gitpod.F("token"), - PageSize: gitpod.F(int64(100)), + PageSize: gitpod.F(int64(20)), }), }) if err != nil { @@ -60,7 +60,7 @@ func TestUserPatDeleteWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Users.Pats.Delete(context.TODO(), gitpod.UserPatDeleteParams{ - PersonalAccessTokenID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + PersonalAccessTokenID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error @@ -85,7 +85,7 @@ func TestUserPatGetWithOptionalParams(t *testing.T) { option.WithBearerToken("My Bearer Token"), ) _, err := client.Users.Pats.Get(context.TODO(), gitpod.UserPatGetParams{ - PersonalAccessTokenID: gitpod.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + PersonalAccessTokenID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"), }) if err != nil { var apierr *gitpod.Error