Skip to content

Latest commit

 

History

History
137 lines (85 loc) · 3.18 KB

UserApi.md

File metadata and controls

137 lines (85 loc) · 3.18 KB

\UserApi

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

Method HTTP request Description
UserSelf Get /user/self/ Provide a brief for the current user (if any).
UserTokenCreate Post /user/token/ Retrieve/Create API key/token for the authenticated user.

UserSelf

UserBrief UserSelf(ctx).Execute()

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

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cloudsmith-io/cloudsmith-api-go"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.UserApi.UserSelf(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UserSelf``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `UserSelf`: UserBrief
	fmt.Fprintf(os.Stdout, "Response from `UserApi.UserSelf`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiUserSelfRequest struct via the builder pattern

Return type

UserBrief

Authorization

apikey, basic

HTTP request headers

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

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

UserTokenCreate

UserAuthToken UserTokenCreate(ctx).Data(data).Execute()

Retrieve/Create API key/token for the authenticated user.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/cloudsmith-io/cloudsmith-api-go"
)

func main() {
	data := *openapiclient.NewUserAuthTokenRequest() // UserAuthTokenRequest |  (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.UserApi.UserTokenCreate(context.Background()).Data(data).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UserTokenCreate``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `UserTokenCreate`: UserAuthToken
	fmt.Fprintf(os.Stdout, "Response from `UserApi.UserTokenCreate`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiUserTokenCreateRequest struct via the builder pattern

Name Type Description Notes
data UserAuthTokenRequest

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]