Skip to content

Latest commit

 

History

History
292 lines (210 loc) · 9.43 KB

File metadata and controls

292 lines (210 loc) · 9.43 KB

cloudsmith_api.UserApi

All URIs are relative to https://api.cloudsmith.io

Method HTTP request Description
user_self GET /user/self/ Provide a brief for the current user (if any).
user_token_create POST /user/token/ Create or retrieve API token for a user.
user_tokens_create POST /user/tokens/ Create an API key for the user that is currently authenticated.
user_tokens_list GET /user/tokens/ Retrieve the API key assigned to the user that is currently authenticated.
user_tokens_refresh PUT /user/tokens/{slug_perm}/refresh/ Refresh the specified API key for the user that is currently authenticated.

user_self

UserBrief user_self()

Provide a brief for the current user (if any).

Provide a brief for the current user (if any).

Example

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.UserApi(cloudsmith_api.ApiClient(configuration))

try:
    # Provide a brief for the current user (if any).
    api_response = api_instance.user_self()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->user_self: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

UserBrief

Authorization

apikey, basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

user_token_create

UserAuthToken user_token_create(data=data)

Create or retrieve API token for a user.

Handles both: - Users authenticating with basic credentials to get a token - Two-factor authentication flow

Example

from __future__ import print_function
import time
import cloudsmith_api
from cloudsmith_api.rest import ApiException
from pprint import pprint

# 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.UserApi(cloudsmith_api.ApiClient(configuration))
data = cloudsmith_api.UserAuthTokenRequest() # UserAuthTokenRequest |  (optional)

try:
    # Create or retrieve API token for a user.
    api_response = api_instance.user_token_create(data=data)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->user_token_create: %s\n" % e)

Parameters

Name Type Description Notes
data UserAuthTokenRequest [optional]

Return type

UserAuthToken

Authorization

basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

user_tokens_create

UserAuthenticationToken user_tokens_create()

Create an API key for the user that is currently authenticated.

Create an API key for the user that is currently authenticated.

Example

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.UserApi(cloudsmith_api.ApiClient(configuration))

try:
    # Create an API key for the user that is currently authenticated.
    api_response = api_instance.user_tokens_create()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->user_tokens_create: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

UserAuthenticationToken

Authorization

apikey, basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

user_tokens_list

InlineResponse2002 user_tokens_list(page=page, page_size=page_size)

Retrieve the API key assigned to the user that is currently authenticated.

Retrieve the API key assigned to the user that is currently authenticated.

Example

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.UserApi(cloudsmith_api.ApiClient(configuration))
page = 56 # int | A page number within the paginated result set. (optional)
page_size = 56 # int | Number of results to return per page. (optional)

try:
    # Retrieve the API key assigned to the user that is currently authenticated.
    api_response = api_instance.user_tokens_list(page=page, page_size=page_size)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->user_tokens_list: %s\n" % e)

Parameters

Name Type Description Notes
page int A page number within the paginated result set. [optional]
page_size int Number of results to return per page. [optional]

Return type

InlineResponse2002

Authorization

apikey, basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

user_tokens_refresh

UserAuthenticationToken user_tokens_refresh(slug_perm)

Refresh the specified API key for the user that is currently authenticated.

Refresh the specified API key for the user that is currently authenticated.

Example

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.UserApi(cloudsmith_api.ApiClient(configuration))
slug_perm = 'slug_perm_example' # str | 

try:
    # Refresh the specified API key for the user that is currently authenticated.
    api_response = api_instance.user_tokens_refresh(slug_perm)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->user_tokens_refresh: %s\n" % e)

Parameters

Name Type Description Notes
slug_perm str

Return type

UserAuthenticationToken

Authorization

apikey, basic

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]