chik

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

chik-go

chik-go is the provider-neutral runtime used by Chick-generated Go application clients.

Generate and use your application's client package with the Chick CLI. The generated package supplies the application-specific services and models.

Documentation

Overview

Package chik provides the public Go runtime used by generated application clients.

Package chik provides the public Go runtime used by generated application clients.

Package chik provides the public Go runtime used by generated application clients.

Package chik provides the public Go runtime used by generated application clients.

Index

Constants

View Source
const (
	ErrorMessageAuthenticationOperationSuperseded       = "The authentication operation was superseded by a newer session operation."
	ErrorMessageAuthenticationSessionChanged            = "The authentication session changed."
	ErrorMessageBrowserSessionCoordinationRequired      = "This browser must support same-origin session coordination to use application sessions safely."
	ErrorMessageCustomerAuthenticationCookieInvalid     = "The customer authentication cookie is invalid."
	ErrorMessageCustomerSessionRequired                 = "A customer session is required."
	ErrorMessageExpectedSessionScopeInvalid             = "The expected session scope is invalid."
	ErrorMessageGithubOauthBrowserCompletionInvalid     = "The GitHub OAuth browser completion is missing or invalid."
	ErrorMessageGithubOauthBrowserOriginInvalid         = "The GitHub OAuth browser completion must come from the application origin."
	ErrorMessageGithubOauthBrowserStateInvalid          = "The GitHub OAuth browser state is invalid."
	ErrorMessageGithubOauthBrowserTransitionUnavailable = "The GitHub OAuth browser transition is unavailable."
	ErrorMessageGithubOauthCallbackInvalid              = "The GitHub OAuth callback is invalid."
	ErrorMessageGithubOauthNonceCookieRequired          = "The GitHub OAuth nonce cookie is required."
	ErrorMessageGithubOauthSessionSnapshotInvalid       = "The GitHub OAuth session snapshot has an invalid format."
	ErrorMessageGithubOauthStateInvalid                 = "The GitHub OAuth state has an invalid format."
)

Variables

This section is empty.

Functions

func IsChikStorageUploadCommitUnknownError

func IsChikStorageUploadCommitUnknownError(err error) bool

IsChikStorageUploadCommitUnknownError reports whether an upload requires a completion check rather than creating a fresh upload intent.

func WithAuthenticationRetry

func WithAuthenticationRetry(ctx context.Context) context.Context

WithAuthenticationRetry permits one credential refresh and retry for a generated idempotent operation. Generated clients opt in operation by operation.

Types

type Auth

type Auth = ChikAuth

Auth provides application authentication operations.

type AuthActionAccepted

type AuthActionAccepted = ChikAuthActionAccepted

AuthActionAccepted acknowledges an authentication action.

type AuthError

type AuthError = ChikAuthError

AuthError describes an application authentication failure.

type AuthSession

type AuthSession = ChikAuthSession

AuthSession is an authenticated application session.

type AuthUser

type AuthUser = ChikAuthUser

AuthUser is an authenticated application user.

type BidiStream

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

BidiStream keeps a generated request stream and response stream active at the same time. Generated clients wrap it with request and response types.

func (*BidiStream) Close

func (stream *BidiStream) Close() error

Close cancels both sides of the stream.

func (*BidiStream) CloseSend

func (stream *BidiStream) CloseSend() error

CloseSend finishes the request side while keeping responses readable.

func (*BidiStream) Receive

func (stream *BidiStream) Receive(response any) error

Receive reads one response while requests may still be sent. It returns io.EOF after the response stream completes.

func (*BidiStream) Send

func (stream *BidiStream) Send(request any) error

Send writes one request without closing the response stream.

type ChikAuth

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

ChikAuth exposes the authentication features configured by chick/auth.yml. All methods use the same deployment origin and customer-controlled request headers as the generated RPC client.

func (*ChikAuth) AdoptSession

func (auth *ChikAuth) AdoptSession(ctx context.Context, session *ChikAuthSession) error

AdoptSession stores a native session returned by a custom sign-in or OAuth completion flow. Cookie-only responses are left in the HTTP cookie jar.

func (*ChikAuth) GetSession

func (auth *ChikAuth) GetSession(ctx context.Context) (*ChikAuthSession, error)

GetSession returns the current customer session.

func (*ChikAuth) OnAppForeground

func (auth *ChikAuth) OnAppForeground(ctx context.Context) (*ChikAuthSession, error)

OnAppForeground restores a native session after an application becomes active.

func (*ChikAuth) RefreshSession

func (auth *ChikAuth) RefreshSession(ctx context.Context) (*ChikAuthSession, error)

RefreshSession rotates the saved native session credentials immediately.

func (*ChikAuth) RequestEmailVerification

func (auth *ChikAuth) RequestEmailVerification(ctx context.Context) (*ChikAuthActionAccepted, error)

RequestEmailVerification asks the application to send a verification message for the current session.

func (*ChikAuth) RequestPasswordReset

func (auth *ChikAuth) RequestPasswordReset(ctx context.Context, email string) (*ChikAuthActionAccepted, error)

RequestPasswordReset asks the application to send a password reset message.

func (*ChikAuth) ResetPassword

func (auth *ChikAuth) ResetPassword(ctx context.Context, token, password string) (*ChikAuthUser, error)

ResetPassword applies a password reset token and returns the updated user.

func (*ChikAuth) RestoreSession

func (auth *ChikAuth) RestoreSession(ctx context.Context) (*ChikAuthSession, error)

RestoreSession restores the saved native session and refreshes it when it is close to expiry. Without a SessionStore it returns the current cookie session instead.

func (*ChikAuth) SignIn

func (auth *ChikAuth) SignIn(ctx context.Context, email, password string) (*ChikAuthSession, error)

SignIn starts a customer session. Cookie sessions are retained in the client HTTP cookie jar; native credentials are retained only through an explicitly configured SessionStore.

func (*ChikAuth) SignInCustom

func (auth *ChikAuth) SignInCustom(ctx context.Context, providerKey, credential string) (*ChikAuthSession, error)

SignInCustom verifies a credential through an application-defined identity provider selected by providerKey.

func (*ChikAuth) SignOut

func (auth *ChikAuth) SignOut(ctx context.Context) (*ChikSignOutResult, error)

SignOut revokes the current customer session.

func (*ChikAuth) SignUp

func (auth *ChikAuth) SignUp(ctx context.Context, email, password string) (*ChikAuthUser, error)

SignUp creates a password identity when the application enables it.

func (*ChikAuth) StartGitHub

func (auth *ChikAuth) StartGitHub(ctx context.Context, returnTo string) (*ChikOAuthStart, error)

StartGitHub returns the provider-neutral authorization URL configured by the application. The caller owns browser navigation and callback handling.

func (*ChikAuth) StartGitHubNative

func (auth *ChikAuth) StartGitHubNative(ctx context.Context) (*ChikNativeGitHubOAuthTransaction, error)

StartGitHubNative starts a native GitHub OAuth attempt. It requires a SessionStore because successful completion is stored as a native application session rather than a browser cookie.

func (*ChikAuth) VerifyEmail

func (auth *ChikAuth) VerifyEmail(ctx context.Context, token string) (*ChikAuthUser, error)

VerifyEmail applies an email verification token.

type ChikAuthActionAccepted

type ChikAuthActionAccepted struct {
	Accepted  bool   `json:"accepted"`
	ExpiresAt string `json:"expiresAt,omitempty"`
}

ChikAuthActionAccepted acknowledges an asynchronous authentication action.

type ChikAuthError

type ChikAuthError struct {
	Code              ErrorCode
	RawCode           string
	Message           string
	HTTPStatus        int
	RetryAfterSeconds int
	Cause             error
}

ChikAuthError is returned by a provider-neutral application authentication endpoint. It contains no identity-provider implementation details.

func (*ChikAuthError) Error

func (err *ChikAuthError) Error() string

func (*ChikAuthError) Unwrap

func (err *ChikAuthError) Unwrap() error

Unwrap preserves the local failure that caused this classified auth error.

type ChikAuthSession

type ChikAuthSession struct {
	User             ChikAuthUser `json:"user"`
	SessionToken     string       `json:"sessionToken,omitempty"`
	RefreshToken     string       `json:"refreshToken,omitempty"`
	ExpiresAt        string       `json:"expiresAt"`
	RefreshExpiresAt string       `json:"refreshExpiresAt,omitempty"`
}

ChikAuthSession is the current application session. Cookie sessions remain in the HTTP cookie jar; native responses include refreshable credentials.

type ChikAuthUser

type ChikAuthUser struct {
	UserID        string `json:"userId"`
	ProjectID     string `json:"projectId"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"emailVerified"`
	Disabled      bool   `json:"disabled"`
	CreatedAt     string `json:"createdAt"`
}

ChikAuthUser is the public user identity returned by application auth.

type ChikNativeGitHubOAuthTransaction

type ChikNativeGitHubOAuthTransaction struct {
	AuthorizationURL string
	RedirectURI      string
	ExpiresAt        string
	// contains filtered or unexported fields
}

ChikNativeGitHubOAuthTransaction keeps one native GitHub OAuth attempt's verification values private. Applications open AuthorizationURL in the system browser and pass the registered app-link callback to Complete.

func (*ChikNativeGitHubOAuthTransaction) Complete

func (transaction *ChikNativeGitHubOAuthTransaction) Complete(ctx context.Context, redirect string) (*ChikAuthSession, error)

Complete verifies one app-link callback, exchanges its authorization code, and saves the resulting Chickinfry application session. Provider tokens are never returned to the caller.

func (*ChikNativeGitHubOAuthTransaction) MatchesRedirect

func (transaction *ChikNativeGitHubOAuthTransaction) MatchesRedirect(redirect string) bool

MatchesRedirect reports whether redirect is the verified callback for this transaction. It does not consume the transaction.

type ChikOAuthStart

type ChikOAuthStart struct {
	AuthorizationURL string `json:"authorizationUrl"`
}

ChikOAuthStart contains the URL at which an OAuth authorization flow starts.

type ChikRealtimeClient

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

ChikRealtimeClient provides publish, single-channel subscription, and multiplexed connection APIs.

func (*ChikRealtimeClient) Connect

Connect starts a reconnecting multiplexed realtime connection.

func (*ChikRealtimeClient) Publish

func (client *ChikRealtimeClient) Publish(ctx context.Context, channel string, payload any, token string) (*ChikRealtimePublishResult, error)

Publish sends a JSON value to a logical realtime channel.

func (*ChikRealtimeClient) Subscribe

Subscribe starts an independently reconnecting subscription for one channel.

type ChikRealtimeConnection

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

ChikRealtimeConnection maintains multiple logical channels and restores subscriptions after transient disconnects.

func (*ChikRealtimeConnection) Close

func (connection *ChikRealtimeConnection) Close()

Close stops delivery and closes the current WebSocket.

func (*ChikRealtimeConnection) Subscribe

func (connection *ChikRealtimeConnection) Subscribe(channel string, lastSeq int64) error

Subscribe adds a logical channel to the multiplexed connection.

func (*ChikRealtimeConnection) Unsubscribe

func (connection *ChikRealtimeConnection) Unsubscribe(channel string) error

Unsubscribe removes a logical channel from the multiplexed connection.

type ChikRealtimeConnectionOptions

type ChikRealtimeConnectionOptions struct {
	Token   string
	OnEvent func(ChikRealtimeEvent)
	OnGap   func(ChikRealtimeGap)
	OnError func(ChikRealtimeProtocolError)
}

ChikRealtimeConnectionOptions configures a multiplexed realtime connection.

type ChikRealtimeEvent

type ChikRealtimeEvent struct {
	Channel string
	Seq     int64
	TS      int64
	Payload json.RawMessage
}

ChikRealtimeEvent is one ordered message delivered on a logical channel.

type ChikRealtimeGap

type ChikRealtimeGap struct {
	Channel   string
	OldestSeq int64
	LatestSeq int64
}

ChikRealtimeGap reports that older channel events are no longer available.

type ChikRealtimeProtocolError

type ChikRealtimeProtocolError struct {
	Code    ErrorCode
	RawCode string
	Message string
	Cause   error
}

ChikRealtimeProtocolError is a logical delivery error.

func (ChikRealtimeProtocolError) Error

func (err ChikRealtimeProtocolError) Error() string

func (ChikRealtimeProtocolError) Unwrap

func (err ChikRealtimeProtocolError) Unwrap() error

Unwrap preserves the local failure that caused this classified realtime error.

type ChikRealtimePublishResult

type ChikRealtimePublishResult struct {
	Seq int64 `json:"seq"`
	TS  int64 `json:"ts"`
}

ChikRealtimePublishResult acknowledges a published message.

type ChikRealtimeSubscribeOptions

type ChikRealtimeSubscribeOptions struct {
	LastSeq int64
	Token   string
	OnEvent func(ChikRealtimeEvent)
	OnGap   func(ChikRealtimeGap)
	OnError func(ChikRealtimeProtocolError)
}

ChikRealtimeSubscribeOptions configures an independent channel subscription.

type ChikRealtimeSubscription

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

ChikRealtimeSubscription owns a single-channel subscription.

func (*ChikRealtimeSubscription) Close

func (subscription *ChikRealtimeSubscription) Close()

Close stops delivery and prevents future reconnects.

type ChikSessionManager

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

ChikSessionManager owns one native application's stored session. It is safe for concurrent use and coalesces simultaneous restore and refresh requests into one store or network operation.

func (*ChikSessionManager) Adopt

func (manager *ChikSessionManager) Adopt(ctx context.Context, session *ChikAuthSession) error

Adopt stores a native session returned by a sign-in or OAuth completion. Cookie-only sessions have no bearer credentials and are intentionally not written to a SessionStore.

func (*ChikSessionManager) Clear

func (manager *ChikSessionManager) Clear(ctx context.Context) error

Clear removes the in-memory and stored native session. It is safe to call after a failed refresh or a completed sign-out.

func (*ChikSessionManager) Current

func (manager *ChikSessionManager) Current() *ChikAuthSession

Current returns the current in-memory native session. It does not read the session store or make a network request.

func (*ChikSessionManager) Refresh

func (manager *ChikSessionManager) Refresh(ctx context.Context) (*ChikAuthSession, error)

Refresh exchanges the current refresh token for a new native session. Concurrent callers share the same exchange result.

func (*ChikSessionManager) Restore

func (manager *ChikSessionManager) Restore(ctx context.Context) (*ChikAuthSession, error)

Restore loads the stored native session and refreshes it before expiry. A nil result means that no native session has been saved.

type ChikSessionStore

type ChikSessionStore interface {
	LoadSession(context.Context) (*ChikAuthSession, error)
	SaveSession(context.Context, *ChikAuthSession) error
	ClearSession(context.Context) error
}

ChikSessionStore persists a native application's access token, refresh token, and expiry record. Desktop and CLI applications should implement it with the operating system credential store. Implementations must not log either token.

type ChikSignOutResult

type ChikSignOutResult struct {
	SignedOut bool `json:"signedOut"`
}

ChikSignOutResult confirms that the current application session was revoked.

type ChikStorageAPIError

type ChikStorageAPIError struct {
	Code       ErrorCode
	RawCode    string
	Message    string
	HTTPStatus int
	Cause      error
}

ChikStorageAPIError describes an application storage API failure.

func (*ChikStorageAPIError) Error

func (err *ChikStorageAPIError) Error() string

func (*ChikStorageAPIError) Unwrap

func (err *ChikStorageAPIError) Unwrap() error

Unwrap preserves the local failure that caused this classified storage error.

type ChikStorageClient

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

ChikStorageClient exposes provider-neutral object upload and URL APIs.

func (*ChikStorageClient) CreateUpload

CreateUpload reserves an upload intent. A generated idempotency key is used when the caller does not provide one.

func (*ChikStorageClient) GetDownloadURL

GetDownloadURL returns a temporary URL for an object.

func (*ChikStorageClient) GetPublicURL

func (client *ChikStorageClient) GetPublicURL(input ChikStoragePublicURLInput) string

GetPublicURL returns the stable logical URL for an object in a public bucket.

type ChikStorageCreateUploadInput

type ChikStorageCreateUploadInput struct {
	Bucket           string
	Key              string
	ContentType      string
	Size             int64
	ContentSHA256    string
	ExpiresInSeconds int
	IdempotencyKey   string
}

ChikStorageCreateUploadInput reserves a logical object upload.

type ChikStorageDownloadInput

type ChikStorageDownloadInput struct {
	Bucket           string
	Key              string
	ExpiresInSeconds int
}

ChikStorageDownloadInput identifies an object for a temporary download URL.

type ChikStorageDownloadURL

type ChikStorageDownloadURL struct {
	URL       string `json:"url"`
	ExpiresAt string `json:"expiresAt"`
}

ChikStorageDownloadURL is a temporary URL returned by the application.

type ChikStoragePublicURLInput

type ChikStoragePublicURLInput struct {
	Bucket string
	Key    string
}

ChikStoragePublicURLInput identifies an object in a public logical bucket.

type ChikStorageUpload

type ChikStorageUpload struct {
	ID        string
	ExpiresAt string
	// contains filtered or unexported fields
}

ChikStorageUpload owns one upload intent. Its fields are stable logical identifiers and never expose storage-provider locations.

func (*ChikStorageUpload) Abort

func (upload *ChikStorageUpload) Abort(ctx context.Context) error

Abort discards an existing upload intent.

func (*ChikStorageUpload) Complete

func (upload *ChikStorageUpload) Complete(ctx context.Context) (json.RawMessage, error)

Complete asks the application to verify and finalize an existing upload.

func (*ChikStorageUpload) Put

func (upload *ChikStorageUpload) Put(ctx context.Context, body io.Reader) error

Put transfers a body through the application-owned upload route. Multipart transfers require io.ReaderAt so a failed part can be retried safely.

type ChikStorageUploadCommitUnknownError

type ChikStorageUploadCommitUnknownError struct {
	Code       ErrorCode
	UploadID   string
	Message    string
	HTTPStatus int
	Cause      error
}

ChikStorageUploadCommitUnknownError means the object transfer may have reached the application, but safe completion was not confirmed. For a single upload, call Complete before sending the body again.

func (*ChikStorageUploadCommitUnknownError) Error

func (*ChikStorageUploadCommitUnknownError) Unwrap

Unwrap preserves the storage error that made completion uncertain.

type ChikStreamDecoder

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

ChikStreamDecoder decodes a response stream.

func (*ChikStreamDecoder) Close

func (decoder *ChikStreamDecoder) Close() error

Close cancels the client request and closes its response stream. Use a context deadline when server-side cleanup must have a bounded completion time.

func (*ChikStreamDecoder) Next

func (decoder *ChikStreamDecoder) Next(message any) error

Next decodes the next generated response message and returns io.EOF at end of stream.

type ChikStreamSender

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

ChikStreamSender sends messages to a request stream.

func (*ChikStreamSender) Close

func (sender *ChikStreamSender) Close() error

Close cancels an in-progress request stream.

func (*ChikStreamSender) CloseAndReceive

func (sender *ChikStreamSender) CloseAndReceive() (*ChikStreamDecoder, error)

CloseAndReceive closes the request stream and returns the response stream.

func (*ChikStreamSender) CloseAndReceiveUnary

func (sender *ChikStreamSender) CloseAndReceiveUnary(response any) error

CloseAndReceiveUnary closes the request stream and decodes one unary response. It is the convenience form for client-streaming RPCs.

func (*ChikStreamSender) Send

func (sender *ChikStreamSender) Send(message any) error

Send writes one generated request message to the stream.

type Client

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

Client is the shared runtime behind generated application clients.

func NewClient

func NewClient(origin string, options Options) (*Client, error)

NewClient creates the shared runtime used by a generated client.

func (*Client) Auth

func (client *Client) Auth() *Auth

Auth returns the application authentication client.

func (*Client) BidiStream

func (client *Client) BidiStream(ctx context.Context, service, method string) (*BidiStream, error)

BidiStream opens a request and response stream that may be used concurrently.

func (*Client) ClientStream

func (client *Client) ClientStream(ctx context.Context, service, method string) (*StreamSender, error)

ClientStream opens a request stream for a declared service method.

func (*Client) JSON

func (client *Client) JSON(ctx context.Context, operation Operation, values []string, payload any, options RawOperationOptions) ([]byte, error)

JSON sends a declared operation with a JSON request body.

func (*Client) Origin

func (client *Client) Origin() string

Origin returns the deployment origin used by this client.

func (*Client) Raw

func (client *Client) Raw(ctx context.Context, operation Operation, values []string, body RawBody, options RawOperationOptions) ([]byte, error)

Raw sends a declared operation with a streaming request body.

func (*Client) Realtime

func (client *Client) Realtime() *Realtime

Realtime returns the application realtime client.

func (*Client) ServerStream

func (client *Client) ServerStream(ctx context.Context, service, method string, request any) (*StreamDecoder, error)

ServerStream opens a response stream for a declared service method.

func (*Client) Session

func (client *Client) Session() *SessionManager

Session returns the native session manager when the client was configured with a SessionStore. It is nil for browser-style cookie sessions.

func (*Client) Storage

func (client *Client) Storage() *Storage

Storage returns the application object storage client.

func (*Client) Unary

func (client *Client) Unary(ctx context.Context, service, method string, request, response any) error

Unary invokes a declared service method.

type Error

type Error struct {
	Code              ErrorCode
	RawCode           string
	Message           string
	HTTPStatus        int
	RetryAfterSeconds int
	Cause             error
}

Error describes an API request failure.

func (*Error) Error

func (err *Error) Error() string

func (*Error) Unwrap

func (err *Error) Unwrap() error

Unwrap preserves the local failure that caused this classified error.

type ErrorCode

type ErrorCode string

ErrorCode is a stable public failure classification.

const (
	ErrorCodeCanceled              ErrorCode = "canceled"
	ErrorCodeUnknown               ErrorCode = "unknown"
	ErrorCodeInvalidArgument       ErrorCode = "invalid_argument"
	ErrorCodeDeadlineExceeded      ErrorCode = "deadline_exceeded"
	ErrorCodeAlreadyExists         ErrorCode = "already_exists"
	ErrorCodeUnauthenticated       ErrorCode = "unauthenticated"
	ErrorCodePermissionDenied      ErrorCode = "permission_denied"
	ErrorCodeNotFound              ErrorCode = "not_found"
	ErrorCodeFailedPrecondition    ErrorCode = "failed_precondition"
	ErrorCodeAborted               ErrorCode = "aborted"
	ErrorCodeOutOfRange            ErrorCode = "out_of_range"
	ErrorCodeUnimplemented         ErrorCode = "unimplemented"
	ErrorCodeResourceExhausted     ErrorCode = "resource_exhausted"
	ErrorCodeInternal              ErrorCode = "internal"
	ErrorCodeUnavailable           ErrorCode = "unavailable"
	ErrorCodeDataLoss              ErrorCode = "data_loss"
	ErrorCodeNetworkFailure        ErrorCode = "network_error"
	ErrorCodeInvalidResponse       ErrorCode = "invalid_response"
	ErrorCodeStorageError          ErrorCode = "storage_error"
	ErrorCodeCommitUnknown         ErrorCode = "commit_unknown"
	ErrorCodeInvalidUploadUrl      ErrorCode = "invalid_upload_url"
	ErrorCodeInvalidMultipartPlan  ErrorCode = "invalid_multipart_plan"
	ErrorCodeMultipartBodyRequired ErrorCode = "multipart_body_required"
	ErrorCodeInvalidMultipartPart  ErrorCode = "invalid_multipart_part"
	ErrorCodePayloadTooLarge       ErrorCode = "payload_too_large"
	ErrorCodeResponseCredit        ErrorCode = "response_credit"
	ErrorCodeChannelLimit          ErrorCode = "channel_limit"
	ErrorCodeUnauthorized          ErrorCode = "unauthorized"
	ErrorCodeFrameAuth             ErrorCode = "frame_auth"
	ErrorCodeHalfClose             ErrorCode = "half_close"
)

func ParseErrorCode

func ParseErrorCode(value string) ErrorCode

ParseErrorCode never turns an unknown wire value into a known contract value.

func ParseWireErrorCode

func ParseWireErrorCode(value string) (ErrorCode, string)

ParseWireErrorCode preserves an unrecognized received code separately from the safe fallback.

func (ErrorCode) DefaultHTTPStatus

func (code ErrorCode) DefaultHTTPStatus() int

DefaultHTTPStatus returns the catalog fallback. Zero means no HTTP response exists.

func (ErrorCode) IsProtocol

func (code ErrorCode) IsProtocol() bool

IsProtocol reports whether this code is valid on the shared RPC/HTTP wire.

type ListValue

type ListValue[T any] struct {
	Values []T `json:"values"`
}

ListValue represents values for a repeated field.

type LiveQuery

type LiveQuery[T any] struct {
	// contains filtered or unexported fields
}

LiveQuery controls one generated reactive list subscription.

func NewLiveQuery

func NewLiveQuery[T any](
	parent context.Context,
	client *Client,
	service, method string,
	request any,
	newResponse func() any,
	items func(any) ([]T, error),
	options LiveQueryOptions[T],
) (*LiveQuery[T], error)

NewLiveQuery starts a reactive list subscription for a declared service method. The generated client supplies only its typed response factory and list projection.

func (*LiveQuery[T]) Close

func (query *LiveQuery[T]) Close()

Close stops the reactive WebSocket, lease renewal, and future refetches.

func (*LiveQuery[T]) Refetch

func (query *LiveQuery[T]) Refetch(ctx context.Context) error

Refetch re-registers or refreshes a reactive list through its generated RPC.

type LiveQueryOptions

type LiveQueryOptions[T any] struct {
	Token      string
	OnSnapshot func(LiveQuerySnapshot[T])
	OnError    func(error)
}

LiveQueryOptions configures callbacks for a generated list watch method.

type LiveQuerySnapshot

type LiveQuerySnapshot[T any] struct {
	Items   []T
	Pending bool
	Version int64
	Cursor  *ReactiveCursor
	Error   error
}

LiveQuerySnapshot is delivered when a reactive list is registered, refreshed, or updated through the reactive WebSocket.

type NativeGitHubOAuthTransaction

type NativeGitHubOAuthTransaction = ChikNativeGitHubOAuthTransaction

NativeGitHubOAuthTransaction is one native GitHub authorization attempt.

type OAuthStart

type OAuthStart = ChikOAuthStart

OAuthStart contains an application authorization URL.

type Operation

type Operation struct {
	Method string
	Path   string
}

Operation describes an HTTP operation declared by an application.

type Options

type Options struct {
	HTTPClient   *http.Client
	Headers      http.Header
	APIKey       string
	SessionToken string
	SessionStore ChikSessionStore
	APIName      string
	RPCPath      string
}

Options configures a client instance.

type RawBody

type RawBody struct {
	Reader        io.Reader
	ContentType   string
	ContentLength int64
}

RawBody supplies a streaming request body for a declared HTTP operation.

type RawOperationOptions

type RawOperationOptions struct {
	Headers http.Header
}

RawOperationOptions configures a declared application operation.

type ReactiveCursor

type ReactiveCursor struct {
	Stream   string
	Position string
}

ReactiveCursor identifies the most recent logical change reflected in a live query snapshot.

type Realtime

type Realtime = ChikRealtimeClient

Realtime provides application realtime operations.

type RealtimeConnection

type RealtimeConnection = ChikRealtimeConnection

RealtimeConnection controls a multiplexed realtime connection.

type RealtimeConnectionOptions

type RealtimeConnectionOptions = ChikRealtimeConnectionOptions

RealtimeConnectionOptions configures a multiplexed realtime connection.

type RealtimeEvent

type RealtimeEvent = ChikRealtimeEvent

RealtimeEvent is a message delivered on an application channel.

type RealtimeGap

type RealtimeGap = ChikRealtimeGap

RealtimeGap reports unavailable older messages on an application channel.

type RealtimeProtocolError

type RealtimeProtocolError = ChikRealtimeProtocolError

RealtimeProtocolError describes a realtime delivery error.

type RealtimePublishResult

type RealtimePublishResult = ChikRealtimePublishResult

RealtimePublishResult acknowledges a realtime message.

type RealtimeSubscribeOptions

type RealtimeSubscribeOptions = ChikRealtimeSubscribeOptions

RealtimeSubscribeOptions configures a channel subscription.

type RealtimeSubscription

type RealtimeSubscription = ChikRealtimeSubscription

RealtimeSubscription controls one channel subscription.

type SessionManager

type SessionManager = ChikSessionManager

SessionManager restores, refreshes, and clears a stored native session.

type SessionStore

type SessionStore = ChikSessionStore

SessionStore persists native application sessions. Implementations for desktop and CLI applications should use the operating system credential store. The Go runtime never writes user credentials to disk itself.

type SignOutResult

type SignOutResult = ChikSignOutResult

SignOutResult confirms that a session was revoked.

type Storage

type Storage = ChikStorageClient

Storage provides application object storage operations.

type StorageCreateUploadInput

type StorageCreateUploadInput = ChikStorageCreateUploadInput

StorageCreateUploadInput reserves an object upload.

type StorageDownloadInput

type StorageDownloadInput = ChikStorageDownloadInput

StorageDownloadInput identifies an object download.

type StorageDownloadURL

type StorageDownloadURL = ChikStorageDownloadURL

StorageDownloadURL is a temporary object download URL.

type StorageError

type StorageError = ChikStorageAPIError

StorageError describes an application storage failure.

type StoragePublicURLInput

type StoragePublicURLInput = ChikStoragePublicURLInput

StoragePublicURLInput identifies an object in a public bucket.

type StorageUpload

type StorageUpload = ChikStorageUpload

StorageUpload controls one application object upload.

type StorageUploadCommitUnknownError

type StorageUploadCommitUnknownError = ChikStorageUploadCommitUnknownError

StorageUploadCommitUnknownError means transfer completion was not confirmed.

type StreamDecoder

type StreamDecoder = ChikStreamDecoder

StreamDecoder reads response-stream messages.

type StreamSender

type StreamSender = ChikStreamSender

StreamSender sends request-stream messages.

Directories

Path Synopsis
Package keyring은 operating system credential store를 사용하는 desktop 및 CLI session store를 제공합니다.
Package keyring은 operating system credential store를 사용하는 desktop 및 CLI session store를 제공합니다.
Package server provides the public runtime contract used by generated Go servers.
Package server provides the public runtime contract used by generated Go servers.

Jump to

Keyboard shortcuts

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