diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7eea51c..64f3cdd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.7.11" + ".": "0.8.0" } diff --git a/.stats.yml b/.stats.yml index 9333247..0fdb5b6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 119 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-ca9a49ac7fbb63f55611fd7cd48a22a3ff8b38a797125c8513e891d9b7345550.yml -openapi_spec_hash: fd6ffbdfaefcc555e61ca1c565e05214 -config_hash: 7fb76543ceafd4a116473f647f8d63b1 +configured_endpoints: 159 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-d62ef4b9187c1f3d36f428abc4b31d8a09ffd36e93d39b8136c60c8f463c838e.yml +openapi_spec_hash: d7f01b6f24e88eb46d744ecd28061f26 +config_hash: 26e4a10dfc6ec809322e60d889d15414 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f5873e..f86e4aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.8.0 (2025-12-15) + +Full Changelog: [v0.7.11...v0.8.0](https://github.com/gitpod-io/gitpod-sdk-typescript/compare/v0.7.11...v0.8.0) + +### Features + +* **api:** RBAC APIs ([5888854](https://github.com/gitpod-io/gitpod-sdk-typescript/commit/588885414cc29e94ec512952822d30f2007cbbae)) + ## 0.7.11 (2025-12-15) Full Changelog: [v0.7.10...v0.7.11](https://github.com/gitpod-io/gitpod-sdk-typescript/compare/v0.7.10...v0.7.11) diff --git a/README.md b/README.md index 74f5d18..c116f77 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This library provides convenient access to the Gitpod REST API from server-side TypeScript or JavaScript. -The REST API documentation can be found on [docs.ona.com](https://docs.ona.com). The full API of this library can be found in [api.md](api.md). +The REST API documentation can be found on [docs.gitpod.io](https://docs.gitpod.io). The full API of this library can be found in [api.md](api.md). It is generated with [Stainless](https://www.stainless.com/). diff --git a/SECURITY.md b/SECURITY.md index 8975e82..efd9088 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -20,7 +20,7 @@ or products provided by Gitpod, please follow the respective company's security ### Gitpod Terms and Policies -Please contact dev-feedback@ona.com for any questions or concerns regarding the security of our services. +Please contact dev-feedback@gitpod.com for any questions or concerns regarding the security of our services. --- diff --git a/api.md b/api.md index 228b9e2..07e45cb 100644 --- a/api.md +++ b/api.md @@ -4,12 +4,17 @@ Types: - AutomationTrigger - EnvironmentClass +- EnvironmentVariableItem +- EnvironmentVariableSource - ErrorCode - FieldValue - Gateway - OrganizationRole - Principal +- ProjectEnvironmentClass +- ResourceType - RunsOn +- SecretRef - Subject - Task - TaskExecution @@ -32,21 +37,60 @@ Types: - AccountRetrieveResponse - AccountDeleteResponse - AccountGetSSOLoginURLResponse -- AccountListJoinableOrganizationsResponse +- AccountListSSOLoginsResponse Methods: - client.accounts.retrieve({ ...params }) -> AccountRetrieveResponse - client.accounts.delete({ ...params }) -> unknown - client.accounts.getSSOLoginURL({ ...params }) -> AccountGetSSOLoginURLResponse -- client.accounts.listJoinableOrganizations({ ...params }) -> AccountListJoinableOrganizationsResponse +- client.accounts.listJoinableOrganizations({ ...params }) -> JoinableOrganizationsJoinableOrganizationsPage - client.accounts.listLoginProviders({ ...params }) -> LoginProvidersLoginProvidersPage +- client.accounts.listSSOLogins({ ...params }) -> AccountListSSOLoginsResponsesLoginsPage + +# Agents + +Types: + +- AgentCodeContext +- AgentExecution +- AgentMode +- Prompt +- PromptMetadata +- PromptSpec +- UserInputBlock +- AgentCreateExecutionConversationTokenResponse +- AgentCreatePromptResponse +- AgentDeleteExecutionResponse +- AgentDeletePromptResponse +- AgentRetrieveExecutionResponse +- AgentRetrievePromptResponse +- AgentSendToExecutionResponse +- AgentStartExecutionResponse +- AgentStopExecutionResponse +- AgentUpdatePromptResponse + +Methods: + +- client.agents.createExecutionConversationToken({ ...params }) -> AgentCreateExecutionConversationTokenResponse +- client.agents.createPrompt({ ...params }) -> AgentCreatePromptResponse +- client.agents.deleteExecution({ ...params }) -> unknown +- client.agents.deletePrompt({ ...params }) -> unknown +- client.agents.listExecutions({ ...params }) -> AgentExecutionsAgentExecutionsPage +- client.agents.listPrompts({ ...params }) -> PromptsPromptsPage +- client.agents.retrieveExecution({ ...params }) -> AgentRetrieveExecutionResponse +- client.agents.retrievePrompt({ ...params }) -> AgentRetrievePromptResponse +- client.agents.sendToExecution({ ...params }) -> unknown +- client.agents.startExecution({ ...params }) -> AgentStartExecutionResponse +- client.agents.stopExecution({ ...params }) -> unknown +- client.agents.updatePrompt({ ...params }) -> AgentUpdatePromptResponse # Editors Types: - Editor +- EditorVersion - EditorRetrieveResponse - EditorResolveURLResponse @@ -65,6 +109,7 @@ Types: - EnvironmentActivitySignal - EnvironmentMetadata - EnvironmentPhase +- EnvironmentRole - EnvironmentSpec - EnvironmentStatus - EnvironmentCreateResponse @@ -112,6 +157,7 @@ Types: - Service - ServiceMetadata - ServicePhase +- ServiceRole - ServiceSpec - ServiceStatus - ServiceCreateResponse @@ -169,12 +215,28 @@ Methods: - client.environments.classes.list({ ...params }) -> EnvironmentClassesEnvironmentClassesPage +# Errors + +Types: + +- Breadcrumb +- ErrorEvent +- ErrorLevel +- ExceptionInfo +- ExceptionMechanism +- RequestInfo +- StackFrame +- ErrorReportErrorsResponse + +Methods: + +- client.errors.reportErrors({ ...params }) -> unknown + # Events Types: - ResourceOperation -- ResourceType - EventListResponse - EventWatchResponse @@ -193,11 +255,48 @@ Methods: Types: -- Group +- Group +- GroupCreateResponse +- GroupRetrieveResponse +- GroupUpdateResponse +- GroupDeleteResponse + +Methods: + +- client.groups.create({ ...params }) -> GroupCreateResponse +- client.groups.retrieve({ ...params }) -> GroupRetrieveResponse +- client.groups.update({ ...params }) -> GroupUpdateResponse +- client.groups.list({ ...params }) -> GroupsGroupsPage +- client.groups.delete({ ...params }) -> unknown + +## Memberships + +Types: + +- GroupMembership +- MembershipCreateResponse +- MembershipDeleteResponse Methods: -- client.groups.list({ ...params }) -> GroupsGroupsPage +- client.groups.memberships.create({ ...params }) -> MembershipCreateResponse +- client.groups.memberships.list({ ...params }) -> GroupMembershipsMembersPage +- client.groups.memberships.delete({ ...params }) -> unknown + +## RoleAssignments + +Types: + +- ResourceRole +- RoleAssignment +- RoleAssignmentCreateResponse +- RoleAssignmentDeleteResponse + +Methods: + +- client.groups.roleAssignments.create({ ...params }) -> RoleAssignmentCreateResponse +- client.groups.roleAssignments.list({ ...params }) -> RoleAssignmentsAssignmentsPage +- client.groups.roleAssignments.delete({ ...params }) -> unknown # Identity @@ -241,6 +340,24 @@ Methods: - client.organizations.listMembers({ ...params }) -> OrganizationMembersMembersPage - client.organizations.setRole({ ...params }) -> unknown +## CustomDomains + +Types: + +- CustomDomain +- CustomDomainProvider +- CustomDomainCreateResponse +- CustomDomainRetrieveResponse +- CustomDomainUpdateResponse +- CustomDomainDeleteResponse + +Methods: + +- client.organizations.customDomains.create({ ...params }) -> CustomDomainCreateResponse +- client.organizations.customDomains.retrieve({ ...params }) -> CustomDomainRetrieveResponse +- client.organizations.customDomains.update({ ...params }) -> CustomDomainUpdateResponse +- client.organizations.customDomains.delete({ ...params }) -> unknown + ## DomainVerifications Types: @@ -279,7 +396,10 @@ Methods: Types: +- AgentPolicy +- CrowdStrikeConfig - OrganizationPolicies +- SecurityAgentPolicy - PolicyRetrieveResponse - PolicyUpdateResponse @@ -308,14 +428,40 @@ Methods: - client.organizations.ssoConfigurations.list({ ...params }) -> SSOConfigurationsSSOConfigurationsPage - client.organizations.ssoConfigurations.delete({ ...params }) -> unknown +# Prebuilds + +Types: + +- Prebuild +- PrebuildMetadata +- PrebuildPhase +- PrebuildSpec +- PrebuildStatus +- PrebuildTrigger +- PrebuildCreateResponse +- PrebuildRetrieveResponse +- PrebuildDeleteResponse +- PrebuildCancelResponse +- PrebuildCreateLogsTokenResponse + +Methods: + +- client.prebuilds.create({ ...params }) -> PrebuildCreateResponse +- client.prebuilds.retrieve({ ...params }) -> PrebuildRetrieveResponse +- client.prebuilds.list({ ...params }) -> PrebuildsPrebuildsPage +- client.prebuilds.delete({ ...params }) -> unknown +- client.prebuilds.cancel({ ...params }) -> PrebuildCancelResponse +- client.prebuilds.createLogsToken({ ...params }) -> PrebuildCreateLogsTokenResponse + # Projects Types: - EnvironmentInitializer - Project -- ProjectEnvironmentClass - ProjectMetadata +- ProjectPhase +- ProjectPrebuildConfiguration - ProjectCreateResponse - ProjectRetrieveResponse - ProjectUpdateResponse @@ -331,6 +477,17 @@ Methods: - client.projects.delete({ ...params }) -> unknown - client.projects.createFromEnvironment({ ...params }) -> ProjectCreateFromEnvironmentResponse +## EnvironmentClases + +Types: + +- EnvironmentClaseUpdateResponse + +Methods: + +- client.projects.environmentClases.update({ ...params }) -> unknown +- client.projects.environmentClases.list({ ...params }) -> ProjectEnvironmentClassesProjectEnvironmentClassesPage + ## Policies Types: @@ -364,13 +521,17 @@ Types: - RunnerReleaseChannel - RunnerSpec - RunnerStatus +- RunnerVariant +- SearchMode - RunnerCreateResponse - RunnerRetrieveResponse - RunnerUpdateResponse - RunnerDeleteResponse - RunnerCheckAuthenticationForHostResponse +- RunnerCreateLogsTokenResponse - RunnerCreateRunnerTokenResponse - RunnerParseContextURLResponse +- RunnerSearchRepositoriesResponse Methods: @@ -380,8 +541,10 @@ Methods: - client.runners.list({ ...params }) -> RunnersRunnersPage - client.runners.delete({ ...params }) -> unknown - client.runners.checkAuthenticationForHost({ ...params }) -> RunnerCheckAuthenticationForHostResponse +- client.runners.createLogsToken({ ...params }) -> RunnerCreateLogsTokenResponse - client.runners.createRunnerToken({ ...params }) -> RunnerCreateRunnerTokenResponse - client.runners.parseContextURL({ ...params }) -> RunnerParseContextURLResponse +- client.runners.searchRepositories({ ...params }) -> RunnerSearchRepositoriesResponse ## Configurations @@ -511,12 +674,16 @@ Methods: Types: - User +- UserDeleteUserResponse - UserGetAuthenticatedUserResponse +- UserGetUserResponse - UserSetSuspendedResponse Methods: +- client.users.deleteUser({ ...params }) -> unknown - client.users.getAuthenticatedUser({ ...params }) -> UserGetAuthenticatedUserResponse +- client.users.getUser({ ...params }) -> UserGetUserResponse - client.users.setSuspended({ ...params }) -> unknown ## Dotfiles diff --git a/package.json b/package.json index a3badc3..d491c93 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "@gitpod/sdk", - "version": "0.7.11", + "version": "0.8.0", "description": "The official TypeScript library for the Gitpod API", - "author": "Gitpod ", + "author": "Gitpod ", "types": "dist/index.d.ts", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 1727bcc..aef5331 100644 --- a/src/client.ts +++ b/src/client.ts @@ -23,6 +23,10 @@ import * as Errors from './core/error'; import * as Pagination from './core/pagination'; import { AbstractPage, + type AgentExecutionsPageParams, + AgentExecutionsPageResponse, + type AssignmentsPageParams, + AssignmentsPageResponse, type DomainVerificationsPageParams, DomainVerificationsPageResponse, type EditorsPageParams, @@ -39,18 +43,30 @@ import { GroupsPageResponse, type IntegrationsPageParams, IntegrationsPageResponse, + type JoinableOrganizationsPageParams, + JoinableOrganizationsPageResponse, type LoginProvidersPageParams, LoginProvidersPageResponse, + type LoginsPageParams, + LoginsPageResponse, type MembersPageParams, MembersPageResponse, type PersonalAccessTokensPageParams, PersonalAccessTokensPageResponse, type PoliciesPageParams, PoliciesPageResponse, + type PrebuildsPageParams, + PrebuildsPageResponse, + type ProjectEnvironmentClassesPageParams, + ProjectEnvironmentClassesPageResponse, type ProjectsPageParams, ProjectsPageResponse, + type PromptsPageParams, + PromptsPageResponse, type RecordsPageParams, RecordsPageResponse, + type RepositoriesPageParams, + RepositoriesPageResponse, type RunnersPageParams, RunnersPageResponse, type SSOConfigurationsPageParams, @@ -76,16 +92,53 @@ import { AccountGetSSOLoginURLParams, AccountGetSSOLoginURLResponse, AccountListJoinableOrganizationsParams, - AccountListJoinableOrganizationsResponse, AccountListLoginProvidersParams, + AccountListSSOLoginsParams, + AccountListSSOLoginsResponse, + AccountListSSOLoginsResponsesLoginsPage, AccountMembership, AccountRetrieveParams, AccountRetrieveResponse, Accounts, JoinableOrganization, + JoinableOrganizationsJoinableOrganizationsPage, LoginProvider, LoginProvidersLoginProvidersPage, } from './resources/accounts'; +import { + AgentCodeContext, + AgentCreateExecutionConversationTokenParams, + AgentCreateExecutionConversationTokenResponse, + AgentCreatePromptParams, + AgentCreatePromptResponse, + AgentDeleteExecutionParams, + AgentDeleteExecutionResponse, + AgentDeletePromptParams, + AgentDeletePromptResponse, + AgentExecution, + AgentExecutionsAgentExecutionsPage, + AgentListExecutionsParams, + AgentListPromptsParams, + AgentMode, + AgentRetrieveExecutionParams, + AgentRetrieveExecutionResponse, + AgentRetrievePromptParams, + AgentRetrievePromptResponse, + AgentSendToExecutionParams, + AgentSendToExecutionResponse, + AgentStartExecutionParams, + AgentStartExecutionResponse, + AgentStopExecutionParams, + AgentStopExecutionResponse, + AgentUpdatePromptParams, + AgentUpdatePromptResponse, + Agents, + Prompt, + PromptMetadata, + PromptSpec, + PromptsPromptsPage, + UserInputBlock, +} from './resources/agents'; import { Editor, EditorListParams, @@ -93,9 +146,22 @@ import { EditorResolveURLResponse, EditorRetrieveParams, EditorRetrieveResponse, + EditorVersion, Editors, EditorsEditorsPage, } from './resources/editors'; +import { + Breadcrumb, + ErrorEvent, + ErrorLevel, + ErrorReportErrorsParams, + ErrorReportErrorsResponse, + Errors as ErrorsAPIErrors, + ExceptionInfo, + ExceptionMechanism, + RequestInfo as ErrorRequestInfo, + StackFrame, +} from './resources/errors'; import { EventListParams, EventListResponse, @@ -104,10 +170,8 @@ import { EventWatchResponse, Events, ResourceOperation, - ResourceType, } from './resources/events'; import { GatewayListParams, Gateways } from './resources/gateways'; -import { Group, GroupListParams, Groups, GroupsGroupsPage } from './resources/groups'; import { IDTokenVersion, Identity, @@ -118,6 +182,27 @@ import { IdentityGetIDTokenParams, IdentityGetIDTokenResponse, } from './resources/identity'; +import { + Prebuild, + PrebuildCancelParams, + PrebuildCancelResponse, + PrebuildCreateLogsTokenParams, + PrebuildCreateLogsTokenResponse, + PrebuildCreateParams, + PrebuildCreateResponse, + PrebuildDeleteParams, + PrebuildDeleteResponse, + PrebuildListParams, + PrebuildMetadata, + PrebuildPhase, + PrebuildRetrieveParams, + PrebuildRetrieveResponse, + PrebuildSpec, + PrebuildStatus, + PrebuildTrigger, + Prebuilds, + PrebuildsPrebuildsPage, +} from './resources/prebuilds'; import { Secret, SecretCreateParams, @@ -160,6 +245,7 @@ import { EnvironmentPhase, EnvironmentRetrieveParams, EnvironmentRetrieveResponse, + EnvironmentRole, EnvironmentSpec, EnvironmentStartParams, EnvironmentStartResponse, @@ -173,6 +259,20 @@ import { Environments, EnvironmentsEnvironmentsPage, } from './resources/environments/environments'; +import { + Group, + GroupCreateParams, + GroupCreateResponse, + GroupDeleteParams, + GroupDeleteResponse, + GroupListParams, + GroupRetrieveParams, + GroupRetrieveResponse, + GroupUpdateParams, + GroupUpdateResponse, + Groups, + GroupsGroupsPage, +} from './resources/groups/groups'; import { InviteDomains, Organization, @@ -205,9 +305,10 @@ import { ProjectCreateResponse, ProjectDeleteParams, ProjectDeleteResponse, - ProjectEnvironmentClass, ProjectListParams, ProjectMetadata, + ProjectPhase, + ProjectPrebuildConfiguration, ProjectRetrieveParams, ProjectRetrieveResponse, ProjectUpdateParams, @@ -224,6 +325,8 @@ import { RunnerCheckAuthenticationForHostParams, RunnerCheckAuthenticationForHostResponse, RunnerConfiguration, + RunnerCreateLogsTokenParams, + RunnerCreateLogsTokenResponse, RunnerCreateParams, RunnerCreateResponse, RunnerCreateRunnerTokenParams, @@ -239,17 +342,25 @@ import { RunnerReleaseChannel, RunnerRetrieveParams, RunnerRetrieveResponse, + RunnerSearchRepositoriesParams, + RunnerSearchRepositoriesResponse, RunnerSpec, RunnerStatus, RunnerUpdateParams, RunnerUpdateResponse, + RunnerVariant, Runners, RunnersRunnersPage, + SearchMode, } from './resources/runners/runners'; import { User, + UserDeleteUserParams, + UserDeleteUserResponse, UserGetAuthenticatedUserParams, UserGetAuthenticatedUserResponse, + UserGetUserParams, + UserGetUserResponse, UserSetSuspendedParams, UserSetSuspendedResponse, Users, @@ -964,13 +1075,16 @@ export class Gitpod { static toFile = Uploads.toFile; accounts: API.Accounts = new API.Accounts(this); + agents: API.Agents = new API.Agents(this); editors: API.Editors = new API.Editors(this); environments: API.Environments = new API.Environments(this); + errors: API.Errors = new API.Errors(this); events: API.Events = new API.Events(this); gateways: API.Gateways = new API.Gateways(this); groups: API.Groups = new API.Groups(this); identity: API.Identity = new API.Identity(this); organizations: API.Organizations = new API.Organizations(this); + prebuilds: API.Prebuilds = new API.Prebuilds(this); projects: API.Projects = new API.Projects(this); runners: API.Runners = new API.Runners(this); secrets: API.Secrets = new API.Secrets(this); @@ -979,13 +1093,16 @@ export class Gitpod { } Gitpod.Accounts = Accounts; +Gitpod.Agents = Agents; Gitpod.Editors = Editors; Gitpod.Environments = Environments; +Gitpod.Errors = ErrorsAPIErrors; Gitpod.Events = Events; Gitpod.Gateways = Gateways; Gitpod.Groups = Groups; Gitpod.Identity = Identity; Gitpod.Organizations = Organizations; +Gitpod.Prebuilds = Prebuilds; Gitpod.Projects = Projects; Gitpod.Runners = Runners; Gitpod.Secrets = Secrets; @@ -995,6 +1112,18 @@ Gitpod.Users = Users; export declare namespace Gitpod { export type RequestOptions = Opts.RequestOptions; + export import AgentExecutionsPage = Pagination.AgentExecutionsPage; + export { + type AgentExecutionsPageParams as AgentExecutionsPageParams, + type AgentExecutionsPageResponse as AgentExecutionsPageResponse, + }; + + export import AssignmentsPage = Pagination.AssignmentsPage; + export { + type AssignmentsPageParams as AssignmentsPageParams, + type AssignmentsPageResponse as AssignmentsPageResponse, + }; + export import DomainVerificationsPage = Pagination.DomainVerificationsPage; export { type DomainVerificationsPageParams as DomainVerificationsPageParams, @@ -1031,12 +1160,21 @@ export declare namespace Gitpod { type IntegrationsPageResponse as IntegrationsPageResponse, }; + export import JoinableOrganizationsPage = Pagination.JoinableOrganizationsPage; + export { + type JoinableOrganizationsPageParams as JoinableOrganizationsPageParams, + type JoinableOrganizationsPageResponse as JoinableOrganizationsPageResponse, + }; + export import LoginProvidersPage = Pagination.LoginProvidersPage; export { type LoginProvidersPageParams as LoginProvidersPageParams, type LoginProvidersPageResponse as LoginProvidersPageResponse, }; + export import LoginsPage = Pagination.LoginsPage; + export { type LoginsPageParams as LoginsPageParams, type LoginsPageResponse as LoginsPageResponse }; + export import MembersPage = Pagination.MembersPage; export { type MembersPageParams as MembersPageParams, type MembersPageResponse as MembersPageResponse }; @@ -1049,12 +1187,33 @@ export declare namespace Gitpod { export import PoliciesPage = Pagination.PoliciesPage; export { type PoliciesPageParams as PoliciesPageParams, type PoliciesPageResponse as PoliciesPageResponse }; + export import PrebuildsPage = Pagination.PrebuildsPage; + export { + type PrebuildsPageParams as PrebuildsPageParams, + type PrebuildsPageResponse as PrebuildsPageResponse, + }; + + export import ProjectEnvironmentClassesPage = Pagination.ProjectEnvironmentClassesPage; + export { + type ProjectEnvironmentClassesPageParams as ProjectEnvironmentClassesPageParams, + type ProjectEnvironmentClassesPageResponse as ProjectEnvironmentClassesPageResponse, + }; + export import ProjectsPage = Pagination.ProjectsPage; export { type ProjectsPageParams as ProjectsPageParams, type ProjectsPageResponse as ProjectsPageResponse }; + export import PromptsPage = Pagination.PromptsPage; + export { type PromptsPageParams as PromptsPageParams, type PromptsPageResponse as PromptsPageResponse }; + export import RecordsPage = Pagination.RecordsPage; export { type RecordsPageParams as RecordsPageParams, type RecordsPageResponse as RecordsPageResponse }; + export import RepositoriesPage = Pagination.RepositoriesPage; + export { + type RepositoriesPageParams as RepositoriesPageParams, + type RepositoriesPageResponse as RepositoriesPageResponse, + }; + export import RunnersPage = Pagination.RunnersPage; export { type RunnersPageParams as RunnersPageParams, type RunnersPageResponse as RunnersPageResponse }; @@ -1091,18 +1250,57 @@ export declare namespace Gitpod { type AccountRetrieveResponse as AccountRetrieveResponse, type AccountDeleteResponse as AccountDeleteResponse, type AccountGetSSOLoginURLResponse as AccountGetSSOLoginURLResponse, - type AccountListJoinableOrganizationsResponse as AccountListJoinableOrganizationsResponse, + type AccountListSSOLoginsResponse as AccountListSSOLoginsResponse, + type JoinableOrganizationsJoinableOrganizationsPage as JoinableOrganizationsJoinableOrganizationsPage, type LoginProvidersLoginProvidersPage as LoginProvidersLoginProvidersPage, + type AccountListSSOLoginsResponsesLoginsPage as AccountListSSOLoginsResponsesLoginsPage, type AccountRetrieveParams as AccountRetrieveParams, type AccountDeleteParams as AccountDeleteParams, type AccountGetSSOLoginURLParams as AccountGetSSOLoginURLParams, type AccountListJoinableOrganizationsParams as AccountListJoinableOrganizationsParams, type AccountListLoginProvidersParams as AccountListLoginProvidersParams, + type AccountListSSOLoginsParams as AccountListSSOLoginsParams, + }; + + export { + Agents as Agents, + type AgentCodeContext as AgentCodeContext, + type AgentExecution as AgentExecution, + type AgentMode as AgentMode, + type Prompt as Prompt, + type PromptMetadata as PromptMetadata, + type PromptSpec as PromptSpec, + type UserInputBlock as UserInputBlock, + type AgentCreateExecutionConversationTokenResponse as AgentCreateExecutionConversationTokenResponse, + type AgentCreatePromptResponse as AgentCreatePromptResponse, + type AgentDeleteExecutionResponse as AgentDeleteExecutionResponse, + type AgentDeletePromptResponse as AgentDeletePromptResponse, + type AgentRetrieveExecutionResponse as AgentRetrieveExecutionResponse, + type AgentRetrievePromptResponse as AgentRetrievePromptResponse, + type AgentSendToExecutionResponse as AgentSendToExecutionResponse, + type AgentStartExecutionResponse as AgentStartExecutionResponse, + type AgentStopExecutionResponse as AgentStopExecutionResponse, + type AgentUpdatePromptResponse as AgentUpdatePromptResponse, + type AgentExecutionsAgentExecutionsPage as AgentExecutionsAgentExecutionsPage, + type PromptsPromptsPage as PromptsPromptsPage, + type AgentCreateExecutionConversationTokenParams as AgentCreateExecutionConversationTokenParams, + type AgentCreatePromptParams as AgentCreatePromptParams, + type AgentDeleteExecutionParams as AgentDeleteExecutionParams, + type AgentDeletePromptParams as AgentDeletePromptParams, + type AgentListExecutionsParams as AgentListExecutionsParams, + type AgentListPromptsParams as AgentListPromptsParams, + type AgentRetrieveExecutionParams as AgentRetrieveExecutionParams, + type AgentRetrievePromptParams as AgentRetrievePromptParams, + type AgentSendToExecutionParams as AgentSendToExecutionParams, + type AgentStartExecutionParams as AgentStartExecutionParams, + type AgentStopExecutionParams as AgentStopExecutionParams, + type AgentUpdatePromptParams as AgentUpdatePromptParams, }; export { Editors as Editors, type Editor as Editor, + type EditorVersion as EditorVersion, type EditorRetrieveResponse as EditorRetrieveResponse, type EditorResolveURLResponse as EditorResolveURLResponse, type EditorsEditorsPage as EditorsEditorsPage, @@ -1118,6 +1316,7 @@ export declare namespace Gitpod { type EnvironmentActivitySignal as EnvironmentActivitySignal, type EnvironmentMetadata as EnvironmentMetadata, type EnvironmentPhase as EnvironmentPhase, + type EnvironmentRole as EnvironmentRole, type EnvironmentSpec as EnvironmentSpec, type EnvironmentStatus as EnvironmentStatus, type EnvironmentCreateResponse as EnvironmentCreateResponse, @@ -1146,10 +1345,22 @@ export declare namespace Gitpod { type EnvironmentUnarchiveParams as EnvironmentUnarchiveParams, }; + export { + ErrorsAPIErrors as Errors, + type Breadcrumb as Breadcrumb, + type ErrorEvent as ErrorEvent, + type ErrorLevel as ErrorLevel, + type ExceptionInfo as ExceptionInfo, + type ExceptionMechanism as ExceptionMechanism, + type ErrorRequestInfo as RequestInfo, + type StackFrame as StackFrame, + type ErrorReportErrorsResponse as ErrorReportErrorsResponse, + type ErrorReportErrorsParams as ErrorReportErrorsParams, + }; + export { Events as Events, type ResourceOperation as ResourceOperation, - type ResourceType as ResourceType, type EventListResponse as EventListResponse, type EventWatchResponse as EventWatchResponse, type EventListResponsesEntriesPage as EventListResponsesEntriesPage, @@ -1162,8 +1373,16 @@ export declare namespace Gitpod { export { Groups as Groups, type Group as Group, + type GroupCreateResponse as GroupCreateResponse, + type GroupRetrieveResponse as GroupRetrieveResponse, + type GroupUpdateResponse as GroupUpdateResponse, + type GroupDeleteResponse as GroupDeleteResponse, type GroupsGroupsPage as GroupsGroupsPage, + type GroupCreateParams as GroupCreateParams, + type GroupRetrieveParams as GroupRetrieveParams, + type GroupUpdateParams as GroupUpdateParams, type GroupListParams as GroupListParams, + type GroupDeleteParams as GroupDeleteParams, }; export { @@ -1201,12 +1420,35 @@ export declare namespace Gitpod { type OrganizationSetRoleParams as OrganizationSetRoleParams, }; + export { + Prebuilds as Prebuilds, + type Prebuild as Prebuild, + type PrebuildMetadata as PrebuildMetadata, + type PrebuildPhase as PrebuildPhase, + type PrebuildSpec as PrebuildSpec, + type PrebuildStatus as PrebuildStatus, + type PrebuildTrigger as PrebuildTrigger, + type PrebuildCreateResponse as PrebuildCreateResponse, + type PrebuildRetrieveResponse as PrebuildRetrieveResponse, + type PrebuildDeleteResponse as PrebuildDeleteResponse, + type PrebuildCancelResponse as PrebuildCancelResponse, + type PrebuildCreateLogsTokenResponse as PrebuildCreateLogsTokenResponse, + type PrebuildsPrebuildsPage as PrebuildsPrebuildsPage, + type PrebuildCreateParams as PrebuildCreateParams, + type PrebuildRetrieveParams as PrebuildRetrieveParams, + type PrebuildListParams as PrebuildListParams, + type PrebuildDeleteParams as PrebuildDeleteParams, + type PrebuildCancelParams as PrebuildCancelParams, + type PrebuildCreateLogsTokenParams as PrebuildCreateLogsTokenParams, + }; + export { Projects as Projects, type EnvironmentInitializer as EnvironmentInitializer, type Project as Project, - type ProjectEnvironmentClass as ProjectEnvironmentClass, type ProjectMetadata as ProjectMetadata, + type ProjectPhase as ProjectPhase, + type ProjectPrebuildConfiguration as ProjectPrebuildConfiguration, type ProjectCreateResponse as ProjectCreateResponse, type ProjectRetrieveResponse as ProjectRetrieveResponse, type ProjectUpdateResponse as ProjectUpdateResponse, @@ -1235,13 +1477,17 @@ export declare namespace Gitpod { type RunnerReleaseChannel as RunnerReleaseChannel, type RunnerSpec as RunnerSpec, type RunnerStatus as RunnerStatus, + type RunnerVariant as RunnerVariant, + type SearchMode as SearchMode, type RunnerCreateResponse as RunnerCreateResponse, type RunnerRetrieveResponse as RunnerRetrieveResponse, type RunnerUpdateResponse as RunnerUpdateResponse, type RunnerDeleteResponse as RunnerDeleteResponse, type RunnerCheckAuthenticationForHostResponse as RunnerCheckAuthenticationForHostResponse, + type RunnerCreateLogsTokenResponse as RunnerCreateLogsTokenResponse, type RunnerCreateRunnerTokenResponse as RunnerCreateRunnerTokenResponse, type RunnerParseContextURLResponse as RunnerParseContextURLResponse, + type RunnerSearchRepositoriesResponse as RunnerSearchRepositoriesResponse, type RunnersRunnersPage as RunnersRunnersPage, type RunnerCreateParams as RunnerCreateParams, type RunnerRetrieveParams as RunnerRetrieveParams, @@ -1249,8 +1495,10 @@ export declare namespace Gitpod { type RunnerListParams as RunnerListParams, type RunnerDeleteParams as RunnerDeleteParams, type RunnerCheckAuthenticationForHostParams as RunnerCheckAuthenticationForHostParams, + type RunnerCreateLogsTokenParams as RunnerCreateLogsTokenParams, type RunnerCreateRunnerTokenParams as RunnerCreateRunnerTokenParams, type RunnerParseContextURLParams as RunnerParseContextURLParams, + type RunnerSearchRepositoriesParams as RunnerSearchRepositoriesParams, }; export { @@ -1279,20 +1527,29 @@ export declare namespace Gitpod { export { Users as Users, type User as User, + type UserDeleteUserResponse as UserDeleteUserResponse, type UserGetAuthenticatedUserResponse as UserGetAuthenticatedUserResponse, + type UserGetUserResponse as UserGetUserResponse, type UserSetSuspendedResponse as UserSetSuspendedResponse, + type UserDeleteUserParams as UserDeleteUserParams, type UserGetAuthenticatedUserParams as UserGetAuthenticatedUserParams, + type UserGetUserParams as UserGetUserParams, type UserSetSuspendedParams as UserSetSuspendedParams, }; export type AutomationTrigger = API.AutomationTrigger; export type EnvironmentClass = API.EnvironmentClass; + export type EnvironmentVariableItem = API.EnvironmentVariableItem; + export type EnvironmentVariableSource = API.EnvironmentVariableSource; export type ErrorCode = API.ErrorCode; export type FieldValue = API.FieldValue; export type Gateway = API.Gateway; export type OrganizationRole = API.OrganizationRole; export type Principal = API.Principal; + export type ProjectEnvironmentClass = API.ProjectEnvironmentClass; + export type ResourceType = API.ResourceType; export type RunsOn = API.RunsOn; + export type SecretRef = API.SecretRef; export type Subject = API.Subject; export type Task = API.Task; export type TaskExecution = API.TaskExecution; diff --git a/src/core/pagination.ts b/src/core/pagination.ts index 77ed264..1a591d6 100644 --- a/src/core/pagination.ts +++ b/src/core/pagination.ts @@ -107,6 +107,119 @@ export class PagePromise< } } +export interface AgentExecutionsPageResponse { + agentExecutions: Array; + + pagination: AgentExecutionsPageResponse.Pagination; +} + +export namespace AgentExecutionsPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface AgentExecutionsPageParams { + pageSize?: number; + + token?: string; +} + +export class AgentExecutionsPage + extends AbstractPage + implements AgentExecutionsPageResponse +{ + agentExecutions: Array; + + pagination: AgentExecutionsPageResponse.Pagination; + + constructor( + client: Gitpod, + response: Response, + body: AgentExecutionsPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.agentExecutions = body.agentExecutions || []; + this.pagination = body.pagination || {}; + } + + getPaginatedItems(): Item[] { + return this.agentExecutions ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + +export interface AssignmentsPageResponse { + assignments: Array; + + pagination: AssignmentsPageResponse.Pagination; +} + +export namespace AssignmentsPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface AssignmentsPageParams { + pageSize?: number; + + token?: string; +} + +export class AssignmentsPage extends AbstractPage implements AssignmentsPageResponse { + assignments: Array; + + pagination: AssignmentsPageResponse.Pagination; + + constructor( + client: Gitpod, + response: Response, + body: AssignmentsPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.assignments = body.assignments || []; + this.pagination = body.pagination || {}; + } + + getPaginatedItems(): Item[] { + return this.assignments ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + export interface DomainVerificationsPageResponse { domainVerifications: Array; @@ -553,6 +666,64 @@ export class IntegrationsPage extends AbstractPage implements Integr } } +export interface JoinableOrganizationsPageResponse { + joinableOrganizations: Array; + + pagination: JoinableOrganizationsPageResponse.Pagination; +} + +export namespace JoinableOrganizationsPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface JoinableOrganizationsPageParams { + pageSize?: number; + + token?: string; +} + +export class JoinableOrganizationsPage + extends AbstractPage + implements JoinableOrganizationsPageResponse +{ + joinableOrganizations: Array; + + pagination: JoinableOrganizationsPageResponse.Pagination; + + constructor( + client: Gitpod, + response: Response, + body: JoinableOrganizationsPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.joinableOrganizations = body.joinableOrganizations || []; + this.pagination = body.pagination || {}; + } + + getPaginatedItems(): Item[] { + return this.joinableOrganizations ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + export interface LoginProvidersPageResponse { loginProviders: Array; @@ -608,6 +779,61 @@ export class LoginProvidersPage extends AbstractPage implements Logi } } +export interface LoginsPageResponse { + logins: Array; + + pagination: LoginsPageResponse.Pagination; +} + +export namespace LoginsPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface LoginsPageParams { + pageSize?: number; + + token?: string; +} + +export class LoginsPage extends AbstractPage implements LoginsPageResponse { + logins: Array; + + pagination: LoginsPageResponse.Pagination; + + constructor( + client: Gitpod, + response: Response, + body: LoginsPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.logins = body.logins || []; + this.pagination = body.pagination || {}; + } + + getPaginatedItems(): Item[] { + return this.logins ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + export interface MembersPageResponse { members: Array; @@ -776,6 +1002,119 @@ export class PoliciesPage extends AbstractPage implements PoliciesPa } } +export interface PrebuildsPageResponse { + pagination: PrebuildsPageResponse.Pagination; + + prebuilds: Array; +} + +export namespace PrebuildsPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface PrebuildsPageParams { + pageSize?: number; + + token?: string; +} + +export class PrebuildsPage extends AbstractPage implements PrebuildsPageResponse { + pagination: PrebuildsPageResponse.Pagination; + + prebuilds: Array; + + constructor( + client: Gitpod, + response: Response, + body: PrebuildsPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.pagination = body.pagination || {}; + this.prebuilds = body.prebuilds || []; + } + + getPaginatedItems(): Item[] { + return this.prebuilds ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + +export interface ProjectEnvironmentClassesPageResponse { + pagination: ProjectEnvironmentClassesPageResponse.Pagination; + + projectEnvironmentClasses: Array; +} + +export namespace ProjectEnvironmentClassesPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface ProjectEnvironmentClassesPageParams { + pageSize?: number; + + token?: string; +} + +export class ProjectEnvironmentClassesPage + extends AbstractPage + implements ProjectEnvironmentClassesPageResponse +{ + pagination: ProjectEnvironmentClassesPageResponse.Pagination; + + projectEnvironmentClasses: Array; + + constructor( + client: Gitpod, + response: Response, + body: ProjectEnvironmentClassesPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.pagination = body.pagination || {}; + this.projectEnvironmentClasses = body.projectEnvironmentClasses || []; + } + + getPaginatedItems(): Item[] { + return this.projectEnvironmentClasses ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + export interface ProjectsPageResponse { pagination: ProjectsPageResponse.Pagination; @@ -831,6 +1170,61 @@ export class ProjectsPage extends AbstractPage implements ProjectsPa } } +export interface PromptsPageResponse { + pagination: PromptsPageResponse.Pagination; + + prompts: Array; +} + +export namespace PromptsPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface PromptsPageParams { + pageSize?: number; + + token?: string; +} + +export class PromptsPage extends AbstractPage implements PromptsPageResponse { + pagination: PromptsPageResponse.Pagination; + + prompts: Array; + + constructor( + client: Gitpod, + response: Response, + body: PromptsPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.pagination = body.pagination || {}; + this.prompts = body.prompts || []; + } + + getPaginatedItems(): Item[] { + return this.prompts ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + export interface RecordsPageResponse { pagination: RecordsPageResponse.Pagination; @@ -886,6 +1280,61 @@ export class RecordsPage extends AbstractPage implements RecordsPage } } +export interface RepositoriesPageResponse { + pagination: RepositoriesPageResponse.Pagination; + + repositories: Array; +} + +export namespace RepositoriesPageResponse { + export interface Pagination { + nextToken?: string; + } +} + +export interface RepositoriesPageParams { + pageSize?: number; + + token?: string; +} + +export class RepositoriesPage extends AbstractPage implements RepositoriesPageResponse { + pagination: RepositoriesPageResponse.Pagination; + + repositories: Array; + + constructor( + client: Gitpod, + response: Response, + body: RepositoriesPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.pagination = body.pagination || {}; + this.repositories = body.repositories || []; + } + + getPaginatedItems(): Item[] { + return this.repositories ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + const cursor = this.pagination?.nextToken; + if (!cursor) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + token: cursor, + }, + }; + } +} + export interface RunnersPageResponse { pagination: RunnersPageResponse.Pagination; diff --git a/src/resources/accounts.ts b/src/resources/accounts.ts index 393e7ee..30f8bc7 100644 --- a/src/resources/accounts.ts +++ b/src/resources/accounts.ts @@ -3,7 +3,15 @@ import { APIResource } from '../core/resource'; import * as Shared from './shared'; import { APIPromise } from '../core/api-promise'; -import { LoginProvidersPage, type LoginProvidersPageParams, PagePromise } from '../core/pagination'; +import { + JoinableOrganizationsPage, + type JoinableOrganizationsPageParams, + LoginProvidersPage, + type LoginProvidersPageParams, + LoginsPage, + type LoginsPageParams, + PagePromise, +} from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; export class Accounts extends APIResource { @@ -131,20 +139,22 @@ export class Accounts extends APIResource { * * @example * ```ts - * const response = - * await client.accounts.listJoinableOrganizations(); + * // Automatically fetches more pages as needed. + * for await (const joinableOrganization of client.accounts.listJoinableOrganizations()) { + * // ... + * } * ``` */ listJoinableOrganizations( params: AccountListJoinableOrganizationsParams, options?: RequestOptions, - ): APIPromise { + ): PagePromise { const { token, pageSize, ...body } = params; - return this._client.post('/gitpod.v1.AccountService/ListJoinableOrganizations', { - query: { token, pageSize }, - body, - ...options, - }); + return this._client.getAPIList( + '/gitpod.v1.AccountService/ListJoinableOrganizations', + JoinableOrganizationsPage, + { query: { token, pageSize }, body, method: 'post', ...options }, + ); } /** @@ -199,10 +209,39 @@ export class Accounts extends APIResource { { query: { token, pageSize }, body, method: 'post', ...options }, ); } + + /** + * ListSSOLogins + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const accountListSSOLoginsResponse of client.accounts.listSSOLogins( + * { email: 'dev@stainless.com' }, + * )) { + * // ... + * } + * ``` + */ + listSSOLogins( + params: AccountListSSOLoginsParams, + options?: RequestOptions, + ): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList( + '/gitpod.v1.AccountService/ListSSOLogins', + LoginsPage, + { query: { token, pageSize }, body, method: 'post', ...options }, + ); + } } +export type JoinableOrganizationsJoinableOrganizationsPage = JoinableOrganizationsPage; + export type LoginProvidersLoginProvidersPage = LoginProvidersPage; +export type AccountListSSOLoginsResponsesLoginsPage = LoginsPage; + export interface Account { id: string; @@ -489,8 +528,17 @@ export interface AccountGetSSOLoginURLResponse { loginUrl: string; } -export interface AccountListJoinableOrganizationsResponse { - joinableOrganizations?: Array; +export interface AccountListSSOLoginsResponse { + /** + * provider is the provider used by this login method, e.g. "github", "google", + * "custom" + */ + displayName: string; + + /** + * login_url is the URL to redirect the user to for SSO login + */ + loginUrl: string; } export interface AccountRetrieveParams { @@ -499,6 +547,11 @@ export interface AccountRetrieveParams { export interface AccountDeleteParams { accountId: string; + + /** + * reason is an optional field for the reason for account deletion + */ + reason?: string | null; } export interface AccountGetSSOLoginURLParams { @@ -513,21 +566,31 @@ export interface AccountGetSSOLoginURLParams { returnTo?: string | null; } -export interface AccountListJoinableOrganizationsParams { +export interface AccountListJoinableOrganizationsParams extends JoinableOrganizationsPageParams { /** - * Query param: + * Body param: pagination contains the pagination options for listing joinable + * organizations */ - token?: string; + pagination?: AccountListJoinableOrganizationsParams.Pagination; +} +export namespace AccountListJoinableOrganizationsParams { /** - * Query param: + * pagination contains the pagination options for listing joinable organizations */ - pageSize?: number; + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; - /** - * Body param: - */ - empty?: boolean; + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } } export interface AccountListLoginProvidersParams extends LoginProvidersPageParams { @@ -547,10 +610,15 @@ export namespace AccountListLoginProvidersParams { * filter contains the filter options for listing login methods */ export interface Filter { + /** + * email is the email address to filter SSO providers by + */ + email?: string | null; + /** * invite_id is the ID of the invite URL the user wants to login with */ - inviteId?: string; + inviteId?: string | null; } /** @@ -571,6 +639,42 @@ export namespace AccountListLoginProvidersParams { } } +export interface AccountListSSOLoginsParams extends LoginsPageParams { + /** + * Body param: email is the email the user wants to login with + */ + email: string; + + /** + * Body param: pagination contains the pagination options for listing SSO logins + */ + pagination?: AccountListSSOLoginsParams.Pagination; + + /** + * Body param: return_to is the URL the user will be redirected to after login + */ + returnTo?: string | null; +} + +export namespace AccountListSSOLoginsParams { + /** + * pagination contains the pagination options for listing SSO logins + */ + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + export declare namespace Accounts { export { type Account as Account, @@ -580,12 +684,15 @@ export declare namespace Accounts { type AccountRetrieveResponse as AccountRetrieveResponse, type AccountDeleteResponse as AccountDeleteResponse, type AccountGetSSOLoginURLResponse as AccountGetSSOLoginURLResponse, - type AccountListJoinableOrganizationsResponse as AccountListJoinableOrganizationsResponse, + type AccountListSSOLoginsResponse as AccountListSSOLoginsResponse, + type JoinableOrganizationsJoinableOrganizationsPage as JoinableOrganizationsJoinableOrganizationsPage, type LoginProvidersLoginProvidersPage as LoginProvidersLoginProvidersPage, + type AccountListSSOLoginsResponsesLoginsPage as AccountListSSOLoginsResponsesLoginsPage, type AccountRetrieveParams as AccountRetrieveParams, type AccountDeleteParams as AccountDeleteParams, type AccountGetSSOLoginURLParams as AccountGetSSOLoginURLParams, type AccountListJoinableOrganizationsParams as AccountListJoinableOrganizationsParams, type AccountListLoginProvidersParams as AccountListLoginProvidersParams, + type AccountListSSOLoginsParams as AccountListSSOLoginsParams, }; } diff --git a/src/resources/agents.ts b/src/resources/agents.ts new file mode 100644 index 0000000..c287386 --- /dev/null +++ b/src/resources/agents.ts @@ -0,0 +1,1436 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import * as AgentsAPI from './agents'; +import * as Shared from './shared'; +import { APIPromise } from '../core/api-promise'; +import { + AgentExecutionsPage, + type AgentExecutionsPageParams, + PagePromise, + PromptsPage, + type PromptsPageParams, +} from '../core/pagination'; +import { RequestOptions } from '../internal/request-options'; + +export class Agents extends APIResource { + /** + * Creates a token for conversation access with a specific agent run. + * + * This method generates a temporary token that can be used to securely connect to + * an ongoing agent conversation, for example in a web UI. + * + * ### Examples + * + * - Create a token to join an agent run conversation in a front-end application: + * + * ```yaml + * agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35" + * ``` + * + * @example + * ```ts + * const response = + * await client.agents.createExecutionConversationToken({ + * agentExecutionId: + * '6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35', + * }); + * ``` + */ + createExecutionConversationToken( + body: AgentCreateExecutionConversationTokenParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.AgentService/CreateAgentExecutionConversationToken', { + body, + ...options, + }); + } + + /** + * Creates a new prompt. + * + * Use this method to: + * + * - Define new prompts for templates or commands + * - Set up organization-wide prompt libraries + * + * @example + * ```ts + * const response = await client.agents.createPrompt(); + * ``` + */ + createPrompt( + body: AgentCreatePromptParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.AgentService/CreatePrompt', { body, ...options }); + } + + /** + * Deletes an agent run. + * + * Use this method to: + * + * - Clean up agent runs that are no longer needed + * + * ### Examples + * + * - Delete an agent run by ID: + * + * ```yaml + * agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35" + * ``` + * + * @example + * ```ts + * const response = await client.agents.deleteExecution({ + * agentExecutionId: '6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35', + * }); + * ``` + */ + deleteExecution(body: AgentDeleteExecutionParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.AgentService/DeleteAgentExecution', { body, ...options }); + } + + /** + * Deletes a prompt. + * + * Use this method to: + * + * - Remove unused prompts + * + * @example + * ```ts + * const response = await client.agents.deletePrompt(); + * ``` + */ + deletePrompt(body: AgentDeletePromptParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.AgentService/DeletePrompt', { body, ...options }); + } + + /** + * Lists all agent runs matching the specified filter. + * + * Use this method to track multiple agent runs and their associated resources. + * Results are ordered by their creation time with the newest first. + * + * ### Examples + * + * - List agent runs by agent ID: + * + * ```yaml + * filter: + * agentIds: ["b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"] + * pagination: + * pageSize: 10 + * ``` + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const agentExecution of client.agents.listExecutions( + * { + * filter: { + * agentIds: ['b8a64cfa-43e2-4b9d-9fb3-07edc63f5971'], + * }, + * pagination: { pageSize: 10 }, + * }, + * )) { + * // ... + * } + * ``` + */ + listExecutions( + params: AgentListExecutionsParams, + options?: RequestOptions, + ): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList( + '/gitpod.v1.AgentService/ListAgentExecutions', + AgentExecutionsPage, + { query: { token, pageSize }, body, method: 'post', ...options }, + ); + } + + /** + * Lists all prompts matching the specified criteria. + * + * Use this method to find and browse prompts across your organization. Results are + * ordered by their creation time with the newest first. + * + * ### Examples + * + * - List all prompts: + * + * Retrieves all prompts with pagination. + * + * ```yaml + * pagination: + * pageSize: 10 + * ``` + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const prompt of client.agents.listPrompts({ + * pagination: { pageSize: 10 }, + * })) { + * // ... + * } + * ``` + */ + listPrompts( + params: AgentListPromptsParams, + options?: RequestOptions, + ): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList('/gitpod.v1.AgentService/ListPrompts', PromptsPage, { + query: { token, pageSize }, + body, + method: 'post', + ...options, + }); + } + + /** + * Gets details about a specific agent run, including its metadata, specification, + * and status (phase, error messages, and usage statistics). + * + * Use this method to: + * + * - Monitor the run's progress + * - Retrieve the agent's conversation URL + * - Check if an agent run is actively producing output + * + * ### Examples + * + * - Get agent run details by ID: + * + * ```yaml + * agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35" + * ``` + * + * @example + * ```ts + * const response = await client.agents.retrieveExecution({ + * agentExecutionId: '6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35', + * }); + * ``` + */ + retrieveExecution( + body: AgentRetrieveExecutionParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.AgentService/GetAgentExecution', { body, ...options }); + } + + /** + * Gets details about a specific prompt including name, description, and prompt + * content. + * + * Use this method to: + * + * - Retrieve prompt details for editing + * - Get prompt content for execution + * + * ### Examples + * + * - Get prompt details: + * + * ```yaml + * promptId: "07e03a28-65a5-4d98-b532-8ea67b188048" + * ``` + * + * @example + * ```ts + * const response = await client.agents.retrievePrompt({ + * promptId: '07e03a28-65a5-4d98-b532-8ea67b188048', + * }); + * ``` + */ + retrievePrompt( + body: AgentRetrievePromptParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.AgentService/GetPrompt', { body, ...options }); + } + + /** + * Sends user input to an active agent run. + * + * This method is used to provide interactive or conversation-based input to an + * agent. The agent can respond with output blocks containing text, file changes, + * or tool usage requests. + * + * ### Examples + * + * - Send a text message to an agent: + * + * ```yaml + * agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35" + * userInput: + * text: + * content: "Generate a report based on the latest logs." + * ``` + * + * @example + * ```ts + * const response = await client.agents.sendToExecution({ + * agentExecutionId: '6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35', + * userInput: { + * text: { + * content: + * 'Generate a report based on the latest logs.', + * }, + * }, + * }); + * ``` + */ + sendToExecution(body: AgentSendToExecutionParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.AgentService/SendToAgentExecution', { body, ...options }); + } + + /** + * Starts (or triggers) an agent run using a provided agent. + * + * Use this method to: + * + * - Launch an agent based on a known agent + * + * ### Examples + * + * - Start an agent with a project ID: + * + * ```yaml + * agentId: "b8a64cfa-43e2-4b9d-9fb3-07edc63f5971" + * codeContext: + * projectId: "2d22e4eb-31da-467f-882c-27e21550992f" + * ``` + * + * @example + * ```ts + * const response = await client.agents.startExecution({ + * agentId: 'b8a64cfa-43e2-4b9d-9fb3-07edc63f5971', + * codeContext: { + * projectId: '2d22e4eb-31da-467f-882c-27e21550992f', + * }, + * }); + * ``` + */ + startExecution( + body: AgentStartExecutionParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.AgentService/StartAgent', { body, ...options }); + } + + /** + * Stops an active agent execution. + * + * Use this method to: + * + * - Stop an agent that is currently running + * - Prevent further processing or resource usage + * + * ### Examples + * + * - Stop an agent execution by ID: + * + * ```yaml + * agentExecutionId: "6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35" + * ``` + * + * @example + * ```ts + * const response = await client.agents.stopExecution({ + * agentExecutionId: '6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35', + * }); + * ``` + */ + stopExecution(body: AgentStopExecutionParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.AgentService/StopAgentExecution', { body, ...options }); + } + + /** + * Updates an existing prompt. + * + * Use this method to: + * + * - Modify prompt content or metadata + * - Change prompt type (template/command) + * + * @example + * ```ts + * const response = await client.agents.updatePrompt(); + * ``` + */ + updatePrompt( + body: AgentUpdatePromptParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.AgentService/UpdatePrompt', { body, ...options }); + } +} + +export type AgentExecutionsAgentExecutionsPage = AgentExecutionsPage; + +export type PromptsPromptsPage = PromptsPage; + +export interface AgentCodeContext { + contextUrl?: AgentCodeContext.ContextURL; + + environmentId?: string; + + projectId?: string; + + /** + * Pull request context - optional metadata about the PR being worked on This is + * populated when the agent execution is triggered by a PR workflow or when + * explicitly provided through the browser extension + */ + pullRequest?: AgentCodeContext.PullRequest | null; +} + +export namespace AgentCodeContext { + export interface ContextURL { + environmentClassId?: string; + + url?: string; + } + + /** + * Pull request context - optional metadata about the PR being worked on This is + * populated when the agent execution is triggered by a PR workflow or when + * explicitly provided through the browser extension + */ + export interface PullRequest { + /** + * Unique identifier from the source system (e.g., "123" for GitHub PR #123) + */ + id?: string; + + /** + * Author name as provided by the SCM system + */ + author?: string; + + /** + * Source branch name (the branch being merged from) + */ + fromBranch?: string; + + /** + * Repository information + */ + repository?: PullRequest.Repository; + + /** + * Pull request title + */ + title?: string; + + /** + * Target branch name (the branch being merged into) + */ + toBranch?: string; + + /** + * Pull request URL (e.g., "https://github.com/owner/repo/pull/123") + */ + url?: string; + } + + export namespace PullRequest { + /** + * Repository information + */ + export interface Repository { + cloneUrl?: string; + + host?: string; + + name?: string; + + owner?: string; + } + } +} + +export interface AgentExecution { + /** + * ID is a unique identifier of this agent run. No other agent run with the same + * name must be managed by this agent manager + */ + id?: string; + + /** + * Metadata is data associated with this agent that's required for other parts of + * Gitpod to function + */ + metadata?: AgentExecution.Metadata; + + /** + * Spec is the configuration of the agent that's required for the runner to start + * the agent + */ + spec?: AgentExecution.Spec; + + /** + * Status is the current status of the agent + */ + status?: AgentExecution.Status; +} + +export namespace AgentExecution { + /** + * Metadata is data associated with this agent that's required for other parts of + * Gitpod to function + */ + export interface Metadata { + /** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at nanosecond + * resolution. The count is relative to an epoch at UTC midnight on January 1, + * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + * backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a + * [24-hour linear smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + * zero-padded to two digits each. The fractional seconds, which can go up to 9 + * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + * serializer should always use UTC (as indicated by "Z") when printing the + * Timestamp type and a proto3 JSON parser should be able to accept both UTC and + * other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + * January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted to + * this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + * Joda Time's + * [`ISODateTimeFormat.dateTime()`]() + * to obtain a formatter capable of generating timestamps in this format. + */ + createdAt?: string; + + creator?: Shared.Subject; + + description?: string; + + name?: string; + + /** + * role is the role of the agent execution + */ + role?: + | 'AGENT_EXECUTION_ROLE_UNSPECIFIED' + | 'AGENT_EXECUTION_ROLE_DEFAULT' + | 'AGENT_EXECUTION_ROLE_WORKFLOW'; + + /** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at nanosecond + * resolution. The count is relative to an epoch at UTC midnight on January 1, + * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + * backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a + * [24-hour linear smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + * zero-padded to two digits each. The fractional seconds, which can go up to 9 + * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + * serializer should always use UTC (as indicated by "Z") when printing the + * Timestamp type and a proto3 JSON parser should be able to accept both UTC and + * other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + * January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted to + * this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + * Joda Time's + * [`ISODateTimeFormat.dateTime()`]() + * to obtain a formatter capable of generating timestamps in this format. + */ + updatedAt?: string; + + /** + * workflow_action_id is set when this agent execution was created as part of a + * workflow. Used to correlate agent executions with their parent workflow + * execution action. + */ + workflowActionId?: string | null; + } + + /** + * Spec is the configuration of the agent that's required for the runner to start + * the agent + */ + export interface Spec { + agentId?: string; + + codeContext?: AgentsAPI.AgentCodeContext; + + /** + * desired_phase is the desired phase of the agent run + */ + desiredPhase?: + | 'PHASE_UNSPECIFIED' + | 'PHASE_PENDING' + | 'PHASE_RUNNING' + | 'PHASE_WAITING_FOR_INPUT' + | 'PHASE_STOPPED'; + + limits?: Spec.Limits; + + /** + * mode is the operational mode for this agent execution + */ + mode?: AgentsAPI.AgentMode; + + session?: string; + + /** + * version of the spec. The value of this field has no semantic meaning (e.g. don't + * interpret it as as a timestamp), but it can be used to impose a partial order. + * If a.spec_version < b.spec_version then a was the spec before b. + */ + specVersion?: string; + } + + export namespace Spec { + export interface Limits { + maxInputTokens?: string; + + maxIterations?: string; + + maxOutputTokens?: string; + } + } + + /** + * Status is the current status of the agent + */ + export interface Status { + cachedCreationTokensUsed?: string; + + cachedInputTokensUsed?: string; + + contextWindowLength?: string; + + /** + * conversation_url is the URL to the conversation (all messages exchanged between + * the agent and the user) of the agent run. + */ + conversationUrl?: string; + + /** + * current_activity is the current activity description of the agent execution. + */ + currentActivity?: string; + + /** + * current_operation is the current operation of the agent execution. + */ + currentOperation?: Status.CurrentOperation; + + /** + * failure_message contains the reason the agent run failed to operate. + */ + failureMessage?: string; + + /** + * failure_reason contains a structured reason code for the failure. + */ + failureReason?: + | 'AGENT_EXECUTION_FAILURE_REASON_UNSPECIFIED' + | 'AGENT_EXECUTION_FAILURE_REASON_ENVIRONMENT' + | 'AGENT_EXECUTION_FAILURE_REASON_SERVICE' + | 'AGENT_EXECUTION_FAILURE_REASON_LLM_INTEGRATION' + | 'AGENT_EXECUTION_FAILURE_REASON_INTERNAL' + | 'AGENT_EXECUTION_FAILURE_REASON_AGENT_EXECUTION'; + + inputTokensUsed?: string; + + iterations?: string; + + /** + * judgement is the judgement of the agent run produced by the judgement prompt. + */ + judgement?: string; + + /** + * outputs is a map of key-value pairs that can be set by the agent during + * execution. Similar to task execution outputs, but with typed values for + * structured data. + */ + outputs?: { [key: string]: Status.Outputs }; + + outputTokensUsed?: string; + + phase?: + | 'PHASE_UNSPECIFIED' + | 'PHASE_PENDING' + | 'PHASE_RUNNING' + | 'PHASE_WAITING_FOR_INPUT' + | 'PHASE_STOPPED'; + + session?: string; + + /** + * version of the status. The value of this field has no semantic meaning (e.g. + * don't interpret it as as a timestamp), but it can be used to impose a partial + * order. If a.status_version < b.status_version then a was the status before b. + */ + statusVersion?: string; + + /** + * supported_model is the LLM model being used by the agent execution. + */ + supportedModel?: + | 'SUPPORTED_MODEL_UNSPECIFIED' + | 'SUPPORTED_MODEL_SONNET_3_5' + | 'SUPPORTED_MODEL_SONNET_3_7' + | 'SUPPORTED_MODEL_SONNET_3_7_EXTENDED' + | 'SUPPORTED_MODEL_SONNET_4' + | 'SUPPORTED_MODEL_SONNET_4_EXTENDED' + | 'SUPPORTED_MODEL_SONNET_4_5' + | 'SUPPORTED_MODEL_SONNET_4_5_EXTENDED' + | 'SUPPORTED_MODEL_OPUS_4' + | 'SUPPORTED_MODEL_OPUS_4_EXTENDED' + | 'SUPPORTED_MODEL_OPUS_4_5' + | 'SUPPORTED_MODEL_OPUS_4_5_EXTENDED' + | 'SUPPORTED_MODEL_OPENAI_4O' + | 'SUPPORTED_MODEL_OPENAI_4O_MINI' + | 'SUPPORTED_MODEL_OPENAI_O1' + | 'SUPPORTED_MODEL_OPENAI_O1_MINI'; + + /** + * transcript_url is the URL to the LLM transcript (all messages exchanged between + * the agent and the LLM) of the agent run. + */ + transcriptUrl?: string; + + /** + * used_environments is the list of environments that were used by the agent + * execution. + */ + usedEnvironments?: Array; + + /** + * warning_message contains warnings, e.g. when the LLM is overloaded. + */ + warningMessage?: string; + } + + export namespace Status { + /** + * current_operation is the current operation of the agent execution. + */ + export interface CurrentOperation { + llm?: CurrentOperation.Llm; + + /** + * retries is the number of times the agent run has retried one or more steps + */ + retries?: string; + + session?: string; + + toolUse?: CurrentOperation.ToolUse; + } + + export namespace CurrentOperation { + export interface Llm { + complete?: boolean; + } + + export interface ToolUse { + complete?: boolean; + + toolName?: string; + } + } + + export interface Outputs { + boolValue?: boolean; + + floatValue?: number; + + intValue?: string; + + stringValue?: string; + } + + export interface UsedEnvironment { + createdByAgent?: boolean; + + environmentId?: string; + } + } +} + +/** + * AgentMode defines the operational mode of an agent + */ +export type AgentMode = 'AGENT_MODE_UNSPECIFIED' | 'AGENT_MODE_EXECUTION' | 'AGENT_MODE_PLANNING'; + +export interface Prompt { + id?: string; + + metadata?: PromptMetadata; + + spec?: PromptSpec; +} + +export interface PromptMetadata { + /** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at nanosecond + * resolution. The count is relative to an epoch at UTC midnight on January 1, + * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + * backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a + * [24-hour linear smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + * zero-padded to two digits each. The fractional seconds, which can go up to 9 + * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + * serializer should always use UTC (as indicated by "Z") when printing the + * Timestamp type and a proto3 JSON parser should be able to accept both UTC and + * other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + * January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted to + * this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + * Joda Time's + * [`ISODateTimeFormat.dateTime()`]() + * to obtain a formatter capable of generating timestamps in this format. + */ + createdAt?: string; + + /** + * creator is the identity of the prompt creator + */ + creator?: Shared.Subject; + + /** + * description is a description of what the prompt does + */ + description?: string; + + /** + * name is the human readable name of the prompt + */ + name?: string; + + /** + * organization_id is the ID of the organization that contains the prompt + */ + organizationId?: string; + + /** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at nanosecond + * resolution. The count is relative to an epoch at UTC midnight on January 1, + * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + * backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a + * [24-hour linear smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + * zero-padded to two digits each. The fractional seconds, which can go up to 9 + * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + * serializer should always use UTC (as indicated by "Z") when printing the + * Timestamp type and a proto3 JSON parser should be able to accept both UTC and + * other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + * January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted to + * this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + * Joda Time's + * [`ISODateTimeFormat.dateTime()`]() + * to obtain a formatter capable of generating timestamps in this format. + */ + updatedAt?: string; +} + +export interface PromptSpec { + /** + * command is the unique command string within the organization + */ + command?: string; + + /** + * is_command indicates if this prompt is a command + */ + isCommand?: boolean; + + /** + * is_template indicates if this prompt is a template + */ + isTemplate?: boolean; + + /** + * prompt is the content of the prompt + */ + prompt?: string; +} + +export interface UserInputBlock { + text: UserInputBlock.Text; + + id?: string; + + /** + * Timestamp when this block was created. Used for debugging and support bundles. + */ + createdAt?: string; +} + +export namespace UserInputBlock { + export interface Text { + content?: string; + } +} + +export interface AgentCreateExecutionConversationTokenResponse { + token?: string; +} + +export interface AgentCreatePromptResponse { + prompt?: Prompt; +} + +export type AgentDeleteExecutionResponse = unknown; + +export type AgentDeletePromptResponse = unknown; + +export interface AgentRetrieveExecutionResponse { + agentExecution?: AgentExecution; +} + +export interface AgentRetrievePromptResponse { + prompt?: Prompt; +} + +export type AgentSendToExecutionResponse = unknown; + +export interface AgentStartExecutionResponse { + agentExecutionId?: string; +} + +export type AgentStopExecutionResponse = unknown; + +export interface AgentUpdatePromptResponse { + prompt?: Prompt; +} + +export interface AgentCreateExecutionConversationTokenParams { + agentExecutionId?: string; +} + +export interface AgentCreatePromptParams { + command?: string; + + description?: string; + + isCommand?: boolean; + + isTemplate?: boolean; + + name?: string; + + prompt?: string; +} + +export interface AgentDeleteExecutionParams { + agentExecutionId?: string; +} + +export interface AgentDeletePromptParams { + promptId?: string; +} + +export interface AgentListExecutionsParams extends AgentExecutionsPageParams { + /** + * Body param: + */ + filter?: AgentListExecutionsParams.Filter; + + /** + * Body param: + */ + pagination?: AgentListExecutionsParams.Pagination; +} + +export namespace AgentListExecutionsParams { + export interface Filter { + agentIds?: Array; + + creatorIds?: Array; + + environmentIds?: Array; + + projectIds?: Array; + + roles?: Array< + 'AGENT_EXECUTION_ROLE_UNSPECIFIED' | 'AGENT_EXECUTION_ROLE_DEFAULT' | 'AGENT_EXECUTION_ROLE_WORKFLOW' + >; + + statusPhases?: Array< + 'PHASE_UNSPECIFIED' | 'PHASE_PENDING' | 'PHASE_RUNNING' | 'PHASE_WAITING_FOR_INPUT' | 'PHASE_STOPPED' + >; + } + + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + +export interface AgentListPromptsParams extends PromptsPageParams { + /** + * Body param: + */ + filter?: AgentListPromptsParams.Filter; + + /** + * Body param: + */ + pagination?: AgentListPromptsParams.Pagination; +} + +export namespace AgentListPromptsParams { + export interface Filter { + command?: string; + + commandPrefix?: string; + + isCommand?: boolean; + + isTemplate?: boolean; + } + + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + +export interface AgentRetrieveExecutionParams { + agentExecutionId?: string; +} + +export interface AgentRetrievePromptParams { + promptId?: string; +} + +export interface AgentSendToExecutionParams { + agentExecutionId?: string; + + userInput?: UserInputBlock; +} + +export interface AgentStartExecutionParams { + agentId?: string; + + codeContext?: AgentCodeContext; + + /** + * mode specifies the operational mode for this agent execution If not specified, + * defaults to AGENT_MODE_EXECUTION + */ + mode?: AgentMode; + + name?: string; + + /** + * workflow_action_id is an optional reference to the workflow execution action + * that created this agent execution. Used for tracking and event correlation. + */ + workflowActionId?: string | null; +} + +export interface AgentStopExecutionParams { + agentExecutionId?: string; +} + +export interface AgentUpdatePromptParams { + /** + * Metadata updates + */ + metadata?: AgentUpdatePromptParams.Metadata | null; + + /** + * The ID of the prompt to update + */ + promptId?: string; + + /** + * Spec updates + */ + spec?: AgentUpdatePromptParams.Spec | null; +} + +export namespace AgentUpdatePromptParams { + /** + * Metadata updates + */ + export interface Metadata { + /** + * A description of what the prompt does + */ + description?: string | null; + + /** + * The name of the prompt + */ + name?: string | null; + } + + /** + * Spec updates + */ + export interface Spec { + /** + * The command string (unique within organization) + */ + command?: string | null; + + /** + * Whether this prompt is a command + */ + isCommand?: boolean | null; + + /** + * Whether this prompt is a template + */ + isTemplate?: boolean | null; + + /** + * The prompt content + */ + prompt?: string | null; + } +} + +export declare namespace Agents { + export { + type AgentCodeContext as AgentCodeContext, + type AgentExecution as AgentExecution, + type AgentMode as AgentMode, + type Prompt as Prompt, + type PromptMetadata as PromptMetadata, + type PromptSpec as PromptSpec, + type UserInputBlock as UserInputBlock, + type AgentCreateExecutionConversationTokenResponse as AgentCreateExecutionConversationTokenResponse, + type AgentCreatePromptResponse as AgentCreatePromptResponse, + type AgentDeleteExecutionResponse as AgentDeleteExecutionResponse, + type AgentDeletePromptResponse as AgentDeletePromptResponse, + type AgentRetrieveExecutionResponse as AgentRetrieveExecutionResponse, + type AgentRetrievePromptResponse as AgentRetrievePromptResponse, + type AgentSendToExecutionResponse as AgentSendToExecutionResponse, + type AgentStartExecutionResponse as AgentStartExecutionResponse, + type AgentStopExecutionResponse as AgentStopExecutionResponse, + type AgentUpdatePromptResponse as AgentUpdatePromptResponse, + type AgentExecutionsAgentExecutionsPage as AgentExecutionsAgentExecutionsPage, + type PromptsPromptsPage as PromptsPromptsPage, + type AgentCreateExecutionConversationTokenParams as AgentCreateExecutionConversationTokenParams, + type AgentCreatePromptParams as AgentCreatePromptParams, + type AgentDeleteExecutionParams as AgentDeleteExecutionParams, + type AgentDeletePromptParams as AgentDeletePromptParams, + type AgentListExecutionsParams as AgentListExecutionsParams, + type AgentListPromptsParams as AgentListPromptsParams, + type AgentRetrieveExecutionParams as AgentRetrieveExecutionParams, + type AgentRetrievePromptParams as AgentRetrievePromptParams, + type AgentSendToExecutionParams as AgentSendToExecutionParams, + type AgentStartExecutionParams as AgentStartExecutionParams, + type AgentStopExecutionParams as AgentStopExecutionParams, + type AgentUpdatePromptParams as AgentUpdatePromptParams, + }; +} diff --git a/src/resources/editors.ts b/src/resources/editors.ts index bf322de..61ad898 100644 --- a/src/resources/editors.ts +++ b/src/resources/editors.ts @@ -141,6 +141,18 @@ export interface Editor { iconUrl?: string; shortDescription?: string; + + /** + * versions contains the list of available versions for this editor + */ + versions?: Array; +} + +export interface EditorVersion { + /** + * version is the version string of the editor Examples for JetBrains: 2025.2 + */ + version: string; } export interface EditorRetrieveResponse { @@ -221,11 +233,20 @@ export interface EditorResolveURLParams { * organizationId is the ID of the organization to resolve the URL for */ organizationId: string; + + /** + * version is the editor version to use If not provided, the latest version will be + * installed + * + * Examples for JetBrains: 2025.2 + */ + version?: string; } export declare namespace Editors { export { type Editor as Editor, + type EditorVersion as EditorVersion, type EditorRetrieveResponse as EditorRetrieveResponse, type EditorResolveURLResponse as EditorResolveURLResponse, type EditorsEditorsPage as EditorsEditorsPage, diff --git a/src/resources/environments/automations/automations.ts b/src/resources/environments/automations/automations.ts index 0ef7335..8860894 100644 --- a/src/resources/environments/automations/automations.ts +++ b/src/resources/environments/automations/automations.ts @@ -14,6 +14,7 @@ import { ServicePhase, ServiceRetrieveParams, ServiceRetrieveResponse, + ServiceRole, ServiceSpec, ServiceStartParams, ServiceStartResponse, @@ -140,6 +141,8 @@ export namespace AutomationsFile { name?: string; + role?: '' | 'default' | 'editor' | 'ai-agent'; + runsOn?: Shared.RunsOn; triggeredBy?: Array<'manual' | 'postEnvironmentStart' | 'postDevcontainerStart'>; @@ -188,7 +191,7 @@ export namespace AutomationsFile { runsOn?: Shared.RunsOn; - triggeredBy?: Array<'manual' | 'postEnvironmentStart' | 'postDevcontainerStart'>; + triggeredBy?: Array<'manual' | 'postEnvironmentStart' | 'postDevcontainerStart' | 'prebuild'>; } } @@ -225,6 +228,7 @@ export declare namespace Automations { type Service as Service, type ServiceMetadata as ServiceMetadata, type ServicePhase as ServicePhase, + type ServiceRole as ServiceRole, type ServiceSpec as ServiceSpec, type ServiceStatus as ServiceStatus, type ServiceCreateResponse as ServiceCreateResponse, diff --git a/src/resources/environments/automations/index.ts b/src/resources/environments/automations/index.ts index 052267d..ae3513f 100644 --- a/src/resources/environments/automations/index.ts +++ b/src/resources/environments/automations/index.ts @@ -11,6 +11,7 @@ export { type Service, type ServiceMetadata, type ServicePhase, + type ServiceRole, type ServiceSpec, type ServiceStatus, type ServiceCreateResponse, diff --git a/src/resources/environments/automations/services.ts b/src/resources/environments/automations/services.ts index 1abda28..b10dd0c 100644 --- a/src/resources/environments/automations/services.ts +++ b/src/resources/environments/automations/services.ts @@ -376,6 +376,11 @@ export interface ServiceMetadata { */ reference?: string; + /** + * role specifies the intended role or purpose of the service. + */ + role?: ServiceRole; + /** * triggered_by is a list of trigger that start the service. */ @@ -391,6 +396,13 @@ export type ServicePhase = | 'SERVICE_PHASE_FAILED' | 'SERVICE_PHASE_DELETED'; +export type ServiceRole = + | 'SERVICE_ROLE_UNSPECIFIED' + | 'SERVICE_ROLE_DEFAULT' + | 'SERVICE_ROLE_EDITOR' + | 'SERVICE_ROLE_AI_AGENT' + | 'SERVICE_ROLE_SECURITY_AGENT'; + export interface ServiceSpec { /** * commands contains the commands to start, stop and check the readiness of the @@ -404,6 +416,11 @@ export interface ServiceSpec { */ desiredPhase?: ServicePhase; + /** + * env specifies environment variables for the service. + */ + env?: Array; + /** * runs_on specifies the environment the service should run on. */ @@ -552,6 +569,8 @@ export namespace ServiceUpdateParams { name?: string | null; + role?: ServicesAPI.ServiceRole | null; + triggeredBy?: Metadata.TriggeredBy | null; } @@ -569,6 +588,8 @@ export namespace ServiceUpdateParams { export interface Spec { commands?: Spec.Commands | null; + env?: Array; + runsOn?: Shared.RunsOn | null; } @@ -630,6 +651,11 @@ export namespace ServiceListParams { */ references?: Array; + /** + * roles filters the response to only services with these roles + */ + roles?: Array; + /** * service_ids filters the response to only services with these IDs */ @@ -673,6 +699,7 @@ export declare namespace Services { type Service as Service, type ServiceMetadata as ServiceMetadata, type ServicePhase as ServicePhase, + type ServiceRole as ServiceRole, type ServiceSpec as ServiceSpec, type ServiceStatus as ServiceStatus, type ServiceCreateResponse as ServiceCreateResponse, diff --git a/src/resources/environments/automations/tasks/tasks.ts b/src/resources/environments/automations/tasks/tasks.ts index 6543b3d..16d9bf7 100644 --- a/src/resources/environments/automations/tasks/tasks.ts +++ b/src/resources/environments/automations/tasks/tasks.ts @@ -339,6 +339,8 @@ export namespace TaskUpdateParams { export interface Spec { command?: string | null; + env?: Array; + runsOn?: Shared.RunsOn | null; } } diff --git a/src/resources/environments/environments.ts b/src/resources/environments/environments.ts index 1e85d49..988d166 100644 --- a/src/resources/environments/environments.ts +++ b/src/resources/environments/environments.ts @@ -661,12 +661,23 @@ export interface EnvironmentMetadata { */ originalContextUrl?: string; + /** + * prebuild_id is the ID of the prebuild this environment was created from. Only + * set if the environment was created from a prebuild. + */ + prebuildId?: string | null; + /** * If the Environment was started from a project, the project_id will reference the * project. */ projectId?: string; + /** + * role is the role of the environment + */ + role?: EnvironmentRole; + /** * Runner is the ID of the runner that runs this environment. */ @@ -684,6 +695,15 @@ export type EnvironmentPhase = | 'ENVIRONMENT_PHASE_DELETING' | 'ENVIRONMENT_PHASE_DELETED'; +/** + * EnvironmentRole represents the role of an environment + */ +export type EnvironmentRole = + | 'ENVIRONMENT_ROLE_UNSPECIFIED' + | 'ENVIRONMENT_ROLE_DEFAULT' + | 'ENVIRONMENT_ROLE_PREBUILD' + | 'ENVIRONMENT_ROLE_WORKFLOW'; + /** * EnvironmentSpec specifies the configuration of an environment for an environment * start @@ -720,7 +740,7 @@ export interface EnvironmentSpec { machine?: EnvironmentSpec.Machine; /** - * ports is the set of ports which ought to be exposed to the internet + * ports is the set of ports which ought to be exposed to your network */ ports?: Array; @@ -745,6 +765,12 @@ export interface EnvironmentSpec { * Timeout configures the environment timeout */ timeout?: EnvironmentSpec.Timeout; + + /** + * workflow_action_id is an optional reference to the workflow execution action + * that created this environment. Used for tracking and event correlation. + */ + workflowActionId?: string | null; } export namespace EnvironmentSpec { @@ -764,6 +790,13 @@ export namespace EnvironmentSpec { automationsFilePath?: string; session?: string; + + /** + * trigger_filter specifies which automation triggers should execute. When set, + * only automations matching these triggers will run. If empty/unset, all triggers + * are evaluated normally. + */ + triggerFilter?: Array; } /** @@ -813,6 +846,12 @@ export namespace EnvironmentSpec { */ dotfiles?: Devcontainer.Dotfiles; + /** + * lifecycle_stage controls which devcontainer lifecycle commands are executed. + * Defaults to FULL if not specified. + */ + lifecycleStage?: 'LIFECYCLE_STAGE_UNSPECIFIED' | 'LIFECYCLE_STAGE_FULL' | 'LIFECYCLE_STAGE_PREBUILD'; + session?: string; } @@ -855,6 +894,13 @@ export namespace EnvironmentSpec { * port number */ port?: number; + + /** + * protocol for communication (Gateway proxy → user environment service). this + * setting only affects the protocol used between Gateway and user environment + * services. + */ + protocol?: 'PROTOCOL_UNSPECIFIED' | 'PROTOCOL_HTTP' | 'PROTOCOL_HTTPS'; } export interface Secret { @@ -863,6 +909,12 @@ export namespace EnvironmentSpec { */ id?: string; + /** + * api_only indicates the secret is only available via API/CLI. These secrets are + * resolved but NOT automatically injected into services or devcontainers. + */ + apiOnly?: boolean; + /** * container_registry_basic_auth_host is the hostname of the container registry * that supports basic auth @@ -1040,7 +1092,8 @@ export namespace EnvironmentStatus { | 'CONTENT_PHASE_INITIALIZING' | 'CONTENT_PHASE_READY' | 'CONTENT_PHASE_UPDATING' - | 'CONTENT_PHASE_FAILED'; + | 'CONTENT_PHASE_FAILED' + | 'CONTENT_PHASE_UNAVAILABLE'; /** * session is the automations file session that is currently applied in the @@ -1085,7 +1138,8 @@ export namespace EnvironmentStatus { | 'CONTENT_PHASE_INITIALIZING' | 'CONTENT_PHASE_READY' | 'CONTENT_PHASE_UPDATING' - | 'CONTENT_PHASE_FAILED'; + | 'CONTENT_PHASE_FAILED' + | 'CONTENT_PHASE_UNAVAILABLE'; /** * session is the session that is currently active in the environment. @@ -1251,12 +1305,23 @@ export namespace EnvironmentStatus { */ logs?: string; + /** + * ops is the URL at which the environment ops service can be accessed. + */ + ops?: string; + ports?: Array; /** * SSH is the URL at which the environment can be accessed via SSH. */ ssh?: EnvironmentURLs.SSH; + + /** + * support_bundle is the URL at which the environment support bundle can be + * accessed. + */ + supportBundle?: string; } export namespace EnvironmentURLs { @@ -1330,6 +1395,8 @@ export namespace EnvironmentStatus { * versions contains the versions of components in the machine. */ export interface Versions { + amiId?: string; + supervisorCommit?: string; supervisorVersion?: string; @@ -1369,7 +1436,8 @@ export namespace EnvironmentStatus { | 'CONTENT_PHASE_INITIALIZING' | 'CONTENT_PHASE_READY' | 'CONTENT_PHASE_UPDATING' - | 'CONTENT_PHASE_FAILED'; + | 'CONTENT_PHASE_FAILED' + | 'CONTENT_PHASE_UNAVAILABLE'; secretName?: string; @@ -1400,7 +1468,8 @@ export namespace EnvironmentStatus { | 'CONTENT_PHASE_INITIALIZING' | 'CONTENT_PHASE_READY' | 'CONTENT_PHASE_UPDATING' - | 'CONTENT_PHASE_FAILED'; + | 'CONTENT_PHASE_FAILED' + | 'CONTENT_PHASE_UNAVAILABLE'; } } @@ -1587,6 +1656,13 @@ export namespace EnvironmentUpdateParams { * port number */ port?: number; + + /** + * protocol for communication (Gateway proxy → user environment service). this + * setting only affects the protocol used between Gateway and user environment + * services. + */ + protocol?: 'PROTOCOL_UNSPECIFIED' | 'PROTOCOL_HTTP' | 'PROTOCOL_HTTPS'; } export interface SSHPublicKey { @@ -1639,6 +1715,11 @@ export namespace EnvironmentListParams { | 'ARCHIVAL_STATUS_ALL' | null; + /** + * created_before filters environments created before this timestamp + */ + createdBefore?: string | null; + /** * creator_ids filters the response to only Environments created by specified * members @@ -1651,6 +1732,11 @@ export namespace EnvironmentListParams { */ projectIds?: Array; + /** + * roles filters the response to only Environments with the specified roles + */ + roles?: Array; + /** * runner_ids filters the response to only Environments running on these Runner IDs */ @@ -1780,6 +1866,7 @@ export declare namespace Environments { type EnvironmentActivitySignal as EnvironmentActivitySignal, type EnvironmentMetadata as EnvironmentMetadata, type EnvironmentPhase as EnvironmentPhase, + type EnvironmentRole as EnvironmentRole, type EnvironmentSpec as EnvironmentSpec, type EnvironmentStatus as EnvironmentStatus, type EnvironmentCreateResponse as EnvironmentCreateResponse, diff --git a/src/resources/environments/index.ts b/src/resources/environments/index.ts index f106742..d73f7b0 100644 --- a/src/resources/environments/index.ts +++ b/src/resources/environments/index.ts @@ -14,6 +14,7 @@ export { type EnvironmentActivitySignal, type EnvironmentMetadata, type EnvironmentPhase, + type EnvironmentRole, type EnvironmentSpec, type EnvironmentStatus, type EnvironmentCreateResponse, diff --git a/src/resources/errors.ts b/src/resources/errors.ts new file mode 100644 index 0000000..c78f5e2 --- /dev/null +++ b/src/resources/errors.ts @@ -0,0 +1,342 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { RequestOptions } from '../internal/request-options'; + +export class Errors extends APIResource { + /** + * ReportErrors allows clients to report batches of errors that will be sent to + * error reporting systems. The structure is fully compatible with Sentry's event + * payload format. + * + * Use this method to: + * + * - Report client-side errors and exceptions + * - Track application crashes and panics + * - Send error context and metadata for debugging + * + * ### Examples + * + * - Report a JavaScript error with Sentry-compatible structure: The service + * accepts events with comprehensive error information including stack traces, + * identity context, breadcrumbs, and metadata that align with Sentry's event + * payload format. + */ + reportErrors(body: ErrorReportErrorsParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.ErrorsService/ReportErrors', { body, ...options }); + } +} + +/** + * Breadcrumb information (Sentry-compatible) + */ +export interface Breadcrumb { + /** + * Breadcrumb category + */ + category?: string; + + /** + * Additional breadcrumb data + */ + data?: { [key: string]: string }; + + /** + * Breadcrumb level + */ + level?: ErrorLevel; + + /** + * Breadcrumb message + */ + message?: string; + + /** + * When the breadcrumb occurred + */ + timestamp?: string; + + /** + * Breadcrumb type (e.g., "navigation", "http", "user", "error") + */ + type?: string; +} + +/** + * ErrorEvent contains comprehensive error information (Sentry-compatible) + */ +export interface ErrorEvent { + /** + * Breadcrumbs leading up to the error + */ + breadcrumbs?: Array; + + /** + * Environment (e.g., "production", "staging", "development") + */ + environment?: string; + + /** + * Unique event identifier (required by Sentry) + */ + eventId?: string; + + /** + * Exception information (primary error data) + */ + exceptions?: Array; + + /** + * Additional arbitrary metadata + */ + extra?: { [key: string]: string }; + + /** + * Custom fingerprint for grouping + */ + fingerprint?: Array; + + /** + * Identity ID of the user (UUID) + */ + identityId?: string; + + /** + * Error severity level + */ + level?: ErrorLevel; + + /** + * Logger name + */ + logger?: string; + + /** + * Modules/dependencies information + */ + modules?: { [key: string]: string }; + + /** + * Platform identifier (required by Sentry) + */ + platform?: string; + + /** + * Release version + */ + release?: string; + + /** + * Request information + */ + request?: RequestInfo; + + /** + * SDK information + */ + sdk?: { [key: string]: string }; + + /** + * Server/host name + */ + serverName?: string; + + /** + * Tags for filtering and grouping + */ + tags?: { [key: string]: string }; + + /** + * When the event occurred (required by Sentry) + */ + timestamp?: string; + + /** + * Transaction name (e.g., route name, function name) + */ + transaction?: string; +} + +/** + * Error severity levels (aligned with Sentry levels) + */ +export type ErrorLevel = + | 'ERROR_LEVEL_UNSPECIFIED' + | 'ERROR_LEVEL_DEBUG' + | 'ERROR_LEVEL_INFO' + | 'ERROR_LEVEL_WARNING' + | 'ERROR_LEVEL_ERROR' + | 'ERROR_LEVEL_FATAL'; + +/** + * Exception information (Sentry-compatible) + */ +export interface ExceptionInfo { + /** + * Exception mechanism + */ + mechanism?: ExceptionMechanism; + + /** + * Module or package where the exception type is defined + */ + module?: string; + + /** + * Stack trace frames + */ + stacktrace?: Array; + + /** + * Thread ID if applicable + */ + threadId?: string; + + /** + * Exception type/class name + */ + type?: string; + + /** + * Exception message/value + */ + value?: string; +} + +/** + * Exception mechanism information (Sentry-compatible) + */ +export interface ExceptionMechanism { + /** + * Additional mechanism-specific data + */ + data?: { [key: string]: string }; + + /** + * Human-readable description of the mechanism + */ + description?: string; + + /** + * Whether the exception was handled by user code + */ + handled?: boolean; + + /** + * Whether this is a synthetic exception (created by SDK) + */ + synthetic?: boolean; + + /** + * Type of mechanism (e.g., "generic", "promise", "onerror") + */ + type?: string; +} + +/** + * Request information (Sentry-compatible) + */ +export interface RequestInfo { + /** + * Request body (truncated if large) + */ + data?: string; + + /** + * Request headers + */ + headers?: { [key: string]: string }; + + /** + * HTTP method + */ + method?: string; + + /** + * Query parameters + */ + queryString?: { [key: string]: string }; + + /** + * Request URL + */ + url?: string; +} + +/** + * Stack trace frame information (Sentry-compatible) + */ +export interface StackFrame { + /** + * Column number in the line + */ + colno?: number; + + contextLine?: string; + + /** + * File name or path + */ + filename?: string; + + /** + * Function name + */ + function?: string; + + /** + * Whether this frame is in application code (vs library/framework code) + */ + inApp?: boolean; + + /** + * Line number in the file + */ + lineno?: number; + + /** + * Module or package name + */ + module?: string; + + postContext?: Array; + + /** + * Source code context around the error line + */ + preContext?: Array; + + /** + * Additional frame-specific variables/locals + */ + vars?: { [key: string]: string }; +} + +/** + * ReportErrorsResponse confirms that the errors were successfully received Success + * is indicated by HTTP 200 status code, failures by other status codes Empty + * response - success indicated by HTTP status code + */ +export type ErrorReportErrorsResponse = unknown; + +export interface ErrorReportErrorsParams { + /** + * Error events to be reported (batch) - now using Sentry-compatible structure + */ + events?: Array; +} + +export declare namespace Errors { + export { + type Breadcrumb as Breadcrumb, + type ErrorEvent as ErrorEvent, + type ErrorLevel as ErrorLevel, + type ExceptionInfo as ExceptionInfo, + type ExceptionMechanism as ExceptionMechanism, + type RequestInfo as RequestInfo, + type StackFrame as StackFrame, + type ErrorReportErrorsResponse as ErrorReportErrorsResponse, + type ErrorReportErrorsParams as ErrorReportErrorsParams, + }; +} diff --git a/src/resources/events.ts b/src/resources/events.ts index 1cdccaf..bb25c8b 100644 --- a/src/resources/events.ts +++ b/src/resources/events.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; -import * as EventsAPI from './events'; import * as Shared from './shared'; import { APIPromise } from '../core/api-promise'; import { EntriesPage, type EntriesPageParams, PagePromise } from '../core/pagination'; @@ -116,33 +115,6 @@ export type ResourceOperation = | 'RESOURCE_OPERATION_DELETE' | 'RESOURCE_OPERATION_UPDATE_STATUS'; -export type ResourceType = - | 'RESOURCE_TYPE_UNSPECIFIED' - | 'RESOURCE_TYPE_ENVIRONMENT' - | 'RESOURCE_TYPE_RUNNER' - | 'RESOURCE_TYPE_PROJECT' - | 'RESOURCE_TYPE_TASK' - | 'RESOURCE_TYPE_TASK_EXECUTION' - | 'RESOURCE_TYPE_SERVICE' - | 'RESOURCE_TYPE_ORGANIZATION' - | 'RESOURCE_TYPE_USER' - | 'RESOURCE_TYPE_ENVIRONMENT_CLASS' - | 'RESOURCE_TYPE_RUNNER_SCM_INTEGRATION' - | 'RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN' - | 'RESOURCE_TYPE_GROUP' - | 'RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN' - | 'RESOURCE_TYPE_USER_PREFERENCE' - | 'RESOURCE_TYPE_SERVICE_ACCOUNT' - | 'RESOURCE_TYPE_SECRET' - | 'RESOURCE_TYPE_SSO_CONFIG' - | 'RESOURCE_TYPE_DOMAIN_VERIFICATION' - | 'RESOURCE_TYPE_AGENT_EXECUTION' - | 'RESOURCE_TYPE_RUNNER_LLM_INTEGRATION' - | 'RESOURCE_TYPE_AGENT' - | 'RESOURCE_TYPE_ENVIRONMENT_SESSION' - | 'RESOURCE_TYPE_USER_SECRET' - | 'RESOURCE_TYPE_ORGANIZATION_POLICY'; - export interface EventListResponse { id?: string; @@ -246,7 +218,7 @@ export interface EventListResponse { subjectId?: string; - subjectType?: ResourceType; + subjectType?: Shared.ResourceType; } export interface EventWatchResponse { @@ -254,7 +226,7 @@ export interface EventWatchResponse { resourceId?: string; - resourceType?: ResourceType; + resourceType?: Shared.ResourceType; } export interface EventListParams extends EntriesPageParams { @@ -277,7 +249,7 @@ export namespace EventListParams { subjectIds?: Array; - subjectTypes?: Array; + subjectTypes?: Array; } /** @@ -316,7 +288,6 @@ export interface EventWatchParams { export declare namespace Events { export { type ResourceOperation as ResourceOperation, - type ResourceType as ResourceType, type EventListResponse as EventListResponse, type EventWatchResponse as EventWatchResponse, type EventListResponsesEntriesPage as EventListResponsesEntriesPage, diff --git a/src/resources/groups.ts b/src/resources/groups.ts index 2ba760c..429bb1a 100644 --- a/src/resources/groups.ts +++ b/src/resources/groups.ts @@ -1,291 +1,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../core/resource'; -import { GroupsPage, type GroupsPageParams, PagePromise } from '../core/pagination'; -import { RequestOptions } from '../internal/request-options'; - -export class Groups extends APIResource { - /** - * Lists groups with optional pagination. - * - * Use this method to: - * - * - View all groups - * - Check group memberships - * - Monitor group configurations - * - Audit group access - * - * ### Examples - * - * - List all groups: - * - * Shows all groups with pagination. - * - * ```yaml - * pagination: - * pageSize: 20 - * ``` - * - * - List with custom page size: - * - * Shows groups with specified page size. - * - * ```yaml - * pagination: - * pageSize: 50 - * token: "next-page-token-from-previous-response" - * ``` - * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const group of client.groups.list({ - * pagination: { pageSize: 20 }, - * })) { - * // ... - * } - * ``` - */ - list(params: GroupListParams, options?: RequestOptions): PagePromise { - const { token, pageSize, ...body } = params; - return this._client.getAPIList('/gitpod.v1.GroupService/ListGroups', GroupsPage, { - query: { token, pageSize }, - body, - method: 'post', - ...options, - }); - } -} - -export type GroupsGroupsPage = GroupsPage; - -export interface Group { - id?: string; - - /** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at nanosecond - * resolution. The count is relative to an epoch at UTC midnight on January 1, - * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - * backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a - * [24-hour linear smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * Example 5: Compute Timestamp from Java `Instant.now()`. - * - * Instant now = Instant.now(); - * - * Timestamp timestamp = - * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - * .setNanos(now.getNano()).build(); - * - * Example 6: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - * zero-padded to two digits each. The fractional seconds, which can go up to 9 - * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - * serializer should always use UTC (as indicated by "Z") when printing the - * Timestamp type and a proto3 JSON parser should be able to accept both UTC and - * other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - * January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted to - * this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - * Joda Time's - * [`ISODateTimeFormat.dateTime()`]() - * to obtain a formatter capable of generating timestamps in this format. - */ - createdAt?: string; - - name?: string; - - organizationId?: string; - - /** - * system_managed indicates that this group is created by the system automatically - */ - systemManaged?: boolean; - - /** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at nanosecond - * resolution. The count is relative to an epoch at UTC midnight on January 1, - * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar - * backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a - * [24-hour linear smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * Example 5: Compute Timestamp from Java `Instant.now()`. - * - * Instant now = Instant.now(); - * - * Timestamp timestamp = - * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - * .setNanos(now.getNano()).build(); - * - * Example 6: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is - * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always - * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are - * zero-padded to two digits each. The fractional seconds, which can go up to 9 - * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix - * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON - * serializer should always use UTC (as indicated by "Z") when printing the - * Timestamp type and a proto3 JSON parser should be able to accept both UTC and - * other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on - * January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted to - * this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the - * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the - * Joda Time's - * [`ISODateTimeFormat.dateTime()`]() - * to obtain a formatter capable of generating timestamps in this format. - */ - updatedAt?: string; -} - -export interface GroupListParams extends GroupsPageParams { - /** - * Body param: pagination contains the pagination options for listing groups - */ - pagination?: GroupListParams.Pagination; -} - -export namespace GroupListParams { - /** - * pagination contains the pagination options for listing groups - */ - export interface Pagination { - /** - * Token for the next set of results that was returned as next_token of a - * PaginationResponse - */ - token?: string; - - /** - * Page size is the maximum number of results to retrieve per page. Defaults to 25. - * Maximum 100. - */ - pageSize?: number; - } -} - -export declare namespace Groups { - export { - type Group as Group, - type GroupsGroupsPage as GroupsGroupsPage, - type GroupListParams as GroupListParams, - }; -} +export * from './groups/index'; diff --git a/src/resources/groups/groups.ts b/src/resources/groups/groups.ts new file mode 100644 index 0000000..5c566bf --- /dev/null +++ b/src/resources/groups/groups.ts @@ -0,0 +1,549 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as MembershipsAPI from './memberships'; +import { + GroupMembership, + GroupMembershipsMembersPage, + MembershipCreateParams, + MembershipCreateResponse, + MembershipDeleteParams, + MembershipDeleteResponse, + MembershipListParams, + Memberships, +} from './memberships'; +import * as RoleAssignmentsAPI from './role-assignments'; +import { + ResourceRole, + RoleAssignment, + RoleAssignmentCreateParams, + RoleAssignmentCreateResponse, + RoleAssignmentDeleteParams, + RoleAssignmentDeleteResponse, + RoleAssignmentListParams, + RoleAssignments, + RoleAssignmentsAssignmentsPage, +} from './role-assignments'; +import { APIPromise } from '../../core/api-promise'; +import { GroupsPage, type GroupsPageParams, PagePromise } from '../../core/pagination'; +import { RequestOptions } from '../../internal/request-options'; + +export class Groups extends APIResource { + memberships: MembershipsAPI.Memberships = new MembershipsAPI.Memberships(this._client); + roleAssignments: RoleAssignmentsAPI.RoleAssignments = new RoleAssignmentsAPI.RoleAssignments(this._client); + + /** + * Creates a new group within an organization. + * + * Use this method to: + * + * - Create teams for access control + * - Organize users by department or function + * - Set up role-based access groups + * + * ### Examples + * + * - Create a basic group: + * + * Creates a group with name and description. + * + * ```yaml + * organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * name: "Backend Team" + * description: "Backend engineering team" + * ``` + * + * ### Authorization + * + * Requires `org:admin` role on the organization. + * + * @example + * ```ts + * const group = await client.groups.create({ + * description: 'Backend engineering team', + * name: 'Backend Team', + * organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * }); + * ``` + */ + create(body: GroupCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.GroupService/CreateGroup', { body, ...options }); + } + + /** + * Gets information about a specific group. + * + * Use this method to: + * + * - Retrieve group details and metadata + * - Check group configuration + * - View member count + * + * ### Examples + * + * - Get group details: + * + * Retrieves information about a specific group. + * + * ```yaml + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * ``` + * + * ### Authorization + * + * All organization members can view group information (transparency model). + * + * @example + * ```ts + * const group = await client.groups.retrieve({ + * groupId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * }); + * ``` + */ + retrieve(body: GroupRetrieveParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.GroupService/GetGroup', { body, ...options }); + } + + /** + * Updates group information. + * + * Use this method to: + * + * - Rename a group + * - Update group description + * + * ### Examples + * + * - Update group name: + * + * Changes the name of an existing group. + * + * ```yaml + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * name: "Platform Team" + * description: "Platform engineering team" + * ``` + * + * ### Authorization + * + * Requires `org:admin` permission on the organization or `group:admin` permission + * on the specific group. + * + * @example + * ```ts + * const group = await client.groups.update({ + * description: 'Platform engineering team', + * groupId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * name: 'Platform Team', + * }); + * ``` + */ + update(body: GroupUpdateParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.GroupService/UpdateGroup', { body, ...options }); + } + + /** + * Lists groups with optional pagination. + * + * Use this method to: + * + * - View all groups in an organization + * - Check group memberships + * - Monitor group configurations + * - Audit group access + * + * ### Examples + * + * - List all groups: + * + * Shows all groups with pagination. + * + * ```yaml + * pagination: + * pageSize: 20 + * ``` + * + * - List with custom page size: + * + * Shows groups with specified page size. + * + * ```yaml + * pagination: + * pageSize: 50 + * token: "next-page-token-from-previous-response" + * ``` + * + * ### Authorization + * + * All organization members can list groups (transparency model). + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const group of client.groups.list({ + * pagination: { pageSize: 20 }, + * })) { + * // ... + * } + * ``` + */ + list(params: GroupListParams, options?: RequestOptions): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList('/gitpod.v1.GroupService/ListGroups', GroupsPage, { + query: { token, pageSize }, + body, + method: 'post', + ...options, + }); + } + + /** + * Deletes a group and removes all its resource assignments. + * + * When a group is deleted, all resource assignments revert to org-level scope. + * + * Use this method to: + * + * - Remove unused groups + * - Clean up after team reorganization + * + * ### Examples + * + * - Delete a group: + * + * Permanently removes a group. + * + * ```yaml + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * ``` + * + * ### Authorization + * + * Requires `org:admin` role on the organization. + * + * @example + * ```ts + * const group = await client.groups.delete({ + * groupId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * }); + * ``` + */ + delete(body: GroupDeleteParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.GroupService/DeleteGroup', { body, ...options }); + } +} + +export type GroupsGroupsPage = GroupsPage; + +export interface Group { + id?: string; + + /** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at nanosecond + * resolution. The count is relative to an epoch at UTC midnight on January 1, + * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + * backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a + * [24-hour linear smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + * zero-padded to two digits each. The fractional seconds, which can go up to 9 + * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + * serializer should always use UTC (as indicated by "Z") when printing the + * Timestamp type and a proto3 JSON parser should be able to accept both UTC and + * other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + * January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted to + * this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + * Joda Time's + * [`ISODateTimeFormat.dateTime()`]() + * to obtain a formatter capable of generating timestamps in this format. + */ + createdAt?: string; + + description?: string; + + /** + * member_count is the total number of members in this group + */ + memberCount?: number; + + name?: string; + + organizationId?: string; + + /** + * system_managed indicates that this group is created by the system automatically + */ + systemManaged?: boolean; + + /** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at nanosecond + * resolution. The count is relative to an epoch at UTC midnight on January 1, + * 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar + * backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a + * [24-hour linear smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is + * "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always + * expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are + * zero-padded to two digits each. The fractional seconds, which can go up to 9 + * digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix + * indicates the timezone ("UTC"); the timezone is required. A proto3 JSON + * serializer should always use UTC (as indicated by "Z") when printing the + * Timestamp type and a proto3 JSON parser should be able to accept both UTC and + * other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on + * January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted to + * this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the + * time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the + * Joda Time's + * [`ISODateTimeFormat.dateTime()`]() + * to obtain a formatter capable of generating timestamps in this format. + */ + updatedAt?: string; +} + +export interface GroupCreateResponse { + group?: Group; +} + +export interface GroupRetrieveResponse { + group?: Group; +} + +export interface GroupUpdateResponse { + group?: Group; +} + +/** + * Empty response + */ +export type GroupDeleteResponse = unknown; + +export interface GroupCreateParams { + description?: string; + + name?: string; + + organizationId?: string; +} + +export interface GroupRetrieveParams { + groupId?: string; +} + +export interface GroupUpdateParams { + description?: string; + + groupId?: string; + + name?: string; +} + +export interface GroupListParams extends GroupsPageParams { + /** + * Body param: pagination contains the pagination options for listing groups + */ + pagination?: GroupListParams.Pagination; +} + +export namespace GroupListParams { + /** + * pagination contains the pagination options for listing groups + */ + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + +export interface GroupDeleteParams { + groupId?: string; +} + +Groups.Memberships = Memberships; +Groups.RoleAssignments = RoleAssignments; + +export declare namespace Groups { + export { + type Group as Group, + type GroupCreateResponse as GroupCreateResponse, + type GroupRetrieveResponse as GroupRetrieveResponse, + type GroupUpdateResponse as GroupUpdateResponse, + type GroupDeleteResponse as GroupDeleteResponse, + type GroupsGroupsPage as GroupsGroupsPage, + type GroupCreateParams as GroupCreateParams, + type GroupRetrieveParams as GroupRetrieveParams, + type GroupUpdateParams as GroupUpdateParams, + type GroupListParams as GroupListParams, + type GroupDeleteParams as GroupDeleteParams, + }; + + export { + Memberships as Memberships, + type GroupMembership as GroupMembership, + type MembershipCreateResponse as MembershipCreateResponse, + type MembershipDeleteResponse as MembershipDeleteResponse, + type GroupMembershipsMembersPage as GroupMembershipsMembersPage, + type MembershipCreateParams as MembershipCreateParams, + type MembershipListParams as MembershipListParams, + type MembershipDeleteParams as MembershipDeleteParams, + }; + + export { + RoleAssignments as RoleAssignments, + type ResourceRole as ResourceRole, + type RoleAssignment as RoleAssignment, + type RoleAssignmentCreateResponse as RoleAssignmentCreateResponse, + type RoleAssignmentDeleteResponse as RoleAssignmentDeleteResponse, + type RoleAssignmentsAssignmentsPage as RoleAssignmentsAssignmentsPage, + type RoleAssignmentCreateParams as RoleAssignmentCreateParams, + type RoleAssignmentListParams as RoleAssignmentListParams, + type RoleAssignmentDeleteParams as RoleAssignmentDeleteParams, + }; +} diff --git a/src/resources/groups/index.ts b/src/resources/groups/index.ts new file mode 100644 index 0000000..80bf45e --- /dev/null +++ b/src/resources/groups/index.ts @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Groups, + type Group, + type GroupCreateResponse, + type GroupRetrieveResponse, + type GroupUpdateResponse, + type GroupDeleteResponse, + type GroupCreateParams, + type GroupRetrieveParams, + type GroupUpdateParams, + type GroupListParams, + type GroupDeleteParams, + type GroupsGroupsPage, +} from './groups'; +export { + Memberships, + type GroupMembership, + type MembershipCreateResponse, + type MembershipDeleteResponse, + type MembershipCreateParams, + type MembershipListParams, + type MembershipDeleteParams, + type GroupMembershipsMembersPage, +} from './memberships'; +export { + RoleAssignments, + type ResourceRole, + type RoleAssignment, + type RoleAssignmentCreateResponse, + type RoleAssignmentDeleteResponse, + type RoleAssignmentCreateParams, + type RoleAssignmentListParams, + type RoleAssignmentDeleteParams, + type RoleAssignmentsAssignmentsPage, +} from './role-assignments'; diff --git a/src/resources/groups/memberships.ts b/src/resources/groups/memberships.ts new file mode 100644 index 0000000..097335a --- /dev/null +++ b/src/resources/groups/memberships.ts @@ -0,0 +1,237 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as Shared from '../shared'; +import { APIPromise } from '../../core/api-promise'; +import { MembersPage, type MembersPageParams, PagePromise } from '../../core/pagination'; +import { RequestOptions } from '../../internal/request-options'; + +export class Memberships extends APIResource { + /** + * Creates a membership for a user in a group. + * + * Use this method to: + * + * - Add users to groups + * - Grant group-based permissions to users + * + * ### Examples + * + * - Add a user to a group: + * + * Creates a membership for a user in a group. + * + * ```yaml + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * subject: + * id: "f53d2330-3795-4c5d-a1f3-453121af9c60" + * principal: PRINCIPAL_USER + * ``` + * + * ### Authorization + * + * Requires `org:admin` permission on the organization or `group:admin` permission + * on the specific group. + * + * @example + * ```ts + * const membership = await client.groups.memberships.create({ + * groupId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * subject: { + * id: 'f53d2330-3795-4c5d-a1f3-453121af9c60', + * principal: 'PRINCIPAL_USER', + * }, + * }); + * ``` + */ + create(body: MembershipCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.GroupService/CreateMembership', { body, ...options }); + } + + /** + * Lists all memberships of a group. + * + * Use this method to: + * + * - View all members of a group + * - Audit group membership + * + * ### Examples + * + * - List group members: + * + * Shows all members of a specific group. + * + * ```yaml + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * pagination: + * pageSize: 20 + * ``` + * + * ### Authorization + * + * All organization members can view group membership (transparency model). + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const groupMembership of client.groups.memberships.list( + * { + * groupId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * pagination: { pageSize: 20 }, + * }, + * )) { + * // ... + * } + * ``` + */ + list( + params: MembershipListParams, + options?: RequestOptions, + ): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList('/gitpod.v1.GroupService/ListMemberships', MembersPage, { + query: { token, pageSize }, + body, + method: 'post', + ...options, + }); + } + + /** + * Deletes a membership for a user in a group. + * + * Use this method to: + * + * - Remove users from groups + * - Revoke group-based permissions + * + * ### Examples + * + * - Remove a user from a group: + * + * Deletes a membership by its ID. + * + * ```yaml + * membershipId: "a1b2c3d4-5678-90ab-cdef-1234567890ab" + * ``` + * + * ### Authorization + * + * Requires `org:admin` permission on the organization or `group:admin` permission + * on the specific group. + * + * @example + * ```ts + * const membership = await client.groups.memberships.delete({ + * membershipId: 'a1b2c3d4-5678-90ab-cdef-1234567890ab', + * }); + * ``` + */ + delete(body: MembershipDeleteParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.GroupService/DeleteMembership', { body, ...options }); + } +} + +export type GroupMembershipsMembersPage = MembersPage; + +/** + * GroupMembership represents a subject's membership in a group + */ +export interface GroupMembership { + /** + * Unique identifier for the group membership + */ + id?: string; + + /** + * Subject's avatar URL + */ + avatarUrl?: string; + + /** + * Group identifier + */ + groupId?: string; + + /** + * Subject's display name + */ + name?: string; + + /** + * Subject (user, runner, environment, service account, etc.) + */ + subject?: Shared.Subject; +} + +export interface MembershipCreateResponse { + /** + * GroupMembership represents a subject's membership in a group + */ + member?: GroupMembership; +} + +/** + * Empty response + */ +export type MembershipDeleteResponse = unknown; + +export interface MembershipCreateParams { + groupId?: string; + + /** + * Subject to add to the group + */ + subject?: Shared.Subject; +} + +export interface MembershipListParams extends MembersPageParams { + /** + * Body param: + */ + groupId?: string; + + /** + * Body param: pagination contains the pagination options for listing memberships + */ + pagination?: MembershipListParams.Pagination; +} + +export namespace MembershipListParams { + /** + * pagination contains the pagination options for listing memberships + */ + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + +export interface MembershipDeleteParams { + /** + * The membership to delete + */ + membershipId?: string; +} + +export declare namespace Memberships { + export { + type GroupMembership as GroupMembership, + type MembershipCreateResponse as MembershipCreateResponse, + type MembershipDeleteResponse as MembershipDeleteResponse, + type GroupMembershipsMembersPage as GroupMembershipsMembersPage, + type MembershipCreateParams as MembershipCreateParams, + type MembershipListParams as MembershipListParams, + type MembershipDeleteParams as MembershipDeleteParams, + }; +} diff --git a/src/resources/groups/role-assignments.ts b/src/resources/groups/role-assignments.ts new file mode 100644 index 0000000..4c8c1eb --- /dev/null +++ b/src/resources/groups/role-assignments.ts @@ -0,0 +1,355 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as RoleAssignmentsAPI from './role-assignments'; +import * as Shared from '../shared'; +import { APIPromise } from '../../core/api-promise'; +import { AssignmentsPage, type AssignmentsPageParams, PagePromise } from '../../core/pagination'; +import { RequestOptions } from '../../internal/request-options'; + +export class RoleAssignments extends APIResource { + /** + * Creates a role assignment for a group on a resource. + * + * Use this method to: + * + * - Assign specific roles to groups on runners, projects, or environments + * - Grant group-based access to resources + * + * ### Examples + * + * - Assign admin role on a runner: + * + * Grants the group admin access to a runner. + * + * ```yaml + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * resourceType: RESOURCE_TYPE_RUNNER + * resourceId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + * resourceRole: RESOURCE_ROLE_RUNNER_ADMIN + * ``` + * + * - Assign user role on a project: + * + * Grants the group user access to a project. + * + * ```yaml + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * resourceType: RESOURCE_TYPE_PROJECT + * resourceId: "a1b2c3d4-5678-90ab-cdef-1234567890ab" + * resourceRole: RESOURCE_ROLE_PROJECT_USER + * ``` + * + * ### Authorization + * + * Requires admin role on the specific resource. + * + * @example + * ```ts + * const roleAssignment = + * await client.groups.roleAssignments.create({ + * groupId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * resourceId: 'f53d2330-3795-4c5d-a1f3-453121af9c60', + * resourceRole: 'RESOURCE_ROLE_RUNNER_ADMIN', + * resourceType: 'RESOURCE_TYPE_RUNNER', + * }); + * ``` + */ + create( + body: RoleAssignmentCreateParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.GroupService/CreateRoleAssignment', { body, ...options }); + } + + /** + * Lists role assignments for a group or resource. + * + * Use this method to: + * + * - View all role assignments for a group + * - Audit resource access + * - Check which groups have access to resources + * + * ### Examples + * + * - List role assignments for a group: + * + * Shows all role assignments for a specific group. + * + * ```yaml + * filter: + * groupId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * pagination: + * pageSize: 20 + * ``` + * + * - List role assignments by resource type: + * + * Shows all role assignments for runners. + * + * ```yaml + * filter: + * resourceTypes: + * - RESOURCE_TYPE_RUNNER + * pagination: + * pageSize: 20 + * ``` + * + * ### Authorization + * + * All organization members can view role assignments (transparency model). + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const roleAssignment of client.groups.roleAssignments.list( + * { + * filter: { resourceTypes: ['RESOURCE_TYPE_RUNNER'] }, + * pagination: { pageSize: 20 }, + * }, + * )) { + * // ... + * } + * ``` + */ + list( + params: RoleAssignmentListParams, + options?: RequestOptions, + ): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList( + '/gitpod.v1.GroupService/ListRoleAssignments', + AssignmentsPage, + { query: { token, pageSize }, body, method: 'post', ...options }, + ); + } + + /** + * Deletes a role assignment. + * + * Use this method to: + * + * - Remove group access to resources + * - Revoke role-based permissions + * + * ### Examples + * + * - Delete a role assignment: + * + * Removes a role assignment by its ID. + * + * ```yaml + * assignmentId: "a1b2c3d4-5678-90ab-cdef-1234567890ab" + * ``` + * + * ### Authorization + * + * Requires admin role on the specific resource. + * + * @example + * ```ts + * const roleAssignment = + * await client.groups.roleAssignments.delete({ + * assignmentId: 'a1b2c3d4-5678-90ab-cdef-1234567890ab', + * }); + * ``` + */ + delete(body: RoleAssignmentDeleteParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.GroupService/DeleteRoleAssignment', { body, ...options }); + } +} + +export type RoleAssignmentsAssignmentsPage = AssignmentsPage; + +/** + * ResourceRole represents roles that can be assigned to groups on resources These + * map directly to the roles defined in backend/db/rule/rbac/role/role.go + */ +export type ResourceRole = + | 'RESOURCE_ROLE_UNSPECIFIED' + | 'RESOURCE_ROLE_ORG_ADMIN' + | 'RESOURCE_ROLE_ORG_MEMBER' + | 'RESOURCE_ROLE_GROUP_ADMIN' + | 'RESOURCE_ROLE_GROUP_VIEWER' + | 'RESOURCE_ROLE_USER_IDENTITY' + | 'RESOURCE_ROLE_USER_VIEWER' + | 'RESOURCE_ROLE_USER_ADMIN' + | 'RESOURCE_ROLE_ENVIRONMENT_IDENTITY' + | 'RESOURCE_ROLE_ENVIRONMENT_ADMIN' + | 'RESOURCE_ROLE_ENVIRONMENT_USER' + | 'RESOURCE_ROLE_ENVIRONMENT_VIEWER' + | 'RESOURCE_ROLE_ENVIRONMENT_RUNNER' + | 'RESOURCE_ROLE_RUNNER_IDENTITY' + | 'RESOURCE_ROLE_RUNNER_ADMIN' + | 'RESOURCE_ROLE_RUNNER_LOCAL_ADMIN' + | 'RESOURCE_ROLE_RUNNER_MANAGED_ADMIN' + | 'RESOURCE_ROLE_RUNNER_USER' + | 'RESOURCE_ROLE_RUNNER_CONFIGURATION_READER' + | 'RESOURCE_ROLE_HOST_AUTHENTICATION_TOKEN_ADMIN' + | 'RESOURCE_ROLE_HOST_AUTHENTICATION_TOKEN_UPDATER' + | 'RESOURCE_ROLE_PROJECT_ADMIN' + | 'RESOURCE_ROLE_PROJECT_USER' + | 'RESOURCE_ROLE_PROJECT_EDITOR' + | 'RESOURCE_ROLE_ENVIRONMENT_SERVICE_ADMIN' + | 'RESOURCE_ROLE_ENVIRONMENT_SERVICE_VIEWER' + | 'RESOURCE_ROLE_ENVIRONMENT_SERVICE_USER' + | 'RESOURCE_ROLE_ENVIRONMENT_SERVICE_ENV' + | 'RESOURCE_ROLE_ENVIRONMENT_TASK_ADMIN' + | 'RESOURCE_ROLE_ENVIRONMENT_TASK_VIEWER' + | 'RESOURCE_ROLE_ENVIRONMENT_TASK_USER' + | 'RESOURCE_ROLE_ENVIRONMENT_TASK_ENV' + | 'RESOURCE_ROLE_SERVICE_ACCOUNT_IDENTITY' + | 'RESOURCE_ROLE_SERVICE_ACCOUNT_ADMIN' + | 'RESOURCE_ROLE_AGENT_EXECUTION_IDENTITY' + | 'RESOURCE_ROLE_AGENT_EXECUTION_USER' + | 'RESOURCE_ROLE_AGENT_EXECUTION_ADMIN' + | 'RESOURCE_ROLE_AGENT_EXECUTION_RUNNER' + | 'RESOURCE_ROLE_AGENT_EXECUTION_OUTPUTS_REPORTER' + | 'RESOURCE_ROLE_AGENT_ADMIN' + | 'RESOURCE_ROLE_AGENT_VIEWER' + | 'RESOURCE_ROLE_AGENT_EXECUTOR' + | 'RESOURCE_ROLE_WORKFLOW_ADMIN' + | 'RESOURCE_ROLE_WORKFLOW_USER' + | 'RESOURCE_ROLE_WORKFLOW_VIEWER' + | 'RESOURCE_ROLE_WORKFLOW_EXECUTOR' + | 'RESOURCE_ROLE_SNAPSHOT_ADMIN' + | 'RESOURCE_ROLE_SNAPSHOT_RUNNER'; + +/** + * RoleAssignment represents a role assigned to a group on a specific resource + */ +export interface RoleAssignment { + /** + * Unique identifier for the role assignment + */ + id?: string; + + /** + * Group identifier + */ + groupId?: string; + + /** + * Organization identifier + */ + organizationId?: string; + + /** + * Resource identifier + */ + resourceId?: string; + + /** + * Role assigned to the group on this resource + */ + resourceRole?: ResourceRole; + + /** + * Type of resource (runner, project, environment, etc.) + */ + resourceType?: Shared.ResourceType; +} + +export interface RoleAssignmentCreateResponse { + /** + * RoleAssignment represents a role assigned to a group on a specific resource + */ + assignment?: RoleAssignment; +} + +/** + * Empty response + */ +export type RoleAssignmentDeleteResponse = unknown; + +export interface RoleAssignmentCreateParams { + groupId?: string; + + resourceId?: string; + + /** + * ResourceRole represents roles that can be assigned to groups on resources These + * map directly to the roles defined in backend/db/rule/rbac/role/role.go + */ + resourceRole?: ResourceRole; + + resourceType?: Shared.ResourceType; +} + +export interface RoleAssignmentListParams extends AssignmentsPageParams { + /** + * Body param: Filter parameters + */ + filter?: RoleAssignmentListParams.Filter; + + /** + * Body param: Pagination parameters + */ + pagination?: RoleAssignmentListParams.Pagination; +} + +export namespace RoleAssignmentListParams { + /** + * Filter parameters + */ + export interface Filter { + /** + * group_id filters the response to only role assignments for this specific group + * Empty string is allowed and means no filtering by group + */ + groupId?: string; + + /** + * resource_roles filters the response to only role assignments with these specific + * roles + */ + resourceRoles?: Array; + + /** + * resource_types filters the response to only role assignments for these resource + * types + */ + resourceTypes?: Array; + + /** + * user_id filters the response to only role assignments for groups that this user + * is a member of Empty string is allowed and means no filtering by user + */ + userId?: string; + } + + /** + * Pagination parameters + */ + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + +export interface RoleAssignmentDeleteParams { + assignmentId?: string; +} + +export declare namespace RoleAssignments { + export { + type ResourceRole as ResourceRole, + type RoleAssignment as RoleAssignment, + type RoleAssignmentCreateResponse as RoleAssignmentCreateResponse, + type RoleAssignmentDeleteResponse as RoleAssignmentDeleteResponse, + type RoleAssignmentsAssignmentsPage as RoleAssignmentsAssignmentsPage, + type RoleAssignmentCreateParams as RoleAssignmentCreateParams, + type RoleAssignmentListParams as RoleAssignmentListParams, + type RoleAssignmentDeleteParams as RoleAssignmentDeleteParams, + }; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index 6fdf73f..0d1d9fd 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -10,17 +10,55 @@ export { type AccountRetrieveResponse, type AccountDeleteResponse, type AccountGetSSOLoginURLResponse, - type AccountListJoinableOrganizationsResponse, + type AccountListSSOLoginsResponse, type AccountRetrieveParams, type AccountDeleteParams, type AccountGetSSOLoginURLParams, type AccountListJoinableOrganizationsParams, type AccountListLoginProvidersParams, + type AccountListSSOLoginsParams, + type JoinableOrganizationsJoinableOrganizationsPage, type LoginProvidersLoginProvidersPage, + type AccountListSSOLoginsResponsesLoginsPage, } from './accounts'; +export { + Agents, + type AgentCodeContext, + type AgentExecution, + type AgentMode, + type Prompt, + type PromptMetadata, + type PromptSpec, + type UserInputBlock, + type AgentCreateExecutionConversationTokenResponse, + type AgentCreatePromptResponse, + type AgentDeleteExecutionResponse, + type AgentDeletePromptResponse, + type AgentRetrieveExecutionResponse, + type AgentRetrievePromptResponse, + type AgentSendToExecutionResponse, + type AgentStartExecutionResponse, + type AgentStopExecutionResponse, + type AgentUpdatePromptResponse, + type AgentCreateExecutionConversationTokenParams, + type AgentCreatePromptParams, + type AgentDeleteExecutionParams, + type AgentDeletePromptParams, + type AgentListExecutionsParams, + type AgentListPromptsParams, + type AgentRetrieveExecutionParams, + type AgentRetrievePromptParams, + type AgentSendToExecutionParams, + type AgentStartExecutionParams, + type AgentStopExecutionParams, + type AgentUpdatePromptParams, + type AgentExecutionsAgentExecutionsPage, + type PromptsPromptsPage, +} from './agents'; export { Editors, type Editor, + type EditorVersion, type EditorRetrieveResponse, type EditorResolveURLResponse, type EditorRetrieveParams, @@ -35,6 +73,7 @@ export { type EnvironmentActivitySignal, type EnvironmentMetadata, type EnvironmentPhase, + type EnvironmentRole, type EnvironmentSpec, type EnvironmentStatus, type EnvironmentCreateResponse, @@ -62,10 +101,21 @@ export { type EnvironmentUnarchiveParams, type EnvironmentsEnvironmentsPage, } from './environments/environments'; +export { + Errors, + type Breadcrumb, + type ErrorEvent, + type ErrorLevel, + type ExceptionInfo, + type ExceptionMechanism, + type RequestInfo, + type StackFrame, + type ErrorReportErrorsResponse, + type ErrorReportErrorsParams, +} from './errors'; export { Events, type ResourceOperation, - type ResourceType, type EventListResponse, type EventWatchResponse, type EventListParams, @@ -73,7 +123,20 @@ export { type EventListResponsesEntriesPage, } from './events'; export { Gateways, type GatewayListParams } from './gateways'; -export { Groups, type Group, type GroupListParams, type GroupsGroupsPage } from './groups'; +export { + Groups, + type Group, + type GroupCreateResponse, + type GroupRetrieveResponse, + type GroupUpdateResponse, + type GroupDeleteResponse, + type GroupCreateParams, + type GroupRetrieveParams, + type GroupUpdateParams, + type GroupListParams, + type GroupDeleteParams, + type GroupsGroupsPage, +} from './groups/groups'; export { Identity, type IDTokenVersion, @@ -107,12 +170,34 @@ export { type OrganizationSetRoleParams, type OrganizationMembersMembersPage, } from './organizations/organizations'; +export { + Prebuilds, + type Prebuild, + type PrebuildMetadata, + type PrebuildPhase, + type PrebuildSpec, + type PrebuildStatus, + type PrebuildTrigger, + type PrebuildCreateResponse, + type PrebuildRetrieveResponse, + type PrebuildDeleteResponse, + type PrebuildCancelResponse, + type PrebuildCreateLogsTokenResponse, + type PrebuildCreateParams, + type PrebuildRetrieveParams, + type PrebuildListParams, + type PrebuildDeleteParams, + type PrebuildCancelParams, + type PrebuildCreateLogsTokenParams, + type PrebuildsPrebuildsPage, +} from './prebuilds'; export { Projects, type EnvironmentInitializer, type Project, - type ProjectEnvironmentClass, type ProjectMetadata, + type ProjectPhase, + type ProjectPrebuildConfiguration, type ProjectCreateResponse, type ProjectRetrieveResponse, type ProjectUpdateResponse, @@ -140,21 +225,27 @@ export { type RunnerReleaseChannel, type RunnerSpec, type RunnerStatus, + type RunnerVariant, + type SearchMode, type RunnerCreateResponse, type RunnerRetrieveResponse, type RunnerUpdateResponse, type RunnerDeleteResponse, type RunnerCheckAuthenticationForHostResponse, + type RunnerCreateLogsTokenResponse, type RunnerCreateRunnerTokenResponse, type RunnerParseContextURLResponse, + type RunnerSearchRepositoriesResponse, type RunnerCreateParams, type RunnerRetrieveParams, type RunnerUpdateParams, type RunnerListParams, type RunnerDeleteParams, type RunnerCheckAuthenticationForHostParams, + type RunnerCreateLogsTokenParams, type RunnerCreateRunnerTokenParams, type RunnerParseContextURLParams, + type RunnerSearchRepositoriesParams, type RunnersRunnersPage, } from './runners/runners'; export { @@ -181,8 +272,12 @@ export { export { Users, type User, + type UserDeleteUserResponse, type UserGetAuthenticatedUserResponse, + type UserGetUserResponse, type UserSetSuspendedResponse, + type UserDeleteUserParams, type UserGetAuthenticatedUserParams, + type UserGetUserParams, type UserSetSuspendedParams, } from './users/users'; diff --git a/src/resources/organizations/custom-domains.ts b/src/resources/organizations/custom-domains.ts new file mode 100644 index 0000000..2e5f32d --- /dev/null +++ b/src/resources/organizations/custom-domains.ts @@ -0,0 +1,311 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import { APIPromise } from '../../core/api-promise'; +import { RequestOptions } from '../../internal/request-options'; + +export class CustomDomains extends APIResource { + /** + * Creates a custom domain configuration for an organization. + * + * Use this method to configure custom domains for organization workspaces + * + * ### Examples + * + * - Configure AWS custom domain: + * + * Sets up a custom domain with AWS provider. + * + * ```yaml + * organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * domainName: "workspaces.acme-corp.com" + * provider: CUSTOM_DOMAIN_PROVIDER_AWS + * awsAccountId: "123456789012" + * ``` + * + * @example + * ```ts + * const customDomain = + * await client.organizations.customDomains.create({ + * domainName: 'workspaces.acme-corp.com', + * organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * awsAccountId: '123456789012', + * provider: 'CUSTOM_DOMAIN_PROVIDER_AWS', + * }); + * ``` + */ + create(body: CustomDomainCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.OrganizationService/CreateCustomDomain', { body, ...options }); + } + + /** + * Retrieves a specific custom domain configuration. + * + * Use this method to view custom domain details + * + * ### Examples + * + * - Get custom domain configuration: + * + * Retrieves details of a specific custom domain. + * + * ```yaml + * organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * ``` + * + * @example + * ```ts + * const customDomain = + * await client.organizations.customDomains.retrieve({ + * organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * }); + * ``` + */ + retrieve( + body: CustomDomainRetrieveParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.OrganizationService/GetCustomDomain', { body, ...options }); + } + + /** + * Updates custom domain configuration settings. + * + * Use this method to: + * + * - Update cloud provider settings + * - Change AWS account ID + * - Modify domain configuration + * + * ### Examples + * + * - Update AWS account ID: + * + * Changes the AWS account ID for the custom domain. + * + * ```yaml + * organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * domainName: "workspaces.acme-corp.com" + * awsAccountId: "987654321098" + * ``` + * + * @example + * ```ts + * const customDomain = + * await client.organizations.customDomains.update({ + * domainName: 'workspaces.acme-corp.com', + * organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * awsAccountId: '987654321098', + * }); + * ``` + */ + update(body: CustomDomainUpdateParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.OrganizationService/UpdateCustomDomain', { body, ...options }); + } + + /** + * Removes a custom domain configuration from an organization. + * + * Use this method to: + * + * - Disable custom domain functionality + * - Remove outdated configurations + * - Clean up unused domains + * + * ### Examples + * + * - Delete custom domain configuration: + * + * Removes a specific custom domain configuration. + * + * ```yaml + * organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * ``` + * + * @example + * ```ts + * const customDomain = + * await client.organizations.customDomains.delete({ + * organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * }); + * ``` + */ + delete(body: CustomDomainDeleteParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.OrganizationService/DeleteCustomDomain', { body, ...options }); + } +} + +/** + * CustomDomain represents a custom domain configuration for an organization + */ +export interface CustomDomain { + /** + * id is the unique identifier of the custom domain + */ + id: string; + + /** + * created_at is when the custom domain was created + */ + createdAt: string; + + /** + * domain_name is the custom domain name + */ + domainName: string; + + /** + * organization_id is the ID of the organization this custom domain belongs to + */ + organizationId: string; + + /** + * updated_at is when the custom domain was last updated + */ + updatedAt: string; + + /** + * @deprecated aws_account_id is the AWS account ID (deprecated: use + * cloud_account_id) + */ + awsAccountId?: string; + + /** + * cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP + * Project ID) + */ + cloudAccountId?: string; + + /** + * provider is the cloud provider for this custom domain + */ + provider?: CustomDomainProvider; +} + +/** + * CustomDomainProvider represents the cloud provider for custom domain + * configuration + */ +export type CustomDomainProvider = + | 'CUSTOM_DOMAIN_PROVIDER_UNSPECIFIED' + | 'CUSTOM_DOMAIN_PROVIDER_AWS' + | 'CUSTOM_DOMAIN_PROVIDER_GCP'; + +/** + * CreateCustomDomainResponse is the response message for creating a custom domain + */ +export interface CustomDomainCreateResponse { + /** + * custom_domain is the created custom domain + */ + customDomain: CustomDomain; +} + +export interface CustomDomainRetrieveResponse { + /** + * CustomDomain represents a custom domain configuration for an organization + */ + customDomain: CustomDomain; +} + +/** + * UpdateCustomDomainResponse is the response message for updating a custom domain + */ +export interface CustomDomainUpdateResponse { + /** + * custom_domain is the updated custom domain + */ + customDomain: CustomDomain; +} + +/** + * DeleteCustomDomainResponse is the response message for deleting a custom domain + */ +export type CustomDomainDeleteResponse = unknown; + +export interface CustomDomainCreateParams { + /** + * domain_name is the custom domain name + */ + domainName: string; + + /** + * organization_id is the ID of the organization to create the custom domain for + */ + organizationId: string; + + /** + * @deprecated aws_account_id is the AWS account ID (deprecated: use + * cloud_account_id) + */ + awsAccountId?: string | null; + + /** + * cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP + * Project ID) + */ + cloudAccountId?: string | null; + + /** + * provider is the cloud provider for this custom domain + */ + provider?: CustomDomainProvider; +} + +export interface CustomDomainRetrieveParams { + /** + * organization_id is the ID of the organization to retrieve custom domain for + */ + organizationId: string; +} + +export interface CustomDomainUpdateParams { + /** + * domain_name is the custom domain name + */ + domainName: string; + + /** + * organization_id is the ID of the organization to update custom domain for + */ + organizationId: string; + + /** + * @deprecated aws_account_id is the AWS account ID (deprecated: use + * cloud_account_id) + */ + awsAccountId?: string | null; + + /** + * cloud_account_id is the unified cloud account identifier (AWS Account ID or GCP + * Project ID) + */ + cloudAccountId?: string | null; + + /** + * provider is the cloud provider for this custom domain + */ + provider?: CustomDomainProvider | null; +} + +export interface CustomDomainDeleteParams { + /** + * organization_id is the ID of the organization to delete custom domain for + */ + organizationId: string; +} + +export declare namespace CustomDomains { + export { + type CustomDomain as CustomDomain, + type CustomDomainProvider as CustomDomainProvider, + type CustomDomainCreateResponse as CustomDomainCreateResponse, + type CustomDomainRetrieveResponse as CustomDomainRetrieveResponse, + type CustomDomainUpdateResponse as CustomDomainUpdateResponse, + type CustomDomainDeleteResponse as CustomDomainDeleteResponse, + type CustomDomainCreateParams as CustomDomainCreateParams, + type CustomDomainRetrieveParams as CustomDomainRetrieveParams, + type CustomDomainUpdateParams as CustomDomainUpdateParams, + type CustomDomainDeleteParams as CustomDomainDeleteParams, + }; +} diff --git a/src/resources/organizations/index.ts b/src/resources/organizations/index.ts index a023d54..0e53032 100644 --- a/src/resources/organizations/index.ts +++ b/src/resources/organizations/index.ts @@ -1,5 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { + CustomDomains, + type CustomDomain, + type CustomDomainProvider, + type CustomDomainCreateResponse, + type CustomDomainRetrieveResponse, + type CustomDomainUpdateResponse, + type CustomDomainDeleteResponse, + type CustomDomainCreateParams, + type CustomDomainRetrieveParams, + type CustomDomainUpdateParams, + type CustomDomainDeleteParams, +} from './custom-domains'; export { DomainVerifications, type DomainVerification, @@ -50,7 +63,10 @@ export { } from './organizations'; export { Policies, + type AgentPolicy, + type CrowdStrikeConfig, type OrganizationPolicies, + type SecurityAgentPolicy, type PolicyRetrieveResponse, type PolicyUpdateResponse, type PolicyRetrieveParams, diff --git a/src/resources/organizations/organizations.ts b/src/resources/organizations/organizations.ts index 6f06f14..f2cf942 100644 --- a/src/resources/organizations/organizations.ts +++ b/src/resources/organizations/organizations.ts @@ -2,6 +2,20 @@ import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; +import * as CustomDomainsAPI from './custom-domains'; +import { + CustomDomain, + CustomDomainCreateParams, + CustomDomainCreateResponse, + CustomDomainDeleteParams, + CustomDomainDeleteResponse, + CustomDomainProvider, + CustomDomainRetrieveParams, + CustomDomainRetrieveResponse, + CustomDomainUpdateParams, + CustomDomainUpdateResponse, + CustomDomains, +} from './custom-domains'; import * as DomainVerificationsAPI from './domain-verifications'; import { DomainVerification, @@ -31,12 +45,15 @@ import { } from './invites'; import * as PoliciesAPI from './policies'; import { + AgentPolicy, + CrowdStrikeConfig, OrganizationPolicies, Policies, PolicyRetrieveParams, PolicyRetrieveResponse, PolicyUpdateParams, PolicyUpdateResponse, + SecurityAgentPolicy, } from './policies'; import * as SSOConfigurationsAPI from './sso-configurations'; import { @@ -60,6 +77,7 @@ import { MembersPage, type MembersPageParams, PagePromise } from '../../core/pag import { RequestOptions } from '../../internal/request-options'; export class Organizations extends APIResource { + customDomains: CustomDomainsAPI.CustomDomains = new CustomDomainsAPI.CustomDomains(this._client); domainVerifications: DomainVerificationsAPI.DomainVerifications = new DomainVerificationsAPI.DomainVerifications(this._client); invites: InvitesAPI.Invites = new InvitesAPI.Invites(this._client); @@ -504,7 +522,7 @@ export interface Organization { name: string; /** - * The tier of the organization - free or enterprise + * The tier of the organization - free, enterprise or core */ tier: OrganizationTier; @@ -717,7 +735,9 @@ export interface OrganizationMember { export type OrganizationTier = | 'ORGANIZATION_TIER_UNSPECIFIED' | 'ORGANIZATION_TIER_FREE' - | 'ORGANIZATION_TIER_ENTERPRISE'; + | 'ORGANIZATION_TIER_ENTERPRISE' + | 'ORGANIZATION_TIER_CORE' + | 'ORGANIZATION_TIER_FREE_ONA'; export interface OrganizationCreateResponse { /** @@ -831,6 +851,11 @@ export interface OrganizationListMembersParams extends MembersPageParams { */ organizationId: string; + /** + * Body param: + */ + filter?: OrganizationListMembersParams.Filter; + /** * Body param: pagination contains the pagination options for listing members */ @@ -838,6 +863,13 @@ export interface OrganizationListMembersParams extends MembersPageParams { } export namespace OrganizationListMembersParams { + export interface Filter { + /** + * search performs case-insensitive search across member name and email + */ + search?: string; + } + /** * pagination contains the pagination options for listing members */ @@ -864,6 +896,7 @@ export interface OrganizationSetRoleParams { role?: Shared.OrganizationRole; } +Organizations.CustomDomains = CustomDomains; Organizations.DomainVerifications = DomainVerifications; Organizations.Invites = Invites; Organizations.Policies = Policies; @@ -893,6 +926,20 @@ export declare namespace Organizations { type OrganizationSetRoleParams as OrganizationSetRoleParams, }; + export { + CustomDomains as CustomDomains, + type CustomDomain as CustomDomain, + type CustomDomainProvider as CustomDomainProvider, + type CustomDomainCreateResponse as CustomDomainCreateResponse, + type CustomDomainRetrieveResponse as CustomDomainRetrieveResponse, + type CustomDomainUpdateResponse as CustomDomainUpdateResponse, + type CustomDomainDeleteResponse as CustomDomainDeleteResponse, + type CustomDomainCreateParams as CustomDomainCreateParams, + type CustomDomainRetrieveParams as CustomDomainRetrieveParams, + type CustomDomainUpdateParams as CustomDomainUpdateParams, + type CustomDomainDeleteParams as CustomDomainDeleteParams, + }; + export { DomainVerifications as DomainVerifications, type DomainVerification as DomainVerification, @@ -922,7 +969,10 @@ export declare namespace Organizations { export { Policies as Policies, + type AgentPolicy as AgentPolicy, + type CrowdStrikeConfig as CrowdStrikeConfig, type OrganizationPolicies as OrganizationPolicies, + type SecurityAgentPolicy as SecurityAgentPolicy, type PolicyRetrieveResponse as PolicyRetrieveResponse, type PolicyUpdateResponse as PolicyUpdateResponse, type PolicyRetrieveParams as PolicyRetrieveParams, diff --git a/src/resources/organizations/policies.ts b/src/resources/organizations/policies.ts index c74050a..86b9b7c 100644 --- a/src/resources/organizations/policies.ts +++ b/src/resources/organizations/policies.ts @@ -90,7 +90,67 @@ export class Policies extends APIResource { } } +/** + * AgentPolicy contains agent-specific policy settings for an organization + */ +export interface AgentPolicy { + /** + * command_deny_list contains a list of commands that agents are not allowed to + * execute + */ + commandDenyList: Array; + + /** + * mcp_disabled controls whether MCP (Model Context Protocol) is disabled for + * agents + */ + mcpDisabled: boolean; + + /** + * scm_tools_disabled controls whether SCM (Source Control Management) tools are + * disabled for agents + */ + scmToolsDisabled: boolean; +} + +/** + * CrowdStrikeConfig configures CrowdStrike Falcon sensor deployment + */ +export interface CrowdStrikeConfig { + /** + * additional*options contains additional FALCONCTL_OPT*\* options as key-value + * pairs. Keys should NOT include the FALCONCTL*OPT* prefix. + */ + additionalOptions?: { [key: string]: string }; + + /** + * cid_secret_id references an organization secret containing the Customer ID + * (CID). + */ + cidSecretId?: string; + + /** + * enabled controls whether CrowdStrike Falcon is deployed to environments + */ + enabled?: boolean; + + /** + * image is the CrowdStrike Falcon sensor container image reference + */ + image?: string; + + /** + * tags are optional tags to apply to the Falcon sensor (comma-separated) + */ + tags?: string; +} + export interface OrganizationPolicies { + /** + * agent_policy contains agent-specific policy settings + */ + agentPolicy: AgentPolicy; + /** * allowed_editor_ids is the list of editor IDs that are allowed to be used in the * organization @@ -149,12 +209,73 @@ export interface OrganizationPolicies { */ portSharingDisabled: boolean; + /** + * require_custom_domain_access controls whether users must access via custom + * domain when one is configured. When true, access via app.gitpod.io is blocked. + */ + requireCustomDomainAccess: boolean; + + /** + * delete_archived_environments_after controls how long archived environments are + * kept before automatic deletion. 0 means no automatic deletion. Maximum duration + * is 4 weeks (2419200 seconds). + */ + deleteArchivedEnvironmentsAfter?: string; + + /** + * editor_version_restrictions restricts which editor versions can be used. Maps + * editor ID to version policy, editor_version_restrictions not set means no + * restrictions. If empty or not set for an editor, we will use the latest version + * of the editor + */ + editorVersionRestrictions?: { [key: string]: OrganizationPolicies.EditorVersionRestrictions }; + + /** + * maximum_environment_lifetime controls for how long environments are allowed to + * be reused. 0 means no maximum lifetime. Maximum duration is 180 days (15552000 + * seconds). + */ + maximumEnvironmentLifetime?: string; + /** * maximum_environment_timeout controls the maximum timeout allowed for * environments in seconds. 0 means no limit (never). Minimum duration is 30 - * minutes. + * minutes (1800 seconds). */ maximumEnvironmentTimeout?: string; + + /** + * security_agent_policy contains security agent configuration for the + * organization. When configured, security agents are automatically deployed to all + * environments. + */ + securityAgentPolicy?: SecurityAgentPolicy; +} + +export namespace OrganizationPolicies { + /** + * EditorVersionPolicy defines the version policy for a specific editor + */ + export interface EditorVersionRestrictions { + /** + * allowed_versions lists the versions that are allowed If empty, we will use the + * latest version of the editor + * + * Examples for JetBrains: `["2025.2", "2025.1", "2024.3"]` + */ + allowedVersions?: Array; + } +} + +/** + * SecurityAgentPolicy contains security agent configuration for an organization. + * When enabled, security agents are automatically deployed to all environments. + */ +export interface SecurityAgentPolicy { + /** + * crowdstrike contains CrowdStrike Falcon configuration + */ + crowdstrike?: CrowdStrikeConfig; } export interface PolicyRetrieveResponse { @@ -176,6 +297,11 @@ export interface PolicyUpdateParams { */ organizationId: string; + /** + * agent_policy contains agent-specific policy settings + */ + agentPolicy?: PolicyUpdateParams.AgentPolicy | null; + /** * allowed_editor_ids is the list of editor IDs that are allowed to be used in the * organization @@ -200,6 +326,26 @@ export interface PolicyUpdateParams { */ defaultEnvironmentImage?: string | null; + /** + * delete_archived_environments_after controls how long archived environments are + * kept before automatic deletion. 0 means no automatic deletion. Maximum duration + * is 4 weeks (2419200 seconds). + */ + deleteArchivedEnvironmentsAfter?: string | null; + + /** + * editor_version_restrictions restricts which editor versions can be used. Maps + * editor ID to version policy with allowed major versions. + */ + editorVersionRestrictions?: { [key: string]: PolicyUpdateParams.EditorVersionRestrictions }; + + /** + * maximum_environment_lifetime controls for how long environments are allowed to + * be reused. 0 means no maximum lifetime. Maximum duration is 180 days (15552000 + * seconds). + */ + maximumEnvironmentLifetime?: string | null; + /** * maximum_environments_per_user limits total environments (running or stopped) per * user @@ -209,7 +355,7 @@ export interface PolicyUpdateParams { /** * maximum_environment_timeout controls the maximum timeout allowed for * environments in seconds. 0 means no limit (never). Minimum duration is 30 - * minutes. + * minutes (1800 seconds). */ maximumEnvironmentTimeout?: string | null; @@ -235,11 +381,106 @@ export interface PolicyUpdateParams { * organization */ portSharingDisabled?: boolean | null; + + /** + * require_custom_domain_access controls whether users must access via custom + * domain when one is configured. When true, access via app.gitpod.io is blocked. + */ + requireCustomDomainAccess?: boolean | null; + + /** + * security_agent_policy contains security agent configuration updates + */ + securityAgentPolicy?: PolicyUpdateParams.SecurityAgentPolicy | null; +} + +export namespace PolicyUpdateParams { + /** + * agent_policy contains agent-specific policy settings + */ + export interface AgentPolicy { + /** + * command_deny_list contains a list of commands that agents are not allowed to + * execute + */ + commandDenyList?: Array; + + /** + * mcp_disabled controls whether MCP (Model Context Protocol) is disabled for + * agents + */ + mcpDisabled?: boolean | null; + + /** + * scm_tools_disabled controls whether SCM (Source Control Management) tools are + * disabled for agents + */ + scmToolsDisabled?: boolean | null; + } + + /** + * EditorVersionPolicy defines the version policy for a specific editor + */ + export interface EditorVersionRestrictions { + /** + * allowed_versions lists the versions that are allowed If empty, we will use the + * latest version of the editor + * + * Examples for JetBrains: `["2025.2", "2025.1", "2024.3"]` + */ + allowedVersions?: Array; + } + + /** + * security_agent_policy contains security agent configuration updates + */ + export interface SecurityAgentPolicy { + /** + * crowdstrike contains CrowdStrike Falcon configuration updates + */ + crowdstrike?: SecurityAgentPolicy.Crowdstrike | null; + } + + export namespace SecurityAgentPolicy { + /** + * crowdstrike contains CrowdStrike Falcon configuration updates + */ + export interface Crowdstrike { + /** + * additional*options contains additional FALCONCTL_OPT*\* options as key-value + * pairs + */ + additionalOptions?: { [key: string]: string }; + + /** + * cid_secret_id references an organization secret containing the Customer ID (CID) + */ + cidSecretId?: string | null; + + /** + * enabled controls whether CrowdStrike Falcon is deployed to environments + */ + enabled?: boolean | null; + + /** + * image is the CrowdStrike Falcon sensor container image reference + */ + image?: string | null; + + /** + * tags are optional tags to apply to the Falcon sensor + */ + tags?: string | null; + } + } } export declare namespace Policies { export { + type AgentPolicy as AgentPolicy, + type CrowdStrikeConfig as CrowdStrikeConfig, type OrganizationPolicies as OrganizationPolicies, + type SecurityAgentPolicy as SecurityAgentPolicy, type PolicyRetrieveResponse as PolicyRetrieveResponse, type PolicyUpdateResponse as PolicyUpdateResponse, type PolicyRetrieveParams as PolicyRetrieveParams, diff --git a/src/resources/organizations/sso-configurations.ts b/src/resources/organizations/sso-configurations.ts index 88875e7..6b0a9d7 100644 --- a/src/resources/organizations/sso-configurations.ts +++ b/src/resources/organizations/sso-configurations.ts @@ -49,9 +49,9 @@ export class SSOConfigurations extends APIResource { * clientId: * '012345678-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com', * clientSecret: 'GOCSPX-abcdefghijklmnopqrstuvwxyz123456', - * emailDomain: 'acme-corp.com', * issuerUrl: 'https://accounts.google.com', * organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * emailDomain: 'acme-corp.com', * }); * ``` */ @@ -272,7 +272,11 @@ export interface SSOConfiguration { */ clientId?: string; + displayName?: string; + emailDomain?: string; + + emailDomains?: Array; } export type SSOConfigurationState = @@ -309,17 +313,21 @@ export interface SSOConfigurationCreateParams { */ clientSecret: string; - /** - * email_domain is the domain that is allowed to sign in to the organization - */ - emailDomain: string; - /** * issuer_url is the URL of the IdP issuer */ issuerUrl: string; organizationId: string; + + displayName?: string; + + /** + * email_domain is the domain that is allowed to sign in to the organization + */ + emailDomain?: string | null; + + emailDomains?: Array; } export interface SSOConfigurationRetrieveParams { @@ -350,8 +358,12 @@ export interface SSOConfigurationUpdateParams { */ clientSecret?: string | null; + displayName?: string | null; + emailDomain?: string | null; + emailDomains?: Array; + /** * issuer_url is the URL of the IdP issuer */ diff --git a/src/resources/prebuilds.ts b/src/resources/prebuilds.ts new file mode 100644 index 0000000..af5a6f1 --- /dev/null +++ b/src/resources/prebuilds.ts @@ -0,0 +1,527 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import * as PrebuildsAPI from './prebuilds'; +import * as Shared from './shared'; +import { APIPromise } from '../core/api-promise'; +import { PagePromise, PrebuildsPage, type PrebuildsPageParams } from '../core/pagination'; +import { RequestOptions } from '../internal/request-options'; + +export class Prebuilds extends APIResource { + /** + * Creates a prebuild for a project. + * + * Use this method to: + * + * - Create on-demand prebuilds for faster environment startup + * - Trigger prebuilds after repository changes + * - Generate prebuilds for specific environment classes + * + * The prebuild process creates an environment, runs the devcontainer prebuild + * lifecycle, and creates a snapshot for future environment provisioning. + * + * ### Examples + * + * - Create basic prebuild: + * + * Creates a prebuild for a project using default settings. + * + * ```yaml + * projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * spec: + * timeout: "3600s" # 60 minutes default + * ``` + * + * - Create prebuild with custom environment class: + * + * Creates a prebuild with a specific environment class and timeout. + * + * ```yaml + * projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * spec: + * timeout: "3600s" # 1 hour + * ``` + * + * @example + * ```ts + * const prebuild = await client.prebuilds.create({ + * projectId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * spec: { timeout: '3600s' }, + * }); + * ``` + */ + create(body: PrebuildCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.PrebuildService/CreatePrebuild', { body, ...options }); + } + + /** + * Gets details about a specific prebuild. + * + * Use this method to: + * + * - Check prebuild status and progress + * - Access prebuild logs for debugging + * + * ### Examples + * + * - Get prebuild details: + * + * Retrieves comprehensive information about a prebuild. + * + * ```yaml + * prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048" + * ``` + * + * @example + * ```ts + * const prebuild = await client.prebuilds.retrieve({ + * prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048', + * }); + * ``` + */ + retrieve(body: PrebuildRetrieveParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.PrebuildService/GetPrebuild', { body, ...options }); + } + + /** + * ListPrebuilds + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const prebuild of client.prebuilds.list()) { + * // ... + * } + * ``` + */ + list(params: PrebuildListParams, options?: RequestOptions): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList('/gitpod.v1.PrebuildService/ListPrebuilds', PrebuildsPage, { + query: { token, pageSize }, + body, + method: 'post', + ...options, + }); + } + + /** + * Deletes a prebuild. + * + * Prebuilds are automatically deleted after some time. Use this method to manually + * delete a prebuild before automatic cleanup, for example to remove a prebuild + * that should no longer be used. + * + * Deletion is processed asynchronously. The prebuild will be marked for deletion + * and removed from the system in the background. + * + * ### Examples + * + * - Delete prebuild: + * + * Marks a prebuild for deletion and removes it from the system. + * + * ```yaml + * prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048" + * ``` + * + * @example + * ```ts + * const prebuild = await client.prebuilds.delete({ + * prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048', + * }); + * ``` + */ + delete(body: PrebuildDeleteParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.PrebuildService/DeletePrebuild', { body, ...options }); + } + + /** + * Cancels a running prebuild. + * + * Use this method to: + * + * - Stop prebuilds that are no longer needed + * - Free up resources for other operations + * + * ### Examples + * + * - Cancel prebuild: + * + * Stops a running prebuild and cleans up resources. + * + * ```yaml + * prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048" + * ``` + * + * @example + * ```ts + * const response = await client.prebuilds.cancel({ + * prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048', + * }); + * ``` + */ + cancel(body: PrebuildCancelParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.PrebuildService/CancelPrebuild', { body, ...options }); + } + + /** + * Creates a logs access token for a prebuild. + * + * Use this method to: + * + * - Stream logs from a running prebuild + * - Access archived logs from completed prebuilds + * + * Generated tokens are valid for one hour. + * + * ### Examples + * + * - Create prebuild logs token: + * + * Generates a token for accessing prebuild logs. + * + * ```yaml + * prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048" + * ``` + * + * @example + * ```ts + * const response = await client.prebuilds.createLogsToken({ + * prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048', + * }); + * ``` + */ + createLogsToken( + body: PrebuildCreateLogsTokenParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.PrebuildService/CreatePrebuildLogsToken', { body, ...options }); + } +} + +export type PrebuildsPrebuildsPage = PrebuildsPage; + +/** + * Prebuild represents a prebuild for a project that creates a snapshot for faster + * environment startup times. + */ +export interface Prebuild { + /** + * metadata contains organizational and ownership information + */ + metadata: PrebuildMetadata; + + /** + * spec contains the configuration used to create this prebuild + */ + spec: PrebuildSpec; + + /** + * status contains the current status and progress of the prebuild + */ + status: PrebuildStatus; + + /** + * id is the unique identifier for the prebuild + */ + id?: string; +} + +/** + * PrebuildMetadata contains metadata about the prebuild + */ +export interface PrebuildMetadata { + /** + * created_at is when the prebuild was created + */ + createdAt: string; + + /** + * creator is the identity of who created the prebuild. For manual prebuilds, this + * is the user who triggered it. For scheduled prebuilds, this is the configured + * executor. + */ + creator: Shared.Subject; + + /** + * updated_at is when the prebuild was last updated + */ + updatedAt: string; + + /** + * environment_class_id is the environment class used to create this prebuild. + * While the prebuild is created with a specific environment class, environments + * with different classes (e.g., smaller or larger instance sizes) can be created + * from the same prebuild, as long as they run on the same runner. If not specified + * in create requests, uses the project's default environment class. + */ + environmentClassId?: string; + + /** + * executor is the identity used to run the prebuild. The executor's SCM + * credentials are used to clone the repository. If not set, the creator's identity + * is used. + */ + executor?: Shared.Subject; + + /** + * organization_id is the ID of the organization that owns the prebuild + */ + organizationId?: string; + + /** + * project_id is the ID of the project this prebuild was created for + */ + projectId?: string; + + /** + * trigger describes the trigger that created this prebuild. + */ + triggeredBy?: PrebuildTrigger; +} + +/** + * PrebuildPhase represents the lifecycle phase of a prebuild + */ +export type PrebuildPhase = + | 'PREBUILD_PHASE_UNSPECIFIED' + | 'PREBUILD_PHASE_PENDING' + | 'PREBUILD_PHASE_STARTING' + | 'PREBUILD_PHASE_RUNNING' + | 'PREBUILD_PHASE_STOPPING' + | 'PREBUILD_PHASE_SNAPSHOTTING' + | 'PREBUILD_PHASE_COMPLETED' + | 'PREBUILD_PHASE_FAILED' + | 'PREBUILD_PHASE_CANCELLING' + | 'PREBUILD_PHASE_CANCELLED' + | 'PREBUILD_PHASE_DELETING' + | 'PREBUILD_PHASE_DELETED'; + +/** + * PrebuildSpec contains the configuration used to create a prebuild + */ +export interface PrebuildSpec { + /** + * desired_phase is the desired phase of the prebuild. Used to signal cancellation + * or other state changes. This field is managed by the API and reconciler. + */ + desiredPhase?: PrebuildPhase; + + /** + * spec_version is incremented each time the spec is updated. Used for optimistic + * concurrency control. + */ + specVersion?: string; + + /** + * timeout is the maximum time allowed for the prebuild to complete. Defaults to 60 + * minutes if not specified. Maximum allowed timeout is 2 hours. + */ + timeout?: string; +} + +/** + * PrebuildStatus contains the current status and progress of a prebuild + */ +export interface PrebuildStatus { + /** + * phase is the current phase of the prebuild lifecycle + */ + phase: PrebuildPhase; + + /** + * completion_time is when the prebuild completed (successfully or with failure) + */ + completionTime?: string; + + /** + * environment_id is the ID of the environment used to create this prebuild. This + * field is set when the prebuild environment is created. + */ + environmentId?: string; + + /** + * failure_message contains details about why the prebuild failed + */ + failureMessage?: string; + + /** + * log_url provides access to prebuild logs. During prebuild execution, this + * references the environment logs. After completion, this may reference archived + * logs. + */ + logUrl?: string; + + /** + * status_version is incremented each time the status is updated. Used for + * optimistic concurrency control. + */ + statusVersion?: string; + + /** + * warning_message contains warnings from the prebuild environment that indicate + * something went wrong but the prebuild could still complete. For example, the + * devcontainer failed to build but the environment is still usable. These warnings + * will likely affect any environment started from this prebuild. + */ + warningMessage?: string; +} + +/** + * PrebuildTrigger indicates how the prebuild was triggered + */ +export type PrebuildTrigger = + | 'PREBUILD_TRIGGER_UNSPECIFIED' + | 'PREBUILD_TRIGGER_MANUAL' + | 'PREBUILD_TRIGGER_SCHEDULED'; + +export interface PrebuildCreateResponse { + /** + * Prebuild represents a prebuild for a project that creates a snapshot for faster + * environment startup times. + */ + prebuild: Prebuild; +} + +export interface PrebuildRetrieveResponse { + /** + * Prebuild represents a prebuild for a project that creates a snapshot for faster + * environment startup times. + */ + prebuild: Prebuild; +} + +export type PrebuildDeleteResponse = unknown; + +export interface PrebuildCancelResponse { + /** + * Prebuild represents a prebuild for a project that creates a snapshot for faster + * environment startup times. + */ + prebuild: Prebuild; +} + +export interface PrebuildCreateLogsTokenResponse { + /** + * access_token is the token that can be used to access the logs of the prebuild + */ + accessToken: string; +} + +export interface PrebuildCreateParams { + /** + * project_id specifies the project to create a prebuild for + */ + projectId: string; + + /** + * spec contains the configuration for creating the prebuild + */ + spec: PrebuildSpec; + + /** + * environment_class_id specifies which environment class to use for the prebuild. + * If not specified, uses the project's default environment class. + */ + environmentClassId?: string | null; +} + +export interface PrebuildRetrieveParams { + /** + * prebuild_id specifies the prebuild to retrieve + */ + prebuildId: string; +} + +export interface PrebuildListParams extends PrebuildsPageParams { + /** + * Body param: filter contains the filter options for listing prebuilds + */ + filter?: PrebuildListParams.Filter; + + /** + * Body param: pagination contains the pagination options for listing prebuilds + */ + pagination?: PrebuildListParams.Pagination; +} + +export namespace PrebuildListParams { + /** + * filter contains the filter options for listing prebuilds + */ + export interface Filter { + /** + * phases filters prebuilds by their current phase + */ + phases?: Array; + + /** + * project_ids filters prebuilds to specific projects + */ + projectIds?: Array; + } + + /** + * pagination contains the pagination options for listing prebuilds + */ + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + +export interface PrebuildDeleteParams { + /** + * prebuild_id specifies the prebuild to delete + */ + prebuildId: string; +} + +export interface PrebuildCancelParams { + /** + * prebuild_id specifies the prebuild to cancel + */ + prebuildId: string; +} + +export interface PrebuildCreateLogsTokenParams { + /** + * prebuild_id specifies the prebuild for which the logs token should be created. + * + * +required + */ + prebuildId: string; +} + +export declare namespace Prebuilds { + export { + type Prebuild as Prebuild, + type PrebuildMetadata as PrebuildMetadata, + type PrebuildPhase as PrebuildPhase, + type PrebuildSpec as PrebuildSpec, + type PrebuildStatus as PrebuildStatus, + type PrebuildTrigger as PrebuildTrigger, + type PrebuildCreateResponse as PrebuildCreateResponse, + type PrebuildRetrieveResponse as PrebuildRetrieveResponse, + type PrebuildDeleteResponse as PrebuildDeleteResponse, + type PrebuildCancelResponse as PrebuildCancelResponse, + type PrebuildCreateLogsTokenResponse as PrebuildCreateLogsTokenResponse, + type PrebuildsPrebuildsPage as PrebuildsPrebuildsPage, + type PrebuildCreateParams as PrebuildCreateParams, + type PrebuildRetrieveParams as PrebuildRetrieveParams, + type PrebuildListParams as PrebuildListParams, + type PrebuildDeleteParams as PrebuildDeleteParams, + type PrebuildCancelParams as PrebuildCancelParams, + type PrebuildCreateLogsTokenParams as PrebuildCreateLogsTokenParams, + }; +} diff --git a/src/resources/projects/environment-clases.ts b/src/resources/projects/environment-clases.ts new file mode 100644 index 0000000..728168b --- /dev/null +++ b/src/resources/projects/environment-clases.ts @@ -0,0 +1,156 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as Shared from '../shared'; +import { ProjectEnvironmentClassesProjectEnvironmentClassesPage } from '../shared'; +import { APIPromise } from '../../core/api-promise'; +import { + PagePromise, + ProjectEnvironmentClassesPage, + type ProjectEnvironmentClassesPageParams, +} from '../../core/pagination'; +import { RequestOptions } from '../../internal/request-options'; + +export class EnvironmentClases extends APIResource { + /** + * Updates all environment classes of a project. + * + * Use this method to: + * + * - Modify all environment classea of a project + * + * ### Examples + * + * - Update project environment classes: + * + * Updates all environment classes for a project. + * + * ```yaml + * projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * projectEnvironmentClasses: + * - environmentClassId: "b0e12f6c-4c67-429d-a4a6-d9838b5da041" + * order: 0 + * - localRunner: true + * order: 1 + * ``` + * + * @example + * ```ts + * const environmentClase = + * await client.projects.environmentClases.update({ + * projectEnvironmentClasses: [ + * { + * environmentClassId: + * 'b0e12f6c-4c67-429d-a4a6-d9838b5da041', + * order: 0, + * }, + * { localRunner: true, order: 1 }, + * ], + * projectId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * }); + * ``` + */ + update(body: EnvironmentClaseUpdateParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.ProjectService/UpdateProjectEnvironmentClasses', { + body, + ...options, + }); + } + + /** + * Lists environment classes of a project. + * + * Use this method to: + * + * - View all environment classes of a project + * + * ### Examples + * + * - List project environment classes: + * + * Shows all environment classes of a project. + * + * ```yaml + * projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" + * pagination: + * pageSize: 20 + * ``` + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const projectEnvironmentClass of client.projects.environmentClases.list( + * { + * pagination: { pageSize: 20 }, + * projectId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + * }, + * )) { + * // ... + * } + * ``` + */ + list( + params: EnvironmentClaseListParams, + options?: RequestOptions, + ): PagePromise { + const { token, pageSize, ...body } = params; + return this._client.getAPIList( + '/gitpod.v1.ProjectService/ListProjectEnvironmentClasses', + ProjectEnvironmentClassesPage, + { query: { token, pageSize }, body, method: 'post', ...options }, + ); + } +} + +export type EnvironmentClaseUpdateResponse = unknown; + +export interface EnvironmentClaseUpdateParams { + projectEnvironmentClasses?: Array; + + /** + * project_id specifies the project identifier + */ + projectId?: string; +} + +export interface EnvironmentClaseListParams extends ProjectEnvironmentClassesPageParams { + /** + * Body param: pagination contains the pagination options for listing project + * policies + */ + pagination?: EnvironmentClaseListParams.Pagination; + + /** + * Body param: project_id specifies the project identifier + */ + projectId?: string; +} + +export namespace EnvironmentClaseListParams { + /** + * pagination contains the pagination options for listing project policies + */ + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + +export declare namespace EnvironmentClases { + export { + type EnvironmentClaseUpdateResponse as EnvironmentClaseUpdateResponse, + type EnvironmentClaseUpdateParams as EnvironmentClaseUpdateParams, + type EnvironmentClaseListParams as EnvironmentClaseListParams, + }; +} + +export { type ProjectEnvironmentClassesProjectEnvironmentClassesPage }; diff --git a/src/resources/projects/index.ts b/src/resources/projects/index.ts index 0dc0a82..14efa77 100644 --- a/src/resources/projects/index.ts +++ b/src/resources/projects/index.ts @@ -1,5 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { + EnvironmentClases, + type EnvironmentClaseUpdateResponse, + type EnvironmentClaseUpdateParams, + type EnvironmentClaseListParams, +} from './environment-clases'; export { Policies, type ProjectPolicy, @@ -17,8 +23,9 @@ export { Projects, type EnvironmentInitializer, type Project, - type ProjectEnvironmentClass, type ProjectMetadata, + type ProjectPhase, + type ProjectPrebuildConfiguration, type ProjectCreateResponse, type ProjectRetrieveResponse, type ProjectUpdateResponse, diff --git a/src/resources/projects/projects.ts b/src/resources/projects/projects.ts index 25e1df1..b7d4d83 100644 --- a/src/resources/projects/projects.ts +++ b/src/resources/projects/projects.ts @@ -2,6 +2,13 @@ import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; +import * as EnvironmentClasesAPI from './environment-clases'; +import { + EnvironmentClaseListParams, + EnvironmentClaseUpdateParams, + EnvironmentClaseUpdateResponse, + EnvironmentClases, +} from './environment-clases'; import * as PoliciesAPI from './policies'; import { Policies, @@ -21,6 +28,9 @@ import { PagePromise, ProjectsPage, type ProjectsPageParams } from '../../core/p import { RequestOptions } from '../../internal/request-options'; export class Projects extends APIResource { + environmentClases: EnvironmentClasesAPI.EnvironmentClases = new EnvironmentClasesAPI.EnvironmentClases( + this._client, + ); policies: PoliciesAPI.Policies = new PoliciesAPI.Policies(this._client); /** @@ -41,8 +51,6 @@ export class Projects extends APIResource { * * ```yaml * name: "Web Application" - * environmentClass: - * environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" * initializer: * specs: * - git: @@ -55,8 +63,6 @@ export class Projects extends APIResource { * * ```yaml * name: "Backend Service" - * environmentClass: - * environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" * initializer: * specs: * - git: @@ -68,10 +74,6 @@ export class Projects extends APIResource { * @example * ```ts * const project = await client.projects.create({ - * environmentClass: { - * environmentClassId: - * 'd2c94c27-3b76-4a42-b88c-95a85e392c68', - * }, * initializer: { * specs: [ * { git: { remoteUri: 'https://github.com/org/repo' } }, @@ -124,6 +126,7 @@ export class Projects extends APIResource { * - Update environment class * - Change project name * - Configure initializers + * - Configure prebuild settings * * ### Examples * @@ -136,22 +139,32 @@ export class Projects extends APIResource { * name: "New Project Name" * ``` * - * - Update environment class: + * - Enable prebuilds with daily schedule: * - * Changes the project's environment class. + * Configures prebuilds to run daily at 2 AM UTC. * * ```yaml * projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" - * environmentClass: - * environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * prebuildConfiguration: + * enabled: true + * environmentClassIds: + * - "b0e12f6c-4c67-429d-a4a6-d9838b5da041" + * timeout: "3600s" + * trigger: + * dailySchedule: + * hourUtc: 2 * ``` * * @example * ```ts * const project = await client.projects.update({ - * environmentClass: { - * environmentClassId: - * 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * prebuildConfiguration: { + * enabled: true, + * environmentClassIds: [ + * 'b0e12f6c-4c67-429d-a4a6-d9838b5da041', + * ], + * timeout: '3600s', + * trigger: { dailySchedule: { hourUtc: 2 } }, * }, * projectId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', * }); @@ -316,7 +329,8 @@ export namespace EnvironmentInitializer { | 'CLONE_TARGET_MODE_REMOTE_HEAD' | 'CLONE_TARGET_MODE_REMOTE_COMMIT' | 'CLONE_TARGET_MODE_REMOTE_BRANCH' - | 'CLONE_TARGET_MODE_LOCAL_BRANCH'; + | 'CLONE_TARGET_MODE_LOCAL_BRANCH' + | 'CLONE_TARGET_MODE_REMOTE_TAG'; /** * upstream_Remote_uri is the fork upstream of a repository @@ -327,7 +341,10 @@ export namespace EnvironmentInitializer { } export interface Project { - environmentClass: ProjectEnvironmentClass; + /** + * @deprecated Use `environment_classes` instead. + */ + environmentClass: Shared.ProjectEnvironmentClass; /** * id is the unique identifier for the project @@ -340,12 +357,23 @@ export interface Project { */ automationsFilePath?: string; + /** + * desired_phase is the desired phase of the project When set to DELETED, the + * project is pending deletion + */ + desiredPhase?: ProjectPhase; + /** * devcontainer_file_path is the path to the devcontainer file relative to the repo * root */ devcontainerFilePath?: string; + /** + * environment_classes is the list of environment classes for the project + */ + environmentClasses?: Array; + /** * initializer is the content initializer */ @@ -353,6 +381,11 @@ export interface Project { metadata?: ProjectMetadata; + /** + * prebuild_configuration defines how prebuilds are created for this project. + */ + prebuildConfiguration?: ProjectPrebuildConfiguration; + /** * technical_description is a detailed technical description of the project This * field is not returned by default in GetProject or ListProjects responses @@ -377,19 +410,6 @@ export namespace Project { } } -export interface ProjectEnvironmentClass { - /** - * Use a fixed environment class on a given Runner. This cannot be a local runner's - * environment class. - */ - environmentClassId?: string; - - /** - * Use a local runner for the user - */ - localRunner?: boolean; -} - export interface ProjectMetadata { /** * A Timestamp represents a point in time independent of any time zone or local @@ -591,6 +611,78 @@ export interface ProjectMetadata { updatedAt?: string; } +export type ProjectPhase = 'PROJECT_PHASE_UNSPECIFIED' | 'PROJECT_PHASE_ACTIVE' | 'PROJECT_PHASE_DELETED'; + +/** + * ProjectPrebuildConfiguration defines how prebuilds are created for a project. + * Prebuilds create environment snapshots that enable faster environment startup + * times. + */ +export interface ProjectPrebuildConfiguration { + /** + * enabled controls whether prebuilds are created for this project. When disabled, + * no automatic prebuilds will be triggered. + */ + enabled?: boolean; + + /** + * enable_jetbrains_warmup controls whether JetBrains IDE warmup runs during + * prebuilds. + */ + enableJetbrainsWarmup?: boolean; + + /** + * environment_class_ids specifies which environment classes should have prebuilds + * created. If empty, no prebuilds are created. + */ + environmentClassIds?: Array; + + /** + * executor specifies who runs prebuilds for this project. The executor's SCM + * credentials are used to clone the repository. If not set, defaults to the + * project creator. + */ + executor?: Shared.Subject; + + /** + * timeout is the maximum duration allowed for a prebuild to complete. If not + * specified, defaults to 1 hour. Must be between 5 minutes and 2 hours. + */ + timeout?: string; + + /** + * trigger defines when prebuilds should be created. + */ + trigger?: ProjectPrebuildConfiguration.Trigger; +} + +export namespace ProjectPrebuildConfiguration { + /** + * trigger defines when prebuilds should be created. + */ + export interface Trigger { + /** + * daily_schedule triggers a prebuild once per day at the specified hour (UTC). The + * actual start time may vary slightly to distribute system load. + */ + dailySchedule: Trigger.DailySchedule; + } + + export namespace Trigger { + /** + * daily_schedule triggers a prebuild once per day at the specified hour (UTC). The + * actual start time may vary slightly to distribute system load. + */ + export interface DailySchedule { + /** + * hour_utc is the hour of day (0-23) in UTC when the prebuild should start. The + * actual start time may be adjusted by a few minutes to balance system load. + */ + hourUtc?: number; + } + } +} + export interface ProjectCreateResponse { project?: Project; } @@ -610,8 +702,6 @@ export interface ProjectCreateFromEnvironmentResponse { } export interface ProjectCreateParams { - environmentClass: ProjectEnvironmentClass; - /** * initializer is the content initializer */ @@ -639,6 +729,12 @@ export interface ProjectCreateParams { name?: string; + /** + * prebuild_configuration defines how prebuilds are created for this project. If + * not set, prebuilds are disabled for the project. + */ + prebuildConfiguration?: ProjectPrebuildConfiguration; + /** * technical_description is a detailed technical description of the project This * field is not returned by default in GetProject or ListProjects responses 8KB max @@ -674,8 +770,6 @@ export interface ProjectUpdateParams { */ devcontainerFilePath?: string | null; - environmentClass?: ProjectEnvironmentClass | null; - /** * initializer is the content initializer */ @@ -683,6 +777,13 @@ export interface ProjectUpdateParams { name?: string | null; + /** + * prebuild_configuration defines how prebuilds are created for this project. If + * not provided, the existing prebuild configuration is not modified. To disable + * prebuilds, set enabled to false. + */ + prebuildConfiguration?: ProjectPrebuildConfiguration | null; + /** * project_id specifies the project identifier */ @@ -713,6 +814,18 @@ export namespace ProjectListParams { * project_ids filters the response to only projects with these IDs */ projectIds?: Array; + + /** + * runner_ids filters the response to only projects that use environment classes + * from these runners + */ + runnerIds?: Array; + + /** + * search performs case-insensitive search across project name, project ID, and + * repository name + */ + search?: string; } /** @@ -749,14 +862,16 @@ export interface ProjectCreateFromEnvironmentParams { name?: string; } +Projects.EnvironmentClases = EnvironmentClases; Projects.Policies = Policies; export declare namespace Projects { export { type EnvironmentInitializer as EnvironmentInitializer, type Project as Project, - type ProjectEnvironmentClass as ProjectEnvironmentClass, type ProjectMetadata as ProjectMetadata, + type ProjectPhase as ProjectPhase, + type ProjectPrebuildConfiguration as ProjectPrebuildConfiguration, type ProjectCreateResponse as ProjectCreateResponse, type ProjectRetrieveResponse as ProjectRetrieveResponse, type ProjectUpdateResponse as ProjectUpdateResponse, @@ -771,6 +886,13 @@ export declare namespace Projects { type ProjectCreateFromEnvironmentParams as ProjectCreateFromEnvironmentParams, }; + export { + EnvironmentClases as EnvironmentClases, + type EnvironmentClaseUpdateResponse as EnvironmentClaseUpdateResponse, + type EnvironmentClaseUpdateParams as EnvironmentClaseUpdateParams, + type EnvironmentClaseListParams as EnvironmentClaseListParams, + }; + export { Policies as Policies, type ProjectPolicy as ProjectPolicy, diff --git a/src/resources/runners/configurations/configurations.ts b/src/resources/runners/configurations/configurations.ts index e77550d..4db5ee0 100644 --- a/src/resources/runners/configurations/configurations.ts +++ b/src/resources/runners/configurations/configurations.ts @@ -195,6 +195,14 @@ export namespace ConfigurationValidateParams { * integration is for */ scmId?: string; + + /** + * virtual_directory is the virtual directory path for Azure DevOps Server (e.g., + * "/tfs"). This field is only used for Azure DevOps Server SCM integrations and + * should be empty for other SCM types. Azure DevOps Server APIs work without + * collection when PAT scope is 'All accessible organizations'. + */ + virtualDirectory?: string | null; } } diff --git a/src/resources/runners/configurations/host-authentication-tokens.ts b/src/resources/runners/configurations/host-authentication-tokens.ts index 5a538a9..4ad2b74 100644 --- a/src/resources/runners/configurations/host-authentication-tokens.ts +++ b/src/resources/runners/configurations/host-authentication-tokens.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; +import * as Shared from '../../shared'; import { APIPromise } from '../../../core/api-promise'; import { PagePromise, TokensPage, type TokensPageParams } from '../../../core/pagination'; import { RequestOptions } from '../../../internal/request-options'; @@ -328,10 +329,34 @@ export interface HostAuthenticationToken { host?: string; + /** + * links to integration instance + */ + integrationId?: string; + runnerId?: string; + /** + * token permissions + */ + scopes?: Array; + + /** + * auth_type + */ source?: HostAuthenticationTokenSource; + /** + * Subject identifies the principal (user or service account) for the token Note: + * actual token and refresh_token values are retrieved via + * GetHostAuthenticationTokenValue API + */ + subject?: Shared.Subject; + + /** + * @deprecated Deprecated: Use principal_id and principal_type instead principal + * (user) + */ userId?: string; } @@ -353,6 +378,9 @@ export type HostAuthenticationTokenUpdateResponse = unknown; export type HostAuthenticationTokenDeleteResponse = unknown; export interface HostAuthenticationTokenCreateParams { + /** + * stored encrypted, retrieved via GetHostAuthenticationTokenValue + */ token?: string; /** @@ -449,12 +477,30 @@ export interface HostAuthenticationTokenCreateParams { host?: string; + integrationId?: string; + + /** + * stored encrypted, retrieved via GetHostAuthenticationTokenValue + */ refreshToken?: string; runnerId?: string; + /** + * Maximum 100 scopes allowed (101 for validation purposes) + */ + scopes?: Array; + source?: HostAuthenticationTokenSource; + /** + * Subject identifies the principal (user or service account) for the token + */ + subject?: Shared.Subject; + + /** + * @deprecated Deprecated: Use principal_id and principal_type instead + */ userId?: string; } @@ -560,6 +606,8 @@ export interface HostAuthenticationTokenUpdateParams { expiresAt?: string | null; refreshToken?: string | null; + + scopes?: Array; } export interface HostAuthenticationTokenListParams extends TokensPageParams { @@ -578,6 +626,14 @@ export namespace HostAuthenticationTokenListParams { export interface Filter { runnerId?: string | null; + /** + * Filter by subject (user or service account) + */ + subjectId?: string | null; + + /** + * @deprecated Deprecated: Use principal_id instead + */ userId?: string | null; } diff --git a/src/resources/runners/configurations/scm-integrations.ts b/src/resources/runners/configurations/scm-integrations.ts index b458f97..7c19374 100644 --- a/src/resources/runners/configurations/scm-integrations.ts +++ b/src/resources/runners/configurations/scm-integrations.ts @@ -232,6 +232,14 @@ export interface ScmIntegration { * integration is for */ scmId?: string; + + /** + * virtual_directory is the virtual directory path for Azure DevOps Server (e.g., + * "/tfs"). This field is only used for Azure DevOps Server SCM integrations and + * should be empty for other SCM types. Azure DevOps Server APIs work without + * collection when PAT scope is 'All accessible organizations'. + */ + virtualDirectory?: string | null; } export interface ScmIntegrationOAuthConfig { @@ -300,6 +308,14 @@ export interface ScmIntegrationCreateParams { * integration is for */ scmId?: string; + + /** + * virtual_directory is the virtual directory path for Azure DevOps Server (e.g., + * "/tfs"). This field is only used for Azure DevOps Server SCM integrations and + * should be empty for other SCM types. Azure DevOps Server APIs work without + * collection when PAT scope is 'All accessible organizations'. + */ + virtualDirectory?: string | null; } export interface ScmIntegrationRetrieveParams { @@ -340,6 +356,14 @@ export interface ScmIntegrationUpdateParams { * re-authenticate. */ pat?: boolean | null; + + /** + * virtual_directory is the virtual directory path for Azure DevOps Server (e.g., + * "/tfs"). This field is only used for Azure DevOps Server SCM integrations and + * should be empty for other SCM types. Azure DevOps Server APIs work without + * collection when PAT scope is 'All accessible organizations'. + */ + virtualDirectory?: string | null; } export interface ScmIntegrationListParams extends IntegrationsPageParams { diff --git a/src/resources/runners/index.ts b/src/resources/runners/index.ts index be65dbf..a28c3f8 100644 --- a/src/resources/runners/index.ts +++ b/src/resources/runners/index.ts @@ -35,20 +35,26 @@ export { type RunnerReleaseChannel, type RunnerSpec, type RunnerStatus, + type RunnerVariant, + type SearchMode, type RunnerCreateResponse, type RunnerRetrieveResponse, type RunnerUpdateResponse, type RunnerDeleteResponse, type RunnerCheckAuthenticationForHostResponse, + type RunnerCreateLogsTokenResponse, type RunnerCreateRunnerTokenResponse, type RunnerParseContextURLResponse, + type RunnerSearchRepositoriesResponse, type RunnerCreateParams, type RunnerRetrieveParams, type RunnerUpdateParams, type RunnerListParams, type RunnerDeleteParams, type RunnerCheckAuthenticationForHostParams, + type RunnerCreateLogsTokenParams, type RunnerCreateRunnerTokenParams, type RunnerParseContextURLParams, + type RunnerSearchRepositoriesParams, type RunnersRunnersPage, } from './runners'; diff --git a/src/resources/runners/runners.ts b/src/resources/runners/runners.ts index e7eaa88..aa02a4c 100644 --- a/src/resources/runners/runners.ts +++ b/src/resources/runners/runners.ts @@ -287,6 +287,35 @@ export class Runners extends APIResource { return this._client.post('/gitpod.v1.RunnerService/CheckAuthenticationForHost', { body, ...options }); } + /** + * Creates an access token for runner logs and debug information. + * + * Generated tokens are valid for one hour and provide runner-specific access + * permissions. The token is scoped to a specific runner and can be used to access + * support bundles. + * + * ### Examples + * + * - Generate runner logs token: + * + * ```yaml + * runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * ``` + * + * @example + * ```ts + * const response = await client.runners.createLogsToken({ + * runnerId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * }); + * ``` + */ + createLogsToken( + body: RunnerCreateLogsTokenParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.RunnerService/CreateRunnerLogsToken', { body, ...options }); + } + /** * Creates a new authentication token for a runner. * @@ -361,6 +390,52 @@ export class Runners extends APIResource { ): APIPromise { return this._client.post('/gitpod.v1.RunnerService/ParseContextURL', { body, ...options }); } + + /** + * Searches for repositories across all authenticated SCM hosts. + * + * Use this method to: + * + * - List available repositories + * - Search repositories by name or content + * - Discover repositories for environment creation + * + * Returns repositories from all authenticated SCM hosts in natural sort order. If + * no repositories are found, returns an empty list. + * + * ### Examples + * + * - List all repositories: + * + * Returns up to 25 repositories from all authenticated hosts. + * + * ```yaml + * runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * ``` + * + * - Search repositories: + * + * Searches for repositories matching the query across all hosts. + * + * ```yaml + * runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" + * searchString: "my-project" + * limit: 10 + * ``` + * + * @example + * ```ts + * const response = await client.runners.searchRepositories({ + * runnerId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', + * }); + * ``` + */ + searchRepositories( + body: RunnerSearchRepositoriesParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/gitpod.v1.RunnerService/SearchRepositories', { body, ...options }); + } } export type RunnersRunnersPage = RunnersPage; @@ -434,6 +509,12 @@ export interface Runner { runnerId?: string; + /** + * The runner manager id specifies the runner manager for the managed runner. This + * field is only set for managed runners. + */ + runnerManagerId?: string; + /** * The runner's specification */ @@ -456,7 +537,8 @@ export type RunnerCapability = | 'RUNNER_CAPABILITY_SECRET_CONTAINER_REGISTRY' | 'RUNNER_CAPABILITY_AGENT_EXECUTION' | 'RUNNER_CAPABILITY_ALLOW_ENV_TOKEN_POPULATION' - | 'RUNNER_CAPABILITY_DEFAULT_DEV_CONTAINER_IMAGE'; + | 'RUNNER_CAPABILITY_DEFAULT_DEV_CONTAINER_IMAGE' + | 'RUNNER_CAPABILITY_ENVIRONMENT_SNAPSHOT'; export interface RunnerConfiguration { /** @@ -467,7 +549,7 @@ export interface RunnerConfiguration { /** * devcontainer_image_cache_enabled controls whether the devcontainer build cache * is enabled for this runner. Only takes effect on supported runners, currently - * only AWS EC2 runners. + * only AWS EC2 and Gitpod-managed runners. */ devcontainerImageCacheEnabled?: boolean; @@ -525,7 +607,8 @@ export type RunnerProvider = | 'RUNNER_PROVIDER_AWS_EC2' | 'RUNNER_PROVIDER_LINUX_HOST' | 'RUNNER_PROVIDER_DESKTOP_MAC' - | 'RUNNER_PROVIDER_MANAGED'; + | 'RUNNER_PROVIDER_MANAGED' + | 'RUNNER_PROVIDER_GCP'; export type RunnerReleaseChannel = | 'RUNNER_RELEASE_CHANNEL_UNSPECIFIED' @@ -542,6 +625,11 @@ export interface RunnerSpec { * RunnerPhase represents the phase a runner is in */ desiredPhase?: RunnerPhase; + + /** + * The runner's variant + */ + variant?: RunnerVariant; } /** @@ -564,6 +652,11 @@ export interface RunnerStatus { */ gatewayInfo?: GatewayInfo; + /** + * llm_url is the URL of the LLM service to which the runner is connected. + */ + llmUrl?: string; + logUrl?: string; /** @@ -577,11 +670,23 @@ export interface RunnerStatus { */ phase?: RunnerPhase; + /** + * public_key is the runner's public key used for encryption (32 bytes) + */ + publicKey?: string; + /** * region is the region the runner is running in, if applicable. */ region?: string; + /** + * support_bundle_url is the URL at which the runner support bundle can be + * accessed. This URL provides access to pprof profiles and other debug + * information. Only available for standalone runners. + */ + supportBundleUrl?: string; + systemDetails?: string; /** @@ -592,6 +697,13 @@ export interface RunnerStatus { version?: string; } +export type RunnerVariant = + | 'RUNNER_VARIANT_UNSPECIFIED' + | 'RUNNER_VARIANT_STANDARD' + | 'RUNNER_VARIANT_ENTERPRISE'; + +export type SearchMode = 'SEARCH_MODE_UNSPECIFIED' | 'SEARCH_MODE_KEYWORD' | 'SEARCH_MODE_NATIVE'; + export interface RunnerCreateResponse { runner: Runner; @@ -696,6 +808,14 @@ export namespace RunnerCheckAuthenticationForHostResponse { } } +export interface RunnerCreateLogsTokenResponse { + /** + * access_token is the token that can be used to access the logs and support bundle + * of the runner + */ + accessToken: string; +} + export interface RunnerCreateRunnerTokenResponse { /** * @deprecated deprecated, will be removed. Use exchange_token instead. @@ -713,12 +833,32 @@ export interface RunnerCreateRunnerTokenResponse { export interface RunnerParseContextURLResponse { git?: RunnerParseContextURLResponse.Git; + issue?: RunnerParseContextURLResponse.Issue; + originalContextUrl?: string; + /** + * @deprecated Deprecated: Use top-level PullRequest message instead + */ + pr?: RunnerParseContextURLResponse.Pr; + /** * project_ids is a list of projects to which the context URL belongs to. */ projectIds?: Array; + + /** + * PullRequest represents pull request metadata from source control systems. This + * message is used across workflow triggers, executions, and agent contexts to + * maintain consistent PR information throughout the system. + */ + pullRequest?: RunnerParseContextURLResponse.PullRequest; + + /** + * scm_id is the unique identifier of the SCM provider (e.g., "github", "gitlab", + * "bitbucket") + */ + scmId?: string; } export namespace RunnerParseContextURLResponse { @@ -735,8 +875,131 @@ export namespace RunnerParseContextURLResponse { repo?: string; + tag?: string; + upstreamRemoteUrl?: string; } + + export interface Issue { + /** + * id is the source system's ID of this issue, e.g. BNFRD-6100 + */ + id?: string; + + title?: string; + } + + /** + * @deprecated Deprecated: Use top-level PullRequest message instead + */ + export interface Pr { + id?: string; + + fromBranch?: string; + + title?: string; + + toBranch?: string; + } + + /** + * PullRequest represents pull request metadata from source control systems. This + * message is used across workflow triggers, executions, and agent contexts to + * maintain consistent PR information throughout the system. + */ + export interface PullRequest { + /** + * Unique identifier from the source system (e.g., "123" for GitHub PR #123) + */ + id?: string; + + /** + * Author name as provided by the SCM system + */ + author?: string; + + /** + * Source branch name (the branch being merged from) + */ + fromBranch?: string; + + /** + * Repository information + */ + repository?: PullRequest.Repository; + + /** + * Pull request title + */ + title?: string; + + /** + * Target branch name (the branch being merged into) + */ + toBranch?: string; + + /** + * Pull request URL (e.g., "https://github.com/owner/repo/pull/123") + */ + url?: string; + } + + export namespace PullRequest { + /** + * Repository information + */ + export interface Repository { + cloneUrl?: string; + + host?: string; + + name?: string; + + owner?: string; + } + } +} + +export interface RunnerSearchRepositoriesResponse { + /** + * Last page in the responses + */ + lastPage?: number; + + /** + * Pagination information for the response + */ + pagination?: RunnerSearchRepositoriesResponse.Pagination; + + /** + * List of repositories matching the search criteria + */ + repositories?: Array; +} + +export namespace RunnerSearchRepositoriesResponse { + /** + * Pagination information for the response + */ + export interface Pagination { + /** + * Token passed for retrieving the next set of results. Empty if there are no more + * results + */ + nextToken?: string; + } + + export interface Repository { + /** + * Repository name (e.g., "my-project") + */ + name?: string; + + /** + * Repository URL (e.g., "https://github.com/owner/my-project") + */ + url?: string; + } } export interface RunnerCreateParams { @@ -930,6 +1193,15 @@ export interface RunnerCheckAuthenticationForHostParams { runnerId?: string; } +export interface RunnerCreateLogsTokenParams { + /** + * runner_id specifies the runner for which the logs token should be created. + * + * +required + */ + runnerId?: string; +} + export interface RunnerCreateRunnerTokenParams { runnerId?: string; } @@ -940,6 +1212,55 @@ export interface RunnerParseContextURLParams { runnerId?: string; } +export interface RunnerSearchRepositoriesParams { + /** + * @deprecated Maximum number of repositories to return. Default: 25, Maximum: 100 + * Deprecated: Use pagination.page_size instead + */ + limit?: number; + + /** + * Pagination parameters for repository search + */ + pagination?: RunnerSearchRepositoriesParams.Pagination; + + runnerId?: string; + + /** + * The SCM's host to retrieve repositories from + */ + scmHost?: string; + + /** + * Search mode determines how search_string is interpreted + */ + searchMode?: SearchMode; + + /** + * Search query - interpretation depends on search_mode + */ + searchString?: string; +} + +export namespace RunnerSearchRepositoriesParams { + /** + * Pagination parameters for repository search + */ + export interface Pagination { + /** + * Token for the next set of results that was returned as next_token of a + * PaginationResponse + */ + token?: string; + + /** + * Page size is the maximum number of results to retrieve per page. Defaults to 25. + * Maximum 100. + */ + pageSize?: number; + } +} + Runners.Configurations = Configurations; Runners.Policies = Policies; @@ -957,13 +1278,17 @@ export declare namespace Runners { type RunnerReleaseChannel as RunnerReleaseChannel, type RunnerSpec as RunnerSpec, type RunnerStatus as RunnerStatus, + type RunnerVariant as RunnerVariant, + type SearchMode as SearchMode, type RunnerCreateResponse as RunnerCreateResponse, type RunnerRetrieveResponse as RunnerRetrieveResponse, type RunnerUpdateResponse as RunnerUpdateResponse, type RunnerDeleteResponse as RunnerDeleteResponse, type RunnerCheckAuthenticationForHostResponse as RunnerCheckAuthenticationForHostResponse, + type RunnerCreateLogsTokenResponse as RunnerCreateLogsTokenResponse, type RunnerCreateRunnerTokenResponse as RunnerCreateRunnerTokenResponse, type RunnerParseContextURLResponse as RunnerParseContextURLResponse, + type RunnerSearchRepositoriesResponse as RunnerSearchRepositoriesResponse, type RunnersRunnersPage as RunnersRunnersPage, type RunnerCreateParams as RunnerCreateParams, type RunnerRetrieveParams as RunnerRetrieveParams, @@ -971,8 +1296,10 @@ export declare namespace Runners { type RunnerListParams as RunnerListParams, type RunnerDeleteParams as RunnerDeleteParams, type RunnerCheckAuthenticationForHostParams as RunnerCheckAuthenticationForHostParams, + type RunnerCreateLogsTokenParams as RunnerCreateLogsTokenParams, type RunnerCreateRunnerTokenParams as RunnerCreateRunnerTokenParams, type RunnerParseContextURLParams as RunnerParseContextURLParams, + type RunnerSearchRepositoriesParams as RunnerSearchRepositoriesParams, }; export { diff --git a/src/resources/secrets.ts b/src/resources/secrets.ts index 9c812cd..84069d3 100644 --- a/src/resources/secrets.ts +++ b/src/resources/secrets.ts @@ -222,6 +222,11 @@ export type SecretsSecretsPage = SecretsPage; export interface Secret { id?: string; + /** + * api_only indicates the secret is only available via API/CLI + */ + apiOnly?: boolean; + /** * secret will be mounted as a registry secret */ @@ -441,6 +446,11 @@ export interface Secret { } export interface SecretScope { + /** + * organization_id is the Organization ID this Secret belongs to + */ + organizationId?: string; + /** * project_id is the Project ID this Secret belongs to */ @@ -465,6 +475,13 @@ export interface SecretGetValueResponse { export type SecretUpdateValueResponse = unknown; export interface SecretCreateParams { + /** + * api_only indicates the secret is only available via API/CLI. These secrets are + * NOT automatically injected into services or devcontainers. Useful for secrets + * that should only be consumed programmatically (e.g., by security agents). + */ + apiOnly?: boolean; + /** * secret will be mounted as a docker config in the environment VM, mount will have * the docker registry host diff --git a/src/resources/shared.ts b/src/resources/shared.ts index a779cf3..1bb2c24 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,13 +1,27 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as Shared from './shared'; -import { EnvironmentClassesPage, GatewaysPage, TaskExecutionsPage, TasksPage } from '../core/pagination'; +import { + EnvironmentClassesPage, + GatewaysPage, + ProjectEnvironmentClassesPage, + TaskExecutionsPage, + TasksPage, +} from '../core/pagination'; /** - * An AutomationTrigger represents a trigger for an automation action. The + * An AutomationTrigger represents a trigger for an automation action. The `manual` + * field shows a start button in the UI for manually triggering the automation. The + * `post_machine_start` field indicates that the automation should be triggered + * after the machine has started, before the devcontainer is ready. This is used + * for machine-level services like security agents that need to start early. The * `post_environment_start` field indicates that the automation should be triggered - * after the environment has started. The `post_devcontainer_start` field indicates - * that the automation should be triggered after the dev container has started. + * after the environment has started (devcontainer ready). The + * `post_devcontainer_start` field indicates that the automation should be + * triggered after the dev container has started. The `prebuild` field starts the + * automation during a prebuild of an environment. This phase does not have user + * secrets available. Note: The prebuild trigger can only be used with tasks, not + * services. */ export interface AutomationTrigger { manual?: boolean; @@ -15,6 +29,10 @@ export interface AutomationTrigger { postDevcontainerStart?: boolean; postEnvironmentStart?: boolean; + + postMachineStart?: boolean; + + prebuild?: boolean; } export interface EnvironmentClass { @@ -51,6 +69,37 @@ export interface EnvironmentClass { enabled?: boolean; } +/** + * EnvironmentVariableItem represents an environment variable that can be set + * either from a literal value or from a secret reference. + */ +export interface EnvironmentVariableItem { + /** + * name is the environment variable name. + */ + name?: string; + + /** + * value is a literal string value. + */ + value?: string; + + /** + * value_from specifies a source for the value. + */ + valueFrom?: EnvironmentVariableSource; +} + +/** + * EnvironmentVariableSource specifies a source for an environment variable value. + */ +export interface EnvironmentVariableSource { + /** + * secret_ref references a secret by ID. + */ + secretRef: SecretRef; +} + /** * The status code, which should be an enum value of * [google.rpc.Code][google.rpc.Code]. @@ -112,10 +161,78 @@ export type Principal = | 'PRINCIPAL_RUNNER' | 'PRINCIPAL_ENVIRONMENT' | 'PRINCIPAL_SERVICE_ACCOUNT' - | 'PRINCIPAL_RUNNER_MANAGER'; + | 'PRINCIPAL_RUNNER_MANAGER' + | 'PRINCIPAL_AGENT_EXECUTION'; + +export interface ProjectEnvironmentClass { + /** + * Use a fixed environment class on a given Runner. This cannot be a local runner's + * environment class. + */ + environmentClassId?: string; + + /** + * Use a local runner for the user + */ + localRunner?: boolean; + + /** + * order is the priority of this entry + */ + order?: number; +} + +export type ResourceType = + | 'RESOURCE_TYPE_UNSPECIFIED' + | 'RESOURCE_TYPE_ENVIRONMENT' + | 'RESOURCE_TYPE_RUNNER' + | 'RESOURCE_TYPE_PROJECT' + | 'RESOURCE_TYPE_TASK' + | 'RESOURCE_TYPE_TASK_EXECUTION' + | 'RESOURCE_TYPE_SERVICE' + | 'RESOURCE_TYPE_ORGANIZATION' + | 'RESOURCE_TYPE_USER' + | 'RESOURCE_TYPE_ENVIRONMENT_CLASS' + | 'RESOURCE_TYPE_RUNNER_SCM_INTEGRATION' + | 'RESOURCE_TYPE_HOST_AUTHENTICATION_TOKEN' + | 'RESOURCE_TYPE_GROUP' + | 'RESOURCE_TYPE_PERSONAL_ACCESS_TOKEN' + | 'RESOURCE_TYPE_USER_PREFERENCE' + | 'RESOURCE_TYPE_SERVICE_ACCOUNT' + | 'RESOURCE_TYPE_SECRET' + | 'RESOURCE_TYPE_SSO_CONFIG' + | 'RESOURCE_TYPE_DOMAIN_VERIFICATION' + | 'RESOURCE_TYPE_AGENT_EXECUTION' + | 'RESOURCE_TYPE_RUNNER_LLM_INTEGRATION' + | 'RESOURCE_TYPE_AGENT' + | 'RESOURCE_TYPE_ENVIRONMENT_SESSION' + | 'RESOURCE_TYPE_USER_SECRET' + | 'RESOURCE_TYPE_ORGANIZATION_POLICY' + | 'RESOURCE_TYPE_ORGANIZATION_SECRET' + | 'RESOURCE_TYPE_PROJECT_ENVIRONMENT_CLASS' + | 'RESOURCE_TYPE_BILLING' + | 'RESOURCE_TYPE_PROMPT' + | 'RESOURCE_TYPE_COUPON' + | 'RESOURCE_TYPE_COUPON_REDEMPTION' + | 'RESOURCE_TYPE_ACCOUNT' + | 'RESOURCE_TYPE_INTEGRATION' + | 'RESOURCE_TYPE_WORKFLOW' + | 'RESOURCE_TYPE_WORKFLOW_EXECUTION' + | 'RESOURCE_TYPE_WORKFLOW_EXECUTION_ACTION' + | 'RESOURCE_TYPE_SNAPSHOT' + | 'RESOURCE_TYPE_PREBUILD' + | 'RESOURCE_TYPE_ORGANIZATION_LLM_INTEGRATION' + | 'RESOURCE_TYPE_CUSTOM_DOMAIN' + | 'RESOURCE_TYPE_ROLE_ASSIGNMENT_CHANGED' + | 'RESOURCE_TYPE_GROUP_MEMBERSHIP_CHANGED'; export interface RunsOn { - docker: RunsOn.Docker; + docker?: RunsOn.Docker; + + /** + * Machine runs the service/task directly on the VM/machine level. + */ + machine?: unknown; } export namespace RunsOn { @@ -126,6 +243,16 @@ export namespace RunsOn { } } +/** + * SecretRef references a secret by its ID. + */ +export interface SecretRef { + /** + * id is the UUID of the secret to reference. + */ + id?: string; +} + export interface Subject { /** * id is the UUID of the subject @@ -358,6 +485,11 @@ export interface TaskSpec { */ command?: string; + /** + * env specifies environment variables for the task. + */ + env?: Array; + /** * runs_on specifies the environment the task should run on. */ @@ -377,3 +509,6 @@ export type TaskExecutionsTaskExecutionsPage = TaskExecutionsPage export type EnvironmentClassesEnvironmentClassesPage = EnvironmentClassesPage; export type GatewaysGatewaysPage = GatewaysPage; + +export type ProjectEnvironmentClassesProjectEnvironmentClassesPage = + ProjectEnvironmentClassesPage; diff --git a/src/resources/users/index.ts b/src/resources/users/index.ts index c91cbf0..be4f278 100644 --- a/src/resources/users/index.ts +++ b/src/resources/users/index.ts @@ -21,8 +21,12 @@ export { export { Users, type User, + type UserDeleteUserResponse, type UserGetAuthenticatedUserResponse, + type UserGetUserResponse, type UserSetSuspendedResponse, + type UserDeleteUserParams, type UserGetAuthenticatedUserParams, + type UserGetUserParams, type UserSetSuspendedParams, } from './users'; diff --git a/src/resources/users/users.ts b/src/resources/users/users.ts index 744a576..f9f4b88 100644 --- a/src/resources/users/users.ts +++ b/src/resources/users/users.ts @@ -29,6 +29,19 @@ export class Users extends APIResource { dotfiles: DotfilesAPI.Dotfiles = new DotfilesAPI.Dotfiles(this._client); pats: PatsAPI.Pats = new PatsAPI.Pats(this._client); + /** + * Deletes a user. If the User comes from an organization's SSO provider, the + * Account will also be deleted. + * + * @example + * ```ts + * const response = await client.users.deleteUser(); + * ``` + */ + deleteUser(body: UserDeleteUserParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.UserService/DeleteUser', { body, ...options }); + } + /** * Gets information about the currently authenticated user. * @@ -61,6 +74,36 @@ export class Users extends APIResource { return this._client.post('/gitpod.v1.UserService/GetAuthenticatedUser', { body, ...options }); } + /** + * Gets basic information about a specific user by their ID. + * + * Use this method to: + * + * - Retrieve user profile information + * - Get user details for display purposes + * - Fetch user metadata for administrative tasks + * + * ### Examples + * + * - Get user by ID: + * + * Retrieves basic user information by user ID. + * + * ```yaml + * userId: "f53d2330-3795-4c5d-a1f3-453121af9c60" + * ``` + * + * @example + * ```ts + * const response = await client.users.getUser({ + * userId: 'f53d2330-3795-4c5d-a1f3-453121af9c60', + * }); + * ``` + */ + getUser(body: UserGetUserParams, options?: RequestOptions): APIPromise { + return this._client.post('/gitpod.v1.UserService/GetUser', { body, ...options }); + } + /** * Sets whether a user account is suspended. * @@ -118,6 +161,11 @@ export interface User { */ createdAt?: string; + /** + * email is the user's email address + */ + email?: string; + /** * name is the full name of the user */ @@ -136,16 +184,30 @@ export interface User { status?: Shared.UserStatus; } +export type UserDeleteUserResponse = unknown; + export interface UserGetAuthenticatedUserResponse { user: User; } +export interface UserGetUserResponse { + user: User; +} + export type UserSetSuspendedResponse = unknown; +export interface UserDeleteUserParams { + userId?: string; +} + export interface UserGetAuthenticatedUserParams { empty?: boolean; } +export interface UserGetUserParams { + userId?: string; +} + export interface UserSetSuspendedParams { suspended?: boolean; @@ -158,9 +220,13 @@ Users.Pats = Pats; export declare namespace Users { export { type User as User, + type UserDeleteUserResponse as UserDeleteUserResponse, type UserGetAuthenticatedUserResponse as UserGetAuthenticatedUserResponse, + type UserGetUserResponse as UserGetUserResponse, type UserSetSuspendedResponse as UserSetSuspendedResponse, + type UserDeleteUserParams as UserDeleteUserParams, type UserGetAuthenticatedUserParams as UserGetAuthenticatedUserParams, + type UserGetUserParams as UserGetUserParams, type UserSetSuspendedParams as UserSetSuspendedParams, }; diff --git a/src/version.ts b/src/version.ts index 364dd7f..23f967c 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.7.11'; // x-release-please-version +export const VERSION = '0.8.0'; // x-release-please-version diff --git a/tests/api-resources/accounts.test.ts b/tests/api-resources/accounts.test.ts index 0b5df9a..11942fa 100644 --- a/tests/api-resources/accounts.test.ts +++ b/tests/api-resources/accounts.test.ts @@ -34,7 +34,10 @@ describe('resource accounts', () => { // Prism tests are disabled test.skip('delete: required and optional params', async () => { - const response = await client.accounts.delete({ accountId: 'f53d2330-3795-4c5d-a1f3-453121af9c60' }); + const response = await client.accounts.delete({ + accountId: 'f53d2330-3795-4c5d-a1f3-453121af9c60', + reason: 'reason', + }); }); // Prism tests are disabled @@ -80,4 +83,27 @@ describe('resource accounts', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + // Prism tests are disabled + test.skip('listSSOLogins: only required params', async () => { + const responsePromise = client.accounts.listSSOLogins({ email: 'dev@stainless.com' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('listSSOLogins: required and optional params', async () => { + const response = await client.accounts.listSSOLogins({ + email: 'dev@stainless.com', + token: 'token', + pageSize: 0, + pagination: { token: 'token', pageSize: 100 }, + returnTo: 'https://example.com', + }); + }); }); diff --git a/tests/api-resources/agents.test.ts b/tests/api-resources/agents.test.ts new file mode 100644 index 0000000..a283db7 --- /dev/null +++ b/tests/api-resources/agents.test.ts @@ -0,0 +1,154 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gitpod from '@gitpod/sdk'; + +const client = new Gitpod({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource agents', () => { + // Prism tests are disabled + test.skip('createExecutionConversationToken', async () => { + const responsePromise = client.agents.createExecutionConversationToken({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('createPrompt', async () => { + const responsePromise = client.agents.createPrompt({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('deleteExecution', async () => { + const responsePromise = client.agents.deleteExecution({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('deletePrompt', async () => { + const responsePromise = client.agents.deletePrompt({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('listExecutions', async () => { + const responsePromise = client.agents.listExecutions({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('listPrompts', async () => { + const responsePromise = client.agents.listPrompts({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('retrieveExecution', async () => { + const responsePromise = client.agents.retrieveExecution({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('retrievePrompt', async () => { + const responsePromise = client.agents.retrievePrompt({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('sendToExecution', async () => { + const responsePromise = client.agents.sendToExecution({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('startExecution', async () => { + const responsePromise = client.agents.startExecution({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('stopExecution', async () => { + const responsePromise = client.agents.stopExecution({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('updatePrompt', async () => { + const responsePromise = client.agents.updatePrompt({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/api-resources/editors.test.ts b/tests/api-resources/editors.test.ts index 911417b..6979c29 100644 --- a/tests/api-resources/editors.test.ts +++ b/tests/api-resources/editors.test.ts @@ -59,6 +59,7 @@ describe('resource editors', () => { editorId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048', organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + version: 'version', }); }); }); diff --git a/tests/api-resources/groups.test.ts b/tests/api-resources/errors.test.ts similarity index 83% rename from tests/api-resources/groups.test.ts rename to tests/api-resources/errors.test.ts index f87d93e..f09b290 100644 --- a/tests/api-resources/groups.test.ts +++ b/tests/api-resources/errors.test.ts @@ -7,10 +7,10 @@ const client = new Gitpod({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); -describe('resource groups', () => { +describe('resource errors', () => { // Prism tests are disabled - test.skip('list', async () => { - const responsePromise = client.groups.list({}); + test.skip('reportErrors', async () => { + const responsePromise = client.errors.reportErrors({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; diff --git a/tests/api-resources/groups/groups.test.ts b/tests/api-resources/groups/groups.test.ts new file mode 100644 index 0000000..97c3ca0 --- /dev/null +++ b/tests/api-resources/groups/groups.test.ts @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gitpod from '@gitpod/sdk'; + +const client = new Gitpod({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource groups', () => { + // Prism tests are disabled + test.skip('create', async () => { + const responsePromise = client.groups.create({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('retrieve', async () => { + const responsePromise = client.groups.retrieve({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('update', async () => { + const responsePromise = client.groups.update({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('list', async () => { + const responsePromise = client.groups.list({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete', async () => { + const responsePromise = client.groups.delete({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/api-resources/groups/memberships.test.ts b/tests/api-resources/groups/memberships.test.ts new file mode 100644 index 0000000..5a8f3cf --- /dev/null +++ b/tests/api-resources/groups/memberships.test.ts @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gitpod from '@gitpod/sdk'; + +const client = new Gitpod({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource memberships', () => { + // Prism tests are disabled + test.skip('create', async () => { + const responsePromise = client.groups.memberships.create({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('list', async () => { + const responsePromise = client.groups.memberships.list({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete', async () => { + const responsePromise = client.groups.memberships.delete({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/api-resources/groups/role-assignments.test.ts b/tests/api-resources/groups/role-assignments.test.ts new file mode 100644 index 0000000..5b4a4eb --- /dev/null +++ b/tests/api-resources/groups/role-assignments.test.ts @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gitpod from '@gitpod/sdk'; + +const client = new Gitpod({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource roleAssignments', () => { + // Prism tests are disabled + test.skip('create', async () => { + const responsePromise = client.groups.roleAssignments.create({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('list', async () => { + const responsePromise = client.groups.roleAssignments.list({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete', async () => { + const responsePromise = client.groups.roleAssignments.delete({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/api-resources/organizations/custom-domains.test.ts b/tests/api-resources/organizations/custom-domains.test.ts new file mode 100644 index 0000000..c3b3cac --- /dev/null +++ b/tests/api-resources/organizations/custom-domains.test.ts @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gitpod from '@gitpod/sdk'; + +const client = new Gitpod({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource customDomains', () => { + // Prism tests are disabled + test.skip('create: only required params', async () => { + const responsePromise = client.organizations.customDomains.create({ + domainName: 'workspaces.acme-corp.com', + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('create: required and optional params', async () => { + const response = await client.organizations.customDomains.create({ + domainName: 'workspaces.acme-corp.com', + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + awsAccountId: '123456789012', + cloudAccountId: 'cloudAccountId', + provider: 'CUSTOM_DOMAIN_PROVIDER_AWS', + }); + }); + + // Prism tests are disabled + test.skip('retrieve: only required params', async () => { + const responsePromise = client.organizations.customDomains.retrieve({ + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('retrieve: required and optional params', async () => { + const response = await client.organizations.customDomains.retrieve({ + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + }); + }); + + // Prism tests are disabled + test.skip('update: only required params', async () => { + const responsePromise = client.organizations.customDomains.update({ + domainName: 'workspaces.acme-corp.com', + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('update: required and optional params', async () => { + const response = await client.organizations.customDomains.update({ + domainName: 'workspaces.acme-corp.com', + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + awsAccountId: '987654321098', + cloudAccountId: 'cloudAccountId', + provider: 'CUSTOM_DOMAIN_PROVIDER_UNSPECIFIED', + }); + }); + + // Prism tests are disabled + test.skip('delete: only required params', async () => { + const responsePromise = client.organizations.customDomains.delete({ + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete: required and optional params', async () => { + const response = await client.organizations.customDomains.delete({ + organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + }); + }); +}); diff --git a/tests/api-resources/organizations/organizations.test.ts b/tests/api-resources/organizations/organizations.test.ts index 8ec21c3..970f752 100644 --- a/tests/api-resources/organizations/organizations.test.ts +++ b/tests/api-resources/organizations/organizations.test.ts @@ -143,6 +143,7 @@ describe('resource organizations', () => { organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', token: 'token', pageSize: 0, + filter: { search: 'search' }, pagination: { token: 'token', pageSize: 20 }, }); }); diff --git a/tests/api-resources/organizations/policies.test.ts b/tests/api-resources/organizations/policies.test.ts index c648f9d..fbbc3b8 100644 --- a/tests/api-resources/organizations/policies.test.ts +++ b/tests/api-resources/organizations/policies.test.ts @@ -47,16 +47,30 @@ describe('resource policies', () => { test.skip('update: required and optional params', async () => { const response = await client.organizations.policies.update({ organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + agentPolicy: { commandDenyList: ['string'], mcpDisabled: true, scmToolsDisabled: true }, allowedEditorIds: ['string'], allowLocalRunners: true, defaultEditorId: 'defaultEditorId', defaultEnvironmentImage: 'defaultEnvironmentImage', + deleteArchivedEnvironmentsAfter: '+9125115.360s', + editorVersionRestrictions: { foo: { allowedVersions: ['string'] } }, + maximumEnvironmentLifetime: '+9125115.360s', maximumEnvironmentsPerUser: '20', maximumEnvironmentTimeout: '3600s', maximumRunningEnvironmentsPerUser: '5', membersCreateProjects: true, membersRequireProjects: true, portSharingDisabled: true, + requireCustomDomainAccess: true, + securityAgentPolicy: { + crowdstrike: { + additionalOptions: { foo: 'string' }, + cidSecretId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + enabled: true, + image: 'image', + tags: 'tags', + }, + }, }); }); }); diff --git a/tests/api-resources/organizations/sso-configurations.test.ts b/tests/api-resources/organizations/sso-configurations.test.ts index 1f90621..eab88b8 100644 --- a/tests/api-resources/organizations/sso-configurations.test.ts +++ b/tests/api-resources/organizations/sso-configurations.test.ts @@ -13,7 +13,6 @@ describe('resource ssoConfigurations', () => { const responsePromise = client.organizations.ssoConfigurations.create({ clientId: '012345678-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com', clientSecret: 'GOCSPX-abcdefghijklmnopqrstuvwxyz123456', - emailDomain: 'acme-corp.com', issuerUrl: 'https://accounts.google.com', organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', }); @@ -31,9 +30,11 @@ describe('resource ssoConfigurations', () => { const response = await client.organizations.ssoConfigurations.create({ clientId: '012345678-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com', clientSecret: 'GOCSPX-abcdefghijklmnopqrstuvwxyz123456', - emailDomain: 'acme-corp.com', issuerUrl: 'https://accounts.google.com', organizationId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + displayName: 'displayName', + emailDomain: 'acme-corp.com', + emailDomains: ['sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB'], }); }); @@ -79,7 +80,9 @@ describe('resource ssoConfigurations', () => { claims: { foo: 'string' }, clientId: 'new-client-id', clientSecret: 'new-client-secret', + displayName: 'displayName', emailDomain: 'xxxx', + emailDomains: ['sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.UKbxB'], issuerUrl: 'https://example.com', state: 'SSO_CONFIGURATION_STATE_UNSPECIFIED', }); diff --git a/tests/api-resources/prebuilds.test.ts b/tests/api-resources/prebuilds.test.ts new file mode 100644 index 0000000..4db6cc4 --- /dev/null +++ b/tests/api-resources/prebuilds.test.ts @@ -0,0 +1,118 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gitpod from '@gitpod/sdk'; + +const client = new Gitpod({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource prebuilds', () => { + // Prism tests are disabled + test.skip('create: only required params', async () => { + const responsePromise = client.prebuilds.create({ + projectId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + spec: {}, + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('create: required and optional params', async () => { + const response = await client.prebuilds.create({ + projectId: 'b0e12f6c-4c67-429d-a4a6-d9838b5da047', + spec: { desiredPhase: 'PREBUILD_PHASE_UNSPECIFIED', specVersion: 'specVersion', timeout: '3600s' }, + environmentClassId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + }); + + // Prism tests are disabled + test.skip('retrieve: only required params', async () => { + const responsePromise = client.prebuilds.retrieve({ prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('retrieve: required and optional params', async () => { + const response = await client.prebuilds.retrieve({ prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048' }); + }); + + // Prism tests are disabled + test.skip('list', async () => { + const responsePromise = client.prebuilds.list({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete: only required params', async () => { + const responsePromise = client.prebuilds.delete({ prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('delete: required and optional params', async () => { + const response = await client.prebuilds.delete({ prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048' }); + }); + + // Prism tests are disabled + test.skip('cancel: only required params', async () => { + const responsePromise = client.prebuilds.cancel({ prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('cancel: required and optional params', async () => { + const response = await client.prebuilds.cancel({ prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048' }); + }); + + // Prism tests are disabled + test.skip('createLogsToken: only required params', async () => { + const responsePromise = client.prebuilds.createLogsToken({ + prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('createLogsToken: required and optional params', async () => { + const response = await client.prebuilds.createLogsToken({ + prebuildId: '07e03a28-65a5-4d98-b532-8ea67b188048', + }); + }); +}); diff --git a/tests/api-resources/projects/environment-clases.test.ts b/tests/api-resources/projects/environment-clases.test.ts new file mode 100644 index 0000000..1d6fe4f --- /dev/null +++ b/tests/api-resources/projects/environment-clases.test.ts @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Gitpod from '@gitpod/sdk'; + +const client = new Gitpod({ + bearerToken: 'My Bearer Token', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource environmentClases', () => { + // Prism tests are disabled + test.skip('update', async () => { + const responsePromise = client.projects.environmentClases.update({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // Prism tests are disabled + test.skip('list', async () => { + const responsePromise = client.projects.environmentClases.list({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/api-resources/projects/projects.test.ts b/tests/api-resources/projects/projects.test.ts index 16245bf..d6d64e5 100644 --- a/tests/api-resources/projects/projects.test.ts +++ b/tests/api-resources/projects/projects.test.ts @@ -10,7 +10,7 @@ const client = new Gitpod({ describe('resource projects', () => { // Prism tests are disabled test.skip('create: only required params', async () => { - const responsePromise = client.projects.create({ environmentClass: {}, initializer: {} }); + const responsePromise = client.projects.create({ initializer: {} }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -23,7 +23,6 @@ describe('resource projects', () => { // Prism tests are disabled test.skip('create: required and optional params', async () => { const response = await client.projects.create({ - environmentClass: { environmentClassId: 'd2c94c27-3b76-4a42-b88c-95a85e392c68', localRunner: true }, initializer: { specs: [ { @@ -41,6 +40,14 @@ describe('resource projects', () => { automationsFilePath: 'automationsFilePath', devcontainerFilePath: 'devcontainerFilePath', name: 'Web Application', + prebuildConfiguration: { + enabled: true, + enableJetbrainsWarmup: true, + environmentClassIds: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'], + executor: { id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', principal: 'PRINCIPAL_UNSPECIFIED' }, + timeout: '+9125115.360s', + trigger: { dailySchedule: { hourUtc: 23 } }, + }, technicalDescription: 'technicalDescription', }); }); diff --git a/tests/api-resources/runners/runners.test.ts b/tests/api-resources/runners/runners.test.ts index cd005be..9367fda 100644 --- a/tests/api-resources/runners/runners.test.ts +++ b/tests/api-resources/runners/runners.test.ts @@ -80,6 +80,18 @@ describe('resource runners', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + // Prism tests are disabled + test.skip('createLogsToken', async () => { + const responsePromise = client.runners.createLogsToken({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + // Prism tests are disabled test.skip('createRunnerToken', async () => { const responsePromise = client.runners.createRunnerToken({}); @@ -103,4 +115,16 @@ describe('resource runners', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + // Prism tests are disabled + test.skip('searchRepositories', async () => { + const responsePromise = client.runners.searchRepositories({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); }); diff --git a/tests/api-resources/users/users.test.ts b/tests/api-resources/users/users.test.ts index e58134e..ca85341 100644 --- a/tests/api-resources/users/users.test.ts +++ b/tests/api-resources/users/users.test.ts @@ -8,6 +8,18 @@ const client = new Gitpod({ }); describe('resource users', () => { + // Prism tests are disabled + test.skip('deleteUser', async () => { + const responsePromise = client.users.deleteUser({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + // Prism tests are disabled test.skip('getAuthenticatedUser', async () => { const responsePromise = client.users.getAuthenticatedUser({}); @@ -20,6 +32,18 @@ describe('resource users', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + // Prism tests are disabled + test.skip('getUser', async () => { + const responsePromise = client.users.getUser({}); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + // Prism tests are disabled test.skip('setSuspended', async () => { const responsePromise = client.users.setSuspended({});