api_keys

package
v0.0.1-beta.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiKeysService

type ApiKeysService struct {
	// contains filtered or unexported fields
}

func NewApiKeysService

func NewApiKeysService(c *client.Client) *ApiKeysService

func (*ApiKeysService) Create

func (s *ApiKeysService) Create(ctx context.Context, merchantCode string, body CreateApikeyBody) (*Apikey, error)

Create: Create an API key Create a new API key.

func (*ApiKeysService) Delete

func (s *ApiKeysService) Delete(ctx context.Context, merchantCode string, keyId string) error

Delete: Delete an API key Delete an API key.

func (*ApiKeysService) Get

func (s *ApiKeysService) Get(ctx context.Context, merchantCode string, keyId string) (*Apikey, error)

Get: Retrieve an API Key Retrieve an API key.

func (*ApiKeysService) List

func (s *ApiKeysService) List(ctx context.Context, merchantCode string, params ListApikeysParams) (*ApikeysList, error)

List: List API keys List merchant's API keys.

func (*ApiKeysService) Update

func (s *ApiKeysService) Update(ctx context.Context, merchantCode string, keyId string, body UpdateApikeyBody) error

Update: Update an API key Update an API key.

type Apikey

type Apikey struct {
	// The timestamp of when the API key was created.
	CreatedAt time.Time `json:"created_at"`
	// Unique identifier of the API Key.
	Id string `json:"id"`
	// User-assigned name of the API Key.
	Name string `json:"name"`
	// The plaintext value of the API key. This field is returned only in the response to API key creation and is
	// never again available in the plaintext form.
	Plaintext *string `json:"plaintext,omitempty"`
	// Last 8 characters of the API key.
	Preview string `json:"preview"`
	// Max items: 128
	Scopes Oauth2Scopes `json:"scopes"`
	Type   ApikeyType   `json:"type"`
	// The timestamp of when the API key was last updated.
	UpdatedAt time.Time `json:"updated_at"`
}

Apikey: An API key is a static token that allows you to authorize with SumUp APIs. Keep your API keys secret and safe. Do not share your API keys or expose them in a publicly accessible areas such as client-side code (browser or apps) or in the GitHub.

type ApikeyType

type ApikeyType string

ApikeyType is a schema definition.

const (
	ApikeyTypePublic ApikeyType = "public"
	ApikeyTypeSecret ApikeyType = "secret"
)

type ApikeysList

type ApikeysList struct {
	// List of API keys.
	Items []Apikey `json:"items"`
	// Total number of API keys.
	TotalCount int `json:"total_count"`
}

ApikeysList: List of API keys.

type CreateApikeyBody

type CreateApikeyBody struct {
	// Name of the API key.
	// Max length: 255
	Name string `json:"name"`
	// Max items: 128
	Scopes Oauth2Scopes `json:"scopes"`
}

CreateApikeyBody is a schema definition.

type ListApikeysParams

type ListApikeysParams struct {
	// Maximum number of API Keys to return.
	Limit *int
	// Offset of the first API Key to return.
	Offset *int
}

ListApikeysParams: query parameters for ListAPIKeys

func (*ListApikeysParams) QueryValues

func (p *ListApikeysParams) QueryValues() url.Values

QueryValues converts ListApikeysParams into url.Values.

type Oauth2Scope

type Oauth2Scope string

Oauth2Scope is a schema definition.

const (
	Oauth2ScopeAccountingRead      Oauth2Scope = "accounting.read"
	Oauth2ScopeAccountingWrite     Oauth2Scope = "accounting.write"
	Oauth2ScopeEmail               Oauth2Scope = "email"
	Oauth2ScopeInvoicesRead        Oauth2Scope = "invoices.read"
	Oauth2ScopeInvoicesWrite       Oauth2Scope = "invoices.write"
	Oauth2ScopePaymentInstruments  Oauth2Scope = "payment_instruments"
	Oauth2ScopePayments            Oauth2Scope = "payments"
	Oauth2ScopeProducts            Oauth2Scope = "products"
	Oauth2ScopeProfile             Oauth2Scope = "profile"
	Oauth2ScopeReadersRead         Oauth2Scope = "readers.read"
	Oauth2ScopeReadersWrite        Oauth2Scope = "readers.write"
	Oauth2ScopeTransactionsHistory Oauth2Scope = "transactions.history"
	Oauth2ScopeUserAppSettings     Oauth2Scope = "user.app-settings"
	Oauth2ScopeUserPayoutSettings  Oauth2Scope = "user.payout-settings"
	Oauth2ScopeUserProfile         Oauth2Scope = "user.profile"
	Oauth2ScopeUserProfileReadonly Oauth2Scope = "user.profile_readonly"
	Oauth2ScopeUserSubaccounts     Oauth2Scope = "user.subaccounts"
)

type Oauth2Scopes

type Oauth2Scopes []Oauth2Scope

Oauth2Scopes is a schema definition. Max items: 128

type UpdateApikeyBody

type UpdateApikeyBody struct {
	// New name for the API key.
	// Max length: 255
	Name string `json:"name"`
	// Max items: 128
	Scopes Oauth2Scopes `json:"scopes"`
}

UpdateApikeyBody is a schema definition.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL