openapi

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

README

Go API client for openapi

Moov Accounts is an HTTP service which represents both a general ledger and chart of accounts for customers. The service is designed to abstract over various core systems and provide a uniform API for developers.

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.

Installation

Install the following dependencies:

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

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

import "./openapi"

Documentation for API Endpoints

All URIs are relative to http://localhost:8085

Class Method HTTP request Description
AccountsApi CreateAccount Post /accounts Create a new account for a Customer
AccountsApi CreateTransaction Post /accounts/transactions Post a transaction against multiple accounts. All transaction lines must sum to zero. No money is created or destroyed in a transaction - only moved from account to account. Accounts can be referred to in a Transaction without creating them first.
AccountsApi GetAccountTransactions Get /accounts/{accountID}/transactions Get transactions for an account. Ordered descending from their posted date.
AccountsApi Ping Get /ping Ping the Accounts service to check if running
AccountsApi ReverseTransaction Post /accounts/transactions/{transaction_id}/reversal Reverse a transaction by debiting the credited and crediting the debited amounts among all accounts involved.
AccountsApi SearchAccounts Get /accounts/search Search for account which matches all query parameters

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	AccountsApi *AccountsApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Simple Core System API API v1.0.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type Account

type Account struct {
	// The unique identifier for an account
	ID string `json:"ID,omitempty"`
	// The unique identifier for the customer who owns the account
	CustomerID string `json:"customerID,omitempty"`
	// Caller defined label for this account.
	Name string `json:"name,omitempty"`
	// A unique Account number at the bank.
	AccountNumber string `json:"accountNumber,omitempty"`
	// Last four digits of an account number
	AccountNumberMasked string `json:"accountNumberMasked,omitempty"`
	// Routing Transit Number is a nine-digit number assigned by the ABA
	RoutingNumber string `json:"routingNumber,omitempty"`
	// Status of the account being created.
	Status string `json:"status,omitempty"`
	// Product type of the account
	Type      string    `json:"type,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	ClosedAt  time.Time `json:"closedAt,omitempty"`
	// Last time the object was modified except balances
	LastModified time.Time `json:"lastModified,omitempty"`
	// Total balance of account in USD cents.
	Balance int32 `json:"balance,omitempty"`
	// Balance available in USD cents to be drawn
	BalanceAvailable int32 `json:"balanceAvailable,omitempty"`
	// Balance of pending transactions in USD cents
	BalancePending int32 `json:"balancePending,omitempty"`
}

Account struct for Account

type AccountsApiService

type AccountsApiService service

AccountsApiService AccountsApi service

func (*AccountsApiService) CreateAccount

func (a *AccountsApiService) CreateAccount(ctx _context.Context, xUserID string, createAccount CreateAccount, localVarOptionals *CreateAccountOpts) (Account, *_nethttp.Response, error)

CreateAccount Create a new account for a Customer

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xUserID Moov User ID header, required in all requests
  • @param createAccount
  • @param optional nil or *CreateAccountOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional Request ID allows application developer to trace requests through the systems logs

@return Account

func (*AccountsApiService) CreateTransaction

func (a *AccountsApiService) CreateTransaction(ctx _context.Context, xUserID string, createTransaction CreateTransaction, localVarOptionals *CreateTransactionOpts) (Transaction, *_nethttp.Response, error)

CreateTransaction Post a transaction against multiple accounts. All transaction lines must sum to zero. No money is created or destroyed in a transaction - only moved from account to account. Accounts can be referred to in a Transaction without creating them first.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xUserID Moov User ID header, required in all requests
  • @param createTransaction
  • @param optional nil or *CreateTransactionOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional Request ID allows application developer to trace requests through the systems logs

@return Transaction

func (*AccountsApiService) GetAccountTransactions

func (a *AccountsApiService) GetAccountTransactions(ctx _context.Context, accountID string, xUserID string, localVarOptionals *GetAccountTransactionsOpts) ([]Transaction, *_nethttp.Response, error)

GetAccountTransactions Get transactions for an account. Ordered descending from their posted date.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param accountID Account ID
  • @param xUserID Moov User ID header, required in all requests
  • @param optional nil or *GetAccountTransactionsOpts - Optional Parameters:
  • @param "Limit" (optional.Float32) - Maximum number of transactions to return
  • @param "XRequestID" (optional.String) - Optional Request ID allows application developer to trace requests through the systems logs

@return []Transaction

func (*AccountsApiService) Ping

Ping Ping the Accounts service to check if running

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

func (*AccountsApiService) ReverseTransaction added in v0.4.0

func (a *AccountsApiService) ReverseTransaction(ctx _context.Context, transactionId string, xUserID string, localVarOptionals *ReverseTransactionOpts) (Transaction, *_nethttp.Response, error)

ReverseTransaction Reverse a transaction by debiting the credited and crediting the debited amounts among all accounts involved.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param transactionId Transaction ID
  • @param xUserID Moov User ID header, required in all requests
  • @param optional nil or *ReverseTransactionOpts - Optional Parameters:
  • @param "XRequestID" (optional.String) - Optional Request ID allows application developer to trace requests through the systems logs

@return Transaction

func (*AccountsApiService) SearchAccounts

func (a *AccountsApiService) SearchAccounts(ctx _context.Context, xUserID string, localVarOptionals *SearchAccountsOpts) ([]Account, *_nethttp.Response, error)

SearchAccounts Search for account which matches all query parameters

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param xUserID Moov User ID header, required in all requests
  • @param optional nil or *SearchAccountsOpts - Optional Parameters:
  • @param "Number" (optional.String) - Account number
  • @param "RoutingNumber" (optional.String) - ABA routing number for the Financial Institution
  • @param "Type_" (optional.String) - Account type
  • @param "CustomerID" (optional.String) - Customer ID associated to accounts
  • @param "XRequestID" (optional.String) - Optional Request ID allows application developer to trace requests through the systems logs

@return []Account

type Address

type Address struct {
	Type string `json:"type,omitempty"`
	// First line of the address
	Address1 string `json:"address1,omitempty"`
	// Second line of the address
	Address2 string `json:"address2,omitempty"`
	City     string `json:"city,omitempty"`
	// two charcer code of US state
	State      string `json:"state,omitempty"`
	PostalCode string `json:"postalCode,omitempty"`
	Country    string `json:"country,omitempty"`
	// Address has been validated for customer
	Validated bool `json:"validated,omitempty"`
	// Address is currently being used for customer
	Active bool `json:"active,omitempty"`
}

Address struct for Address

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

type CreateAccount

type CreateAccount struct {
	// Customer ID associated with accounts
	CustomerID string `json:"customerID"`
	// Initial balance of account in USD cents. This amount is to be deposited from an account at another Financial Institution or in-person (i.e. cash) on account creation.
	Balance int32 `json:"balance"`
	// Caller defined label for this account.
	Name string `json:"name"`
	// Random number to be used as unique to distinguish this Account
	Number string `json:"number,omitempty"`
	// Product type of the account
	Type string `json:"type"`
}

CreateAccount struct for CreateAccount

type CreateAccountOpts

type CreateAccountOpts struct {
	XRequestID optional.String
}

CreateAccountOpts Optional parameters for the method 'CreateAccount'

type CreateAddress

type CreateAddress struct {
	Type string `json:"type"`
	// First line of the address
	Address1 string `json:"address1"`
	// Second line of the address
	Address2 string `json:"address2"`
	City     string `json:"city"`
	// two charcer code of US state
	State      string `json:"state"`
	PostalCode string `json:"postalCode"`
	Country    string `json:"country"`
}

CreateAddress struct for CreateAddress

type CreatePhone

type CreatePhone struct {
	// phone number
	Number string `json:"number"`
	Type   string `json:"type"`
}

CreatePhone struct for CreatePhone

type CreateTransaction

type CreateTransaction struct {
	Lines []TransactionLine `json:"lines,omitempty"`
}

CreateTransaction struct for CreateTransaction

type CreateTransactionOpts

type CreateTransactionOpts struct {
	XRequestID optional.String
}

CreateTransactionOpts Optional parameters for the method 'CreateTransaction'

type Error

type Error struct {
	// An error message describing the problem intended for humans.
	Error string `json:"error"`
}

Error struct for Error

type GenericOpenAPIError

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

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type GetAccountTransactionsOpts

type GetAccountTransactionsOpts struct {
	Limit      optional.Float32
	XRequestID optional.String
}

GetAccountTransactionsOpts Optional parameters for the method 'GetAccountTransactions'

type Phone

type Phone struct {
	// phone number
	Number string `json:"number,omitempty"`
	// phone number has been validated to connect with customer
	Valid bool   `json:"valid,omitempty"`
	Type  string `json:"type,omitempty"`
}

Phone struct for Phone

type ReverseTransactionOpts added in v0.4.0

type ReverseTransactionOpts struct {
	XRequestID optional.String
}

ReverseTransactionOpts Optional parameters for the method 'ReverseTransaction'

type SearchAccountsOpts

type SearchAccountsOpts struct {
	Number        optional.String
	RoutingNumber optional.String
	Type_         optional.String
	CustomerID    optional.String
	XRequestID    optional.String
}

SearchAccountsOpts Optional parameters for the method 'SearchAccounts'

type Transaction

type Transaction struct {
	// Unique ID of a transaction
	ID        string            `json:"ID,omitempty"`
	Timestamp time.Time         `json:"timestamp,omitempty"`
	Lines     []TransactionLine `json:"lines,omitempty"`
}

Transaction struct for Transaction

type TransactionLine

type TransactionLine struct {
	// Account ID
	AccountID string `json:"accountID,omitempty"`
	Purpose   string `json:"purpose,omitempty"`
	// Change in account balance (in USD cents)
	Amount float32 `json:"amount,omitempty"`
}

TransactionLine struct for TransactionLine

Jump to

Keyboard shortcuts

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