openapi

package
v0.8.1-0...-5fccf1a Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

README

Go API client for openapi

OFAC (Office of Foreign Assets Control) API is designed to facilitate the enforcement of US government economic sanctions programs required by federal law. This project implements a modern REST HTTP API for companies and organizations to obey federal law and use OFAC data in their applications.

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 For more information, please visit https://github.com/moov-io/ofac

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:8084

Class Method HTTP request Description
OFACApi AddOFACCompanyNameWatch Post /companies/watch Add company watch by name. The match percentage will be included in the webhook's JSON payload.
OFACApi AddOFACCompanyWatch Post /companies/{companyId}/watch Add OFAC watch on a Company
OFACApi AddOFACCustomerNameWatch Post /customers/watch Add customer watch by name. The match percentage will be included in the webhook's JSON payload.
OFACApi AddOFACCustomerWatch Post /customers/{customerId}/watch Add OFAC watch on a Customer
OFACApi GetLatestDownloads Get /downloads Return list of recent downloads of OFAC data
OFACApi GetOFACCompany Get /companies/{companyId} Get information about a company, trust or organization such as addresses, alternate names, and remarks.
OFACApi GetOFACCustomer Get /customers/{customerId} Get information about a customer, addresses, alternate names, and their SDN metadata.
OFACApi GetSDN Get /sdn/{sdnId} Specially designated national
OFACApi GetSDNAddresses Get /sdn/{sdnId}/addresses Get addresses for a given SDN
OFACApi GetSDNAltNames Get /sdn/{sdnId}/alts Get alternate names for a given SDN
OFACApi Ping Get /ping Ping the OFAC service to check if running
OFACApi RemoveOFACCompanyNameWatch Delete /companies/watch/{watchId} Remove a Company name watch
OFACApi RemoveOFACCompanyWatch Delete /companies/{companyId}/watch/{watchId} Remove company watch
OFACApi RemoveOFACCustomerNameWatch Delete /customers/watch/{watchId} Remove a Customer name watch
OFACApi RemoveOFACCustomerWatch Delete /customers/{customerId}/watch/{watchId} Remove customer watch
OFACApi Search Get /search Search SDN names and metadata
OFACApi UpdateOFACCompanyStatus Put /companies/{companyId} Update a Companies sanction status to always block or always allow transactions.
OFACApi UpdateOFACCustomerStatus Put /customers/{customerId} Update a Customer's sanction status to always block or always allow transactions.

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 {
	OFACApi *OFACApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the OFAC API API vv1 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)

Change 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:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AddOFACCompanyNameWatchOpts

type AddOFACCompanyNameWatchOpts struct {
	XRequestId optional.String
}

type AddOFACCompanyWatchOpts

type AddOFACCompanyWatchOpts struct {
	XRequestId optional.String
}

type AddOFACCustomerNameWatchOpts

type AddOFACCustomerNameWatchOpts struct {
	XRequestId optional.String
}

type AddOFACCustomerWatchOpts

type AddOFACCustomerWatchOpts struct {
	XRequestId optional.String
}

type Address

type Address struct {
	EntityID                    string  `json:"entityID,omitempty"`
	AddressID                   string  `json:"addressID,omitempty"`
	Address                     string  `json:"address,omitempty"`
	CityStateProvincePostalCode string  `json:"cityStateProvincePostalCode,omitempty"`
	Country                     string  `json:"country,omitempty"`
	Match                       float32 `json:"match,omitempty"`
}

Physical address from OFAC list

type Alt

type Alt struct {
	EntityID         string  `json:"entityID,omitempty"`
	AlternateID      string  `json:"alternateID,omitempty"`
	AlternateType    string  `json:"alternateType,omitempty"`
	AlternateName    string  `json:"alternateName,omitempty"`
	AlternateRemarks string  `json:"alternateRemarks,omitempty"`
	Match            float32 `json:"match,omitempty"`
}

Alternate name from OFAC list

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
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

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

type Download

type Download struct {
	SDNs      int32     `json:"SDNs,omitempty"`
	AltNames  int32     `json:"altNames,omitempty"`
	Addresses int32     `json:"addresses,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty"`
}

Metadata and stats about downloaded OFAC data

type Dpl

type Dpl struct {
	// Name of the Denied Person
	Name string `json:"name,omitempty"`
	// Denied Person's street address
	StreetAddress string `json:"streetAddress,omitempty"`
	// Denied Person's city
	City string `json:"city,omitempty"`
	// Denied Person's state
	State string `json:"state,omitempty"`
	// Denied Person's country
	Country string `json:"country,omitempty"`
	// Denied Person's postal code
	PostalCode string `json:"postalCode,omitempty"`
	// Date when denial came into effect
	EffectiveDate string `json:"effectiveDate,omitempty"`
	// Date when denial expires, if blank denial never expires
	ExpirationDate string `json:"expirationDate,omitempty"`
	// Denotes whether or not the Denied Person was added by a standard order
	StandardOrder string `json:"standardOrder,omitempty"`
	// Most recent date when the Denied Person record was updated
	LastUpdate string `json:"lastUpdate,omitempty"`
	// Most recent action taken regarding the denial
	Action string `json:"action,omitempty"`
	// Reference to the order's citation in the Federal Register
	FrCitation string  `json:"frCitation,omitempty"`
	Match      float32 `json:"match,omitempty"`
}

BIS Denied Persons List item

type El

type El struct {
	// The name of the entity
	Name string `json:"name,omitempty"`
	// Addresses associated with the entity
	Addresses []string `json:"addresses,omitempty"`
	// Known aliases associated with the entity
	AlternateNames []string `json:"alternateNames,omitempty"`
	// Date when the restriction came into effect
	StartDate string `json:"startDate,omitempty"`
	// Specifies the license requirement imposed on the named entity
	LicenseRequirement string `json:"licenseRequirement,omitempty"`
	// Identifies the policy BIS uses to review the licenseRequirements
	LicensePolicy string `json:"licensePolicy,omitempty"`
	// Identifies the corresponding Notice in the Federal Register
	FrNotice string `json:"frNotice,omitempty"`
	// The link to the official SSI list
	SourceListURL string `json:"sourceListURL,omitempty"`
	// The link for information regarding the source
	SourceInfoURL string `json:"sourceInfoURL,omitempty"`
}

Entity List (EL) - Bureau of Industry and Security

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 GetLatestDownloadsOpts

type GetLatestDownloadsOpts struct {
	Limit optional.Int32
}

type GetOFACCompanyOpts

type GetOFACCompanyOpts struct {
	XRequestId optional.String
}

type GetOFACCustomerOpts

type GetOFACCustomerOpts struct {
	XRequestId optional.String
}

type GetSDNAddressesOpts

type GetSDNAddressesOpts struct {
	XRequestId optional.String
}

type GetSDNAltNamesOpts

type GetSDNAltNamesOpts struct {
	XRequestId optional.String
}

type GetSDNOpts

type GetSDNOpts struct {
	XRequestId optional.String
}

type OFACApiService

type OFACApiService service

func (*OFACApiService) AddOFACCompanyNameWatch

func (a *OFACApiService) AddOFACCompanyNameWatch(ctx context.Context, name string, watchRequest WatchRequest, localVarOptionals *AddOFACCompanyNameWatchOpts) (Watch, *http.Response, error)

func (*OFACApiService) AddOFACCompanyWatch

func (a *OFACApiService) AddOFACCompanyWatch(ctx context.Context, companyId string, watchRequest WatchRequest, localVarOptionals *AddOFACCompanyWatchOpts) (Watch, *http.Response, error)

func (*OFACApiService) AddOFACCustomerNameWatch

func (a *OFACApiService) AddOFACCustomerNameWatch(ctx context.Context, name string, watchRequest WatchRequest, localVarOptionals *AddOFACCustomerNameWatchOpts) (Watch, *http.Response, error)

func (*OFACApiService) AddOFACCustomerWatch

func (a *OFACApiService) AddOFACCustomerWatch(ctx context.Context, customerId string, watchRequest WatchRequest, localVarOptionals *AddOFACCustomerWatchOpts) (Watch, *http.Response, error)

func (*OFACApiService) GetLatestDownloads

func (a *OFACApiService) GetLatestDownloads(ctx context.Context, localVarOptionals *GetLatestDownloadsOpts) ([]Download, *http.Response, error)

func (*OFACApiService) GetOFACCompany

func (a *OFACApiService) GetOFACCompany(ctx context.Context, companyId string, localVarOptionals *GetOFACCompanyOpts) (OfacCompany, *http.Response, error)

func (*OFACApiService) GetOFACCustomer

func (a *OFACApiService) GetOFACCustomer(ctx context.Context, customerId string, localVarOptionals *GetOFACCustomerOpts) (OfacCustomer, *http.Response, error)

func (*OFACApiService) GetSDN

func (a *OFACApiService) GetSDN(ctx context.Context, sdnId string, localVarOptionals *GetSDNOpts) (Sdn, *http.Response, error)

func (*OFACApiService) GetSDNAddresses

func (a *OFACApiService) GetSDNAddresses(ctx context.Context, sdnId string, localVarOptionals *GetSDNAddressesOpts) ([]Address, *http.Response, error)

func (*OFACApiService) GetSDNAltNames

func (a *OFACApiService) GetSDNAltNames(ctx context.Context, sdnId string, localVarOptionals *GetSDNAltNamesOpts) ([]Alt, *http.Response, error)

func (*OFACApiService) Ping

func (a *OFACApiService) Ping(ctx context.Context) (*http.Response, error)

OFACApiService Ping the OFAC service to check if running

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

func (*OFACApiService) RemoveOFACCompanyNameWatch

func (a *OFACApiService) RemoveOFACCompanyNameWatch(ctx context.Context, watchId string, name string, localVarOptionals *RemoveOFACCompanyNameWatchOpts) (*http.Response, error)

func (*OFACApiService) RemoveOFACCompanyWatch

func (a *OFACApiService) RemoveOFACCompanyWatch(ctx context.Context, companyId string, watchId string, localVarOptionals *RemoveOFACCompanyWatchOpts) (*http.Response, error)

func (*OFACApiService) RemoveOFACCustomerNameWatch

func (a *OFACApiService) RemoveOFACCustomerNameWatch(ctx context.Context, watchId string, name string, localVarOptionals *RemoveOFACCustomerNameWatchOpts) (*http.Response, error)

func (*OFACApiService) RemoveOFACCustomerWatch

func (a *OFACApiService) RemoveOFACCustomerWatch(ctx context.Context, customerId string, watchId string, localVarOptionals *RemoveOFACCustomerWatchOpts) (*http.Response, error)

func (*OFACApiService) Search

func (a *OFACApiService) Search(ctx context.Context, localVarOptionals *SearchOpts) (Search, *http.Response, error)

func (*OFACApiService) UpdateOFACCompanyStatus

func (a *OFACApiService) UpdateOFACCompanyStatus(ctx context.Context, companyId string, updateCompanyStatus UpdateCompanyStatus, localVarOptionals *UpdateOFACCompanyStatusOpts) (*http.Response, error)

func (*OFACApiService) UpdateOFACCustomerStatus

func (a *OFACApiService) UpdateOFACCustomerStatus(ctx context.Context, customerId string, updateCustomerStatus UpdateCustomerStatus, localVarOptionals *UpdateOFACCustomerStatusOpts) (*http.Response, error)

type OfacCompany

type OfacCompany struct {
	// OFAC Company ID
	Id        string            `json:"id,omitempty"`
	Sdn       Sdn               `json:"sdn,omitempty"`
	Addresses []Address         `json:"addresses,omitempty"`
	Alts      []Alt             `json:"alts,omitempty"`
	Status    OfacCompanyStatus `json:"status,omitempty"`
}

OFAC Company and metadata

type OfacCompanyStatus

type OfacCompanyStatus struct {
	// User ID provided when updating status
	UserId string `json:"userId,omitempty"`
	// Optional note from updating status
	Note string `json:"note,omitempty"`
	// Manually applied status for OFAC Company
	Status    string    `json:"status,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
}

Status properties of an OFAC Company

type OfacCustomer

type OfacCustomer struct {
	// OFAC Customer ID
	Id        string             `json:"id,omitempty"`
	Sdn       Sdn                `json:"sdn,omitempty"`
	Addresses []Address          `json:"addresses,omitempty"`
	Alts      []Alt              `json:"alts,omitempty"`
	Status    OfacCustomerStatus `json:"status,omitempty"`
}

OFAC Customer and metadata

type OfacCustomerStatus

type OfacCustomerStatus struct {
	// User ID provided when updating status
	UserId string `json:"userId,omitempty"`
	// Optional note from updating status
	Note string `json:"note,omitempty"`
	// Manually applied status for OFAC Customer
	Status    string    `json:"status,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
}

Status properties of an OFAC Customer

type RemoveOFACCompanyNameWatchOpts

type RemoveOFACCompanyNameWatchOpts struct {
	XRequestId optional.String
}

type RemoveOFACCompanyWatchOpts

type RemoveOFACCompanyWatchOpts struct {
	XRequestId optional.String
}

type RemoveOFACCustomerNameWatchOpts

type RemoveOFACCustomerNameWatchOpts struct {
	XRequestId optional.String
}

type RemoveOFACCustomerWatchOpts

type RemoveOFACCustomerWatchOpts struct {
	XRequestId optional.String
}

type Sdn

type Sdn struct {
	EntityID string `json:"entityID,omitempty"`
	SdnName  string `json:"sdnName,omitempty"`
	// SDN's typically represent an individual (customer) or trust/company/organization. OFAC endpoints refer to customers or companies as different entities, but underlying both is the same SDN metadata.
	SdnType string `json:"sdnType,omitempty"`
	Program string `json:"program,omitempty"`
	Title   string `json:"title,omitempty"`
	Remarks string `json:"remarks,omitempty"`
	// Remarks on SDN and often additional information about the SDN
	Match float32 `json:"match,omitempty"`
}

Specially designated national from OFAC list

type Search struct {
	SDNs              []Sdn     `json:"SDNs,omitempty"`
	AltNames          []Alt     `json:"altNames,omitempty"`
	Addresses         []Address `json:"addresses,omitempty"`
	DeniedPersons     []Dpl     `json:"deniedPersons,omitempty"`
	SectoralSanctions []Ssi     `json:"sectoralSanctions,omitempty"`
	BisEntities       []El      `json:"bisEntities,omitempty"`
}

Search results containing SDNs, alternate names and/or addreses

type SearchOpts

type SearchOpts struct {
	XRequestId optional.String
	Q          optional.String
	Name       optional.String
	Address    optional.String
	City       optional.String
	State      optional.String
	Providence optional.String
	Zip        optional.String
	Country    optional.String
	AltName    optional.String
	Limit      optional.Int32
}

type Ssi

type Ssi struct {
	// The ID assigned to an entity by the Treasury Department
	EntityID string `json:"entityID,omitempty"`
	// Entity type (e.g. individual, vessel, aircraft, etc)
	Type string `json:"type,omitempty"`
	// Sanction programs for which the entity is flagged
	Programs []string `json:"programs,omitempty"`
	// The name of the entity
	Name string `json:"name,omitempty"`
	// Addresses associated with the entity
	Addresses []string `json:"addresses,omitempty"`
	// Additional details regarding the entity
	Remarks []string `json:"remarks,omitempty"`
	// Known aliases associated with the entity
	AlternateNames []string `json:"alternateNames,omitempty"`
	// IDs on file for the entity
	Ids []string `json:"ids,omitempty"`
	// The link to the official SSI list
	SourceListURL string `json:"sourceListURL,omitempty"`
	// The link for information regarding the source
	SourceInfoURL string `json:"sourceInfoURL,omitempty"`
}

Treasury Department Sectoral Sanctions Identifications List (SSI)

type UpdateCompanyStatus

type UpdateCompanyStatus struct {
	// manual override of company/SDN sanction status
	Status string `json:"status"`
	// Free form notes about manually changing the Company status
	Notes string `json:"notes,omitempty"`
}

Request body to update a company status.

type UpdateCustomerStatus

type UpdateCustomerStatus struct {
	// manual override of customer/SDN sanction status
	Status string `json:"status"`
	// Free form notes about manually changing the Customer status
	Notes string `json:"notes,omitempty"`
}

Request body to update a customers status.

type UpdateOFACCompanyStatusOpts

type UpdateOFACCompanyStatusOpts struct {
	XRequestId optional.String
}

type UpdateOFACCustomerStatusOpts

type UpdateOFACCustomerStatusOpts struct {
	XRequestId optional.String
}

type Watch

type Watch struct {
	// Object representing a customer or company watch
	WatchId string `json:"watchId,omitempty"`
}

Customer or Company watch

type WatchRequest

type WatchRequest struct {
	// Private token supplied by clients to be used for authenticating webhooks.
	AuthToken string `json:"authToken"`
	// HTTPS url for webhook on search match
	Webhook string `json:"webhook"`
}

Webhook or other means of notification on search criteria. OFAC will make a POST request with a body of the customer or company (SDN, AltNames, and Address).

Jump to

Keyboard shortcuts

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