apiclient

package
v0.0.0-...-bfb5a2a Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package apiclient provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQueryByHashBatchRequest

func NewQueryByHashBatchRequest(server string, body QueryByHashBatchJSONRequestBody) (*http.Request, error)

NewQueryByHashBatchRequest calls the generic QueryByHashBatch builder with application/json body

func NewQueryByHashBatchRequestWithBody

func NewQueryByHashBatchRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewQueryByHashBatchRequestWithBody generates requests for QueryByHashBatch with any type of body

func NewQueryByHashRequest

func NewQueryByHashRequest(server string, hash string) (*http.Request, error)

NewQueryByHashRequest generates requests for QueryByHash

func NewSubmitReportRequest

func NewSubmitReportRequest(server string, body SubmitReportJSONRequestBody) (*http.Request, error)

NewSubmitReportRequest calls the generic SubmitReport builder with application/json body

func NewSubmitReportRequestWithBody

func NewSubmitReportRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewSubmitReportRequestWithBody generates requests for SubmitReport with any type of body

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) QueryByHash

func (c *Client) QueryByHash(ctx context.Context, hash string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) QueryByHashBatch

func (c *Client) QueryByHashBatch(ctx context.Context, body QueryByHashBatchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) QueryByHashBatchWithBody

func (c *Client) QueryByHashBatchWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitReport

func (c *Client) SubmitReport(ctx context.Context, body SubmitReportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitReportWithBody

func (c *Client) SubmitReportWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// QueryByHashBatch request with any body
	QueryByHashBatchWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	QueryByHashBatch(ctx context.Context, body QueryByHashBatchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// QueryByHash request
	QueryByHash(ctx context.Context, hash string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SubmitReport request with any body
	SubmitReportWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SubmitReport(ctx context.Context, body SubmitReportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) QueryByHashBatchWithBodyWithResponse

func (c *ClientWithResponses) QueryByHashBatchWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*QueryByHashBatchResponse, error)

QueryByHashBatchWithBodyWithResponse request with arbitrary body returning *QueryByHashBatchResponse

func (*ClientWithResponses) QueryByHashBatchWithResponse

func (c *ClientWithResponses) QueryByHashBatchWithResponse(ctx context.Context, body QueryByHashBatchJSONRequestBody, reqEditors ...RequestEditorFn) (*QueryByHashBatchResponse, error)

func (*ClientWithResponses) QueryByHashWithResponse

func (c *ClientWithResponses) QueryByHashWithResponse(ctx context.Context, hash string, reqEditors ...RequestEditorFn) (*QueryByHashResponse, error)

QueryByHashWithResponse request returning *QueryByHashResponse

func (*ClientWithResponses) SubmitReportWithBodyWithResponse

func (c *ClientWithResponses) SubmitReportWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitReportResponse, error)

SubmitReportWithBodyWithResponse request with arbitrary body returning *SubmitReportResponse

func (*ClientWithResponses) SubmitReportWithResponse

func (c *ClientWithResponses) SubmitReportWithResponse(ctx context.Context, body SubmitReportJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitReportResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// QueryByHashBatch request with any body
	QueryByHashBatchWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*QueryByHashBatchResponse, error)

	QueryByHashBatchWithResponse(ctx context.Context, body QueryByHashBatchJSONRequestBody, reqEditors ...RequestEditorFn) (*QueryByHashBatchResponse, error)

	// QueryByHash request
	QueryByHashWithResponse(ctx context.Context, hash string, reqEditors ...RequestEditorFn) (*QueryByHashResponse, error)

	// SubmitReport request with any body
	SubmitReportWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitReportResponse, error)

	SubmitReportWithResponse(ctx context.Context, body SubmitReportJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitReportResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Error

type Error struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

type File

type File struct {
	Ctime    *int64  `json:"ctime,omitempty"`
	FileMode uint32  `json:"fileMode"`
	Group    *uint32 `json:"group,omitempty"`
	Md5      *string `json:"md5,omitempty"`
	Mtime    int64   `json:"mtime"`
	Owner    *uint32 `json:"owner,omitempty"`
	Path     string  `json:"path"`
	Sha1     *string `json:"sha1,omitempty"`
	Sha256   *string `json:"sha256,omitempty"`
	Size     int64   `json:"size"`
}

File defines model for File.

type HashQuery

type HashQuery struct {
	Hash string `json:"hash"`
	Path string `json:"path"`
}

HashQuery defines model for HashQuery.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type KnownFile

type KnownFile struct {
	KnownPath *string              `json:"knownPath,omitempty"`
	Md5       *string              `json:"md5,omitempty"`
	Path      string               `json:"path"`
	Sha1      *string              `json:"sha1,omitempty"`
	Sha256    *string              `json:"sha256,omitempty"`
	Size      *int64               `json:"size,omitempty"`
	Status    datastore.FileStatus `json:"status"`
}

KnownFile defines model for KnownFile.

type NewReportRequest

type NewReportRequest struct {
	Files       []File     `json:"files"`
	Hostname    string     `json:"hostname"`
	MachineId   string     `json:"machineId"`
	ReportRunId *uuid.UUID `json:"reportRunId,omitempty"`
}

NewReportRequest defines model for NewReportRequest.

type NewReportResponse

type NewReportResponse struct {
	Files []ReportFile `json:"files"`
	Id    uuid.UUID    `json:"id"`
}

NewReportResponse defines model for NewReportResponse.

type QueryByHashBatchJSONBody

type QueryByHashBatchJSONBody = []HashQuery

QueryByHashBatchJSONBody defines parameters for QueryByHashBatch.

type QueryByHashBatchJSONRequestBody

type QueryByHashBatchJSONRequestBody = QueryByHashBatchJSONBody

QueryByHashBatchJSONRequestBody defines body for QueryByHashBatch for application/json ContentType.

type QueryByHashBatchResponse

type QueryByHashBatchResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]KnownFile
	JSONDefault  *Error
}

func ParseQueryByHashBatchResponse

func ParseQueryByHashBatchResponse(rsp *http.Response) (*QueryByHashBatchResponse, error)

ParseQueryByHashBatchResponse parses an HTTP response from a QueryByHashBatchWithResponse call

func (QueryByHashBatchResponse) Status

func (r QueryByHashBatchResponse) Status() string

Status returns HTTPResponse.Status

func (QueryByHashBatchResponse) StatusCode

func (r QueryByHashBatchResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type QueryByHashResponse

type QueryByHashResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *KnownFile
	JSONDefault  *Error
}

func ParseQueryByHashResponse

func ParseQueryByHashResponse(rsp *http.Response) (*QueryByHashResponse, error)

ParseQueryByHashResponse parses an HTTP response from a QueryByHashWithResponse call

func (QueryByHashResponse) Status

func (r QueryByHashResponse) Status() string

Status returns HTTPResponse.Status

func (QueryByHashResponse) StatusCode

func (r QueryByHashResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ReportFile

type ReportFile struct {
	Error  *string              `json:"error,omitempty"`
	Path   string               `json:"path"`
	Status datastore.FileStatus `json:"status"`
}

ReportFile defines model for ReportFile.

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type SubmitReportJSONRequestBody

type SubmitReportJSONRequestBody = NewReportRequest

SubmitReportJSONRequestBody defines body for SubmitReport for application/json ContentType.

type SubmitReportResponse

type SubmitReportResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *NewReportResponse
	JSONDefault  *Error
}

func ParseSubmitReportResponse

func ParseSubmitReportResponse(rsp *http.Response) (*SubmitReportResponse, error)

ParseSubmitReportResponse parses an HTTP response from a SubmitReportWithResponse call

func (SubmitReportResponse) Status

func (r SubmitReportResponse) Status() string

Status returns HTTPResponse.Status

func (SubmitReportResponse) StatusCode

func (r SubmitReportResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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