Skip to content

Latest commit

 

History

History
349 lines (219 loc) · 8.77 KB

APITokensAPI.md

File metadata and controls

349 lines (219 loc) · 8.77 KB

\APITokensAPI

All URIs are relative to https://us.app.unleash-hosted.com/ushosted

Method HTTP request Description
CreateApiToken Post /api/admin/api-tokens Create API token
DeleteApiToken Delete /api/admin/api-tokens/{token} Delete API token
GetAllApiTokens Get /api/admin/api-tokens Get API tokens
GetApiTokensByName Get /api/admin/api-tokens/{name} Get API tokens by name
UpdateApiToken Put /api/admin/api-tokens/{token} Update API token

CreateApiToken

ApiTokenSchema CreateApiToken(ctx).CreateApiTokenSchema(createApiTokenSchema).Execute()

Create API token

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/Unleash/unleash-server-api-go"
)

func main() {
	createApiTokenSchema := openapiclient.createApiTokenSchema{CreateApiTokenSchemaOneOf: openapiclient.NewCreateApiTokenSchemaOneOf("admin", "token-64522")} // CreateApiTokenSchema | createApiTokenSchema

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

Path Parameters

Other Parameters

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

Name Type Description Notes
createApiTokenSchema CreateApiTokenSchema createApiTokenSchema

Return type

ApiTokenSchema

Authorization

bearerToken, apiKey

HTTP request headers

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

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

DeleteApiToken

DeleteApiToken(ctx, token).Execute()

Delete API token

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/Unleash/unleash-server-api-go"
)

func main() {
	token := "token_example" // string | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.APITokensAPI.DeleteApiToken(context.Background(), token).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `APITokensAPI.DeleteApiToken``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
token string

Other Parameters

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

Name Type Description Notes

Return type

(empty response body)

Authorization

bearerToken, apiKey

HTTP request headers

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

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

GetAllApiTokens

ApiTokensSchema GetAllApiTokens(ctx).Execute()

Get API tokens

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/Unleash/unleash-server-api-go"
)

func main() {

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

Path Parameters

This endpoint does not need any parameter.

Other Parameters

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

Return type

ApiTokensSchema

Authorization

bearerToken, apiKey

HTTP request headers

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

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

GetApiTokensByName

ApiTokensSchema GetApiTokensByName(ctx, name).Execute()

Get API tokens by name

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/Unleash/unleash-server-api-go"
)

func main() {
	name := "name_example" // string | 

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string

Other Parameters

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

Name Type Description Notes

Return type

ApiTokensSchema

Authorization

bearerToken, apiKey

HTTP request headers

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

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

UpdateApiToken

UpdateApiToken(ctx, token).UpdateApiTokenSchema(updateApiTokenSchema).Execute()

Update API token

Example

package main

import (
	"context"
	"fmt"
	"os"
    "time"
	openapiclient "github.com/Unleash/unleash-server-api-go"
)

func main() {
	token := "token_example" // string | 
	updateApiTokenSchema := *openapiclient.NewUpdateApiTokenSchema(time.Now()) // UpdateApiTokenSchema | updateApiTokenSchema

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.APITokensAPI.UpdateApiToken(context.Background(), token).UpdateApiTokenSchema(updateApiTokenSchema).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `APITokensAPI.UpdateApiToken``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
token string

Other Parameters

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

Name Type Description Notes

updateApiTokenSchema | UpdateApiTokenSchema | updateApiTokenSchema |

Return type

(empty response body)

Authorization

bearerToken, apiKey

HTTP request headers

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

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