streaming

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// StreamGetSwitchingProtocolsBodyEventUpdate captures enum value "update"
	StreamGetSwitchingProtocolsBodyEventUpdate string = "update"

	// StreamGetSwitchingProtocolsBodyEventNotification captures enum value "notification"
	StreamGetSwitchingProtocolsBodyEventNotification string = "notification"

	// StreamGetSwitchingProtocolsBodyEventDelete captures enum value "delete"
	StreamGetSwitchingProtocolsBodyEventDelete string = "delete"

	// StreamGetSwitchingProtocolsBodyEventFiltersChanged captures enum value "filters_changed"
	StreamGetSwitchingProtocolsBodyEventFiltersChanged string = "filters_changed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client for streaming API

func (*Client) SetTransport

func (a *Client) SetTransport(transport runtime.ClientTransport)

SetTransport changes the transport on the client

func (*Client) StreamGet

func (a *Client) StreamGet(params *StreamGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error
StreamGet initiates a websocket connection for live streaming of statuses and notifications

The scheme used should *always* be `wss`. The streaming basepath can be viewed at `/api/v1/instance`.

On a successful connection, a code `101` will be returned, which indicates that the connection is being upgraded to a secure websocket connection.

As long as the connection is open, various message types will be streamed into it.

GoToSocial will ping the connection every 30 seconds to check whether the client is still receiving.

If the ping fails, or something else goes wrong during transmission, then the connection will be dropped, and the client will be expected to start it again.

type ClientOption

type ClientOption func(*runtime.ClientOperation)

ClientOption may be used to customize the behavior of Client methods.

type ClientService

type ClientService interface {
	StreamGet(params *StreamGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error

	SetTransport(transport runtime.ClientTransport)
}

ClientService is the interface for Client methods

func New

func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService

New creates a new streaming API client.

func NewClientWithBasicAuth

func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService

New creates a new streaming API client with basic auth credentials. It takes the following parameters: - host: http host (github.com). - basePath: any base path for the API client ("/v1", "/v3"). - scheme: http scheme ("http", "https"). - user: user for basic authentication header. - password: password for basic authentication header.

func NewClientWithBearerToken

func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService

New creates a new streaming API client with a bearer token for authentication. It takes the following parameters: - host: http host (github.com). - basePath: any base path for the API client ("/v1", "/v3"). - scheme: http scheme ("http", "https"). - bearerToken: bearer token for Bearer authentication header.

type StreamGetBadRequest

type StreamGetBadRequest struct {
}

StreamGetBadRequest describes a response with status code 400, with default header values.

bad request

func NewStreamGetBadRequest

func NewStreamGetBadRequest() *StreamGetBadRequest

NewStreamGetBadRequest creates a StreamGetBadRequest with default headers values

func (*StreamGetBadRequest) Code

func (o *StreamGetBadRequest) Code() int

Code gets the status code for the stream get bad request response

func (*StreamGetBadRequest) Error

func (o *StreamGetBadRequest) Error() string

func (*StreamGetBadRequest) IsClientError

func (o *StreamGetBadRequest) IsClientError() bool

IsClientError returns true when this stream get bad request response has a 4xx status code

func (*StreamGetBadRequest) IsCode

func (o *StreamGetBadRequest) IsCode(code int) bool

IsCode returns true when this stream get bad request response a status code equal to that given

func (*StreamGetBadRequest) IsRedirect

func (o *StreamGetBadRequest) IsRedirect() bool

IsRedirect returns true when this stream get bad request response has a 3xx status code

func (*StreamGetBadRequest) IsServerError

func (o *StreamGetBadRequest) IsServerError() bool

IsServerError returns true when this stream get bad request response has a 5xx status code

func (*StreamGetBadRequest) IsSuccess

func (o *StreamGetBadRequest) IsSuccess() bool

IsSuccess returns true when this stream get bad request response has a 2xx status code

func (*StreamGetBadRequest) String

func (o *StreamGetBadRequest) String() string

type StreamGetParams

type StreamGetParams struct {

	/* AccessToken.

	   Access token for the requesting account.
	*/
	AccessToken string

	/* List.

	     ID of the list to subscribe to.
	Only used if stream type is 'list'.
	*/
	List *string

	/* Stream.

	     Type of stream to request.

	Options are:

	`user`: receive updates for the account's home timeline.
	`public`: receive updates for the public timeline.
	`public:local`: receive updates for the local timeline.
	`hashtag`: receive updates for a given hashtag.
	`hashtag:local`: receive local updates for a given hashtag.
	`list`: receive updates for a certain list of accounts.
	`direct`: receive updates for direct messages.
	*/
	Stream string

	/* Tag.

	     Name of the tag to subscribe to.
	Only used if stream type is 'hashtag' or 'hashtag:local'.
	*/
	Tag *string

	Context    context.Context
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

StreamGetParams contains all the parameters to send to the API endpoint

for the stream get operation.

Typically these are written to a http.Request.

func NewStreamGetParams

func NewStreamGetParams() *StreamGetParams

NewStreamGetParams creates a new StreamGetParams object, with the default timeout for this client.

Default values are not hydrated, since defaults are normally applied by the API server side.

To enforce default values in parameter, use SetDefaults or WithDefaults.

func NewStreamGetParamsWithContext

func NewStreamGetParamsWithContext(ctx context.Context) *StreamGetParams

NewStreamGetParamsWithContext creates a new StreamGetParams object with the ability to set a context for a request.

func NewStreamGetParamsWithHTTPClient

func NewStreamGetParamsWithHTTPClient(client *http.Client) *StreamGetParams

NewStreamGetParamsWithHTTPClient creates a new StreamGetParams object with the ability to set a custom HTTPClient for a request.

func NewStreamGetParamsWithTimeout

func NewStreamGetParamsWithTimeout(timeout time.Duration) *StreamGetParams

NewStreamGetParamsWithTimeout creates a new StreamGetParams object with the ability to set a timeout on a request.

func (*StreamGetParams) SetAccessToken

func (o *StreamGetParams) SetAccessToken(accessToken string)

SetAccessToken adds the accessToken to the stream get params

func (*StreamGetParams) SetContext

func (o *StreamGetParams) SetContext(ctx context.Context)

SetContext adds the context to the stream get params

func (*StreamGetParams) SetDefaults

func (o *StreamGetParams) SetDefaults()

SetDefaults hydrates default values in the stream get params (not the query body).

All values with no default are reset to their zero value.

func (*StreamGetParams) SetHTTPClient

func (o *StreamGetParams) SetHTTPClient(client *http.Client)

SetHTTPClient adds the HTTPClient to the stream get params

func (*StreamGetParams) SetList

func (o *StreamGetParams) SetList(list *string)

SetList adds the list to the stream get params

func (*StreamGetParams) SetStream

func (o *StreamGetParams) SetStream(stream string)

SetStream adds the stream to the stream get params

func (*StreamGetParams) SetTag

func (o *StreamGetParams) SetTag(tag *string)

SetTag adds the tag to the stream get params

func (*StreamGetParams) SetTimeout

func (o *StreamGetParams) SetTimeout(timeout time.Duration)

SetTimeout adds the timeout to the stream get params

func (*StreamGetParams) WithAccessToken

func (o *StreamGetParams) WithAccessToken(accessToken string) *StreamGetParams

WithAccessToken adds the accessToken to the stream get params

func (*StreamGetParams) WithContext

func (o *StreamGetParams) WithContext(ctx context.Context) *StreamGetParams

WithContext adds the context to the stream get params

func (*StreamGetParams) WithDefaults

func (o *StreamGetParams) WithDefaults() *StreamGetParams

WithDefaults hydrates default values in the stream get params (not the query body).

All values with no default are reset to their zero value.

func (*StreamGetParams) WithHTTPClient

func (o *StreamGetParams) WithHTTPClient(client *http.Client) *StreamGetParams

WithHTTPClient adds the HTTPClient to the stream get params

func (*StreamGetParams) WithList

func (o *StreamGetParams) WithList(list *string) *StreamGetParams

WithList adds the list to the stream get params

func (*StreamGetParams) WithStream

func (o *StreamGetParams) WithStream(stream string) *StreamGetParams

WithStream adds the stream to the stream get params

func (*StreamGetParams) WithTag

func (o *StreamGetParams) WithTag(tag *string) *StreamGetParams

WithTag adds the tag to the stream get params

func (*StreamGetParams) WithTimeout

func (o *StreamGetParams) WithTimeout(timeout time.Duration) *StreamGetParams

WithTimeout adds the timeout to the stream get params

func (*StreamGetParams) WriteToRequest

func (o *StreamGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error

WriteToRequest writes these params to a swagger request

type StreamGetReader

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

StreamGetReader is a Reader for the StreamGet structure.

func (*StreamGetReader) ReadResponse

func (o *StreamGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)

ReadResponse reads a server response into the received o.

type StreamGetSwitchingProtocols

type StreamGetSwitchingProtocols struct {
	Payload *StreamGetSwitchingProtocolsBody
}

StreamGetSwitchingProtocols describes a response with status code 101, with default header values.

StreamGetSwitchingProtocols stream get switching protocols

func NewStreamGetSwitchingProtocols

func NewStreamGetSwitchingProtocols() *StreamGetSwitchingProtocols

NewStreamGetSwitchingProtocols creates a StreamGetSwitchingProtocols with default headers values

func (*StreamGetSwitchingProtocols) Code

func (o *StreamGetSwitchingProtocols) Code() int

Code gets the status code for the stream get switching protocols response

func (*StreamGetSwitchingProtocols) Error

func (*StreamGetSwitchingProtocols) GetPayload

func (*StreamGetSwitchingProtocols) IsClientError

func (o *StreamGetSwitchingProtocols) IsClientError() bool

IsClientError returns true when this stream get switching protocols response has a 4xx status code

func (*StreamGetSwitchingProtocols) IsCode

func (o *StreamGetSwitchingProtocols) IsCode(code int) bool

IsCode returns true when this stream get switching protocols response a status code equal to that given

func (*StreamGetSwitchingProtocols) IsRedirect

func (o *StreamGetSwitchingProtocols) IsRedirect() bool

IsRedirect returns true when this stream get switching protocols response has a 3xx status code

func (*StreamGetSwitchingProtocols) IsServerError

func (o *StreamGetSwitchingProtocols) IsServerError() bool

IsServerError returns true when this stream get switching protocols response has a 5xx status code

func (*StreamGetSwitchingProtocols) IsSuccess

func (o *StreamGetSwitchingProtocols) IsSuccess() bool

IsSuccess returns true when this stream get switching protocols response has a 2xx status code

func (*StreamGetSwitchingProtocols) String

func (o *StreamGetSwitchingProtocols) String() string

type StreamGetSwitchingProtocolsBody

type StreamGetSwitchingProtocolsBody struct {

	// The type of event being received.
	//
	// `update`: a new status has been received.
	// `notification`: a new notification has been received.
	// `delete`: a status has been deleted.
	// `filters_changed`: filters (including keywords and statuses) have changed.
	// Enum: ["update","notification","delete","filters_changed"]
	Event string `json:"event,omitempty"`

	// The payload of the streamed message.
	// Different depending on the `event` type.
	//
	// If present, it should be parsed as a string.
	//
	// If `event` = `update`, then the payload will be a JSON string of a status.
	// If `event` = `notification`, then the payload will be a JSON string of a notification.
	// If `event` = `delete`, then the payload will be a status ID.
	// If `event` = `filters_changed`, then there is no payload.
	// Example: {\"id\":\"01FC3TZ5CFG6H65GCKCJRKA669\",\"created_at\":\"2021-08-02T16:25:52Z\",\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"public\",\"language\":\"en\",\"uri\":\"https://gts.superseriousbusiness.org/users/dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"url\":\"https://gts.superseriousbusiness.org/@dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"bookmarked\":fals…//gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/original/019036W043D8FXPJKSKCX7G965.png\",\"header_static\":\"https://gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/small/019036W043D8FXPJKSKCX7G965.png\",\"followers_count\":33,\"following_count\":28,\"statuses_count\":126,\"last_status_at\":\"2021-08-02T16:25:52Z\",\"emojis\":[],\"fields\":[]},\"media_attachments\":[],\"mentions\":[],\"tags\":[],\"emojis\":[],\"card\":null,\"poll\":null,\"text\":\"a\"}
	Payload string `json:"payload,omitempty"`

	// stream
	Stream []string `json:"stream"`
}

StreamGetSwitchingProtocolsBody stream get switching protocols body swagger:model StreamGetSwitchingProtocolsBody

func (*StreamGetSwitchingProtocolsBody) ContextValidate

func (o *StreamGetSwitchingProtocolsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this stream get switching protocols body based on context it is used

func (*StreamGetSwitchingProtocolsBody) MarshalBinary

func (o *StreamGetSwitchingProtocolsBody) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*StreamGetSwitchingProtocolsBody) UnmarshalBinary

func (o *StreamGetSwitchingProtocolsBody) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*StreamGetSwitchingProtocolsBody) Validate

Validate validates this stream get switching protocols body

type StreamGetUnauthorized

type StreamGetUnauthorized struct {
}

StreamGetUnauthorized describes a response with status code 401, with default header values.

unauthorized

func NewStreamGetUnauthorized

func NewStreamGetUnauthorized() *StreamGetUnauthorized

NewStreamGetUnauthorized creates a StreamGetUnauthorized with default headers values

func (*StreamGetUnauthorized) Code

func (o *StreamGetUnauthorized) Code() int

Code gets the status code for the stream get unauthorized response

func (*StreamGetUnauthorized) Error

func (o *StreamGetUnauthorized) Error() string

func (*StreamGetUnauthorized) IsClientError

func (o *StreamGetUnauthorized) IsClientError() bool

IsClientError returns true when this stream get unauthorized response has a 4xx status code

func (*StreamGetUnauthorized) IsCode

func (o *StreamGetUnauthorized) IsCode(code int) bool

IsCode returns true when this stream get unauthorized response a status code equal to that given

func (*StreamGetUnauthorized) IsRedirect

func (o *StreamGetUnauthorized) IsRedirect() bool

IsRedirect returns true when this stream get unauthorized response has a 3xx status code

func (*StreamGetUnauthorized) IsServerError

func (o *StreamGetUnauthorized) IsServerError() bool

IsServerError returns true when this stream get unauthorized response has a 5xx status code

func (*StreamGetUnauthorized) IsSuccess

func (o *StreamGetUnauthorized) IsSuccess() bool

IsSuccess returns true when this stream get unauthorized response has a 2xx status code

func (*StreamGetUnauthorized) String

func (o *StreamGetUnauthorized) String() string

Jump to

Keyboard shortcuts

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