All URIs are relative to https://api.cloudsmith.io
| Method | HTTP request | Description |
|---|---|---|
| UserSelf | Get /user/self/ | Provide a brief for the current user (if any). |
| UserTokenCreate | Post /user/token/ | Create or retrieve API token for a user. |
| UserTokensCreate | Post /user/tokens/ | Create an API key for the user that is currently authenticated. |
| UserTokensList | Get /user/tokens/ | Retrieve the API key assigned to the user that is currently authenticated. |
| UserTokensRefresh | Put /user/tokens/{slug_perm}/refresh/ | Refresh the specified API key for the user that is currently authenticated. |
UserBrief UserSelf(ctx).Execute()
Provide a brief for the current user (if any).
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)
}This endpoint does not need any parameter.
Other parameters are passed through a pointer to a apiUserSelfRequest struct via the builder pattern
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserAuthToken UserTokenCreate(ctx).Data(data).Execute()
Create or retrieve API token for a user.
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)
}Other parameters are passed through a pointer to a apiUserTokenCreateRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| data | UserAuthTokenRequest |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserAuthenticationToken UserTokensCreate(ctx).Execute()
Create an API key for the user that is currently authenticated.
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.UserTokensCreate(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UserTokensCreate``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UserTokensCreate`: UserAuthenticationToken
fmt.Fprintf(os.Stdout, "Response from `UserApi.UserTokensCreate`: %v\n", resp)
}This endpoint does not need any parameter.
Other parameters are passed through a pointer to a apiUserTokensCreateRequest struct via the builder pattern
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserTokensList200Response UserTokensList(ctx).Page(page).PageSize(pageSize).Execute()
Retrieve the API key assigned to the user that is currently authenticated.
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cloudsmith-io/cloudsmith-api-go"
)
func main() {
page := int64(56) // int64 | A page number within the paginated result set. (optional)
pageSize := int64(56) // int64 | Number of results to return per page. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UserApi.UserTokensList(context.Background()).Page(page).PageSize(pageSize).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UserTokensList``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UserTokensList`: UserTokensList200Response
fmt.Fprintf(os.Stdout, "Response from `UserApi.UserTokensList`: %v\n", resp)
}Other parameters are passed through a pointer to a apiUserTokensListRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| page | int64 | A page number within the paginated result set. | |
| pageSize | int64 | Number of results to return per page. |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UserAuthenticationToken UserTokensRefresh(ctx, slugPerm).Execute()
Refresh the specified API key for the user that is currently authenticated.
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/cloudsmith-io/cloudsmith-api-go"
)
func main() {
slugPerm := "slugPerm_example" // string |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UserApi.UserTokensRefresh(context.Background(), slugPerm).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UserTokensRefresh``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UserTokensRefresh`: UserAuthenticationToken
fmt.Fprintf(os.Stdout, "Response from `UserApi.UserTokensRefresh`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| slugPerm | string |
Other parameters are passed through a pointer to a apiUserTokensRefreshRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]