### Create Python Upstream Configuration (Java) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Illustrates how to create a Python upstream configuration for a repository using the Cloudsmith Java SDK. This example includes authentication setup and the necessary parameters for creating the configuration. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; // String | String identifier = "identifier_example"; // String | PythonUpstreamRequest data = new PythonUpstreamRequest(); // PythonUpstreamRequest | try { PythonUpstream result = apiInstance.reposUpstreamPythonCreate(owner, identifier, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamPythonCreate"); e.printStackTrace(); } ``` -------------------------------- ### List Organization Vulnerability Policy Evaluations (Java) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/OrgsApi.md This example demonstrates how to list vulnerability policy evaluation requests for a given organization and policy using the Cloudsmith API. It covers authentication setup and paginated results. Proper import of Cloudsmith API client classes is required. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); OrgsApi apiInstance = new OrgsApi(); String org = "org_example"; // String | String policySlugPerm = "policySlugPerm_example"; // String | java.math.BigInteger page = new java.math.BigInteger(); // java.math.BigInteger | A page number within the paginated result set. java.math.BigInteger pageSize = new java.math.BigInteger(); // java.math.BigInteger | Number of results to return per page. try { List result = apiInstance.orgsVulnerabilityPolicyEvaluationList(org, policySlugPerm, page, pageSize); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling OrgsApi#orgsVulnerabilityPolicyEvaluationList"); e.printStackTrace(); } ``` -------------------------------- ### GET /repos/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/ReposApi.md Get a list of all repositories associated with the current user. ```APIDOC ## GET /repos/ ### Description Get a list of all repositories associated with the current user. ### Method GET ### Endpoint /repos/ ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number of results to fetch. - **page_size** (integer) - Optional - Number of results to return per page. ### Response #### Success Response (200) - **(Array of Repository)** - A list of repositories. #### Response Example ```json [ { "id": "string", "name": "string", "owner": { "username": "string", "public_key": "string", "email": "string", "gravatar_id": "string", "full_name": "string", "date_joined": "datetime", "company": "string", "location": "string", "bio": "string", "website": "string", "followers": 0, "following": 0, "user_url": "string", "api_url": "string", "html_url": "string" }, "description": "string", "private": true, "public_key": "string", "created_at": "datetime", "updated_at": "datetime", "package_types": [ "string" ], "slug_perm": "string", "api_url": "string", "html_url": "string", "owner_api_url": "string", "owner_html_url": "string" } ] ``` ``` -------------------------------- ### GET /repos/user/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Retrieve a paginated list of repositories owned by the user. ```APIDOC ## GET /repos/user/ ### Description Retrieve a paginated list of repositories owned by the user. ### Method GET ### Endpoint /repos/user/ ### Parameters #### Query Parameters - **page** (BigInteger) - Optional - A page number within the paginated result set. - **pageSize** (BigInteger) - Optional - Number of results to return per page. ### Response #### Success Response (200) - **List** (Array) - A list of repository objects. #### Response Example [ { "name": "example-repo", "slug": "example-repo" } ] ``` -------------------------------- ### GET /repos/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Retrieves a list of all repositories associated with the authenticated user. ```APIDOC ## GET /repos/ ### Description Retrieves a list of all repositories associated with the authenticated user. ### Method GET ### Endpoint /repos/ ### Parameters #### Query Parameters - **page** (Integer) - Optional - Page number for pagination. - **pageSize** (Integer) - Optional - Number of results per page. ### Response #### Success Response (200) - **List** (Array) - A list of repository objects. #### Response Example [ { "name": "my-repo", "slug": "my-repo-slug" } ] ``` -------------------------------- ### Upload Go Package using Cloudsmith API (Python) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/PackagesApi.md Provides a Python example for uploading a Go package to Cloudsmith. It details the setup for API key or basic authentication and how to use the `cloudsmith_api` library to perform the upload. The example includes error handling for potential API issues. ```python from __future__ import print_function import time import cloudsmith_api from cloudsmith_api.rest import ApiException from pprint import pprint # Configure API key authorization: apikey configuration = cloudsmith_api.Configuration() configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['X-Api-Key'] = 'Bearer' # Configure HTTP basic authorization: basic configuration = cloudsmith_api.Configuration() configuration.username = 'YOUR_USERNAME' configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = cloudsmith_api.PackagesApi(cloudsmith_api.ApiClient(configuration)) owner = 'owner_example' # str | repo = 'repo_example' # str | data = cloudsmith_api.GoPackageUploadRequest() # GoPackageUploadRequest | (optional) try: # Create a new Go package api_response = api_instance.packages_upload_go(owner, repo, data=data) pprint(api_response) except ApiException as e: print("Exception when calling PackagesApi->packages_upload_go: %s\n" % e) ``` -------------------------------- ### Create Organization Invite (Java) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/OrgsApi.md This Java code example demonstrates how to create an organization invite using the Cloudsmith API. It includes configuration for API key or basic authentication and the necessary calls to the `orgsInvitesCreate` method. The `io.cloudsmith.api` library is required. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); OrgsApi apiInstance = new OrgsApi(); String org = "org_example"; // String | OrganizationInviteRequest data = new OrganizationInviteRequest(); // OrganizationInviteRequest | try { OrganizationInvite result = apiInstance.orgsInvitesCreate(org, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling OrgsApi#orgsInvitesCreate"); e.printStackTrace(); } ``` -------------------------------- ### List Generic Upstream Configurations in Java Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Demonstrates how to authenticate and list Generic upstream configurations for a specific repository. It uses the ReposApi class and supports optional pagination parameters. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; String identifier = "identifier_example"; java.math.BigInteger page = new java.math.BigInteger("1"); java.math.BigInteger pageSize = new java.math.BigInteger("20"); try { List result = apiInstance.reposUpstreamGenericList(owner, identifier, page, pageSize); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamGenericList"); e.printStackTrace(); } ``` -------------------------------- ### Read Package Information using Cloudsmith API (Java) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/PackagesApi.md Provides a Java code snippet to retrieve details of a specific package within a Cloudsmith repository. This example utilizes the `packagesRead` method from the Cloudsmith API client. Authentication setup is similar to other examples, requiring API key or basic credentials. ```java import io.cloudsmith.api.ApiClient; import io.cloudsmith.api.ApiException; import io.cloudsmith.api.Configuration; import io.cloudsmith.api.auth.ApiKeyAuth; import io.cloudsmith.api.auth.HttpBasicAuth; import io.cloudsmith.api.apis.PackagesApi; import io.cloudsmith.api.models.ModelPackage; public class CloudsmithPackageRead { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); PackagesApi apiInstance = new PackagesApi(); String owner = "owner_example"; // String | String repo = "repo_example"; // String | String identifier = "identifier_example"; // String | try { ModelPackage result = apiInstance.packagesRead(owner, repo, identifier); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PackagesApi#packagesRead"); e.printStackTrace(); } } } ``` -------------------------------- ### Create Hex Upstream Configuration in Java Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Demonstrates how to initialize the Cloudsmith API client with authentication and create a new Hex upstream configuration using the ReposApi class. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; String identifier = "identifier_example"; HexUpstreamRequest data = new HexUpstreamRequest(); try { HexUpstream result = apiInstance.reposUpstreamHexCreate(owner, identifier, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamHexCreate"); e.printStackTrace(); } ``` -------------------------------- ### Upload Terraform Package using Cloudsmith Java API Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/PackagesApi.md This example demonstrates how to upload a Terraform package to a Cloudsmith repository using the Java API client. It includes authentication setup and requires the owner, repository name, and package data. ```java import io.cloudsmith.api.ApiClient; import io.cloudsmith.api.ApiException; import io.cloudsmith.api.Configuration; import io.cloudsmith.api.auth.ApiKeyAuth; import io.cloudsmith.api.auth.HttpBasicAuth; import io.cloudsmith.api.apis.PackagesApi; import io.cloudsmith.api.models.TerraformPackageUploadRequest; import io.cloudsmith.api.models.TerraformPackageUpload; public class CloudsmithTerraformUpload { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); PackagesApi apiInstance = new PackagesApi(); String owner = "owner_example"; // String | String repo = "repo_example"; // String | TerraformPackageUploadRequest data = new TerraformPackageUploadRequest(); // TerraformPackageUploadRequest | try { TerraformPackageUpload result = apiInstance.packagesUploadTerraform(owner, repo, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PackagesApi#packagesUploadTerraform"); e.printStackTrace(); } } } ``` -------------------------------- ### List Go Upstream Configs - Python Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/ReposApi.md Lists all Go upstream configurations for a given repository. Requires owner and identifier, with optional pagination parameters page and page_size. Handles API key or basic authentication. Returns a list of GoUpstream objects or raises ApiException on error. ```python from __future__ import print_function import time import cloudsmith_api from cloudsmith_api.rest import ApiException from pprint import pprint # Configure API key authorization: apikey configuration = cloudsmith_api.Configuration() configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['X-Api-Key'] = 'Bearer' # Configure HTTP basic authorization: basic configuration = cloudsmith_api.Configuration() configuration.username = 'YOUR_USERNAME' configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = cloudsmith_api.ReposApi(cloudsmith_api.ApiClient(configuration)) owner = 'owner_example' # str | identifier = 'identifier_example' # str | page = 1 # int | page_size = 100 # int | # try: # # List Go upstream configs for this repository. # api_response = api_instance.repos_upstream_go_list(owner, identifier, page=page, page_size=page_size) # pprint(api_response) # except ApiException as e: # print("Exception when calling ReposApi->repos_upstream_go_list: %s\n" % e) ``` -------------------------------- ### Read RPM Upstream Configuration - Java Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Reads the RedHat upstream configuration for a given repository. This example demonstrates authentication using API key or basic auth and making a GET request to the reposUpstreamRpmRead endpoint. It requires the owner, identifier, and slugPerm of the repository. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; // String | String identifier = "identifier_example"; // String | String slugPerm = "slugPerm_example"; // String | try { RpmUpstream result = apiInstance.reposUpstreamRpmRead(owner, identifier, slugPerm); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamRpmRead"); e.printStackTrace(); } ``` -------------------------------- ### POST /repos/{owner}/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Create a new repository within a specified namespace. ```APIDOC ## POST /repos/{owner}/ ### Description Create a new repository in a given namespace. ### Method POST ### Endpoint /repos/{owner}/ ### Parameters #### Path Parameters - **owner** (string) - Required - The namespace owner of the repository. ### Request Example { "name": "my-new-repo", "slug": "my-new-repo", "description": "A new repository" } ### Response #### Success Response (201) - **slug** (string) - The unique slug of the created repository. #### Response Example { "slug": "my-new-repo", "name": "my-new-repo" } ``` -------------------------------- ### POST /packages/upload/vagrant/{owner}/{repo} Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/PackagesApi.md Creates a new Vagrant package in the specified repository. ```APIDOC ## POST /packages/upload/vagrant/{owner}/{repo} ### Description Creates a new Vagrant package within the designated owner's repository. ### Method POST ### Endpoint /packages/upload/vagrant/{owner}/{repo} ### Parameters #### Path Parameters - **owner** (String) - Required - The namespace owner. - **repo** (String) - Required - The repository name. #### Request Body - **data** (VagrantPackageUploadRequest) - Optional - Vagrant package metadata. ### Request Example { "package_file": "vagrant_box_data", "version": "2.0.0" } ### Response #### Success Response (200) - **result** (VagrantPackageUpload) - Details of the created Vagrant package. #### Response Example { "slug": "vagrant-box-456", "status": "created" } ``` -------------------------------- ### Quarantine Package in Cloudsmith API (Python) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/PackagesApi.md Shows how to quarantine or release a package using the Cloudsmith API. This operation requires the owner, repository name, package identifier, and an optional PackageQuarantineRequest object. The example includes setup for both API key and basic authentication and error handling. ```python from __future__ import print_function import time import cloudsmith_api from cloudsmith_api.rest import ApiException from pprint import pprint # Configure API key authorization: apikey configuration = cloudsmith_api.Configuration() configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['X-Api-Key'] = 'Bearer' # Configure HTTP basic authorization: basic configuration = cloudsmith_api.Configuration() configuration.username = 'YOUR_USERNAME' configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = cloudsmith_api.PackagesApi(cloudsmith_api.ApiClient(configuration)) owner = 'owner_example' # str | repo = 'repo_example' # str | identifier = 'identifier_example' # str | data = cloudsmith_api.PackageQuarantineRequest() # PackageQuarantineRequest | (optional) try: # Quarantine or release a package. api_response = api_instance.packages_quarantine(owner, repo, identifier, data=data) pprint(api_response) except ApiException as e: print("Exception when calling PackagesApi->packages_quarantine: %s\n" % e) ``` -------------------------------- ### Create Hex Upstream Configuration via Cloudsmith API Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/ReposApi.md Demonstrates how to initialize the Cloudsmith API client with authentication and create a new Hex upstream configuration for a specific repository. ```python from __future__ import print_function import cloudsmith_api from cloudsmith_api.rest import ApiException from pprint import pprint configuration = cloudsmith_api.Configuration() configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY' api_instance = cloudsmith_api.ReposApi(cloudsmith_api.ApiClient(configuration)) owner = 'owner_example' identifier = 'identifier_example' data = cloudsmith_api.HexUpstreamRequest() try: api_response = api_instance.repos_upstream_hex_create(owner, identifier, data=data) pprint(api_response) except ApiException as e: print("Exception when calling ReposApi->repos_upstream_hex_create: %s\n" % e) ``` -------------------------------- ### Get Package Details and Dependencies using Python SDK Source: https://context7.com/cloudsmith-io/cloudsmith-api/llms.txt Retrieves detailed information about a specific package, including its name, version, format, status, download URL, and dependencies. This example uses the cloudsmith-api Python SDK and requires an API key. ```python import cloudsmith_api from cloudsmith_api.rest import ApiException configuration = cloudsmith_api.Configuration() configuration.api_key['X-Api-Key'] = 'your-api-key' api_instance = cloudsmith_api.PackagesApi(cloudsmith_api.ApiClient(configuration)) try: # Get package details package = api_instance.packages_read( owner='my-organization', repo='my-repo', identifier='pkg-slug-perm-identifier' ) print(f"Package: {package.name}") print(f"Version: {package.version}") print(f"Format: {package.format}") print(f"Status: {package.status_str}") print(f"Download URL: {package.cdn_url}") # Get package dependencies deps = api_instance.packages_dependencies( owner='my-organization', repo='my-repo', identifier='pkg-slug-perm-identifier' ) print(f"Dependencies: {deps.dependencies}") except ApiException as e: print(f"Exception: {e}") ``` -------------------------------- ### Create OpenID Connect provider settings for an organization Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/OrgsApi.md Demonstrates how to initialize the Cloudsmith API client and create new OpenID Connect provider settings for a specific organization. Requires authentication via API key or basic auth. ```python configuration = cloudsmith_api.Configuration() configuration.username = 'YOUR_USERNAME' configuration.password = 'YOUR_PASSWORD' api_instance = cloudsmith_api.OrgsApi(cloudsmith_api.ApiClient(configuration)) org = 'org_example' data = cloudsmith_api.ProviderSettingsWriteRequest() try: api_response = api_instance.orgs_openid_connect_create(org, data=data) pprint(api_response) except ApiException as e: print("Exception when calling OrgsApi->orgs_openid_connect_create: %s\n" % e) ``` -------------------------------- ### POST /packages/upload/go/{owner}/{repo} Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/PackagesApi.md Uploads a new Go package to the specified repository. ```APIDOC ## POST /packages/upload/go/{owner}/{repo} ### Description Uploads a new Go package to a specific repository owned by the user. ### Method POST ### Endpoint /packages/upload/go/{owner}/{repo} ### Parameters #### Path Parameters - **owner** (String) - Required - The namespace/owner of the repository. - **repo** (String) - Required - The name of the repository. #### Request Body - **data** (GoPackageUploadRequest) - Optional - The Go package upload details. ### Request Example { "package_file": "binary_data" } ### Response #### Success Response (200) - **result** (GoPackageUpload) - The uploaded package details. #### Response Example { "slug": "go-package-slug", "status": "uploaded" } ``` -------------------------------- ### Upload Conda Package to Cloudsmith API Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/ruby/src/docs/PackagesApi.md Provides a Ruby example for uploading Conda packages to Cloudsmith. It covers the necessary setup including gem loading, authentication configuration, and instantiating the PackagesApi. The code specifies owner, repository, and uses CondaPackageUploadRequest for the upload data, with error handling. ```ruby # load the gem require 'cloudsmith-api' # setup authorization CloudsmithApi.configure do |config| # Configure API key authorization: apikey config.api_key['X-Api-Key'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) #config.api_key_prefix['X-Api-Key'] = 'Bearer' # Configure HTTP basic authorization: basic config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' end api_instance = CloudsmithApi::PackagesApi.new owner = 'owner_example' # String | repo = 'repo_example' # String | opts = { data: CloudsmithApi::CondaPackageUploadRequest.new # CondaPackageUploadRequest | } begin #Create a new Conda package result = api_instance.packages_upload_conda(owner, repo, opts) p result rescue CloudsmithApi::ApiError => e puts "Exception when calling PackagesApi->packages_upload_conda: #{e}" end ``` -------------------------------- ### Create HuggingFace Upstream Configuration in Java Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Demonstrates how to initialize the Cloudsmith API client with authentication and create a new HuggingFace upstream configuration using the ReposApi class. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; String identifier = "identifier_example"; HuggingfaceUpstreamRequest data = new HuggingfaceUpstreamRequest(); try { HuggingfaceUpstream result = apiInstance.reposUpstreamHuggingfaceCreate(owner, identifier, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamHuggingfaceCreate"); e.printStackTrace(); } ``` -------------------------------- ### Create NuGet upstream config for a repository (Java) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md This Java code example illustrates how to create a NuGet upstream configuration for a repository using the Cloudsmith API. It requires authentication setup and calls the `reposUpstreamNugetCreate` method from the ReposApi class, passing the repository owner, identifier, and NuGet upstream data. ```java import io.cloudsmith.api.ApiClient; import io.cloudsmith.api.ApiException; import io.cloudsmith.api.Configuration; import io.cloudsmith.api.auth.*; import io.cloudsmith.api.apis.ReposApi; ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; // String | String identifier = "identifier_example"; // String | NugetUpstreamRequest data = new NugetUpstreamRequest(); // NugetUpstreamRequest | try { NugetUpstream result = apiInstance.reposUpstreamNugetCreate(owner, identifier, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamNugetCreate"); e.printStackTrace(); } ``` -------------------------------- ### Create Helm Upstream Configuration - Java Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md This Java code snippet illustrates how to create a Helm upstream configuration for a repository. Similar to other examples, it requires authentication setup using API key or basic credentials. The ReposApi client is used to invoke the reposUpstreamHelmCreate method, which takes owner, identifier, and a GoUpstreamRequest object as input. ```java import io.cloudsmith.api.ApiClient; import io.cloudsmith.api.ApiException; import io.cloudsmith.api.Configuration; import io.cloudsmith.api.auth.*; import io.cloudsmith.api.apis.ReposApi; ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; // String | String identifier = "identifier_example"; // String | GoUpstreamRequest data = new GoUpstreamRequest(); // GoUpstreamRequest | try { HelmUpstream result = apiInstance.reposUpstreamHelmCreate(owner, identifier, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamHelmCreate"); e.printStackTrace(); } ``` -------------------------------- ### POST /orgs/{org}/openid-connect/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/OrgsApi.md Creates the OpenID Connect provider settings for a given organization. ```APIDOC ## POST /orgs/{org}/openid-connect/ ### Description Creates the OpenID Connect provider settings for the organization. ### Method POST ### Endpoint /orgs/{org}/openid-connect/ ### Parameters #### Path Parameters - **org** (str) - Required - The organization identifier. #### Query Parameters None #### Request Body - **data** (ProviderSettingsWriteRequest) - Optional - The settings for the OpenID Connect provider. ### Request Example ```python { "example": "{\"client_id\": \"example_client_id\", \"client_secret\": \"example_client_secret\", \"discovery_endpoint\": \"https://example.com/.well-known/openid-configuration\"}" } ``` ### Response #### Success Response (200) - **ProviderSettingsWrite** (object) - The created OpenID Connect provider settings. #### Response Example ```json { "example": "{\"id\": \"example_id\", \"created_at\": \"2023-10-27T10:00:00Z\", \"updated_at\": \"2023-10-27T10:00:00Z\", \"provider\": \"oidc\", \"client_id\": \"example_client_id\", \"discovery_endpoint\": \"https://example.com/.well-known/openid-configuration\"}" } ``` ``` -------------------------------- ### Upload LuaRocks Package using Cloudsmith Java API Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/PackagesApi.md This example illustrates how to upload a LuaRocks package to a Cloudsmith repository using the Java API client. It covers the necessary authentication setup (API key or basic) and the method call for uploading. Ensure the Cloudsmith API client libraries are correctly included in your project. ```java import io.cloudsmith.api.ApiClient; import io.cloudsmith.api.ApiException; import io.cloudsmith.api.Configuration; import io.cloudsmith.api.auth.*; import io.cloudsmith.api.apis.PackagesApi; import io.cloudsmith.api.models.LuarocksPackageUploadRequest; import io.cloudsmith.api.models.LuarocksPackageUpload; public class CloudsmithLuarocksUpload { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); PackagesApi apiInstance = new PackagesApi(); String owner = "owner_example"; // String | String repo = "repo_example"; // String | LuarocksPackageUploadRequest data = new LuarocksPackageUploadRequest(); // LuarocksPackageUploadRequest | try { LuarocksPackageUpload result = apiInstance.packagesUploadLuarocks(owner, repo, data); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PackagesApi#packagesUploadLuarocks"); e.printStackTrace(); } } } ``` -------------------------------- ### Get Quota Usage (Java) - Alternative Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/QuotaApi.md This Java code snippet shows an alternative method to fetch quota usage for an owner via the Cloudsmith API. It also covers authentication setup (API key or basic) and error handling for API calls. Ensure the Cloudsmith API client library is included in your project dependencies. ```java import io.cloudsmith.api.ApiClient; import io.cloudsmith.api.ApiException; import io.cloudsmith.api.Configuration; import io.cloudsmith.api.auth.ApiKeyAuth; import io.cloudsmith.api.auth.HttpBasicAuth; import io.cloudsmith.api.apis.QuotaApi; import io.cloudsmith.api.models.Quota; public class CloudsmithQuotaExampleAlt { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) // apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); QuotaApi apiInstance = new QuotaApi(); String owner = "owner_example"; // String | try { Quota result = apiInstance.quotaRead(owner); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling QuotaApi#quotaRead"); e.printStackTrace(); } } } ``` -------------------------------- ### List Go Upstream Configurations - Java Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md This Java code snippet demonstrates how to list Go upstream configurations for a given repository. It requires authentication using an API key or basic credentials and utilizes the ReposApi client. The function returns a list of GoUpstream objects. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); // Configure API key authorization: apikey ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //apikey.setApiKeyPrefix("Token"); // Configure HTTP basic authorization: basic HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; // String | String identifier = "identifier_example"; // String | java.math.BigInteger page = new java.math.BigInteger(); // java.math.BigInteger | A page number within the paginated result set. java.math.BigInteger pageSize = new java.math.BigInteger(); // java.math.BigInteger | Number of results to return per page. try { List result = apiInstance.reposUpstreamGoList(owner, identifier, page, pageSize); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ReposApi#reposUpstreamGoList"); e.printStackTrace(); } ``` -------------------------------- ### Get Package Version Badge (Ruby) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/ruby/src/docs/BadgesApi.md Retrieves the latest package version badge for a specified package or package group. This Ruby example demonstrates how to configure the Cloudsmith API client with authentication (API key or basic auth) and then call the `badges_version_list` method with various optional parameters to customize the badge appearance and behavior. It handles potential API errors. ```ruby require 'cloudsmith-api' CloudsmithApi.configure do |config| config.api_key['X-Api-Key'] = 'YOUR API KEY' # config.api_key_prefix['X-Api-Key'] = 'Bearer' config.username = 'YOUR USERNAME' config.password = 'YOUR PASSWORD' end api_instance = CloudsmithApi::BadgesApi.new owner = 'owner_example' repo = 'repo_example' package_format = 'package_format_example' package_name = 'package_name_example' package_version = 'package_version_example' package_identifiers = 'package_identifiers_example' opts = { badge_token: '', cache_seconds: '300', color: '12577E', label: 'cloudsmith', label_color: '021F2F', logo_color: '45B6EE', logo_width: '10', render: false, shields: false, show_latest: false, style: 'flat-square' } begin result = api_instance.badges_version_list(owner, repo, package_format, package_name, package_version, package_identifiers, opts) p result rescue CloudsmithApi::ApiError => e puts "Exception when calling BadgesApi->badges_version_list: #{e}" end ``` -------------------------------- ### Create Organization OpenID Connect Settings (Python) Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/OrgsApi.md Creates OpenID Connect provider settings for an organization via the Cloudsmith API. Requires API key or basic authentication. Accepts organization identifier and provider settings data. Returns the created provider settings. ```python from __future__ import print_function import time import cloudsmith_api from cloudsmith_api.rest import ApiException from pprint import pprint # Configure API key authorization: apikey configuration = cloudsmith_api.Configuration() configuration.api_key['X-Api-Key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['X-Api-Key'] = 'Bearer' # Configure HTTP basic authorization: basic configuration = cloudsmith_api.Configuration() configuration.username = 'YOUR_USERNAME' configuration.password = 'YOUR_PASSWORD' # create an instance of the API class api_instance = cloudsmith_api.OrgsApi(cloudsmith_api.ApiClient(configuration)) org = 'org_example' # str | data = cloudsmith_api.ProviderSettingsWrite() # ProviderSettingsWrite | (optional) try: # Create the OpenID Connect provider settings for the org. api_response = api_instance.orgs_openid_connect_create(org, data=data) pprint(api_response) except ApiException as e: print("Exception when calling OrgsApi->orgs_openid_connect_create: %s\n" % e) ``` -------------------------------- ### GET /packages/{owner}/{repo}/{identifier}/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/ruby/src/docs/PackagesApi.md Get a specific package in a repository. ```APIDOC ## GET /packages/{owner}/{repo}/{identifier}/ ### Description Get a specific package in a repository. ### Method GET ### Endpoint /packages/{owner}/{repo}/{identifier}/ ### Parameters #### Path Parameters - **owner** (string) - Required - The owner of the repository. - **repo** (string) - Required - The name of the repository. - **identifier** (string) - Required - The unique identifier of the package. #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body needed for this operation." } ``` ### Response #### Success Response (200) - **name** (string) - The name of the package. - **version** (string) - The version of the package. - **type** (string) - The type of the package. - **created_at** (string) - The creation timestamp of the package. #### Response Example ```json { "name": "my-package", "version": "1.2.3", "type": "generic", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Read Helm Upstream Configuration in Java Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/ReposApi.md Demonstrates how to authenticate using API keys or basic auth and retrieve a Helm upstream configuration using the ReposApi class. ```java ApiClient defaultClient = Configuration.getDefaultApiClient(); ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication("apikey"); apikey.setApiKey("YOUR API KEY"); HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic"); basic.setUsername("YOUR USERNAME"); basic.setPassword("YOUR PASSWORD"); ReposApi apiInstance = new ReposApi(); String owner = "owner_example"; String identifier = "identifier_example"; String slugPerm = "slugPerm_example"; try { HelmUpstream result = apiInstance.reposUpstreamHelmRead(owner, identifier, slugPerm); System.out.println(result); } catch (ApiException e) { e.printStackTrace(); } ``` -------------------------------- ### POST /repos/{owner}/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/ruby/src/docs/ReposApi.md Creates a new repository within the specified namespace. ```APIDOC ## POST /repos/{owner}/ ### Description Create a new repository in a given namespace. ### Method POST ### Endpoint /repos/{owner}/ ### Parameters #### Path Parameters - **owner** (string) - Required - The namespace owner of the repository. ### Request Example { "name": "my-new-repo", "slug": "my-new-repo", "description": "A new repository" } ### Response #### Success Response (201) - **slug** (string) - The unique identifier of the created repository. #### Response Example { "slug": "my-new-repo", "name": "my-new-repo" } ``` -------------------------------- ### GET /packages/{owner}/{repo}/{identifier}/status/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/ruby/src/docs/PackagesApi.md Get the synchronization status for a package. ```APIDOC ## GET /packages/{owner}/{repo}/{identifier}/status/ ### Description Get the synchronization status for a package. ### Method GET ### Endpoint /packages/{owner}/{repo}/{identifier}/status/ ### Parameters #### Path Parameters - **owner** (string) - Required - The owner of the repository. - **repo** (string) - Required - The name of the repository. - **identifier** (string) - Required - The unique identifier of the package. #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "No request body needed for this operation." } ``` ### Response #### Success Response (200) - **status** (string) - The synchronization status of the package (e.g., 'synced', 'syncing', 'failed'). #### Response Example ```json { "status": "synced" } ``` ``` -------------------------------- ### GET /orgs/{org}/vulnerability-policy/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/python/src/docs/OrgsApi.md Get a list of all package vulnerability policies for an organization. ```APIDOC ## GET /orgs/{org}/vulnerability-policy/ ### Description Get a list of all package vulnerability policies. ### Method GET ### Endpoint /orgs/{org}/vulnerability-policy/ ### Parameters #### Path Parameters - **org** (string) - Required - The organization identifier. ### Response #### Success Response (200) - **policies** (array) - A list of vulnerability policies. #### Response Example { "policies": [ { "id": 1, "name": "Default Policy", "slug_perm": "default-policy-123" } ] } ``` -------------------------------- ### GET /orgs/{org}/license/policy Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/ruby/src/docs/OrgsApi.md Get a list of all package license policies for a given organization. ```APIDOC ## GET /orgs/{org}/license/policy ### Description Get a list of all package license policies. ### Method GET ### Endpoint /orgs/{org}/license/policy ### Parameters #### Path Parameters - **org** (String) - Required - Organization identifier. #### Query Parameters - **page** (Integer) - Optional - A page number within the paginated result set. - **page_size** (Integer) - Optional - Number of results to return per page. ### Response #### Success Response (200) - **Array** (Array) - A list of organization package license policies. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### POST /orgs/{org}/saml/group-sync/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/java/src/docs/OrgsApi.md Create a new SAML Group Sync mapping within an organization. ```APIDOC ## POST /orgs/{org}/saml/group-sync/ ### Description Create a new SAML Group Sync mapping within an organization. ### Method POST ### Endpoint /orgs/{org}/saml/group-sync/ ### Parameters #### Path Parameters - **org** (String) - Required - The organization slug. #### Request Body - **data** (OrganizationGroupSyncRequest) - Optional - The SAML group sync configuration details. ### Request Example { "group_name": "developers", "team_slug": "dev-team" } ### Response #### Success Response (200) - **OrganizationGroupSync** (Object) - The created SAML group sync mapping object. #### Response Example { "slug_perm": "sync-123", "group_name": "developers", "team_slug": "dev-team" } ``` -------------------------------- ### POST /orgs/{org}/saml/group-sync/ Source: https://github.com/cloudsmith-io/cloudsmith-api/blob/master/bindings/ruby/src/docs/OrgsApi.md Create a new SAML Group Sync mapping within an organization. ```APIDOC ## POST /orgs/{org}/saml/group-sync/ ### Description Create a new SAML Group Sync mapping within an organization. ### Method POST ### Endpoint /orgs/{org}/saml/group-sync/ ### Parameters #### Path Parameters - **org** (String) - Required - The organization slug. #### Request Body - **data** (OrganizationGroupSyncRequest) - Optional - The group sync mapping details. ### Response #### Success Response (200) - **OrganizationGroupSync** (Object) - The created group sync mapping. #### Response Example { "id": "sync-123", "saml_group": "admin-group" } ```