client

package
v0.0.0-...-8b3e257 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEchoerPayload

func BuildEchoerPayload(chatterEchoerToken string) (*chatter.EchoerPayload, error)

BuildEchoerPayload builds the payload for the chatter echoer endpoint from CLI flags.

func BuildHistoryPayload

func BuildHistoryPayload(chatterHistoryView string, chatterHistoryToken string) (*chatter.HistoryPayload, error)

BuildHistoryPayload builds the payload for the chatter history endpoint from CLI flags.

func BuildListenerPayload

func BuildListenerPayload(chatterListenerToken string) (*chatter.ListenerPayload, error)

BuildListenerPayload builds the payload for the chatter listener endpoint from CLI flags.

func BuildLoginPayload

func BuildLoginPayload(chatterLoginUser string, chatterLoginPassword string) (*chatter.LoginPayload, error)

BuildLoginPayload builds the payload for the chatter login endpoint from CLI flags.

func BuildSubscribePayload

func BuildSubscribePayload(chatterSubscribeToken string) (*chatter.SubscribePayload, error)

BuildSubscribePayload builds the payload for the chatter subscribe endpoint from CLI flags.

func BuildSummaryPayload

func BuildSummaryPayload(chatterSummaryToken string) (*chatter.SummaryPayload, error)

BuildSummaryPayload builds the payload for the chatter summary endpoint from CLI flags.

func DecodeEchoerResponse

func DecodeEchoerResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "invalid-scopes" (type chatter.InvalidScopes): http.StatusForbidden
  • "unauthorized" (type chatter.Unauthorized): http.StatusUnauthorized
  • error: internal error

func DecodeHistoryResponse

func DecodeHistoryResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "invalid-scopes" (type chatter.InvalidScopes): http.StatusForbidden
  • "unauthorized" (type chatter.Unauthorized): http.StatusUnauthorized
  • error: internal error

func DecodeListenerResponse

func DecodeListenerResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "invalid-scopes" (type chatter.InvalidScopes): http.StatusForbidden
  • "unauthorized" (type chatter.Unauthorized): http.StatusUnauthorized
  • error: internal error

func DecodeLoginResponse

func DecodeLoginResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "unauthorized" (type chatter.Unauthorized): http.StatusUnauthorized
  • error: internal error

func DecodeSubscribeResponse

func DecodeSubscribeResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "invalid-scopes" (type chatter.InvalidScopes): http.StatusForbidden
  • "unauthorized" (type chatter.Unauthorized): http.StatusUnauthorized
  • error: internal error

func DecodeSummaryResponse

func DecodeSummaryResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "invalid-scopes" (type chatter.InvalidScopes): http.StatusForbidden
  • "unauthorized" (type chatter.Unauthorized): http.StatusUnauthorized
  • error: internal error

func EchoerChatterPath

func EchoerChatterPath() string

EchoerChatterPath returns the URL path to the chatter service echoer HTTP endpoint.

func EncodeEchoerRequest

func EncodeEchoerRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeEchoerRequest returns an encoder for requests sent to the chatter echoer server.

func EncodeHistoryRequest

func EncodeHistoryRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeHistoryRequest returns an encoder for requests sent to the chatter history server.

func EncodeListenerRequest

func EncodeListenerRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeListenerRequest returns an encoder for requests sent to the chatter listener server.

func EncodeLoginRequest

func EncodeLoginRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeLoginRequest returns an encoder for requests sent to the chatter login server.

func EncodeSubscribeRequest

func EncodeSubscribeRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeSubscribeRequest returns an encoder for requests sent to the chatter subscribe server.

func EncodeSummaryRequest

func EncodeSummaryRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeSummaryRequest returns an encoder for requests sent to the chatter summary server.

func HistoryChatterPath

func HistoryChatterPath() string

HistoryChatterPath returns the URL path to the chatter service history HTTP endpoint.

func ListenerChatterPath

func ListenerChatterPath() string

ListenerChatterPath returns the URL path to the chatter service listener HTTP endpoint.

func LoginChatterPath

func LoginChatterPath() string

LoginChatterPath returns the URL path to the chatter service login HTTP endpoint.

func NewEchoerInvalidScopes

func NewEchoerInvalidScopes(body string) chatter.InvalidScopes

NewEchoerInvalidScopes builds a chatter service echoer endpoint invalid-scopes error.

func NewEchoerUnauthorized

func NewEchoerUnauthorized(body string) chatter.Unauthorized

NewEchoerUnauthorized builds a chatter service echoer endpoint unauthorized error.

func NewHistoryChatSummaryOK

func NewHistoryChatSummaryOK(body *HistoryResponseBody) *chatterviews.ChatSummaryView

NewHistoryChatSummaryOK builds a "chatter" service "history" endpoint result from a HTTP "OK" response.

func NewHistoryInvalidScopes

func NewHistoryInvalidScopes(body string) chatter.InvalidScopes

NewHistoryInvalidScopes builds a chatter service history endpoint invalid-scopes error.

func NewHistoryUnauthorized

func NewHistoryUnauthorized(body string) chatter.Unauthorized

NewHistoryUnauthorized builds a chatter service history endpoint unauthorized error.

func NewListenerInvalidScopes

func NewListenerInvalidScopes(body string) chatter.InvalidScopes

NewListenerInvalidScopes builds a chatter service listener endpoint invalid-scopes error.

func NewListenerUnauthorized

func NewListenerUnauthorized(body string) chatter.Unauthorized

NewListenerUnauthorized builds a chatter service listener endpoint unauthorized error.

func NewLoginUnauthorized

func NewLoginUnauthorized(body string) chatter.Unauthorized

NewLoginUnauthorized builds a chatter service login endpoint unauthorized error.

func NewSubscribeEventOK

func NewSubscribeEventOK(body *SubscribeResponseBody) *chatter.Event

NewSubscribeEventOK builds a "chatter" service "subscribe" endpoint result from a HTTP "OK" response.

func NewSubscribeInvalidScopes

func NewSubscribeInvalidScopes(body string) chatter.InvalidScopes

NewSubscribeInvalidScopes builds a chatter service subscribe endpoint invalid-scopes error.

func NewSubscribeUnauthorized

func NewSubscribeUnauthorized(body string) chatter.Unauthorized

NewSubscribeUnauthorized builds a chatter service subscribe endpoint unauthorized error.

func NewSummaryChatSummaryCollectionOK

func NewSummaryChatSummaryCollectionOK(body SummaryResponseBody) chatterviews.ChatSummaryCollectionView

NewSummaryChatSummaryCollectionOK builds a "chatter" service "summary" endpoint result from a HTTP "OK" response.

func NewSummaryInvalidScopes

func NewSummaryInvalidScopes(body string) chatter.InvalidScopes

NewSummaryInvalidScopes builds a chatter service summary endpoint invalid-scopes error.

func NewSummaryUnauthorized

func NewSummaryUnauthorized(body string) chatter.Unauthorized

NewSummaryUnauthorized builds a chatter service summary endpoint unauthorized error.

func SubscribeChatterPath

func SubscribeChatterPath() string

SubscribeChatterPath returns the URL path to the chatter service subscribe HTTP endpoint.

func SummaryChatterPath

func SummaryChatterPath() string

SummaryChatterPath returns the URL path to the chatter service summary HTTP endpoint.

func ValidateChatSummaryResponse

func ValidateChatSummaryResponse(body *ChatSummaryResponse) (err error)

ValidateChatSummaryResponse runs the validations defined on ChatSummaryResponse

func ValidateSubscribeResponseBody

func ValidateSubscribeResponseBody(body *SubscribeResponseBody) (err error)

ValidateSubscribeResponseBody runs the validations defined on SubscribeResponseBody

Types

type ChatSummaryResponse

type ChatSummaryResponse struct {
	// Message sent to the server
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Length of the message sent
	Length *int `form:"length,omitempty" json:"length,omitempty" xml:"length,omitempty"`
	// Time at which the message was sent
	SentAt *string `form:"sent_at,omitempty" json:"sent_at,omitempty" xml:"sent_at,omitempty"`
}

ChatSummaryResponse is used to define fields on response body types.

type Client

type Client struct {
	// Login Doer is the HTTP client used to make requests to the login endpoint.
	LoginDoer goahttp.Doer

	// Echoer Doer is the HTTP client used to make requests to the echoer endpoint.
	EchoerDoer goahttp.Doer

	// Listener Doer is the HTTP client used to make requests to the listener
	// endpoint.
	ListenerDoer goahttp.Doer

	// Summary Doer is the HTTP client used to make requests to the summary
	// endpoint.
	SummaryDoer goahttp.Doer

	// Subscribe Doer is the HTTP client used to make requests to the subscribe
	// endpoint.
	SubscribeDoer goahttp.Doer

	// History Doer is the HTTP client used to make requests to the history
	// endpoint.
	HistoryDoer 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 chatter 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,
	dialer goahttp.Dialer,
	cfn *ConnConfigurer,
) *Client

NewClient instantiates HTTP clients for all the chatter service servers.

func (*Client) BuildEchoerRequest

func (c *Client) BuildEchoerRequest(ctx context.Context, v any) (*http.Request, error)

BuildEchoerRequest instantiates a HTTP request object with method and path set to call the "chatter" service "echoer" endpoint

func (*Client) BuildHistoryRequest

func (c *Client) BuildHistoryRequest(ctx context.Context, v any) (*http.Request, error)

BuildHistoryRequest instantiates a HTTP request object with method and path set to call the "chatter" service "history" endpoint

func (*Client) BuildListenerRequest

func (c *Client) BuildListenerRequest(ctx context.Context, v any) (*http.Request, error)

BuildListenerRequest instantiates a HTTP request object with method and path set to call the "chatter" service "listener" endpoint

func (*Client) BuildLoginRequest

func (c *Client) BuildLoginRequest(ctx context.Context, v any) (*http.Request, error)

BuildLoginRequest instantiates a HTTP request object with method and path set to call the "chatter" service "login" endpoint

func (*Client) BuildSubscribeRequest

func (c *Client) BuildSubscribeRequest(ctx context.Context, v any) (*http.Request, error)

BuildSubscribeRequest instantiates a HTTP request object with method and path set to call the "chatter" service "subscribe" endpoint

func (*Client) BuildSummaryRequest

func (c *Client) BuildSummaryRequest(ctx context.Context, v any) (*http.Request, error)

BuildSummaryRequest instantiates a HTTP request object with method and path set to call the "chatter" service "summary" endpoint

func (*Client) Echoer

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

Echoer returns an endpoint that makes HTTP requests to the chatter service echoer server.

func (*Client) History

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

History returns an endpoint that makes HTTP requests to the chatter service history server.

func (*Client) Listener

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

Listener returns an endpoint that makes HTTP requests to the chatter service listener server.

func (*Client) Login

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

Login returns an endpoint that makes HTTP requests to the chatter service login server.

func (*Client) Subscribe

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

Subscribe returns an endpoint that makes HTTP requests to the chatter service subscribe server.

func (*Client) Summary

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

Summary returns an endpoint that makes HTTP requests to the chatter service summary server.

type ConnConfigurer

type ConnConfigurer struct {
	EchoerFn    goahttp.ConnConfigureFunc
	ListenerFn  goahttp.ConnConfigureFunc
	SummaryFn   goahttp.ConnConfigureFunc
	SubscribeFn goahttp.ConnConfigureFunc
	HistoryFn   goahttp.ConnConfigureFunc
}

ConnConfigurer holds the websocket connection configurer functions for the streaming endpoints in "chatter" service.

func NewConnConfigurer

func NewConnConfigurer(fn goahttp.ConnConfigureFunc) *ConnConfigurer

NewConnConfigurer initializes the websocket connection configurer function with fn for all the streaming endpoints in "chatter" service.

type EchoerClientStream

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

EchoerClientStream implements the chatter.EchoerClientStream interface.

func (*EchoerClientStream) Close

func (s *EchoerClientStream) Close() error

Close closes the "echoer" endpoint websocket connection.

func (*EchoerClientStream) Recv

func (s *EchoerClientStream) Recv() (string, error)

Recv reads instances of "string" from the "echoer" endpoint websocket connection.

func (*EchoerClientStream) Send

func (s *EchoerClientStream) Send(v string) error

Send streams instances of "string" to the "echoer" endpoint websocket connection.

type HistoryClientStream

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

HistoryClientStream implements the chatter.HistoryClientStream interface.

func (*HistoryClientStream) Recv

Recv reads instances of "chatter.ChatSummary" from the "history" endpoint websocket connection.

func (*HistoryClientStream) SetView

func (s *HistoryClientStream) SetView(view string)

SetView sets the view to render the type before sending to the "history" endpoint websocket connection.

type HistoryResponseBody

type HistoryResponseBody struct {
	// Message sent to the server
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Length of the message sent
	Length *int `form:"length,omitempty" json:"length,omitempty" xml:"length,omitempty"`
	// Time at which the message was sent
	SentAt *string `form:"sent_at,omitempty" json:"sent_at,omitempty" xml:"sent_at,omitempty"`
}

HistoryResponseBody is the type of the "chatter" service "history" endpoint HTTP response body.

type ListenerClientStream

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

ListenerClientStream implements the chatter.ListenerClientStream interface.

func (*ListenerClientStream) Close

func (s *ListenerClientStream) Close() error

Close closes the "listener" endpoint websocket connection.

func (*ListenerClientStream) Send

func (s *ListenerClientStream) Send(v string) error

Send streams instances of "string" to the "listener" endpoint websocket connection.

type SubscribeClientStream

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

SubscribeClientStream implements the chatter.SubscribeClientStream interface.

func (*SubscribeClientStream) Recv

func (s *SubscribeClientStream) Recv() (*chatter.Event, error)

Recv reads instances of "chatter.Event" from the "subscribe" endpoint websocket connection.

type SubscribeResponseBody

type SubscribeResponseBody struct {
	// Message sent to the server
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	Action  *string `form:"action,omitempty" json:"action,omitempty" xml:"action,omitempty"`
	// Time at which the message was added
	AddedAt *string `form:"added_at,omitempty" json:"added_at,omitempty" xml:"added_at,omitempty"`
}

SubscribeResponseBody is the type of the "chatter" service "subscribe" endpoint HTTP response body.

type SummaryClientStream

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

SummaryClientStream implements the chatter.SummaryClientStream interface.

func (*SummaryClientStream) CloseAndRecv

CloseAndRecv stops sending messages to the "summary" endpoint websocket connection and reads instances of "chatter.ChatSummaryCollection" from the connection.

func (*SummaryClientStream) Send

func (s *SummaryClientStream) Send(v string) error

Send streams instances of "string" to the "summary" endpoint websocket connection.

type SummaryResponseBody

type SummaryResponseBody []*ChatSummaryResponse

SummaryResponseBody is the type of the "chatter" service "summary" endpoint HTTP response body.

Jump to

Keyboard shortcuts

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