request

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var API_VERSION = "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
	RequestClient *RequestClient
}

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) 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 Header struct {
	Key   string
	Value string
}

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

type Integration

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

type RequestClient

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

func NewRequestClient

func NewRequestClient() *RequestClient

func (*RequestClient) Delete added in v0.1.7

func (c *RequestClient) 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 (*RequestClient) Get added in v0.1.3

func (c *RequestClient) 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 (*RequestClient) Post

func (c *RequestClient) 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 (*RequestClient) Put

func (c *RequestClient) 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 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