Skip to content

Basis-Theory/basistheory-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basis Theory Go SDK

Release

Getting Started

  • Sign-in to Basis Theory and go to Applications
  • Create a Basis Theory Private Application
  • All permissions should be selected
  • Paste the API Key into the BT-API-KEY variable

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import basistheory "github.com/Basis-Theory/basistheory-go/v5"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Running tests locally

To run tests locally, you'll need to create a Basis Theory tenant with private and management applications that are granted all permissions, then add the API keys for these applications to a .env.local file. You'll want to follow the same format as defined in the .env.example file. Then you can run make verify from the root of this repository to run all tests.

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), basistheory.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), basistheory.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), basistheory.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), basistheory.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.basistheory.com

Class Method HTTP request Description
ApplicationKeysApi Create Post /applications/{id}/keys
ApplicationKeysApi Delete Delete /applications/{id}/keys/{keyId}
ApplicationKeysApi Get Get /applications/{id}/keys
ApplicationKeysApi GetById Get /applications/{id}/keys/{keyId}
ApplicationTemplatesApi Get Get /application-templates
ApplicationTemplatesApi GetById Get /application-templates/{id}
ApplicationsApi Create Post /applications
ApplicationsApi Delete Delete /applications/{id}
ApplicationsApi Get Get /applications
ApplicationsApi GetById Get /applications/{id}
ApplicationsApi GetByKey Get /applications/key
ApplicationsApi RegenerateKey Post /applications/{id}/regenerate
ApplicationsApi Update Put /applications/{id}
LogsApi Get Get /logs
LogsApi GetEntityTypes Get /logs/entity-types
PermissionsApi Get Get /permissions
ProxiesApi Create Post /proxies
ProxiesApi Delete Delete /proxies/{id}
ProxiesApi Get Get /proxies
ProxiesApi GetById Get /proxies/{id}
ProxiesApi Patch Patch /proxies/{id}
ProxiesApi Update Put /proxies/{id}
ReactorFormulasApi Create Post /reactor-formulas
ReactorFormulasApi Delete Delete /reactor-formulas/{id}
ReactorFormulasApi Get Get /reactor-formulas
ReactorFormulasApi GetById Get /reactor-formulas/{id}
ReactorFormulasApi Update Put /reactor-formulas/{id}
ReactorsApi Create Post /reactors
ReactorsApi Delete Delete /reactors/{id}
ReactorsApi Get Get /reactors
ReactorsApi GetById Get /reactors/{id}
ReactorsApi Patch Patch /reactors/{id}
ReactorsApi React Post /reactors/{id}/react
ReactorsApi Update Put /reactors/{id}
SessionsApi Authorize Post /sessions/authorize
SessionsApi Create Post /sessions
TenantsApi CreateInvitation Post /tenants/self/invitations
TenantsApi Delete Delete /tenants/self
TenantsApi DeleteInvitation Delete /tenants/self/invitations/{invitationId}
TenantsApi DeleteMember Delete /tenants/self/members/{memberId}
TenantsApi Get Get /tenants/self
TenantsApi GetInvitations Get /tenants/self/invitations
TenantsApi GetMembers Get /tenants/self/members
TenantsApi GetTenantUsageReport Get /tenants/self/reports/usage
TenantsApi ResendInvitation Post /tenants/self/invitations/{invitationId}/resend
TenantsApi Update Put /tenants/self
ThreeDSApi ThreeDSAuthenticateSession Post /3ds/sessions/{sessionId}/authenticate
ThreeDSApi ThreeDSGetChallengeResult Get /3ds/sessions/{sessionId}/challenge-result
ThreeDSApi ThreeDSGetSessionById Get /3ds/sessions/{id}
TokenizeApi Tokenize Post /tokenize
TokensApi Create Post /tokens
TokensApi Delete Delete /tokens/{id}
TokensApi Get Get /tokens
TokensApi GetById Get /tokens/{id}
TokensApi Search Post /tokens/search
TokensApi Update Patch /tokens/{id}

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKey

  • Type: API key
  • API key parameter name: BT-API-KEY
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: BT-API-KEY and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author