client

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	Active                     *bool     `json:"active,omitempty"`
	CreationDate               *string   `json:"creation_date,omitempty"`
	DetectionCategoriesEnabled *[]string `json:"detection_categories_enabled,omitempty"`
	LastSeenDate               *string   `json:"last_seen_date,omitempty"`
	Tags                       *[]string `json:"tags,omitempty"`
}

APIKey defines an API key's properties.

type AccountInfo

type AccountInfo struct {
	Balance          *float32           `json:"balance,omitempty"`
	BillingEmail     *string            `json:"billing_email,omitempty"`
	CreationDate     *string            `json:"creation_date,omitempty"`
	Keys             *map[string]APIKey `json:"keys,omitempty"`
	ModificationDate *string            `json:"modification_date,omitempty"`
	Name             *string            `json:"name,omitempty"`
	StartingBalance  *float32           `json:"starting_balance,omitempty"`
	Subscription     *string            `json:"subscription,omitempty"`
	Users            *map[string]User   `json:"users,omitempty"`
}

AccountInfo defines the account information response.

type AccountResult

type AccountResult struct {
	Response
	Account *AccountInfo
}

AccountResult is the response from the account endpoint.

type AuthToken

type AuthToken struct {
	CreationDate   *string `json:"creation_date,omitempty"`
	ExpirationDate *string `json:"expiration_date,omitempty"`
	ID             *string `json:"id,omitempty"`
}

AuthToken defines a temporary authentication token.

type Client

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

Client is a hand-written HTTP client for the Scanii v2.2 API.

func New

func New(baseURL string, opts ...ClientOption) (*Client, error)

New creates a new Client with the given base URL and options.

func (*Client) Account

func (c *Client) Account(ctx context.Context) (*AccountResult, error)

Account retrieves account information.

func (*Client) CreateToken

func (c *Client) CreateToken(ctx context.Context, contentType string, body io.Reader) (*CreateTokenResult, error)

CreateToken creates a temporary authentication token.

func (*Client) DeleteToken

func (c *Client) DeleteToken(ctx context.Context, id string) (*Response, error)

DeleteToken deletes an authentication token.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (*PingResult, error)

Ping validates API credentials.

func (*Client) ProcessFile

func (c *Client) ProcessFile(ctx context.Context, contentType string, body io.Reader) (*ProcessFileResult, error)

ProcessFile processes a file synchronously.

func (*Client) ProcessFileAsync

func (c *Client) ProcessFileAsync(ctx context.Context, contentType string, body io.Reader) (*ProcessFileAsyncResult, error)

ProcessFileAsync processes a file asynchronously.

func (*Client) ProcessFileFetch

func (c *Client) ProcessFileFetch(ctx context.Context, contentType string, body io.Reader) (*ProcessFileFetchResult, error)

ProcessFileFetch submits a URL for asynchronous processing.

func (*Client) RetrieveFile

func (c *Client) RetrieveFile(ctx context.Context, id string) (*RetrieveFileResult, error)

RetrieveFile retrieves a previously processed file result.

func (*Client) RetrieveToken

func (c *Client) RetrieveToken(ctx context.Context, id string) (*RetrieveTokenResult, error)

RetrieveToken retrieves an existing authentication token.

func (*Client) RetrieveTrace added in v1.5.0

func (c *Client) RetrieveTrace(ctx context.Context, id string) (*RetrieveTraceResult, error)

RetrieveTrace retrieves the processing trace for a previously processed file.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) ClientOption

WithHTTPClient sets a custom *http.Client.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn adds a request editor callback.

type CreateTokenResult

type CreateTokenResult struct {
	Response
	Token *AuthToken
}

CreateTokenResult is the response from the create token endpoint.

type ErrorResponse

type ErrorResponse struct {
	Error    *string            `json:"error,omitempty"`
	ID       *string            `json:"id,omitempty"`
	Metadata *map[string]string `json:"metadata,omitempty"`
}

ErrorResponse defines an API error.

type PingResult

type PingResult struct {
	Response
	Message string `json:"message"`
	Key     string `json:"key"`
}

PingResult is the response from the ping endpoint.

type ProcessFileAsyncResult

type ProcessFileAsyncResult struct {
	Response
	Pending *ProcessingPendingResponse
	Error   *ErrorResponse
}

ProcessFileAsyncResult is the response from the async file processing endpoint.

type ProcessFileFetchResult

type ProcessFileFetchResult struct {
	Response
	Pending *ProcessingPendingResponse
	Error   *ErrorResponse
}

ProcessFileFetchResult is the response from the file fetch endpoint.

type ProcessFileResult

type ProcessFileResult struct {
	Response
	Result *ProcessingResponse
	Error  *ErrorResponse
}

ProcessFileResult is the response from the synchronous file processing endpoint.

type ProcessingPendingResponse

type ProcessingPendingResponse struct {
	ID *string `json:"id,omitempty"`
}

ProcessingPendingResponse is the acknowledgment for an async processing request.

type ProcessingResponse

type ProcessingResponse struct {
	Checksum      *string            `json:"checksum,omitempty"`
	ContentLength *float32           `json:"content_length,omitempty"`
	ContentType   *string            `json:"content_type,omitempty"`
	CreationDate  *string            `json:"creation_date,omitempty"`
	Error         *string            `json:"error,omitempty"`
	Findings      *[]string          `json:"findings,omitempty"`
	ID            *string            `json:"id,omitempty"`
	Metadata      *map[string]string `json:"metadata,omitempty"`
}

ProcessingResponse is the result of a file analysis.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is a callback for modifying requests before sending.

type Response

type Response struct {
	StatusCode int
	Header     http.Header
}

Response is the base response containing HTTP metadata.

type RetrieveFileResult

type RetrieveFileResult struct {
	Response
	Result *ProcessingResponse
}

RetrieveFileResult is the response from the file retrieve endpoint.

type RetrieveTokenResult

type RetrieveTokenResult struct {
	Response
	Token *AuthToken
}

RetrieveTokenResult is the response from the retrieve token endpoint.

type RetrieveTraceResult added in v1.5.0

type RetrieveTraceResult struct {
	Response
	Trace *TraceResponse
	Error *ErrorResponse
}

RetrieveTraceResult is the response from the trace retrieve endpoint.

type TraceEvent added in v1.4.0

type TraceEvent struct {
	Message   *string `json:"message,omitempty"`
	Timestamp *string `json:"timestamp,omitempty"`
}

TraceEvent is a single event in a processing trace.

type TraceResponse added in v1.4.0

type TraceResponse struct {
	Events *[]TraceEvent `json:"events,omitempty"`
	ID     *string       `json:"id,omitempty"`
}

TraceResponse is the ordered list of processing events for a given id.

type User

type User struct {
	CreationDate *string `json:"creation_date,omitempty"`
	LastLogin    *string `json:"last_login,omitempty"`
}

User defines a user account.

Jump to

Keyboard shortcuts

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