Documentation
¶
Index ¶
- type APIKey
- type AccountInfo
- type AccountResult
- type AuthToken
- type Client
- func (c *Client) Account(ctx context.Context) (*AccountResult, error)
- func (c *Client) CreateToken(ctx context.Context, contentType string, body io.Reader) (*CreateTokenResult, error)
- func (c *Client) DeleteToken(ctx context.Context, id string) (*Response, error)
- func (c *Client) Ping(ctx context.Context) (*PingResult, error)
- func (c *Client) ProcessFile(ctx context.Context, contentType string, body io.Reader) (*ProcessFileResult, error)
- func (c *Client) ProcessFileAsync(ctx context.Context, contentType string, body io.Reader) (*ProcessFileAsyncResult, error)
- func (c *Client) ProcessFileFetch(ctx context.Context, contentType string, body io.Reader) (*ProcessFileFetchResult, error)
- func (c *Client) RetrieveFile(ctx context.Context, id string) (*RetrieveFileResult, error)
- func (c *Client) RetrieveToken(ctx context.Context, id string) (*RetrieveTokenResult, error)
- func (c *Client) RetrieveTrace(ctx context.Context, id string) (*RetrieveTraceResult, error)
- type ClientOption
- type CreateTokenResult
- type ErrorResponse
- type PingResult
- type ProcessFileAsyncResult
- type ProcessFileFetchResult
- type ProcessFileResult
- type ProcessingPendingResponse
- type ProcessingResponse
- type RequestEditorFn
- type Response
- type RetrieveFileResult
- type RetrieveTokenResult
- type RetrieveTraceResult
- type TraceEvent
- type TraceResponse
- type User
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 ¶
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 ¶
RetrieveFile retrieves a previously processed file result.
func (*Client) RetrieveToken ¶
RetrieveToken retrieves an existing authentication token.
func (*Client) RetrieveTrace ¶ added in v1.5.0
RetrieveTrace retrieves the processing trace for a previously processed file.
type ClientOption ¶
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 ¶
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 ¶
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 ¶
RequestEditorFn is a callback for modifying requests before sending.
type RetrieveFileResult ¶
type RetrieveFileResult struct {
Response
Result *ProcessingResponse
}
RetrieveFileResult is the response from the file retrieve endpoint.
type RetrieveTokenResult ¶
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.