client

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildWebhookPayload

func BuildWebhookPayload(ttnWebhookToken string, ttnWebhookContentType string, ttnWebhookContentLength string, ttnWebhookAuth string) (*ttn.WebhookPayload, error)

BuildWebhookPayload builds the payload for the ttn webhook endpoint from CLI flags.

func BuildWebhookStreamPayload

func BuildWebhookStreamPayload(payload interface{}, fpath string) (*ttn.WebhookRequestData, error)

// BuildWebhookStreamPayload creates a streaming endpoint request payload from the method payload and the path to the file to be streamed

func DecodeWebhookResponse

func DecodeWebhookResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeWebhookResponse returns a decoder for responses returned by the ttn webhook endpoint. restoreBody controls whether the response body should be restored after having been read. DecodeWebhookResponse may return the following errors:

  • "forbidden" (type *goa.ServiceError): http.StatusForbidden
  • "not-found" (type *goa.ServiceError): http.StatusNotFound
  • "bad-request" (type *goa.ServiceError): http.StatusBadRequest
  • "unauthorized" (type ttn.Unauthorized): http.StatusUnauthorized
  • error: internal error

func EncodeWebhookRequest

func EncodeWebhookRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error

EncodeWebhookRequest returns an encoder for requests sent to the ttn webhook server.

func NewWebhookBadRequest

func NewWebhookBadRequest(body *WebhookBadRequestResponseBody) *goa.ServiceError

NewWebhookBadRequest builds a ttn service webhook endpoint bad-request error.

func NewWebhookForbidden

func NewWebhookForbidden(body *WebhookForbiddenResponseBody) *goa.ServiceError

NewWebhookForbidden builds a ttn service webhook endpoint forbidden error.

func NewWebhookNotFound

func NewWebhookNotFound(body *WebhookNotFoundResponseBody) *goa.ServiceError

NewWebhookNotFound builds a ttn service webhook endpoint not-found error.

func NewWebhookUnauthorized

func NewWebhookUnauthorized(body WebhookUnauthorizedResponseBody) ttn.Unauthorized

NewWebhookUnauthorized builds a ttn service webhook endpoint unauthorized error.

func ValidateWebhookBadRequestResponseBody

func ValidateWebhookBadRequestResponseBody(body *WebhookBadRequestResponseBody) (err error)

ValidateWebhookBadRequestResponseBody runs the validations defined on webhook_bad-request_response_body

func ValidateWebhookForbiddenResponseBody

func ValidateWebhookForbiddenResponseBody(body *WebhookForbiddenResponseBody) (err error)

ValidateWebhookForbiddenResponseBody runs the validations defined on webhook_forbidden_response_body

func ValidateWebhookNotFoundResponseBody

func ValidateWebhookNotFoundResponseBody(body *WebhookNotFoundResponseBody) (err error)

ValidateWebhookNotFoundResponseBody runs the validations defined on webhook_not-found_response_body

func WebhookTtnPath

func WebhookTtnPath() string

WebhookTtnPath returns the URL path to the ttn service webhook HTTP endpoint.

Types

type Client

type Client struct {
	// Webhook Doer is the HTTP client used to make requests to the webhook
	// endpoint.
	WebhookDoer goahttp.Doer

	// CORS Doer is the HTTP client used to make requests to the  endpoint.
	CORSDoer goahttp.Doer

	// RestoreResponseBody controls whether the response bodies are reset after
	// decoding so they can be read again.
	RestoreResponseBody bool
	// contains filtered or unexported fields
}

Client lists the ttn service endpoint HTTP clients.

func NewClient

func NewClient(
	scheme string,
	host string,
	doer goahttp.Doer,
	enc func(*http.Request) goahttp.Encoder,
	dec func(*http.Response) goahttp.Decoder,
	restoreBody bool,
) *Client

NewClient instantiates HTTP clients for all the ttn service servers.

func (*Client) BuildWebhookRequest

func (c *Client) BuildWebhookRequest(ctx context.Context, v interface{}) (*http.Request, error)

BuildWebhookRequest instantiates a HTTP request object with method and path set to call the "ttn" service "webhook" endpoint

func (*Client) Webhook

func (c *Client) Webhook() goa.Endpoint

Webhook returns an endpoint that makes HTTP requests to the ttn service webhook server.

type WebhookBadRequestResponseBody

type WebhookBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

WebhookBadRequestResponseBody is the type of the "ttn" service "webhook" endpoint HTTP response body for the "bad-request" error.

type WebhookForbiddenResponseBody

type WebhookForbiddenResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

WebhookForbiddenResponseBody is the type of the "ttn" service "webhook" endpoint HTTP response body for the "forbidden" error.

type WebhookNotFoundResponseBody

type WebhookNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

WebhookNotFoundResponseBody is the type of the "ttn" service "webhook" endpoint HTTP response body for the "not-found" error.

type WebhookUnauthorizedResponseBody

type WebhookUnauthorizedResponseBody string

WebhookUnauthorizedResponseBody is the type of the "ttn" service "webhook" endpoint HTTP response body for the "unauthorized" error.

Jump to

Keyboard shortcuts

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