Skip to content

Latest commit

 

History

History
150 lines (95 loc) · 3.87 KB

File metadata and controls

150 lines (95 loc) · 3.87 KB

\TokensAPI

All URIs are relative to https://api.opal.dev/v1

Method HTTP request Description
DeleteToken Delete /tokens/{token_id} Delete token
GetTokens Get /tokens Get tokens

DeleteToken

DeleteToken(ctx, tokenId).Execute()

Delete token

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/opalsecurity/opal-go"
)

func main() {
	tokenId := "f454d283-ca87-4a8a-bdbb-df212eca5353" // string | The ID of the token to delete.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.TokensAPI.DeleteToken(context.Background(), tokenId).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TokensAPI.DeleteToken``: %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.
tokenId string The ID of the token to delete.

Other Parameters

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

Name Type Description Notes

Return type

(empty response body)

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

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

GetTokens

PaginatedTokensList GetTokens(ctx).Cursor(cursor).PageSize(pageSize).TokenIds(tokenIds).UserId(userId).Execute()

Get tokens

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/opalsecurity/opal-go"
)

func main() {
	cursor := "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw" // string | The pagination cursor value. (optional)
	pageSize := int32(200) // int32 | Number of results to return per page. Default is 200. (optional)
	tokenIds := []string{"Inner_example"} // []string | Filter by token IDs. (optional)
	userId := "29827fb8-f2dd-4e80-9576-28e31e9934ac" // string | Filter by user ID. (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.TokensAPI.GetTokens(context.Background()).Cursor(cursor).PageSize(pageSize).TokenIds(tokenIds).UserId(userId).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `TokensAPI.GetTokens``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetTokens`: PaginatedTokensList
	fmt.Fprintf(os.Stdout, "Response from `TokensAPI.GetTokens`: %v\n", resp)
}

Path Parameters

Other Parameters

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

Name Type Description Notes
cursor string The pagination cursor value.
pageSize int32 Number of results to return per page. Default is 200.
tokenIds []string Filter by token IDs.
userId string Filter by user ID.

Return type

PaginatedTokensList

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]