rest

package
v0.0.0-...-84b81c9 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package rest provides types/client for making requests to the postman REST api.

Package rest provides types/client for making requests to the postman REST api.

Package rest provides types/client for making requests to the postman REST api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client handles interacting with the postman api.

func NewClient

func NewClient(apiKey string, opts ...Option) *Client

NewClient returns a new instance of the Client.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the baseURL for the rest client.

func (*Client) DoRequest

func (c *Client) DoRequest(r *http.Request, result interface{}, opts ...RequestOption) error

DoRequest makes the http request and unmarshalls the response into the result interface.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, url string, payload interface{}) (*http.Request, error)

NewRequest creates a new http request.

type Error

type Error struct {
	Name    string            `json:"name"`
	Message string            `json:"message"`
	Details map[string]string `json:"details"`
}

Error represents the error fields from the postman api error response.

func (*Error) Error

func (e *Error) Error() string

Error satisfies the error interface.

func (*Error) UnmarshalJSON

func (e *Error) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the json unmarshalling of Error.

type ErrorResponse

type ErrorResponse struct {
	Error *Error `json:"error"`
}

ErrorResponse represents an error response from the postman api.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option represents functional options for configuring the client.

func WithDebugLog

func WithDebugLog(w io.Writer) Option

WithDebugLog configures the io.Writer to send debug logging output to.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient configures the client to use the given http.Client.

type RequestOption

type RequestOption interface {
	// contains filtered or unexported methods
}

RequestOption represents functional options for configuring client requests.

func WithContentType

func WithContentType(c string) RequestOption

WithContentType specifies the content type for the request

func WithWorkspace

func WithWorkspace(w string) RequestOption

WithWorkspace specifies the target workspace for the api operation.

Jump to

Keyboard shortcuts

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