{"id":51601045,"url":"https://github.com/cloudsmith-io/cloudsmith-go-v2","last_synced_at":"2026-07-11T22:02:09.220Z","repository":{"id":362052429,"uuid":"1243352983","full_name":"cloudsmith-io/cloudsmith-go-v2","owner":"cloudsmith-io","description":"Cloudsmith SDK v2 in Go","archived":false,"fork":false,"pushed_at":"2026-06-02T11:15:31.000Z","size":356,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-02T12:20:05.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudsmith-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-19T09:06:50.000Z","updated_at":"2026-06-02T11:15:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cloudsmith-io/cloudsmith-go-v2","commit_stats":null,"previous_names":["cloudsmith-io/cloudsmith-go-v2"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cloudsmith-io/cloudsmith-go-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudsmith-io%2Fcloudsmith-go-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudsmith-io%2Fcloudsmith-go-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudsmith-io%2Fcloudsmith-go-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudsmith-io%2Fcloudsmith-go-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudsmith-io","download_url":"https://codeload.github.com/cloudsmith-io/cloudsmith-go-v2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudsmith-io%2Fcloudsmith-go-v2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35376136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-11T22:02:08.466Z","updated_at":"2026-07-11T22:02:09.214Z","avatar_url":"https://github.com/cloudsmith-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloudsmith\n\nDeveloper-friendly \u0026 type-safe Go SDK specifically catered to leverage *cloudsmith* API.\n\n[![Built by Speakeasy](https://img.shields.io/badge/Built_by-SPEAKEASY-374151?style=for-the-badge\u0026labelColor=f3f4f6)](https://www.speakeasy.com/?utm_source=cloudsmith\u0026utm_campaign=go)\n[![License: Apache 2.0](https://img.shields.io/badge/LICENSE_//_Apache_2.0-3b5bdb?style=for-the-badge\u0026labelColor=eff6ff)](https://www.apache.org/licenses/LICENSE-2.0)\n\n\n\u003c!-- Start Summary [summary] --\u003e\n## Summary\n\nCloudsmith API: The API to the Cloudsmith Service\n\nFor more information about the API: [Cloudsmith API Reference](https://help.cloudsmith.io/reference/introduction)\n\u003c!-- End Summary [summary] --\u003e\n\n\u003c!-- Start Table of Contents [toc] --\u003e\n## Table of Contents\n\u003c!-- $toc-max-depth=2 --\u003e\n* [cloudsmith](#cloudsmith)\n  * [SDK Installation](#sdk-installation)\n  * [SDK Example Usage](#sdk-example-usage)\n  * [Authentication](#authentication)\n  * [Available Resources and Operations](#available-resources-and-operations)\n  * [Pagination](#pagination)\n  * [Retries](#retries)\n  * [Error Handling](#error-handling)\n  * [Server Selection](#server-selection)\n  * [Custom HTTP Client](#custom-http-client)\n* [Development](#development)\n  * [Maturity](#maturity)\n  * [Contributions](#contributions)\n\n\u003c!-- End Table of Contents [toc] --\u003e\n\n\u003c!-- Start SDK Installation [installation] --\u003e\n## SDK Installation\n\nTo add the SDK as a dependency to your project:\n```bash\ngo get github.com/cloudsmith-io/cloudsmith-go-v2\n```\n\u003c!-- End SDK Installation [installation] --\u003e\n\n\u003c!-- Start SDK Example Usage [usage] --\u003e\n## SDK Example Usage\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\tcloudsmith \"github.com/cloudsmith-io/cloudsmith-go-v2\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\ts := cloudsmith.New(\n\t\tcloudsmith.WithSecurity(\"\u003cYOUR_API_KEY_HERE\u003e\"),\n\t)\n\n\tres, err := s.Metadata.MetadataPackagesList(ctx, operations.MetadataPackagesListRequest{\n\t\tPackageSlugPerm: \"\u003cvalue\u003e\",\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif res.PaginatedArtifactMetadataReadList != nil {\n\t\t// handle response\n\t}\n}\n\n```\n\u003c!-- End SDK Example Usage [usage] --\u003e\n\n\u003c!-- Start Authentication [security] --\u003e\n## Authentication\n\n### Per-Client Security Schemes\n\nThis SDK supports the following security scheme globally:\n\n| Name     | Type   | Scheme  |\n| -------- | ------ | ------- |\n| `Apikey` | apiKey | API key |\n\nYou can configure it using the `WithSecurity` option when initializing the SDK client instance. For example:\n```go\npackage main\n\nimport (\n\t\"context\"\n\tcloudsmith \"github.com/cloudsmith-io/cloudsmith-go-v2\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\ts := cloudsmith.New(\n\t\tcloudsmith.WithSecurity(\"\u003cYOUR_API_KEY_HERE\u003e\"),\n\t)\n\n\tres, err := s.Metadata.MetadataPackagesList(ctx, operations.MetadataPackagesListRequest{\n\t\tPackageSlugPerm: \"\u003cvalue\u003e\",\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif res.PaginatedArtifactMetadataReadList != nil {\n\t\t// handle response\n\t}\n}\n\n```\n\u003c!-- End Authentication [security] --\u003e\n\n\u003c!-- Start Available Resources and Operations [operations] --\u003e\n## Available Resources and Operations\n\n\u003cdetails open\u003e\n\u003csummary\u003eAvailable methods\u003c/summary\u003e\n\n### [Metadata](docs/sdks/metadata/README.md)\n\n* [MetadataPackagesList](docs/sdks/metadata/README.md#metadatapackageslist) - List metadata for a package\n* [MetadataPackagesCreate](docs/sdks/metadata/README.md#metadatapackagescreate) - Attach metadata to a package\n* [MetadataPackagesRetrieve](docs/sdks/metadata/README.md#metadatapackagesretrieve) - Retrieve a package metadata entry\n* [MetadataPackagesPartialUpdate](docs/sdks/metadata/README.md#metadatapackagespartialupdate) - Update a package metadata entry\n* [MetadataPackagesDestroy](docs/sdks/metadata/README.md#metadatapackagesdestroy) - Delete a package metadata entry\n* [MetadataValidateCreate](docs/sdks/metadata/README.md#metadatavalidatecreate) - Validate a metadata payload\n\n### [Workspaces](docs/sdks/workspaces/README.md)\n\n* [WorkspacesPoliciesList](docs/sdks/workspaces/README.md#workspacespolicieslist) - List policies.\n* [WorkspacesPoliciesCreate](docs/sdks/workspaces/README.md#workspacespoliciescreate) - Create a policy.\n* [WorkspacesPoliciesRetrieve](docs/sdks/workspaces/README.md#workspacespoliciesretrieve) - Retrieve a policy.\n* [WorkspacesPoliciesUpdate](docs/sdks/workspaces/README.md#workspacespoliciesupdate) - Update a policy.\n* [WorkspacesPoliciesPartialUpdate](docs/sdks/workspaces/README.md#workspacespoliciespartialupdate) - Partially update a policy.\n* [WorkspacesPoliciesDestroy](docs/sdks/workspaces/README.md#workspacespoliciesdestroy) - Delete a policy.\n* [WorkspacesPoliciesActionsList](docs/sdks/workspaces/README.md#workspacespoliciesactionslist) - List all actions for the policy.\n* [WorkspacesPoliciesActionsCreate](docs/sdks/workspaces/README.md#workspacespoliciesactionscreate) - Create an action for a policy.\n* [WorkspacesPoliciesActionsRetrieve](docs/sdks/workspaces/README.md#workspacespoliciesactionsretrieve) - Retrieve an action for a policy.\n* [WorkspacesPoliciesActionsUpdate](docs/sdks/workspaces/README.md#workspacespoliciesactionsupdate) - Update an action for a policy.\n* [WorkspacesPoliciesActionsPartialUpdate](docs/sdks/workspaces/README.md#workspacespoliciesactionspartialupdate) - Partially update an action for a policy.\n* [WorkspacesPoliciesActionsDestroy](docs/sdks/workspaces/README.md#workspacespoliciesactionsdestroy) - Delete an action for a policy.\n* [WorkspacesPoliciesSimulateList](docs/sdks/workspaces/README.md#workspacespoliciessimulatelist) - Simulates the execution of a Policy to verify its behavior without taking any actions.\n\nBefore using this endpoint, the Policy to simulate must be created with the creation endpoint. To experiment\nwith the policy, it is recommended to create the policy with disabled=True, so that it does not take effect\noutside the simulation endpoint.\n\nThis endpoint evaluates all packages in the workspace, generating a \"decision log\" for each evaluation.\nEach log contains:\n- Package metadata provided to the policy engine at runtime.\n- Output from the user-defined Rego policy.\n\nNo actions associated with the policy are executed. Instead, the endpoint reports what would happen to each package if the policy were active.\n* [WorkspacesPoliciesDecisionLogsV1List](docs/sdks/workspaces/README.md#workspacespoliciesdecisionlogsv1list) - List policy evaluation decision logs.\n* [WorkspacesPoliciesDecisionLogsV1Retrieve](docs/sdks/workspaces/README.md#workspacespoliciesdecisionlogsv1retrieve) - Retrieve the full decision log JSON from S3.\n\n\u003c/details\u003e\n\u003c!-- End Available Resources and Operations [operations] --\u003e\n\n\u003c!-- Start Pagination [pagination] --\u003e\n## Pagination\n\nSome of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the\nreturned response object will have a `Next` method that can be called to pull down the next group of results. If the\nreturn value of `Next` is `nil`, then there are no more pages to be fetched.\n\nHere's an example of one such pagination call:\n```go\npackage main\n\nimport (\n\t\"context\"\n\tcloudsmith \"github.com/cloudsmith-io/cloudsmith-go-v2\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\ts := cloudsmith.New(\n\t\tcloudsmith.WithSecurity(\"\u003cYOUR_API_KEY_HERE\u003e\"),\n\t)\n\n\tres, err := s.Workspaces.WorkspacesPoliciesList(ctx, operations.WorkspacesPoliciesListRequest{\n\t\tPage:      694333,\n\t\tQuery:     cloudsmith.Pointer(\"name: foo OR name: bar\"),\n\t\tSort:      cloudsmith.Pointer(\"-version,updated_at\"),\n\t\tWorkspace: \"\u003cvalue\u003e\",\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif res.PaginatedPolicyList != nil {\n\t\tfor {\n\t\t\t// handle items\n\n\t\t\tres, err = res.Next()\n\n\t\t\tif err != nil {\n\t\t\t\t// handle error\n\t\t\t}\n\n\t\t\tif res == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\n```\n\u003c!-- End Pagination [pagination] --\u003e\n\n\u003c!-- Start Retries [retries] --\u003e\n## Retries\n\nSome of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.\n\nTo change the default retry strategy for a single API call, simply provide a `retry.Config` object to the call by using the `WithRetries` option:\n```go\npackage main\n\nimport (\n\t\"context\"\n\tcloudsmith \"github.com/cloudsmith-io/cloudsmith-go-v2\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/operations\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/retry\"\n\t\"log\"\n\t\"models/operations\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\ts := cloudsmith.New(\n\t\tcloudsmith.WithSecurity(\"\u003cYOUR_API_KEY_HERE\u003e\"),\n\t)\n\n\tres, err := s.Metadata.MetadataPackagesList(ctx, operations.MetadataPackagesListRequest{\n\t\tPackageSlugPerm: \"\u003cvalue\u003e\",\n\t}, operations.WithRetries(\n\t\tretry.Config{\n\t\t\tStrategy: \"backoff\",\n\t\t\tBackoff: \u0026retry.BackoffStrategy{\n\t\t\t\tInitialInterval: 1,\n\t\t\t\tMaxInterval:     50,\n\t\t\t\tExponent:        1.1,\n\t\t\t\tMaxElapsedTime:  100,\n\t\t\t},\n\t\t\tRetryConnectionErrors: false,\n\t\t}))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif res.PaginatedArtifactMetadataReadList != nil {\n\t\t// handle response\n\t}\n}\n\n```\n\nIf you'd like to override the default retry strategy for all operations that support retries, you can use the `WithRetryConfig` option at SDK initialization:\n```go\npackage main\n\nimport (\n\t\"context\"\n\tcloudsmith \"github.com/cloudsmith-io/cloudsmith-go-v2\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/operations\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/retry\"\n\t\"log\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\ts := cloudsmith.New(\n\t\tcloudsmith.WithRetryConfig(\n\t\t\tretry.Config{\n\t\t\t\tStrategy: \"backoff\",\n\t\t\t\tBackoff: \u0026retry.BackoffStrategy{\n\t\t\t\t\tInitialInterval: 1,\n\t\t\t\t\tMaxInterval:     50,\n\t\t\t\t\tExponent:        1.1,\n\t\t\t\t\tMaxElapsedTime:  100,\n\t\t\t\t},\n\t\t\t\tRetryConnectionErrors: false,\n\t\t\t}),\n\t\tcloudsmith.WithSecurity(\"\u003cYOUR_API_KEY_HERE\u003e\"),\n\t)\n\n\tres, err := s.Metadata.MetadataPackagesList(ctx, operations.MetadataPackagesListRequest{\n\t\tPackageSlugPerm: \"\u003cvalue\u003e\",\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif res.PaginatedArtifactMetadataReadList != nil {\n\t\t// handle response\n\t}\n}\n\n```\n\u003c!-- End Retries [retries] --\u003e\n\n\u003c!-- Start Error Handling [errors] --\u003e\n## Error Handling\n\nHandling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both.\n\nBy Default, an API error will return `apierrors.APIError`. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation.\n\nFor example, the `MetadataPackagesList` function may return the following errors:\n\n| Error Type            | Status Code        | Content Type     |\n| --------------------- | ------------------ | ---------------- |\n| apierrors.ErrorDetail | 401, 403, 404, 422 | application/json |\n| apierrors.APIError    | 4XX, 5XX           | \\*/\\*            |\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"errors\"\n\tcloudsmith \"github.com/cloudsmith-io/cloudsmith-go-v2\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/apierrors\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\ts := cloudsmith.New(\n\t\tcloudsmith.WithSecurity(\"\u003cYOUR_API_KEY_HERE\u003e\"),\n\t)\n\n\tres, err := s.Metadata.MetadataPackagesList(ctx, operations.MetadataPackagesListRequest{\n\t\tPackageSlugPerm: \"\u003cvalue\u003e\",\n\t})\n\tif err != nil {\n\n\t\tvar e *apierrors.ErrorDetail\n\t\tif errors.As(err, \u0026e) {\n\t\t\t// handle error\n\t\t\tlog.Fatal(e.Error())\n\t\t}\n\n\t\tvar e *apierrors.APIError\n\t\tif errors.As(err, \u0026e) {\n\t\t\t// handle error\n\t\t\tlog.Fatal(e.Error())\n\t\t}\n\t}\n}\n\n```\n\u003c!-- End Error Handling [errors] --\u003e\n\n\u003c!-- Start Server Selection [server] --\u003e\n## Server Selection\n\n### Override Server URL Per-Client\n\nThe default server can be overridden globally using the `WithServerURL(serverURL string)` option when initializing the SDK client instance. For example:\n```go\npackage main\n\nimport (\n\t\"context\"\n\tcloudsmith \"github.com/cloudsmith-io/cloudsmith-go-v2\"\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\ts := cloudsmith.New(\n\t\tcloudsmith.WithServerURL(\"https://api.cloudsmith.io/v2/\"),\n\t\tcloudsmith.WithSecurity(\"\u003cYOUR_API_KEY_HERE\u003e\"),\n\t)\n\n\tres, err := s.Metadata.MetadataPackagesList(ctx, operations.MetadataPackagesListRequest{\n\t\tPackageSlugPerm: \"\u003cvalue\u003e\",\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif res.PaginatedArtifactMetadataReadList != nil {\n\t\t// handle response\n\t}\n}\n\n```\n\u003c!-- End Server Selection [server] --\u003e\n\n\u003c!-- Start Custom HTTP Client [http-client] --\u003e\n## Custom HTTP Client\n\nThe Go SDK makes API calls that wrap an internal HTTP client. The requirements for the HTTP client are very simple. It must match this interface:\n\n```go\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n```\n\nThe built-in `net/http` client satisfies this interface and a default client based on the built-in is provided by default. To replace this default with a client of your own, you can implement this interface yourself or provide your own client configured as desired. Here's a simple example, which adds a client with a 30 second timeout.\n\n```go\nimport (\n\t\"net/http\"\n\t\"time\"\n\n\t\"github.com/cloudsmith-io/cloudsmith-go-v2\"\n)\n\nvar (\n\thttpClient = \u0026http.Client{Timeout: 30 * time.Second}\n\tsdkClient  = cloudsmith.New(cloudsmith.WithClient(httpClient))\n)\n```\n\nThis can be a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration.\n\u003c!-- End Custom HTTP Client [http-client] --\u003e\n\n\u003c!-- Placeholder for Future Speakeasy SDK Sections --\u003e\n\n# Development\n\n## Maturity\n\nThis SDK is generally available (GA) and ready for production use. We follow [semantic versioning](https://semver.org/), so you can expect backwards-compatible changes within a major version.\n\n## Contributions\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. \nWe look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. \n\n### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=cloudsmith\u0026utm_campaign=go)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudsmith-io%2Fcloudsmith-go-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudsmith-io%2Fcloudsmith-go-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudsmith-io%2Fcloudsmith-go-v2/lists"}