admin

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

README

Go API client for admin

Watchman is an HTTP API and Go library to download, parse and offer search functions over numerous trade sanction lists from the United States, European Union governments, agencies, and non profits for complying with regional laws. Also included is a web UI and async webhook notification service to initiate processes on remote systems.

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/watchman

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 "./admin"

Documentation for API Endpoints

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

Class Method HTTP request Description
AdminApi DebugSDN Get /debug/sdn/{sdnId} Debug SDN
AdminApi GetVersion Get /version Get Version
AdminApi RefreshData Post /data/refresh Download and reindex all data sources

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

APIClient manages communication with the Watchman Admin 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)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

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 AdminApiService

type AdminApiService service

AdminApiService AdminApi service

func (*AdminApiService) DebugSDN

func (a *AdminApiService) DebugSDN(ctx _context.Context, sdnId string) (DebugSdn, *_nethttp.Response, error)

DebugSDN Debug SDN Get an SDN and search index debug information

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

@return DebugSdn

func (*AdminApiService) GetVersion

func (a *AdminApiService) GetVersion(ctx _context.Context) (string, *_nethttp.Response, error)

GetVersion Get Version Show the current version of Watchman

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

@return string

func (*AdminApiService) RefreshData

RefreshData Download and reindex all data sources

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

@return DataRefresh

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"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	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

func (*Configuration) ServerUrl

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type DataRefresh

type DataRefresh struct {
	// Count of OFAC SDNs after index
	SDNs int32 `json:"SDNs,omitempty"`
	// Count of OFAC alternate names after index
	AltNames int32 `json:"altNames,omitempty"`
	// Count of OFAC Addresses after index
	Addresses int32 `json:"addresses,omitempty"`
	// Count of SSI entities after index
	SectoralSanctions int32 `json:"sectoralSanctions,omitempty"`
	// Count of BSL denied persons after index
	DeniedPersons int32 `json:"deniedPersons,omitempty"`
	// Count of BIS entities after index
	BisEntities int32     `json:"bisEntities,omitempty"`
	Timestamp   time.Time `json:"timestamp,omitempty"`
}

DataRefresh struct for DataRefresh

type DebugSdn

type DebugSdn struct {
	SDN   OfacSdn          `json:"SDN,omitempty"`
	Debug SdnDebugMetadata `json:"debug,omitempty"`
}

DebugSdn struct for DebugSdn

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 OfacSdn

type OfacSdn struct {
	EntityID string  `json:"entityID,omitempty"`
	SdnName  string  `json:"sdnName,omitempty"`
	SdnType  SdnType `json:"sdnType,omitempty"`
	// Programs is the sanction programs this SDN was added from
	Programs []string `json:"programs,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"`
}

OfacSdn Specially designated national from OFAC list

type SdnDebugMetadata

type SdnDebugMetadata struct {
	// Exact text stored in our index used for string ranking
	IndexedName string `json:"indexedName,omitempty"`
	// ID parsed from remarks field
	ParsedRemarksId string `json:"parsedRemarksId,omitempty"`
}

SdnDebugMetadata struct for SdnDebugMetadata

type SdnType added in v0.19.0

type SdnType string

SdnType Used for classifying SDNs — typically represents an individual or company

const (
	INDIVIDUAL SdnType = "individual"
	ENTITY     SdnType = "entity"
	VESSEL     SdnType = "vessel"
	AIRCRAFT   SdnType = "aircraft"
)

List of SdnType

type ServerConfiguration

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

Jump to

Keyboard shortcuts

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