request

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiVersion = "v1" //nolint:gochecknoglobals
View Source
var ErrNon200Status = errors.New("error response from API")

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	Root      string
	ProjectId string
	APIKey    *string
	Client    *Client
}

func NewAPIClient

func NewAPIClient(projectId string, key *string) *APIClient

func (*APIClient) BatchUpsertIntegrations

func (c *APIClient) BatchUpsertIntegrations(
	ctx context.Context, reqParams BatchUpsertIntegrationsParams,
) ([]Integration, error)

func (*APIClient) DeleteInstallation added in v0.1.11

func (c *APIClient) DeleteInstallation(ctx context.Context, integrationId string, installationId string) error

func (*APIClient) DeleteIntegration added in v0.1.7

func (c *APIClient) DeleteIntegration(ctx context.Context, integrationId string) error

func (*APIClient) GetMyInfo added in v0.1.13

func (c *APIClient) GetMyInfo(ctx context.Context) (map[string]any, error)

func (*APIClient) GetPreSignedUploadURL added in v0.1.3

func (c *APIClient) GetPreSignedUploadURL(ctx context.Context, md5 string) (SignedURL, error)

type BatchUpsertIntegrationsParams

type BatchUpsertIntegrationsParams struct {
	SourceZipURL string `json:"sourceZipUrl"`
}

type Client added in v0.1.13

type Client struct {
	Client         *http.Client
	DefaultHeaders []Header
}

func NewRequestClient

func NewRequestClient() *Client

func (*Client) Delete added in v0.1.13

func (c *Client) Delete(ctx context.Context,
	url string, headers ...Header,
) (*http.Response, error)

Delete makes a Delete request to the desired URL for plain text requests.

func (*Client) Get added in v0.1.13

func (c *Client) Get(ctx context.Context,
	url string, result any, headers ...Header,
) (*http.Response, error)

Get makes a GET request to the desired URL, and unmarshalls the response body into `result`.

func (*Client) Post added in v0.1.13

func (c *Client) Post(ctx context.Context,
	url string, reqBody any, result any, headers ...Header,
) (*http.Response, error)

Post makes a POST request to the desired URL, and unmarshalls the response body into `result`.

func (*Client) Put added in v0.1.13

func (c *Client) Put(ctx context.Context,
	url string, reqBody any, result any, headers ...Header,
) (*http.Response, error)

Put makes a PUT request to the desired URL, and unmarshalls the response body into `result`.

type Header struct {
	Key   string
	Value string
}

Header is a key/value pair that can be added to a request.

type InputValidationIssue added in v0.1.13

type InputValidationIssue struct {
	In           string         `json:"in,omitempty"`
	Name         string         `json:"name,omitempty"`
	Value        any            `json:"value,omitempty"`
	Detail       string         `json:"detail,omitempty"`
	Href         string         `json:"href,omitempty"`
	Instance     string         `json:"instance,omitempty"`
	Status       int32          `json:"status,omitempty"`
	Title        string         `json:"title,omitempty"`
	Type         string         `json:"type,omitempty"`
	Subsystem    string         `json:"subsystem,omitempty"`
	Time         string         `json:"time,omitempty"`
	RequestID    string         `json:"requestId,omitempty"`
	Causes       []string       `json:"causes,omitempty"`
	Remedy       string         `json:"remedy,omitempty"`
	SupportEmail string         `json:"supportEmail,omitempty"`
	SupportPhone string         `json:"supportPhone,omitempty"`
	SupportURL   string         `json:"supportUrl,omitempty"`
	Retryable    *bool          `json:"retryable,omitempty"`
	RetryAfter   string         `json:"retryAfter,omitempty"`
	Context      map[string]any `json:"context,omitempty"`
}

type Integration

type Integration struct {
	Name string `json:"name"`
}

type ProblemError added in v0.1.13

type ProblemError struct {
	Detail       string                 `json:"detail,omitempty"`
	Href         string                 `json:"href,omitempty"`
	Instance     string                 `json:"instance,omitempty"`
	Status       int32                  `json:"status,omitempty"`
	Title        string                 `json:"title,omitempty"`
	Type         string                 `json:"type,omitempty"`
	Subsystem    string                 `json:"subsystem,omitempty"`
	Time         string                 `json:"time,omitempty"`
	RequestID    string                 `json:"requestId,omitempty"`
	Causes       []string               `json:"causes,omitempty"`
	Remedy       string                 `json:"remedy,omitempty"`
	SupportEmail string                 `json:"supportEmail,omitempty"`
	SupportPhone string                 `json:"supportPhone,omitempty"`
	SupportURL   string                 `json:"supportUrl,omitempty"`
	Retryable    *bool                  `json:"retryable,omitempty"`
	RetryAfter   string                 `json:"retryAfter,omitempty"`
	Context      map[string]any         `json:"context,omitempty"`
	Issues       []InputValidationIssue `json:"issues,omitempty"`
}

func (*ProblemError) Error added in v0.1.13

func (p *ProblemError) Error() string

type SignedURL added in v0.1.3

type SignedURL struct {
	URL    string `json:"url"`
	Bucket string `json:"bucket"`
	Path   string `json:"path"`
}

Jump to

Keyboard shortcuts

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