Skip to content

Latest commit

 

History

History
220 lines (143 loc) · 6.1 KB

File metadata and controls

220 lines (143 loc) · 6.1 KB

\TokensAPI

All URIs are relative to https://dashboard.quantcdn.io

Method HTTP request Description
TokensCreate Post /api/v2/organizations/{organization}/tokens Create a new API token scoped to this organization
TokensDelete Delete /api/v2/organizations/{organization}/tokens/{token_id} Revoke an API token
TokensList Get /api/v2/organizations/{organization}/tokens List API tokens scoped to this organization

TokensCreate

TokensCreate201Response TokensCreate(ctx, organization).TokensCreateRequest(tokensCreateRequest).Execute()

Create a new API token scoped to this organization

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/quantcdn/quant-admin-go"
)

func main() {
	organization := "test-org" // string | Organization identifier
	tokensCreateRequest := *openapiclient.NewTokensCreateRequest("My CI token") // TokensCreateRequest | 

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

Path Parameters

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

Other Parameters

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

Name Type Description Notes

tokensCreateRequest | TokensCreateRequest | |

Return type

TokensCreate201Response

Authorization

BearerAuth

HTTP request headers

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

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

TokensDelete

TokensDelete200Response TokensDelete(ctx, organization, tokenId).Execute()

Revoke an API token

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/quantcdn/quant-admin-go"
)

func main() {
	organization := "test-org" // string | Organization identifier
	tokenId := int32(42) // int32 | Token ID to revoke

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

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
organization string Organization identifier
tokenId int32 Token ID to revoke

Other Parameters

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

Name Type Description Notes

Return type

TokensDelete200Response

Authorization

BearerAuth

HTTP request headers

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

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

TokensList

[]TokensList200ResponseInner TokensList(ctx, organization).Execute()

List API tokens scoped to this organization

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/quantcdn/quant-admin-go"
)

func main() {
	organization := "test-org" // string | Organization identifier

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

Path Parameters

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

Other Parameters

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

Name Type Description Notes

Return type

[]TokensList200ResponseInner

Authorization

BearerAuth

HTTP request headers

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

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