diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7a52ab..846bc19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,17 @@ on: - 'integrated/**' - 'stl-preview-head/**' - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/gitpod-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 @@ -28,6 +33,7 @@ jobs: timeout-minutes: 10 name: test runs-on: ${{ github.repository == 'stainless-sdks/gitpod-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@v4 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2aca35a..4208b5c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.0" + ".": "0.6.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index d375176..9333247 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: bb9d0a0bdadbee0985dd7c1e4f0e9e8a +config_hash: 7fb76543ceafd4a116473f647f8d63b1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 853c2d7..bbc525c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## 0.6.0 (2025-09-25) + +Full Changelog: [v0.5.0...v0.6.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.5.0...v0.6.0) + +### Features + +* **api:** gitpod -> ona ([552d759](https://github.com/gitpod-io/gitpod-sdk-go/commit/552d759cc37edb71984b3a8d8dc740e999fa42a4)) +* **client:** add debug log helper ([80b9e2b](https://github.com/gitpod-io/gitpod-sdk-go/commit/80b9e2b14e06850bda8d96cb4bdbcc611d9684d8)) +* **client:** support optional json html escaping ([1b5fe8d](https://github.com/gitpod-io/gitpod-sdk-go/commit/1b5fe8d71198d7c27d346ced65b1a5916c1ca5f8)) + + +### Bug Fixes + +* bugfix for setting JSON keys with special characters ([8cb7fa5](https://github.com/gitpod-io/gitpod-sdk-go/commit/8cb7fa5e315ee8407b030c7203e95b66003d9473)) +* **client:** process custom base url ahead of time ([aa5fbb8](https://github.com/gitpod-io/gitpod-sdk-go/commit/aa5fbb87c9b247fbe9ca6d74f72ccbd775d295b6)) +* don't try to deserialize as json when ResponseBodyInto is []byte ([52bb01f](https://github.com/gitpod-io/gitpod-sdk-go/commit/52bb01f2bc2aae5736c292faf09d98a515be2a08)) +* **pagination:** check if page data is empty in GetNextPage ([8d9d6fb](https://github.com/gitpod-io/gitpod-sdk-go/commit/8d9d6fb9ca5a3913d0400620dd18686290f8e57d)) +* use slices.Concat instead of sometimes modifying r.Options ([083789f](https://github.com/gitpod-io/gitpod-sdk-go/commit/083789f37af9f36fe39d0e45cb9e0ed087cf54cf)) + + +### Chores + +* bump minimum go version to 1.22 ([92bbcb3](https://github.com/gitpod-io/gitpod-sdk-go/commit/92bbcb34c44340cfc9eb20416ac7f9c565462299)) +* **ci:** enable for pull requests ([2c731e3](https://github.com/gitpod-io/gitpod-sdk-go/commit/2c731e32d19595c013749cea2a7a8c50603aa0a4)) +* **ci:** only run for pushes and fork pull requests ([5214c86](https://github.com/gitpod-io/gitpod-sdk-go/commit/5214c8625e015da0f06ab2f817c96a31346475ec)) +* do not install brew dependencies in ./scripts/bootstrap by default ([99dff1a](https://github.com/gitpod-io/gitpod-sdk-go/commit/99dff1a321df7284bf84be3b4639ddbbbba3f588)) +* **internal:** fix lint script for tests ([076dd1d](https://github.com/gitpod-io/gitpod-sdk-go/commit/076dd1d2cef96adf0c5b21e4413387307f52971d)) +* **internal:** update comment in script ([b55d442](https://github.com/gitpod-io/gitpod-sdk-go/commit/b55d44229d14d7bc61b3bf18ed181689b280dfc8)) +* lint tests ([1bba107](https://github.com/gitpod-io/gitpod-sdk-go/commit/1bba1075657651b1ac7b261bbd9c2fcd3fc08fdd)) +* lint tests in subpackages ([7c466c2](https://github.com/gitpod-io/gitpod-sdk-go/commit/7c466c272c807ecda01497bd3565408e973cc177)) +* update @stainless-api/prism-cli to v5.15.0 ([b8acf38](https://github.com/gitpod-io/gitpod-sdk-go/commit/b8acf385df0d9b2ca8d2cf65635b6a2ab437e9c7)) +* update more docs for 1.22 ([d1761ab](https://github.com/gitpod-io/gitpod-sdk-go/commit/d1761aba3bc28977b3227bcdf8161099feeee04d)) + ## 0.5.0 (2025-06-06) Full Changelog: [v0.4.0...v0.5.0](https://github.com/gitpod-io/gitpod-sdk-go/compare/v0.4.0...v0.5.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 33099b9..d358576 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ $ ./scripts/build This will install all the required dependencies and build the SDK. -You can also [install go 1.18+ manually](https://go.dev/doc/install). +You can also [install go 1.22+ manually](https://go.dev/doc/install). ## Modifying/Adding code diff --git a/README.md b/README.md index ef33925..b527f47 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Go Reference -The Gitpod Go library provides convenient access to the [Gitpod REST API](https://docs.gitpod.io) +The Gitpod Go library provides convenient access to the [Gitpod REST API](https://docs.ona.com) from applications written in Go. It is generated with [Stainless](https://www.stainless.com/). @@ -24,14 +24,14 @@ Or to pin the version: ```sh -go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.5.0' +go get -u 'github.com/gitpod-io/gitpod-sdk-go@v0.6.0' ``` ## Requirements -This library requires Go 1.18+. +This library requires Go 1.22+. ## Usage diff --git a/SECURITY.md b/SECURITY.md index efd9088..8975e82 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@gitpod.com for any questions or concerns regarding the security of our services. +Please contact dev-feedback@ona.com for any questions or concerns regarding the security of our services. --- diff --git a/account.go b/account.go index 12ed09b..916ab6c 100644 --- a/account.go +++ b/account.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -55,7 +56,7 @@ func NewAccountService(opts ...option.RequestOption) (r *AccountService) { // {} // ``` func (r *AccountService) Get(ctx context.Context, body AccountGetParams, opts ...option.RequestOption) (res *AccountGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.AccountService/GetAccount" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -81,7 +82,7 @@ func (r *AccountService) Get(ctx context.Context, body AccountGetParams, opts .. // accountId: "f53d2330-3795-4c5d-a1f3-453121af9c60" // ``` func (r *AccountService) Delete(ctx context.Context, body AccountDeleteParams, opts ...option.RequestOption) (res *AccountDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.AccountService/DeleteAccount" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -114,7 +115,7 @@ func (r *AccountService) Delete(ctx context.Context, body AccountDeleteParams, o // returnTo: "https://gitpod.io/workspaces" // ``` func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOLoginURLParams, opts ...option.RequestOption) (res *AccountGetSSOLoginURLResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.AccountService/GetSSOLoginURL" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -138,7 +139,7 @@ func (r *AccountService) GetSSOLoginURL(ctx context.Context, body AccountGetSSOL // {} // ``` func (r *AccountService) ListJoinableOrganizations(ctx context.Context, params AccountListJoinableOrganizationsParams, opts ...option.RequestOption) (res *AccountListJoinableOrganizationsResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.AccountService/ListJoinableOrganizations" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) return @@ -175,7 +176,7 @@ func (r *AccountService) ListJoinableOrganizations(ctx context.Context, params A // ``` func (r *AccountService) ListLoginProviders(ctx context.Context, params AccountListLoginProvidersParams, opts ...option.RequestOption) (res *pagination.LoginProvidersPage[LoginProvider], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.AccountService/ListLoginProviders" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) diff --git a/account_test.go b/account_test.go index 51b820f..32a3af8 100644 --- a/account_test.go +++ b/account_test.go @@ -14,7 +14,7 @@ import ( ) func TestAccountGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +39,7 @@ func TestAccountGetWithOptionalParams(t *testing.T) { } func TestAccountDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -64,7 +64,7 @@ func TestAccountDelete(t *testing.T) { } func TestAccountGetSSOLoginURLWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -90,7 +90,7 @@ func TestAccountGetSSOLoginURLWithOptionalParams(t *testing.T) { } func TestAccountListJoinableOrganizationsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -117,7 +117,7 @@ func TestAccountListJoinableOrganizationsWithOptionalParams(t *testing.T) { } func TestAccountListLoginProvidersWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/client.go b/client.go index fb9ea61..8ce13cd 100644 --- a/client.go +++ b/client.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "os" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/requestconfig" "github.com/gitpod-io/gitpod-sdk-go/option" @@ -102,7 +103,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) { // For even greater flexibility, see [option.WithResponseInto] and // [option.WithResponseBodyInto]. func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error { - opts = append(r.Options, opts...) + opts = slices.Concat(r.Options, opts) return requestconfig.ExecuteNewRequest(ctx, method, path, params, res, opts...) } diff --git a/editor.go b/editor.go index f37c3ff..6c9598a 100644 --- a/editor.go +++ b/editor.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -51,7 +52,7 @@ func NewEditorService(opts ...option.RequestOption) (r *EditorService) { // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EditorService) Get(ctx context.Context, body EditorGetParams, opts ...option.RequestOption) (res *EditorGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EditorService/GetEditor" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -91,7 +92,7 @@ func (r *EditorService) Get(ctx context.Context, body EditorGetParams, opts ...o // ``` func (r *EditorService) List(ctx context.Context, params EditorListParams, opts ...option.RequestOption) (res *pagination.EditorsPage[Editor], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.EditorService/ListEditors" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -163,7 +164,7 @@ func (r *EditorService) ListAutoPaging(ctx context.Context, params EditorListPar // organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" // ``` func (r *EditorService) ResolveURL(ctx context.Context, body EditorResolveURLParams, opts ...option.RequestOption) (res *EditorResolveURLResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EditorService/ResolveEditorURL" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/editor_test.go b/editor_test.go index fd6f930..a09978c 100644 --- a/editor_test.go +++ b/editor_test.go @@ -14,7 +14,7 @@ import ( ) func TestEditorGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +39,7 @@ func TestEditorGet(t *testing.T) { } func TestEditorListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -72,7 +72,7 @@ func TestEditorListWithOptionalParams(t *testing.T) { } func TestEditorResolveURL(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/environment.go b/environment.go index 180ec8a..9512e1a 100644 --- a/environment.go +++ b/environment.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -102,7 +103,7 @@ func NewEnvironmentService(opts ...option.RequestOption) (r *EnvironmentService) // name: "Web App" // ``` func (r *EnvironmentService) New(ctx context.Context, body EnvironmentNewParams, opts ...option.RequestOption) (res *EnvironmentNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/CreateEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -129,7 +130,7 @@ func (r *EnvironmentService) New(ctx context.Context, body EnvironmentNewParams, // environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" // ``` func (r *EnvironmentService) Get(ctx context.Context, body EnvironmentGetParams, opts ...option.RequestOption) (res *EnvironmentGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/GetEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -186,7 +187,7 @@ func (r *EnvironmentService) Get(ctx context.Context, body EnvironmentGetParams, // Note: Machine class changes require stopping the environment and creating a new // one. func (r *EnvironmentService) Update(ctx context.Context, body EnvironmentUpdateParams, opts ...option.RequestOption) (res *EnvironmentUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/UpdateEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -231,7 +232,7 @@ func (r *EnvironmentService) Update(ctx context.Context, body EnvironmentUpdateP // ``` func (r *EnvironmentService) List(ctx context.Context, params EnvironmentListParams, opts ...option.RequestOption) (res *pagination.EnvironmentsPage[Environment], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.EnvironmentService/ListEnvironments" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -312,7 +313,7 @@ func (r *EnvironmentService) ListAutoPaging(ctx context.Context, params Environm // force: true // ``` func (r *EnvironmentService) Delete(ctx context.Context, body EnvironmentDeleteParams, opts ...option.RequestOption) (res *EnvironmentDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/DeleteEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -333,7 +334,7 @@ func (r *EnvironmentService) Delete(ctx context.Context, body EnvironmentDeleteP // environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" // ``` func (r *EnvironmentService) NewEnvironmentToken(ctx context.Context, body EnvironmentNewEnvironmentTokenParams, opts ...option.RequestOption) (res *EnvironmentNewEnvironmentTokenResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/CreateEnvironmentAccessToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -370,7 +371,7 @@ func (r *EnvironmentService) NewEnvironmentToken(ctx context.Context, body Envir // disconnected: "14400s" # 4 hours in seconds // ``` func (r *EnvironmentService) NewFromProject(ctx context.Context, body EnvironmentNewFromProjectParams, opts ...option.RequestOption) (res *EnvironmentNewFromProjectResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/CreateEnvironmentFromProject" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -391,7 +392,7 @@ func (r *EnvironmentService) NewFromProject(ctx context.Context, body Environmen // environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" // ``` func (r *EnvironmentService) NewLogsToken(ctx context.Context, body EnvironmentNewLogsTokenParams, opts ...option.RequestOption) (res *EnvironmentNewLogsTokenResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/CreateEnvironmentLogsToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -415,7 +416,7 @@ func (r *EnvironmentService) NewLogsToken(ctx context.Context, body EnvironmentN // timestamp: "2025-02-12T14:30:00Z" // ``` func (r *EnvironmentService) MarkActive(ctx context.Context, body EnvironmentMarkActiveParams, opts ...option.RequestOption) (res *EnvironmentMarkActiveResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/MarkEnvironmentActive" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -437,7 +438,7 @@ func (r *EnvironmentService) MarkActive(ctx context.Context, body EnvironmentMar // environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" // ``` func (r *EnvironmentService) Start(ctx context.Context, body EnvironmentStartParams, opts ...option.RequestOption) (res *EnvironmentStartResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/StartEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -458,7 +459,7 @@ func (r *EnvironmentService) Start(ctx context.Context, body EnvironmentStartPar // environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" // ``` func (r *EnvironmentService) Stop(ctx context.Context, body EnvironmentStopParams, opts ...option.RequestOption) (res *EnvironmentStopResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/StopEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -474,7 +475,7 @@ func (r *EnvironmentService) Stop(ctx context.Context, body EnvironmentStopParam // environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" // ``` func (r *EnvironmentService) Unarchive(ctx context.Context, body EnvironmentUnarchiveParams, opts ...option.RequestOption) (res *EnvironmentUnarchiveResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentService/UnarchiveEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/environment_test.go b/environment_test.go index 3f54cdf..4d5ccff 100644 --- a/environment_test.go +++ b/environment_test.go @@ -15,7 +15,7 @@ import ( ) func TestEnvironmentNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -102,7 +102,7 @@ func TestEnvironmentNewWithOptionalParams(t *testing.T) { } func TestEnvironmentGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -127,7 +127,7 @@ func TestEnvironmentGet(t *testing.T) { } func TestEnvironmentUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -196,7 +196,7 @@ func TestEnvironmentUpdateWithOptionalParams(t *testing.T) { } func TestEnvironmentListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -234,7 +234,7 @@ func TestEnvironmentListWithOptionalParams(t *testing.T) { } func TestEnvironmentDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -260,7 +260,7 @@ func TestEnvironmentDeleteWithOptionalParams(t *testing.T) { } func TestEnvironmentNewEnvironmentToken(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -285,7 +285,7 @@ func TestEnvironmentNewEnvironmentToken(t *testing.T) { } func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -373,7 +373,7 @@ func TestEnvironmentNewFromProjectWithOptionalParams(t *testing.T) { } func TestEnvironmentNewLogsTokenWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -398,7 +398,7 @@ func TestEnvironmentNewLogsTokenWithOptionalParams(t *testing.T) { } func TestEnvironmentMarkActiveWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -427,7 +427,7 @@ func TestEnvironmentMarkActiveWithOptionalParams(t *testing.T) { } func TestEnvironmentStartWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -452,7 +452,7 @@ func TestEnvironmentStartWithOptionalParams(t *testing.T) { } func TestEnvironmentStopWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -477,7 +477,7 @@ func TestEnvironmentStopWithOptionalParams(t *testing.T) { } func TestEnvironmentUnarchiveWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/environmentautomation.go b/environmentautomation.go index f1726f4..acde3b1 100644 --- a/environmentautomation.go +++ b/environmentautomation.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/param" @@ -71,7 +72,7 @@ func NewEnvironmentAutomationService(opts ...option.RequestOption) (r *Environme // - postEnvironmentStart // ``` func (r *EnvironmentAutomationService) Upsert(ctx context.Context, body EnvironmentAutomationUpsertParams, opts ...option.RequestOption) (res *EnvironmentAutomationUpsertResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/UpsertAutomationsFile" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/environmentautomation_test.go b/environmentautomation_test.go index 1eba091..ac2463e 100644 --- a/environmentautomation_test.go +++ b/environmentautomation_test.go @@ -15,7 +15,7 @@ import ( ) func TestEnvironmentAutomationUpsertWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/environmentautomationservice.go b/environmentautomationservice.go index 0a62d99..01ffa4c 100644 --- a/environmentautomationservice.go +++ b/environmentautomationservice.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -83,7 +84,7 @@ func NewEnvironmentAutomationServiceService(opts ...option.RequestOption) (r *En // image: "redis:7" // ``` func (r *EnvironmentAutomationServiceService) New(ctx context.Context, body EnvironmentAutomationServiceNewParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/CreateService" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -108,7 +109,7 @@ func (r *EnvironmentAutomationServiceService) New(ctx context.Context, body Envi // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationServiceService) Get(ctx context.Context, body EnvironmentAutomationServiceGetParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/GetService" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -150,7 +151,7 @@ func (r *EnvironmentAutomationServiceService) Get(ctx context.Context, body Envi // - manual: true // ``` func (r *EnvironmentAutomationServiceService) Update(ctx context.Context, body EnvironmentAutomationServiceUpdateParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/UpdateService" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -189,7 +190,7 @@ func (r *EnvironmentAutomationServiceService) Update(ctx context.Context, body E // ``` func (r *EnvironmentAutomationServiceService) List(ctx context.Context, params EnvironmentAutomationServiceListParams, opts ...option.RequestOption) (res *pagination.ServicesPage[Service], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.EnvironmentAutomationService/ListServices" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -268,7 +269,7 @@ func (r *EnvironmentAutomationServiceService) ListAutoPaging(ctx context.Context // force: true // ``` func (r *EnvironmentAutomationServiceService) Delete(ctx context.Context, body EnvironmentAutomationServiceDeleteParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/DeleteService" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -294,7 +295,7 @@ func (r *EnvironmentAutomationServiceService) Delete(ctx context.Context, body E // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationServiceService) Start(ctx context.Context, body EnvironmentAutomationServiceStartParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceStartResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/StartService" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -320,7 +321,7 @@ func (r *EnvironmentAutomationServiceService) Start(ctx context.Context, body En // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationServiceService) Stop(ctx context.Context, body EnvironmentAutomationServiceStopParams, opts ...option.RequestOption) (res *EnvironmentAutomationServiceStopResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/StopService" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/environmentautomationservice_test.go b/environmentautomationservice_test.go index df89f59..2d2b739 100644 --- a/environmentautomationservice_test.go +++ b/environmentautomationservice_test.go @@ -16,7 +16,7 @@ import ( ) func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -72,7 +72,7 @@ func TestEnvironmentAutomationServiceNewWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationServiceGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -97,7 +97,7 @@ func TestEnvironmentAutomationServiceGetWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -155,7 +155,7 @@ func TestEnvironmentAutomationServiceUpdateWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationServiceListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -190,7 +190,7 @@ func TestEnvironmentAutomationServiceListWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationServiceDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -216,7 +216,7 @@ func TestEnvironmentAutomationServiceDeleteWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationServiceStartWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -241,7 +241,7 @@ func TestEnvironmentAutomationServiceStartWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationServiceStopWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/environmentautomationtask.go b/environmentautomationtask.go index 02869b5..fdd4f28 100644 --- a/environmentautomationtask.go +++ b/environmentautomationtask.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -79,7 +80,7 @@ func NewEnvironmentAutomationTaskService(opts ...option.RequestOption) (r *Envir // dependsOn: ["d2c94c27-3b76-4a42-b88c-95a85e392c68"] // ``` func (r *EnvironmentAutomationTaskService) New(ctx context.Context, body EnvironmentAutomationTaskNewParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/CreateTask" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -103,7 +104,7 @@ func (r *EnvironmentAutomationTaskService) New(ctx context.Context, body Environ // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationTaskService) Get(ctx context.Context, body EnvironmentAutomationTaskGetParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/GetTask" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -142,7 +143,7 @@ func (r *EnvironmentAutomationTaskService) Get(ctx context.Context, body Environ // - postEnvironmentStart: true // ``` func (r *EnvironmentAutomationTaskService) Update(ctx context.Context, body EnvironmentAutomationTaskUpdateParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/UpdateTask" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -181,7 +182,7 @@ func (r *EnvironmentAutomationTaskService) Update(ctx context.Context, body Envi // ``` func (r *EnvironmentAutomationTaskService) List(ctx context.Context, params EnvironmentAutomationTaskListParams, opts ...option.RequestOption) (res *pagination.TasksPage[shared.Task], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.EnvironmentAutomationService/ListTasks" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -249,7 +250,7 @@ func (r *EnvironmentAutomationTaskService) ListAutoPaging(ctx context.Context, p // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationTaskService) Delete(ctx context.Context, body EnvironmentAutomationTaskDeleteParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/DeleteTask" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -274,7 +275,7 @@ func (r *EnvironmentAutomationTaskService) Delete(ctx context.Context, body Envi // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationTaskService) Start(ctx context.Context, body EnvironmentAutomationTaskStartParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskStartResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/StartTask" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/environmentautomationtask_test.go b/environmentautomationtask_test.go index fed5a5e..3db720b 100644 --- a/environmentautomationtask_test.go +++ b/environmentautomationtask_test.go @@ -16,7 +16,7 @@ import ( ) func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -66,7 +66,7 @@ func TestEnvironmentAutomationTaskNewWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationTaskGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -91,7 +91,7 @@ func TestEnvironmentAutomationTaskGetWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationTaskUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -137,7 +137,7 @@ func TestEnvironmentAutomationTaskUpdateWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationTaskListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -172,7 +172,7 @@ func TestEnvironmentAutomationTaskListWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationTaskDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -197,7 +197,7 @@ func TestEnvironmentAutomationTaskDeleteWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationTaskStartWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/environmentautomationtaskexecution.go b/environmentautomationtaskexecution.go index 2f191cd..08623fc 100644 --- a/environmentautomationtaskexecution.go +++ b/environmentautomationtaskexecution.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -55,7 +56,7 @@ func NewEnvironmentAutomationTaskExecutionService(opts ...option.RequestOption) // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationTaskExecutionService) Get(ctx context.Context, body EnvironmentAutomationTaskExecutionGetParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskExecutionGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/GetTaskExecution" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -94,7 +95,7 @@ func (r *EnvironmentAutomationTaskExecutionService) Get(ctx context.Context, bod // ``` func (r *EnvironmentAutomationTaskExecutionService) List(ctx context.Context, params EnvironmentAutomationTaskExecutionListParams, opts ...option.RequestOption) (res *pagination.TaskExecutionsPage[shared.TaskExecution], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.EnvironmentAutomationService/ListTaskExecutions" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -162,7 +163,7 @@ func (r *EnvironmentAutomationTaskExecutionService) ListAutoPaging(ctx context.C // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *EnvironmentAutomationTaskExecutionService) Stop(ctx context.Context, body EnvironmentAutomationTaskExecutionStopParams, opts ...option.RequestOption) (res *EnvironmentAutomationTaskExecutionStopResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.EnvironmentAutomationService/StopTaskExecution" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/environmentautomationtaskexecution_test.go b/environmentautomationtaskexecution_test.go index fb63e66..48f31d0 100644 --- a/environmentautomationtaskexecution_test.go +++ b/environmentautomationtaskexecution_test.go @@ -15,7 +15,7 @@ import ( ) func TestEnvironmentAutomationTaskExecutionGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -40,7 +40,7 @@ func TestEnvironmentAutomationTaskExecutionGetWithOptionalParams(t *testing.T) { } func TestEnvironmentAutomationTaskExecutionListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +76,7 @@ func TestEnvironmentAutomationTaskExecutionListWithOptionalParams(t *testing.T) } func TestEnvironmentAutomationTaskExecutionStopWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/environmentclass.go b/environmentclass.go index 930e20c..2c53a62 100644 --- a/environmentclass.go +++ b/environmentclass.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -55,7 +56,7 @@ func NewEnvironmentClassService(opts ...option.RequestOption) (r *EnvironmentCla // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE func (r *EnvironmentClassService) List(ctx context.Context, params EnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[shared.EnvironmentClass], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.EnvironmentService/ListEnvironmentClasses" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) diff --git a/environmentclass_test.go b/environmentclass_test.go index b4acb10..fe371e5 100644 --- a/environmentclass_test.go +++ b/environmentclass_test.go @@ -14,7 +14,7 @@ import ( ) func TestEnvironmentClassListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/event.go b/event.go index 2e83dac..95b2464 100644 --- a/event.go +++ b/event.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -65,7 +66,7 @@ func NewEventService(opts ...option.RequestOption) (r *EventService) { // ``` func (r *EventService) List(ctx context.Context, params EventListParams, opts ...option.RequestOption) (res *pagination.EntriesPage[EventListResponse], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.EventService/ListAuditLogs" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -132,7 +133,7 @@ func (r *EventService) WatchStreaming(ctx context.Context, body EventWatchParams raw *http.Response err error ) - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithHeader("Accept", "application/jsonl")}, opts...) path := "gitpod.v1.EventService/WatchEvents" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...) diff --git a/event_test.go b/event_test.go index 88747dc..697fee5 100644 --- a/event_test.go +++ b/event_test.go @@ -15,7 +15,7 @@ import ( ) func TestEventListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/gateway.go b/gateway.go index ffe14da..4fcd9dd 100644 --- a/gateway.go +++ b/gateway.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -38,7 +39,7 @@ func NewGatewayService(opts ...option.RequestOption) (r *GatewayService) { // ListGateways func (r *GatewayService) List(ctx context.Context, params GatewayListParams, opts ...option.RequestOption) (res *pagination.GatewaysPage[shared.Gateway], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.GatewayService/ListGateways" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) diff --git a/gateway_test.go b/gateway_test.go index c2777de..e0c1f47 100644 --- a/gateway_test.go +++ b/gateway_test.go @@ -14,7 +14,7 @@ import ( ) func TestGatewayListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/go.mod b/go.mod index f776218..28335c2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/gitpod-io/gitpod-sdk-go -go 1.21 +go 1.22 require ( github.com/tidwall/gjson v1.14.4 diff --git a/group.go b/group.go index 3605d69..c328dc5 100644 --- a/group.go +++ b/group.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -66,7 +67,7 @@ func NewGroupService(opts ...option.RequestOption) (r *GroupService) { // ``` func (r *GroupService) List(ctx context.Context, params GroupListParams, opts ...option.RequestOption) (res *pagination.GroupsPage[Group], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.GroupService/ListGroups" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) diff --git a/group_test.go b/group_test.go index c36c71a..fcc578f 100644 --- a/group_test.go +++ b/group_test.go @@ -14,7 +14,7 @@ import ( ) func TestGroupListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/identity.go b/identity.go index 3a50be8..0b52447 100644 --- a/identity.go +++ b/identity.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/param" @@ -50,7 +51,7 @@ func NewIdentityService(opts ...option.RequestOption) (r *IdentityService) { // exchangeToken: "exchange-token-value" // ``` func (r *IdentityService) ExchangeToken(ctx context.Context, body IdentityExchangeTokenParams, opts ...option.RequestOption) (res *IdentityExchangeTokenResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.IdentityService/ExchangeToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -75,7 +76,7 @@ func (r *IdentityService) ExchangeToken(ctx context.Context, body IdentityExchan // {} // ``` func (r *IdentityService) GetAuthenticatedIdentity(ctx context.Context, body IdentityGetAuthenticatedIdentityParams, opts ...option.RequestOption) (res *IdentityGetAuthenticatedIdentityResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.IdentityService/GetAuthenticatedIdentity" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -110,7 +111,7 @@ func (r *IdentityService) GetAuthenticatedIdentity(ctx context.Context, body Ide // - "https://ws.gitpod.io" // ``` func (r *IdentityService) GetIDToken(ctx context.Context, body IdentityGetIDTokenParams, opts ...option.RequestOption) (res *IdentityGetIDTokenResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.IdentityService/GetIDToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/identity_test.go b/identity_test.go index f68cf47..f244dfe 100644 --- a/identity_test.go +++ b/identity_test.go @@ -14,7 +14,7 @@ import ( ) func TestIdentityExchangeTokenWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +39,7 @@ func TestIdentityExchangeTokenWithOptionalParams(t *testing.T) { } func TestIdentityGetAuthenticatedIdentityWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -64,7 +64,7 @@ func TestIdentityGetAuthenticatedIdentityWithOptionalParams(t *testing.T) { } func TestIdentityGetIDTokenWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/internal/apijson/decoder.go b/internal/apijson/decoder.go index 68b7ed6..bf01bf6 100644 --- a/internal/apijson/decoder.go +++ b/internal/apijson/decoder.go @@ -224,7 +224,7 @@ func (d *decoderBuilder) newUnionDecoder(t reflect.Type) decoderFunc { } if len(unionEntry.discriminatorKey) != 0 { - discriminatorValue := n.Get(unionEntry.discriminatorKey).Value() + discriminatorValue := n.Get(EscapeSJSONKey(unionEntry.discriminatorKey)).Value() if discriminatorValue == variant.DiscriminatorValue { inner := reflect.New(variant.Type).Elem() err := decoder(n, inner, state) diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go index 2210412..2d6c571 100644 --- a/internal/apijson/encoder.go +++ b/internal/apijson/encoder.go @@ -18,6 +18,10 @@ import ( var encoders sync.Map // map[encoderEntry]encoderFunc +// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have +// special characters that sjson interprets as a path. +var EscapeSJSONKey = strings.NewReplacer("\\", "\\\\", "|", "\\|", "#", "\\#", "@", "\\@", "*", "\\*", ".", "\\.", ":", "\\:", "?", "\\?").Replace + func Marshal(value interface{}) ([]byte, error) { e := &encoder{dateFormat: time.RFC3339} return e.marshal(value) @@ -276,7 +280,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc { if encoded == nil { continue } - json, err = sjson.SetRawBytes(json, ef.tag.name, encoded) + json, err = sjson.SetRawBytes(json, EscapeSJSONKey(ef.tag.name), encoded) if err != nil { return nil, err } @@ -354,7 +358,7 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error) } encodedKeyString = string(encodedKeyBytes) } - encodedKey := []byte(sjsonReplacer.Replace(encodedKeyString)) + encodedKey := []byte(encodedKeyString) pairs = append(pairs, mapPair{key: encodedKey, value: iter.Value()}) } @@ -372,7 +376,7 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error) if len(encodedValue) == 0 { continue } - json, err = sjson.SetRawBytes(json, string(p.key), encodedValue) + json, err = sjson.SetRawBytes(json, EscapeSJSONKey(string(p.key)), encodedValue) if err != nil { return nil, err } @@ -392,7 +396,3 @@ func (e *encoder) newMapEncoder(t reflect.Type) encoderFunc { return json, nil } } - -// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have -// special characters that sjson interprets as a path. -var sjsonReplacer *strings.Replacer = strings.NewReplacer(".", "\\.", ":", "\\:", "*", "\\*") diff --git a/internal/apijson/json_test.go b/internal/apijson/json_test.go index e656344..d4c6283 100644 --- a/internal/apijson/json_test.go +++ b/internal/apijson/json_test.go @@ -362,7 +362,7 @@ var tests = map[string]struct { "date_time_nano_missing_t_coerce": {`"2007-03-01 13:03:05.123456789Z"`, time.Date(2007, time.March, 1, 13, 3, 5, 123456789, time.UTC)}, "map_string": {`{"foo":"bar"}`, map[string]string{"foo": "bar"}}, - "map_string_with_sjson_path_chars": {`{":a.b.c*:d*-1e.f":"bar"}`, map[string]string{":a.b.c*:d*-1e.f": "bar"}}, + "map_string_with_sjson_path_chars": {`{":a.b.c*:d*-1e.f@g?h":"bar"}`, map[string]string{":a.b.c*:d*-1e.f@g?h": "bar"}}, "map_interface": {`{"a":1,"b":"str","c":false}`, map[string]interface{}{"a": float64(1), "b": "str", "c": false}}, "primitive_struct": { diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 66ccdd5..ff9f6ba 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -133,11 +133,13 @@ func NewRequestConfig(ctx context.Context, method string, u string, body interfa // Fallback to json serialization if none of the serialization functions that we expect // to see is present. if body != nil && !hasSerializationFunc { - content, err := json.Marshal(body) - if err != nil { + buf := new(bytes.Buffer) + enc := json.NewEncoder(buf) + enc.SetEscapeHTML(true) + if err := enc.Encode(body); err != nil { return nil, err } - reader = bytes.NewBuffer(content) + reader = buf } req, err := http.NewRequestWithContext(ctx, method, u, nil) @@ -463,6 +465,11 @@ func (cfg *RequestConfig) Execute() (err error) { break } + // Close the response body before retrying to prevent connection leaks + if res != nil && res.Body != nil { + res.Body.Close() + } + time.Sleep(retryDelay(res, retryCount)) } @@ -539,15 +546,15 @@ func (cfg *RequestConfig) Execute() (err error) { return nil } - // If the response happens to be a byte array, deserialize the body as-is. switch dst := cfg.ResponseBodyInto.(type) { + // If the response happens to be a byte array, deserialize the body as-is. case *[]byte: *dst = contents - } - - err = json.NewDecoder(bytes.NewReader(contents)).Decode(cfg.ResponseBodyInto) - if err != nil { - return fmt.Errorf("error parsing response json: %w", err) + default: + err = json.NewDecoder(bytes.NewReader(contents)).Decode(cfg.ResponseBodyInto) + if err != nil { + return fmt.Errorf("error parsing response json: %w", err) + } } return nil diff --git a/internal/version.go b/internal/version.go index 67c4d40..577a4dc 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.5.0" // x-release-please-version +const PackageVersion = "0.6.0" // x-release-please-version diff --git a/option/middleware.go b/option/middleware.go new file mode 100644 index 0000000..8ec9dd6 --- /dev/null +++ b/option/middleware.go @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package option + +import ( + "log" + "net/http" + "net/http/httputil" +) + +// WithDebugLog logs the HTTP request and response content. +// If the logger parameter is nil, it uses the default logger. +// +// WithDebugLog is for debugging and development purposes only. +// It should not be used in production code. The behavior and interface +// of WithDebugLog is not guaranteed to be stable. +func WithDebugLog(logger *log.Logger) RequestOption { + return WithMiddleware(func(req *http.Request, nxt MiddlewareNext) (*http.Response, error) { + if logger == nil { + logger = log.Default() + } + + if reqBytes, err := httputil.DumpRequest(req, true); err == nil { + logger.Printf("Request Content:\n%s\n", reqBytes) + } + + resp, err := nxt(req) + if err != nil { + return resp, err + } + + if respBytes, err := httputil.DumpResponse(resp, true); err == nil { + logger.Printf("Response Content:\n%s\n", respBytes) + } + + return resp, err + }) +} diff --git a/option/requestoption.go b/option/requestoption.go index a02cd87..5996347 100644 --- a/option/requestoption.go +++ b/option/requestoption.go @@ -27,14 +27,15 @@ type RequestOption = requestconfig.RequestOption // For security reasons, ensure that the base URL is trusted. func WithBaseURL(base string) RequestOption { u, err := url.Parse(base) + if err == nil && u.Path != "" && !strings.HasSuffix(u.Path, "/") { + u.Path += "/" + } + return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error { if err != nil { - return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s\n", err) + return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s", err) } - if u.Path != "" && !strings.HasSuffix(u.Path, "/") { - u.Path += "/" - } r.BaseURL = u return nil }) diff --git a/organization.go b/organization.go index 4a493dd..b6309c0 100644 --- a/organization.go +++ b/organization.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -74,7 +75,7 @@ func NewOrganizationService(opts ...option.RequestOption) (r *OrganizationServic // inviteAccountsWithMatchingDomain: true // ``` func (r *OrganizationService) New(ctx context.Context, body OrganizationNewParams, opts ...option.RequestOption) (res *OrganizationNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/CreateOrganization" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -98,7 +99,7 @@ func (r *OrganizationService) New(ctx context.Context, body OrganizationNewParam // organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" // ``` func (r *OrganizationService) Get(ctx context.Context, body OrganizationGetParams, opts ...option.RequestOption) (res *OrganizationGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/GetOrganization" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -139,7 +140,7 @@ func (r *OrganizationService) Get(ctx context.Context, body OrganizationGetParam // domains: [] // ``` func (r *OrganizationService) Update(ctx context.Context, body OrganizationUpdateParams, opts ...option.RequestOption) (res *OrganizationUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/UpdateOrganization" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -163,7 +164,7 @@ func (r *OrganizationService) Update(ctx context.Context, body OrganizationUpdat // organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" // ``` func (r *OrganizationService) Delete(ctx context.Context, body OrganizationDeleteParams, opts ...option.RequestOption) (res *OrganizationDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/DeleteOrganization" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -196,7 +197,7 @@ func (r *OrganizationService) Delete(ctx context.Context, body OrganizationDelet // inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *OrganizationService) Join(ctx context.Context, body OrganizationJoinParams, opts ...option.RequestOption) (res *OrganizationJoinResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/JoinOrganization" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -223,7 +224,7 @@ func (r *OrganizationService) Join(ctx context.Context, body OrganizationJoinPar // // Note: Ensure all projects and resources are transferred before leaving. func (r *OrganizationService) Leave(ctx context.Context, body OrganizationLeaveParams, opts ...option.RequestOption) (res *OrganizationLeaveResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/LeaveOrganization" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -261,7 +262,7 @@ func (r *OrganizationService) Leave(ctx context.Context, body OrganizationLeaveP // ``` func (r *OrganizationService) ListMembers(ctx context.Context, params OrganizationListMembersParams, opts ...option.RequestOption) (res *pagination.MembersPage[OrganizationMember], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.OrganizationService/ListMembers" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -341,7 +342,7 @@ func (r *OrganizationService) ListMembersAutoPaging(ctx context.Context, params // role: ORGANIZATION_ROLE_MEMBER // ``` func (r *OrganizationService) SetRole(ctx context.Context, body OrganizationSetRoleParams, opts ...option.RequestOption) (res *OrganizationSetRoleResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/SetRole" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/organization_test.go b/organization_test.go index 97436c9..04d9ba8 100644 --- a/organization_test.go +++ b/organization_test.go @@ -15,7 +15,7 @@ import ( ) func TestOrganizationNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +42,7 @@ func TestOrganizationNewWithOptionalParams(t *testing.T) { } func TestOrganizationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -67,7 +67,7 @@ func TestOrganizationGet(t *testing.T) { } func TestOrganizationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -96,7 +96,7 @@ func TestOrganizationUpdateWithOptionalParams(t *testing.T) { } func TestOrganizationDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +121,7 @@ func TestOrganizationDelete(t *testing.T) { } func TestOrganizationJoinWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -147,7 +147,7 @@ func TestOrganizationJoinWithOptionalParams(t *testing.T) { } func TestOrganizationLeave(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -172,7 +172,7 @@ func TestOrganizationLeave(t *testing.T) { } func TestOrganizationListMembersWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -203,7 +203,7 @@ func TestOrganizationListMembersWithOptionalParams(t *testing.T) { } func TestOrganizationSetRoleWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/organizationdomainverification.go b/organizationdomainverification.go index 54d2b8d..185a7b6 100644 --- a/organizationdomainverification.go +++ b/organizationdomainverification.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -64,7 +65,7 @@ func NewOrganizationDomainVerificationService(opts ...option.RequestOption) (r * // domain: "acme-subsidiary.com" // ``` func (r *OrganizationDomainVerificationService) New(ctx context.Context, body OrganizationDomainVerificationNewParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/CreateDomainVerification" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -88,7 +89,7 @@ func (r *OrganizationDomainVerificationService) New(ctx context.Context, body Or // domainVerificationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *OrganizationDomainVerificationService) Get(ctx context.Context, body OrganizationDomainVerificationGetParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/GetDomainVerification" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -127,7 +128,7 @@ func (r *OrganizationDomainVerificationService) Get(ctx context.Context, body Or // ``` func (r *OrganizationDomainVerificationService) List(ctx context.Context, params OrganizationDomainVerificationListParams, opts ...option.RequestOption) (res *pagination.DomainVerificationsPage[DomainVerification], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.OrganizationService/ListDomainVerifications" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -195,7 +196,7 @@ func (r *OrganizationDomainVerificationService) ListAutoPaging(ctx context.Conte // domainVerificationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *OrganizationDomainVerificationService) Delete(ctx context.Context, body OrganizationDomainVerificationDeleteParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/DeleteDomainVerification" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -219,7 +220,7 @@ func (r *OrganizationDomainVerificationService) Delete(ctx context.Context, body // domainVerificationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *OrganizationDomainVerificationService) Verify(ctx context.Context, body OrganizationDomainVerificationVerifyParams, opts ...option.RequestOption) (res *OrganizationDomainVerificationVerifyResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/VerifyDomain" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/organizationdomainverification_test.go b/organizationdomainverification_test.go index 4794dbf..672466d 100644 --- a/organizationdomainverification_test.go +++ b/organizationdomainverification_test.go @@ -14,7 +14,7 @@ import ( ) func TestOrganizationDomainVerificationNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -40,7 +40,7 @@ func TestOrganizationDomainVerificationNew(t *testing.T) { } func TestOrganizationDomainVerificationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -65,7 +65,7 @@ func TestOrganizationDomainVerificationGet(t *testing.T) { } func TestOrganizationDomainVerificationListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -96,7 +96,7 @@ func TestOrganizationDomainVerificationListWithOptionalParams(t *testing.T) { } func TestOrganizationDomainVerificationDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +121,7 @@ func TestOrganizationDomainVerificationDelete(t *testing.T) { } func TestOrganizationDomainVerificationVerify(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/organizationinvite.go b/organizationinvite.go index cb80ea2..9b0b8c4 100644 --- a/organizationinvite.go +++ b/organizationinvite.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/param" @@ -50,7 +51,7 @@ func NewOrganizationInviteService(opts ...option.RequestOption) (r *Organization // organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" // ``` func (r *OrganizationInviteService) New(ctx context.Context, body OrganizationInviteNewParams, opts ...option.RequestOption) (res *OrganizationInviteNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/CreateOrganizationInvite" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -58,7 +59,7 @@ func (r *OrganizationInviteService) New(ctx context.Context, body OrganizationIn // GetOrganizationInvite func (r *OrganizationInviteService) Get(ctx context.Context, body OrganizationInviteGetParams, opts ...option.RequestOption) (res *OrganizationInviteGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/GetOrganizationInvite" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -83,7 +84,7 @@ func (r *OrganizationInviteService) Get(ctx context.Context, body OrganizationIn // inviteId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *OrganizationInviteService) GetSummary(ctx context.Context, body OrganizationInviteGetSummaryParams, opts ...option.RequestOption) (res *OrganizationInviteGetSummaryResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/GetOrganizationInviteSummary" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/organizationinvite_test.go b/organizationinvite_test.go index f4b786d..1fdfb6b 100644 --- a/organizationinvite_test.go +++ b/organizationinvite_test.go @@ -14,7 +14,7 @@ import ( ) func TestOrganizationInviteNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +39,7 @@ func TestOrganizationInviteNew(t *testing.T) { } func TestOrganizationInviteGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -64,7 +64,7 @@ func TestOrganizationInviteGet(t *testing.T) { } func TestOrganizationInviteGetSummary(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/organizationpolicy.go b/organizationpolicy.go index 1572d7f..48edca5 100644 --- a/organizationpolicy.go +++ b/organizationpolicy.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/param" @@ -49,7 +50,7 @@ func NewOrganizationPolicyService(opts ...option.RequestOption) (r *Organization // organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" // ``` func (r *OrganizationPolicyService) Get(ctx context.Context, body OrganizationPolicyGetParams, opts ...option.RequestOption) (res *OrganizationPolicyGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/GetOrganizationPolicies" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -89,7 +90,7 @@ func (r *OrganizationPolicyService) Get(ctx context.Context, body OrganizationPo // maximumEnvironmentsPerUser: "20" // ``` func (r *OrganizationPolicyService) Update(ctx context.Context, body OrganizationPolicyUpdateParams, opts ...option.RequestOption) (res *OrganizationPolicyUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/UpdateOrganizationPolicies" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/organizationpolicy_test.go b/organizationpolicy_test.go index 6f7c167..94fda35 100644 --- a/organizationpolicy_test.go +++ b/organizationpolicy_test.go @@ -14,7 +14,7 @@ import ( ) func TestOrganizationPolicyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +39,7 @@ func TestOrganizationPolicyGet(t *testing.T) { } func TestOrganizationPolicyUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/organizationssoconfiguration.go b/organizationssoconfiguration.go index 340a068..3aefb95 100644 --- a/organizationssoconfiguration.go +++ b/organizationssoconfiguration.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -69,7 +70,7 @@ func NewOrganizationSSOConfigurationService(opts ...option.RequestOption) (r *Or // emailDomain: "acme-corp.com" // ``` func (r *OrganizationSSOConfigurationService) New(ctx context.Context, body OrganizationSSOConfigurationNewParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/CreateSSOConfiguration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -93,7 +94,7 @@ func (r *OrganizationSSOConfigurationService) New(ctx context.Context, body Orga // ssoConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *OrganizationSSOConfigurationService) Get(ctx context.Context, body OrganizationSSOConfigurationGetParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/GetSSOConfiguration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -130,7 +131,7 @@ func (r *OrganizationSSOConfigurationService) Get(ctx context.Context, body Orga // state: SSO_CONFIGURATION_STATE_ACTIVE // ``` func (r *OrganizationSSOConfigurationService) Update(ctx context.Context, body OrganizationSSOConfigurationUpdateParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/UpdateSSOConfiguration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -169,7 +170,7 @@ func (r *OrganizationSSOConfigurationService) Update(ctx context.Context, body O // ``` func (r *OrganizationSSOConfigurationService) List(ctx context.Context, params OrganizationSSOConfigurationListParams, opts ...option.RequestOption) (res *pagination.SSOConfigurationsPage[SSOConfiguration], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.OrganizationService/ListSSOConfigurations" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -237,7 +238,7 @@ func (r *OrganizationSSOConfigurationService) ListAutoPaging(ctx context.Context // ssoConfigurationId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *OrganizationSSOConfigurationService) Delete(ctx context.Context, body OrganizationSSOConfigurationDeleteParams, opts ...option.RequestOption) (res *OrganizationSSOConfigurationDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.OrganizationService/DeleteSSOConfiguration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/organizationssoconfiguration_test.go b/organizationssoconfiguration_test.go index 5559d43..192f9e2 100644 --- a/organizationssoconfiguration_test.go +++ b/organizationssoconfiguration_test.go @@ -14,7 +14,7 @@ import ( ) func TestOrganizationSSOConfigurationNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +43,7 @@ func TestOrganizationSSOConfigurationNew(t *testing.T) { } func TestOrganizationSSOConfigurationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -68,7 +68,7 @@ func TestOrganizationSSOConfigurationGet(t *testing.T) { } func TestOrganizationSSOConfigurationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -101,7 +101,7 @@ func TestOrganizationSSOConfigurationUpdateWithOptionalParams(t *testing.T) { } func TestOrganizationSSOConfigurationListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +132,7 @@ func TestOrganizationSSOConfigurationListWithOptionalParams(t *testing.T) { } func TestOrganizationSSOConfigurationDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/packages/pagination/pagination.go b/packages/pagination/pagination.go index ad46709..88ab34c 100644 --- a/packages/pagination/pagination.go +++ b/packages/pagination/pagination.go @@ -60,6 +60,9 @@ func (r domainVerificationsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *DomainVerificationsPage[T]) GetNextPage() (res *DomainVerificationsPage[T], err error) { + if len(r.DomainVerifications) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -181,6 +184,9 @@ func (r editorsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *EditorsPage[T]) GetNextPage() (res *EditorsPage[T], err error) { + if len(r.Editors) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -302,6 +308,9 @@ func (r entriesPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *EntriesPage[T]) GetNextPage() (res *EntriesPage[T], err error) { + if len(r.Entries) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -424,6 +433,9 @@ func (r environmentClassesPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *EnvironmentClassesPage[T]) GetNextPage() (res *EnvironmentClassesPage[T], err error) { + if len(r.EnvironmentClasses) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -546,6 +558,9 @@ func (r environmentsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *EnvironmentsPage[T]) GetNextPage() (res *EnvironmentsPage[T], err error) { + if len(r.Environments) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -667,6 +682,9 @@ func (r gatewaysPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *GatewaysPage[T]) GetNextPage() (res *GatewaysPage[T], err error) { + if len(r.Gateways) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -788,6 +806,9 @@ func (r groupsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *GroupsPage[T]) GetNextPage() (res *GroupsPage[T], err error) { + if len(r.Groups) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -910,6 +931,9 @@ func (r integrationsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *IntegrationsPage[T]) GetNextPage() (res *IntegrationsPage[T], err error) { + if len(r.Integrations) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1032,6 +1056,9 @@ func (r loginProvidersPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *LoginProvidersPage[T]) GetNextPage() (res *LoginProvidersPage[T], err error) { + if len(r.LoginProviders) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1153,6 +1180,9 @@ func (r membersPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *MembersPage[T]) GetNextPage() (res *MembersPage[T], err error) { + if len(r.Members) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1275,6 +1305,9 @@ func (r personalAccessTokensPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *PersonalAccessTokensPage[T]) GetNextPage() (res *PersonalAccessTokensPage[T], err error) { + if len(r.PersonalAccessTokens) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1396,6 +1429,9 @@ func (r policiesPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *PoliciesPage[T]) GetNextPage() (res *PoliciesPage[T], err error) { + if len(r.Policies) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1517,6 +1553,9 @@ func (r projectsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *ProjectsPage[T]) GetNextPage() (res *ProjectsPage[T], err error) { + if len(r.Projects) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1638,6 +1677,9 @@ func (r recordsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *RecordsPage[T]) GetNextPage() (res *RecordsPage[T], err error) { + if len(r.Records) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1759,6 +1801,9 @@ func (r runnersPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *RunnersPage[T]) GetNextPage() (res *RunnersPage[T], err error) { + if len(r.Runners) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -1880,6 +1925,9 @@ func (r secretsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *SecretsPage[T]) GetNextPage() (res *SecretsPage[T], err error) { + if len(r.Secrets) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -2001,6 +2049,9 @@ func (r servicesPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *ServicesPage[T]) GetNextPage() (res *ServicesPage[T], err error) { + if len(r.Services) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -2123,6 +2174,9 @@ func (r ssoConfigurationsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *SSOConfigurationsPage[T]) GetNextPage() (res *SSOConfigurationsPage[T], err error) { + if len(r.SSOConfigurations) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -2245,6 +2299,9 @@ func (r taskExecutionsPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *TaskExecutionsPage[T]) GetNextPage() (res *TaskExecutionsPage[T], err error) { + if len(r.TaskExecutions) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -2366,6 +2423,9 @@ func (r tasksPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *TasksPage[T]) GetNextPage() (res *TasksPage[T], err error) { + if len(r.Tasks) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil @@ -2487,6 +2547,9 @@ func (r tokensPageJSON) RawJSON() string { // there is no next page, this function will return a 'nil' for the page value, but // will not return an error func (r *TokensPage[T]) GetNextPage() (res *TokensPage[T], err error) { + if len(r.Tokens) == 0 { + return nil, nil + } next := r.Pagination.NextToken if len(next) == 0 { return nil, nil diff --git a/project.go b/project.go index f589536..ccc8de5 100644 --- a/project.go +++ b/project.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -79,7 +80,7 @@ func NewProjectService(opts ...option.RequestOption) (r *ProjectService) { // automationsFilePath: ".gitpod/automations.yaml" // ``` func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts ...option.RequestOption) (res *ProjectNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/CreateProject" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -103,7 +104,7 @@ func (r *ProjectService) New(ctx context.Context, body ProjectNewParams, opts .. // projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" // ``` func (r *ProjectService) Get(ctx context.Context, body ProjectGetParams, opts ...option.RequestOption) (res *ProjectGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/GetProject" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -139,7 +140,7 @@ func (r *ProjectService) Get(ctx context.Context, body ProjectGetParams, opts .. // environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *ProjectService) Update(ctx context.Context, body ProjectUpdateParams, opts ...option.RequestOption) (res *ProjectUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/UpdateProject" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -165,7 +166,7 @@ func (r *ProjectService) Update(ctx context.Context, body ProjectUpdateParams, o // ``` func (r *ProjectService) List(ctx context.Context, params ProjectListParams, opts ...option.RequestOption) (res *pagination.ProjectsPage[Project], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.ProjectService/ListProjects" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -220,7 +221,7 @@ func (r *ProjectService) ListAutoPaging(ctx context.Context, params ProjectListP // projectId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" // ``` func (r *ProjectService) Delete(ctx context.Context, body ProjectDeleteParams, opts ...option.RequestOption) (res *ProjectDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/DeleteProject" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -245,7 +246,7 @@ func (r *ProjectService) Delete(ctx context.Context, body ProjectDeleteParams, o // environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048" // ``` func (r *ProjectService) NewFromEnvironment(ctx context.Context, body ProjectNewFromEnvironmentParams, opts ...option.RequestOption) (res *ProjectNewFromEnvironmentResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/CreateProjectFromEnvironment" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/project_test.go b/project_test.go index cc95ff2..608869e 100644 --- a/project_test.go +++ b/project_test.go @@ -14,7 +14,7 @@ import ( ) func TestProjectNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,7 +60,7 @@ func TestProjectNewWithOptionalParams(t *testing.T) { } func TestProjectGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -85,7 +85,7 @@ func TestProjectGetWithOptionalParams(t *testing.T) { } func TestProjectUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +132,7 @@ func TestProjectUpdateWithOptionalParams(t *testing.T) { } func TestProjectListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -165,7 +165,7 @@ func TestProjectListWithOptionalParams(t *testing.T) { } func TestProjectDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -190,7 +190,7 @@ func TestProjectDeleteWithOptionalParams(t *testing.T) { } func TestProjectNewFromEnvironmentWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/projectpolicy.go b/projectpolicy.go index e2d01bb..19788fe 100644 --- a/projectpolicy.go +++ b/projectpolicy.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -54,7 +55,7 @@ func NewProjectPolicyService(opts ...option.RequestOption) (r *ProjectPolicyServ // role: PROJECT_ROLE_ADMIN // ``` func (r *ProjectPolicyService) New(ctx context.Context, body ProjectPolicyNewParams, opts ...option.RequestOption) (res *ProjectPolicyNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/CreateProjectPolicy" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -80,7 +81,7 @@ func (r *ProjectPolicyService) New(ctx context.Context, body ProjectPolicyNewPar // role: PROJECT_ROLE_EDITOR // ``` func (r *ProjectPolicyService) Update(ctx context.Context, body ProjectPolicyUpdateParams, opts ...option.RequestOption) (res *ProjectPolicyUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/UpdateProjectPolicy" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -107,7 +108,7 @@ func (r *ProjectPolicyService) Update(ctx context.Context, body ProjectPolicyUpd // ``` func (r *ProjectPolicyService) List(ctx context.Context, params ProjectPolicyListParams, opts ...option.RequestOption) (res *pagination.PoliciesPage[ProjectPolicy], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.ProjectService/ListProjectPolicies" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -164,7 +165,7 @@ func (r *ProjectPolicyService) ListAutoPaging(ctx context.Context, params Projec // groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" // ``` func (r *ProjectPolicyService) Delete(ctx context.Context, body ProjectPolicyDeleteParams, opts ...option.RequestOption) (res *ProjectPolicyDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.ProjectService/DeleteProjectPolicy" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/projectpolicy_test.go b/projectpolicy_test.go index 3cd9486..5ca0f5d 100644 --- a/projectpolicy_test.go +++ b/projectpolicy_test.go @@ -14,7 +14,7 @@ import ( ) func TestProjectPolicyNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +41,7 @@ func TestProjectPolicyNewWithOptionalParams(t *testing.T) { } func TestProjectPolicyUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -68,7 +68,7 @@ func TestProjectPolicyUpdateWithOptionalParams(t *testing.T) { } func TestProjectPolicyListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +99,7 @@ func TestProjectPolicyListWithOptionalParams(t *testing.T) { } func TestProjectPolicyDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/runner.go b/runner.go index b41a132..ca04ae0 100644 --- a/runner.go +++ b/runner.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -81,7 +82,7 @@ func NewRunnerService(opts ...option.RequestOption) (r *RunnerService) { // autoUpdate: true // ``` func (r *RunnerService) New(ctx context.Context, body RunnerNewParams, opts ...option.RequestOption) (res *RunnerNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/CreateRunner" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -106,7 +107,7 @@ func (r *RunnerService) New(ctx context.Context, body RunnerNewParams, opts ...o // runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerService) Get(ctx context.Context, body RunnerGetParams, opts ...option.RequestOption) (res *RunnerGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/GetRunner" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -136,7 +137,7 @@ func (r *RunnerService) Get(ctx context.Context, body RunnerGetParams, opts ...o // autoUpdate: true // ``` func (r *RunnerService) Update(ctx context.Context, body RunnerUpdateParams, opts ...option.RequestOption) (res *RunnerUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/UpdateRunner" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -174,7 +175,7 @@ func (r *RunnerService) Update(ctx context.Context, body RunnerUpdateParams, opt // ``` func (r *RunnerService) List(ctx context.Context, params RunnerListParams, opts ...option.RequestOption) (res *pagination.RunnersPage[Runner], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.RunnerService/ListRunners" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -241,7 +242,7 @@ func (r *RunnerService) ListAutoPaging(ctx context.Context, params RunnerListPar // runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerService) Delete(ctx context.Context, body RunnerDeleteParams, opts ...option.RequestOption) (res *RunnerDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/DeleteRunner" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -265,7 +266,7 @@ func (r *RunnerService) Delete(ctx context.Context, body RunnerDeleteParams, opt // host: "github.com" // ``` func (r *RunnerService) CheckAuthenticationForHost(ctx context.Context, body RunnerCheckAuthenticationForHostParams, opts ...option.RequestOption) (res *RunnerCheckAuthenticationForHostResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/CheckAuthenticationForHost" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -291,7 +292,7 @@ func (r *RunnerService) CheckAuthenticationForHost(ctx context.Context, body Run // runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerService) NewRunnerToken(ctx context.Context, body RunnerNewRunnerTokenParams, opts ...option.RequestOption) (res *RunnerNewRunnerTokenResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/CreateRunnerToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -322,7 +323,7 @@ func (r *RunnerService) NewRunnerToken(ctx context.Context, body RunnerNewRunner // contextUrl: "https://github.com/org/repo/tree/main" // ``` func (r *RunnerService) ParseContextURL(ctx context.Context, body RunnerParseContextURLParams, opts ...option.RequestOption) (res *RunnerParseContextURLResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/ParseContextURL" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/runner_test.go b/runner_test.go index ac8f9ca..1eb07f8 100644 --- a/runner_test.go +++ b/runner_test.go @@ -14,7 +14,7 @@ import ( ) func TestRunnerNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -58,7 +58,7 @@ func TestRunnerNewWithOptionalParams(t *testing.T) { } func TestRunnerGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,7 +83,7 @@ func TestRunnerGetWithOptionalParams(t *testing.T) { } func TestRunnerUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,7 +124,7 @@ func TestRunnerUpdateWithOptionalParams(t *testing.T) { } func TestRunnerListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -159,7 +159,7 @@ func TestRunnerListWithOptionalParams(t *testing.T) { } func TestRunnerDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -185,7 +185,7 @@ func TestRunnerDeleteWithOptionalParams(t *testing.T) { } func TestRunnerCheckAuthenticationForHostWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -211,7 +211,7 @@ func TestRunnerCheckAuthenticationForHostWithOptionalParams(t *testing.T) { } func TestRunnerNewRunnerTokenWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -236,7 +236,7 @@ func TestRunnerNewRunnerTokenWithOptionalParams(t *testing.T) { } func TestRunnerParseContextURLWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/runnerconfiguration.go b/runnerconfiguration.go index f4b8c73..3ca8fd0 100644 --- a/runnerconfiguration.go +++ b/runnerconfiguration.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/param" @@ -64,7 +65,7 @@ func NewRunnerConfigurationService(opts ...option.RequestOption) (r *RunnerConfi // oauthPlaintextClientSecret: "client_secret" // ``` func (r *RunnerConfigurationService) Validate(ctx context.Context, body RunnerConfigurationValidateParams, opts ...option.RequestOption) (res *RunnerConfigurationValidateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/ValidateRunnerConfiguration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/runnerconfiguration_test.go b/runnerconfiguration_test.go index 11859a2..2a7a7a9 100644 --- a/runnerconfiguration_test.go +++ b/runnerconfiguration_test.go @@ -15,7 +15,7 @@ import ( ) func TestRunnerConfigurationValidateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/runnerconfigurationenvironmentclass.go b/runnerconfigurationenvironmentclass.go index e90b615..9654f30 100644 --- a/runnerconfigurationenvironmentclass.go +++ b/runnerconfigurationenvironmentclass.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -61,7 +62,7 @@ func NewRunnerConfigurationEnvironmentClassService(opts ...option.RequestOption) // value: "16384" // ``` func (r *RunnerConfigurationEnvironmentClassService) New(ctx context.Context, body RunnerConfigurationEnvironmentClassNewParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/CreateEnvironmentClass" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -85,7 +86,7 @@ func (r *RunnerConfigurationEnvironmentClassService) New(ctx context.Context, bo // environmentClassId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerConfigurationEnvironmentClassService) Get(ctx context.Context, body RunnerConfigurationEnvironmentClassGetParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/GetEnvironmentClass" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -112,7 +113,7 @@ func (r *RunnerConfigurationEnvironmentClassService) Get(ctx context.Context, bo // enabled: true // ``` func (r *RunnerConfigurationEnvironmentClassService) Update(ctx context.Context, body RunnerConfigurationEnvironmentClassUpdateParams, opts ...option.RequestOption) (res *RunnerConfigurationEnvironmentClassUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/UpdateEnvironmentClass" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -151,7 +152,7 @@ func (r *RunnerConfigurationEnvironmentClassService) Update(ctx context.Context, // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE func (r *RunnerConfigurationEnvironmentClassService) List(ctx context.Context, params RunnerConfigurationEnvironmentClassListParams, opts ...option.RequestOption) (res *pagination.EnvironmentClassesPage[shared.EnvironmentClass], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.RunnerConfigurationService/ListEnvironmentClasses" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) diff --git a/runnerconfigurationenvironmentclass_test.go b/runnerconfigurationenvironmentclass_test.go index ef35f4b..d683850 100644 --- a/runnerconfigurationenvironmentclass_test.go +++ b/runnerconfigurationenvironmentclass_test.go @@ -15,7 +15,7 @@ import ( ) func TestRunnerConfigurationEnvironmentClassNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +49,7 @@ func TestRunnerConfigurationEnvironmentClassNewWithOptionalParams(t *testing.T) } func TestRunnerConfigurationEnvironmentClassGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -74,7 +74,7 @@ func TestRunnerConfigurationEnvironmentClassGetWithOptionalParams(t *testing.T) } func TestRunnerConfigurationEnvironmentClassUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -102,7 +102,7 @@ func TestRunnerConfigurationEnvironmentClassUpdateWithOptionalParams(t *testing. } func TestRunnerConfigurationEnvironmentClassListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/runnerconfigurationhostauthenticationtoken.go b/runnerconfigurationhostauthenticationtoken.go index e61e6b5..257d4a6 100644 --- a/runnerconfigurationhostauthenticationtoken.go +++ b/runnerconfigurationhostauthenticationtoken.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -60,7 +61,7 @@ func NewRunnerConfigurationHostAuthenticationTokenService(opts ...option.Request // refreshToken: "ghr_xxxxxxxxxxxx" // ``` func (r *RunnerConfigurationHostAuthenticationTokenService) New(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenNewParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/CreateHostAuthenticationToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -84,7 +85,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) New(ctx context.Cont // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerConfigurationHostAuthenticationTokenService) Get(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenGetParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/GetHostAuthenticationToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -111,7 +112,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) Get(ctx context.Cont // refreshToken: "ghr_xxxxxxxxxxxx" // ``` func (r *RunnerConfigurationHostAuthenticationTokenService) Update(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenUpdateParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/UpdateHostAuthenticationToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -148,7 +149,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) Update(ctx context.C // ``` func (r *RunnerConfigurationHostAuthenticationTokenService) List(ctx context.Context, params RunnerConfigurationHostAuthenticationTokenListParams, opts ...option.RequestOption) (res *pagination.TokensPage[HostAuthenticationToken], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.RunnerConfigurationService/ListHostAuthenticationTokens" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -214,7 +215,7 @@ func (r *RunnerConfigurationHostAuthenticationTokenService) ListAutoPaging(ctx c // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerConfigurationHostAuthenticationTokenService) Delete(ctx context.Context, body RunnerConfigurationHostAuthenticationTokenDeleteParams, opts ...option.RequestOption) (res *RunnerConfigurationHostAuthenticationTokenDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/DeleteHostAuthenticationToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/runnerconfigurationhostauthenticationtoken_test.go b/runnerconfigurationhostauthenticationtoken_test.go index bfc7bb8..06879bb 100644 --- a/runnerconfigurationhostauthenticationtoken_test.go +++ b/runnerconfigurationhostauthenticationtoken_test.go @@ -15,7 +15,7 @@ import ( ) func TestRunnerConfigurationHostAuthenticationTokenNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +46,7 @@ func TestRunnerConfigurationHostAuthenticationTokenNewWithOptionalParams(t *test } func TestRunnerConfigurationHostAuthenticationTokenGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +71,7 @@ func TestRunnerConfigurationHostAuthenticationTokenGetWithOptionalParams(t *test } func TestRunnerConfigurationHostAuthenticationTokenUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +99,7 @@ func TestRunnerConfigurationHostAuthenticationTokenUpdateWithOptionalParams(t *t } func TestRunnerConfigurationHostAuthenticationTokenListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -133,7 +133,7 @@ func TestRunnerConfigurationHostAuthenticationTokenListWithOptionalParams(t *tes } func TestRunnerConfigurationHostAuthenticationTokenDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/runnerconfigurationschema.go b/runnerconfigurationschema.go index 8ad2f47..1fc6c96 100644 --- a/runnerconfigurationschema.go +++ b/runnerconfigurationschema.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/param" @@ -49,7 +50,7 @@ func NewRunnerConfigurationSchemaService(opts ...option.RequestOption) (r *Runne // runnerId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerConfigurationSchemaService) Get(ctx context.Context, body RunnerConfigurationSchemaGetParams, opts ...option.RequestOption) (res *RunnerConfigurationSchemaGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/GetRunnerConfigurationSchema" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/runnerconfigurationschema_test.go b/runnerconfigurationschema_test.go index 7a61d0a..494d918 100644 --- a/runnerconfigurationschema_test.go +++ b/runnerconfigurationschema_test.go @@ -14,7 +14,7 @@ import ( ) func TestRunnerConfigurationSchemaGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/runnerconfigurationscmintegration.go b/runnerconfigurationscmintegration.go index 8616ae1..03fad41 100644 --- a/runnerconfigurationscmintegration.go +++ b/runnerconfigurationscmintegration.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -56,7 +57,7 @@ func NewRunnerConfigurationScmIntegrationService(opts ...option.RequestOption) ( // oauthPlaintextClientSecret: "client_secret" // ``` func (r *RunnerConfigurationScmIntegrationService) New(ctx context.Context, body RunnerConfigurationScmIntegrationNewParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/CreateSCMIntegration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -80,7 +81,7 @@ func (r *RunnerConfigurationScmIntegrationService) New(ctx context.Context, body // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerConfigurationScmIntegrationService) Get(ctx context.Context, body RunnerConfigurationScmIntegrationGetParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/GetSCMIntegration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -106,7 +107,7 @@ func (r *RunnerConfigurationScmIntegrationService) Get(ctx context.Context, body // oauthPlaintextClientSecret: "new_client_secret" // ``` func (r *RunnerConfigurationScmIntegrationService) Update(ctx context.Context, body RunnerConfigurationScmIntegrationUpdateParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/UpdateSCMIntegration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -134,7 +135,7 @@ func (r *RunnerConfigurationScmIntegrationService) Update(ctx context.Context, b // ``` func (r *RunnerConfigurationScmIntegrationService) List(ctx context.Context, params RunnerConfigurationScmIntegrationListParams, opts ...option.RequestOption) (res *pagination.IntegrationsPage[ScmIntegration], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.RunnerConfigurationService/ListSCMIntegrations" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -191,7 +192,7 @@ func (r *RunnerConfigurationScmIntegrationService) ListAutoPaging(ctx context.Co // id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *RunnerConfigurationScmIntegrationService) Delete(ctx context.Context, body RunnerConfigurationScmIntegrationDeleteParams, opts ...option.RequestOption) (res *RunnerConfigurationScmIntegrationDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerConfigurationService/DeleteSCMIntegration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/runnerconfigurationscmintegration_test.go b/runnerconfigurationscmintegration_test.go index 1f34966..beb6112 100644 --- a/runnerconfigurationscmintegration_test.go +++ b/runnerconfigurationscmintegration_test.go @@ -14,7 +14,7 @@ import ( ) func TestRunnerConfigurationScmIntegrationNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,7 @@ func TestRunnerConfigurationScmIntegrationNewWithOptionalParams(t *testing.T) { } func TestRunnerConfigurationScmIntegrationGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -70,7 +70,7 @@ func TestRunnerConfigurationScmIntegrationGetWithOptionalParams(t *testing.T) { } func TestRunnerConfigurationScmIntegrationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +99,7 @@ func TestRunnerConfigurationScmIntegrationUpdateWithOptionalParams(t *testing.T) } func TestRunnerConfigurationScmIntegrationListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +132,7 @@ func TestRunnerConfigurationScmIntegrationListWithOptionalParams(t *testing.T) { } func TestRunnerConfigurationScmIntegrationDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/runnerpolicy.go b/runnerpolicy.go index 2e443eb..75abc2e 100644 --- a/runnerpolicy.go +++ b/runnerpolicy.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/apiquery" @@ -54,7 +55,7 @@ func NewRunnerPolicyService(opts ...option.RequestOption) (r *RunnerPolicyServic // role: RUNNER_ROLE_ADMIN // ``` func (r *RunnerPolicyService) New(ctx context.Context, body RunnerPolicyNewParams, opts ...option.RequestOption) (res *RunnerPolicyNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/CreateRunnerPolicy" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -80,7 +81,7 @@ func (r *RunnerPolicyService) New(ctx context.Context, body RunnerPolicyNewParam // role: RUNNER_ROLE_USER // ``` func (r *RunnerPolicyService) Update(ctx context.Context, body RunnerPolicyUpdateParams, opts ...option.RequestOption) (res *RunnerPolicyUpdateResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/UpdateRunnerPolicy" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -107,7 +108,7 @@ func (r *RunnerPolicyService) Update(ctx context.Context, body RunnerPolicyUpdat // ``` func (r *RunnerPolicyService) List(ctx context.Context, params RunnerPolicyListParams, opts ...option.RequestOption) (res *pagination.PoliciesPage[RunnerPolicy], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.RunnerService/ListRunnerPolicies" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -164,7 +165,7 @@ func (r *RunnerPolicyService) ListAutoPaging(ctx context.Context, params RunnerP // groupId: "f53d2330-3795-4c5d-a1f3-453121af9c60" // ``` func (r *RunnerPolicyService) Delete(ctx context.Context, body RunnerPolicyDeleteParams, opts ...option.RequestOption) (res *RunnerPolicyDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.RunnerService/DeleteRunnerPolicy" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/runnerpolicy_test.go b/runnerpolicy_test.go index cc03a29..17e1444 100644 --- a/runnerpolicy_test.go +++ b/runnerpolicy_test.go @@ -14,7 +14,7 @@ import ( ) func TestRunnerPolicyNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +41,7 @@ func TestRunnerPolicyNewWithOptionalParams(t *testing.T) { } func TestRunnerPolicyUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -68,7 +68,7 @@ func TestRunnerPolicyUpdateWithOptionalParams(t *testing.T) { } func TestRunnerPolicyListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +99,7 @@ func TestRunnerPolicyListWithOptionalParams(t *testing.T) { } func TestRunnerPolicyDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/scripts/bootstrap b/scripts/bootstrap index d6ac165..5ab3066 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi diff --git a/scripts/lint b/scripts/lint index fa7ba1f..7e03a7b 100755 --- a/scripts/lint +++ b/scripts/lint @@ -6,3 +6,6 @@ cd "$(dirname "$0")/.." echo "==> Running Go build" go build ./... + +echo "==> Checking tests compile" +go test -run=^$ ./... diff --git a/scripts/mock b/scripts/mock index d2814ae..0b28f6e 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi diff --git a/scripts/test b/scripts/test index efebcea..c26b122 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! prism_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the prism command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" echo exit 1 diff --git a/secret.go b/secret.go index bc16e92..990ce81 100644 --- a/secret.go +++ b/secret.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -80,7 +81,7 @@ func NewSecretService(opts ...option.RequestOption) (r *SecretService) { // containerRegistryBasicAuthHost: "https://registry.example.com" // ``` func (r *SecretService) New(ctx context.Context, body SecretNewParams, opts ...option.RequestOption) (res *SecretNewResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.SecretService/CreateSecret" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -120,7 +121,7 @@ func (r *SecretService) New(ctx context.Context, body SecretNewParams, opts ...o // ``` func (r *SecretService) List(ctx context.Context, params SecretListParams, opts ...option.RequestOption) (res *pagination.SecretsPage[Secret], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.SecretService/ListSecrets" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -188,7 +189,7 @@ func (r *SecretService) ListAutoPaging(ctx context.Context, params SecretListPar // secretId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *SecretService) Delete(ctx context.Context, body SecretDeleteParams, opts ...option.RequestOption) (res *SecretDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.SecretService/DeleteSecret" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -212,7 +213,7 @@ func (r *SecretService) Delete(ctx context.Context, body SecretDeleteParams, opt // secretId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *SecretService) GetValue(ctx context.Context, body SecretGetValueParams, opts ...option.RequestOption) (res *SecretGetValueResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.SecretService/GetSecretValue" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -236,7 +237,7 @@ func (r *SecretService) GetValue(ctx context.Context, body SecretGetValueParams, // value: "new-secret-value" // ``` func (r *SecretService) UpdateValue(ctx context.Context, body SecretUpdateValueParams, opts ...option.RequestOption) (res *SecretUpdateValueResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.SecretService/UpdateSecretValue" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/secret_test.go b/secret_test.go index 6255feb..92f5a18 100644 --- a/secret_test.go +++ b/secret_test.go @@ -14,7 +14,7 @@ import ( ) func TestSecretNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -48,7 +48,7 @@ func TestSecretNewWithOptionalParams(t *testing.T) { } func TestSecretListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -85,7 +85,7 @@ func TestSecretListWithOptionalParams(t *testing.T) { } func TestSecretDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -110,7 +110,7 @@ func TestSecretDeleteWithOptionalParams(t *testing.T) { } func TestSecretGetValueWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -135,7 +135,7 @@ func TestSecretGetValueWithOptionalParams(t *testing.T) { } func TestSecretUpdateValueWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/usage.go b/usage.go index 6f49fe1..3ab514d 100644 --- a/usage.go +++ b/usage.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -64,7 +65,7 @@ func NewUsageService(opts ...option.RequestOption) (r *UsageService) { // ``` func (r *UsageService) ListEnvironmentRuntimeRecords(ctx context.Context, params UsageListEnvironmentRuntimeRecordsParams, opts ...option.RequestOption) (res *pagination.RecordsPage[EnvironmentUsageRecord], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.UsageService/ListEnvironmentUsageRecords" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) diff --git a/usage_test.go b/usage_test.go index 0ec9957..698bad9 100644 --- a/usage_test.go +++ b/usage_test.go @@ -15,7 +15,7 @@ import ( ) func TestUsageListEnvironmentRuntimeRecordsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user.go b/user.go index 82b394f..467c393 100644 --- a/user.go +++ b/user.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -56,7 +57,7 @@ func NewUserService(opts ...option.RequestOption) (r *UserService) { // {} // ``` func (r *UserService) GetAuthenticatedUser(ctx context.Context, body UserGetAuthenticatedUserParams, opts ...option.RequestOption) (res *UserGetAuthenticatedUserResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.UserService/GetAuthenticatedUser" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -90,7 +91,7 @@ func (r *UserService) GetAuthenticatedUser(ctx context.Context, body UserGetAuth // suspended: false // ``` func (r *UserService) SetSuspended(ctx context.Context, body UserSetSuspendedParams, opts ...option.RequestOption) (res *UserSetSuspendedResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.UserService/SetSuspended" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/user_test.go b/user_test.go index f4f33c4..0a5872b 100644 --- a/user_test.go +++ b/user_test.go @@ -14,7 +14,7 @@ import ( ) func TestUserGetAuthenticatedUserWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +39,7 @@ func TestUserGetAuthenticatedUserWithOptionalParams(t *testing.T) { } func TestUserSetSuspendedWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/userdotfile.go b/userdotfile.go index 5657f0b..f3ff00f 100644 --- a/userdotfile.go +++ b/userdotfile.go @@ -5,6 +5,7 @@ package gitpod import ( "context" "net/http" + "slices" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" "github.com/gitpod-io/gitpod-sdk-go/internal/param" @@ -47,7 +48,7 @@ func NewUserDotfileService(opts ...option.RequestOption) (r *UserDotfileService) // {} // ``` func (r *UserDotfileService) Get(ctx context.Context, body UserDotfileGetParams, opts ...option.RequestOption) (res *UserDotfileGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.UserService/GetDotfilesConfiguration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -78,7 +79,7 @@ func (r *UserDotfileService) Get(ctx context.Context, body UserDotfileGetParams, // {} // ``` func (r *UserDotfileService) Set(ctx context.Context, body UserDotfileSetParams, opts ...option.RequestOption) (res *UserDotfileSetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.UserService/SetDotfilesConfiguration" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/userdotfile_test.go b/userdotfile_test.go index cb85ea9..436f782 100644 --- a/userdotfile_test.go +++ b/userdotfile_test.go @@ -14,7 +14,7 @@ import ( ) func TestUserDotfileGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +39,7 @@ func TestUserDotfileGetWithOptionalParams(t *testing.T) { } func TestUserDotfileSetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/userpat.go b/userpat.go index a3dc58a..151c464 100644 --- a/userpat.go +++ b/userpat.go @@ -6,6 +6,7 @@ import ( "context" "net/http" "net/url" + "slices" "time" "github.com/gitpod-io/gitpod-sdk-go/internal/apijson" @@ -58,7 +59,7 @@ func NewUserPatService(opts ...option.RequestOption) (r *UserPatService) { // ``` func (r *UserPatService) List(ctx context.Context, params UserPatListParams, opts ...option.RequestOption) (res *pagination.PersonalAccessTokensPage[PersonalAccessToken], err error) { var raw *http.Response - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := "gitpod.v1.UserService/ListPersonalAccessTokens" cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodPost, path, params, &res, opts...) @@ -115,7 +116,7 @@ func (r *UserPatService) ListAutoPaging(ctx context.Context, params UserPatListP // personalAccessTokenId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *UserPatService) Delete(ctx context.Context, body UserPatDeleteParams, opts ...option.RequestOption) (res *UserPatDeleteResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.UserService/DeletePersonalAccessToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return @@ -139,7 +140,7 @@ func (r *UserPatService) Delete(ctx context.Context, body UserPatDeleteParams, o // personalAccessTokenId: "d2c94c27-3b76-4a42-b88c-95a85e392c68" // ``` func (r *UserPatService) Get(ctx context.Context, body UserPatGetParams, opts ...option.RequestOption) (res *UserPatGetResponse, err error) { - opts = append(r.Options[:], opts...) + opts = slices.Concat(r.Options, opts) path := "gitpod.v1.UserService/GetPersonalAccessToken" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) return diff --git a/userpat_test.go b/userpat_test.go index 52c8336..cfa34ca 100644 --- a/userpat_test.go +++ b/userpat_test.go @@ -14,7 +14,7 @@ import ( ) func TestUserPatListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +47,7 @@ func TestUserPatListWithOptionalParams(t *testing.T) { } func TestUserPatDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -72,7 +72,7 @@ func TestUserPatDeleteWithOptionalParams(t *testing.T) { } func TestUserPatGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL