Documentation
¶
Overview ¶
Package bibleit provides a client for Bibleit Server protocol v1. It does not read CLI configuration, open browsers, or manage credentials.
Index ¶
- Constants
- Variables
- type AccountInfo
- type AuthClient
- type AuthorizationResult
- type CatalogBook
- type CatalogChapter
- type Client
- func (c *Client) ControlLive(ctx context.Context, id string, action LiveAction) (LiveActionResult, error)
- func (c *Client) CreateLive(ctx context.Context, name string) (LiveResult, error)
- func (c *Client) Execute(ctx context.Context, command Command) (Response, error)
- func (c *Client) GetAccountInfo(ctx context.Context) (AccountInfo, error)
- func (c *Client) GetIdentity(ctx context.Context) (IdentityInfo, error)
- func (c *Client) GetLive(ctx context.Context, id string) (LiveResult, error)
- func (c *Client) GetLiveStack(ctx context.Context, id string) (LiveStack, error)
- func (c *Client) GetLiveStats(ctx context.Context, id string) (LiveStatistics, error)
- func (c *Client) GetOrganizationApplicationStatus(ctx context.Context, id string) (OrganizationApplicationResult, error)
- func (c *Client) GetServerInfo(ctx context.Context) (ServerInfo, error)
- func (c *Client) GetTranslationCatalog(ctx context.Context, slug string) (TranslationCatalog, error)
- func (c *Client) GetTranslationInfo(ctx context.Context, slug string) (TranslationInfo, error)
- func (c *Client) Help(ctx context.Context, topic string) (HelpResult, error)
- func (c *Client) Identity(ctx context.Context) (Response, error)
- func (c *Client) ListLives(ctx context.Context) (LiveList, error)
- func (c *Client) ListOrganizations(ctx context.Context, cursor string) (OrganizationDirectory, error)
- func (c *Client) ListQuotas(ctx context.Context) (QuotaResult, error)
- func (c *Client) ListTokens(ctx context.Context) (TokenList, error)
- func (c *Client) ListTranslations(ctx context.Context) (Response, error)
- func (c *Client) Ping(ctx context.Context) (Response, error)
- func (c *Client) PopLive(ctx context.Context, id string, count int) (LiveVerseResult, error)
- func (c *Client) PushLive(ctx context.Context, id string, ref Reference) (LiveVerseResult, error)
- func (c *Client) Read(ctx context.Context, ref Reference) (Response, error)
- func (c *Client) ReadVerses(ctx context.Context, ref Reference) (Reading, error)
- func (c *Client) RevokeCredential(ctx context.Context) error
- func (c *Client) Search(ctx context.Context, translation, query string) (Response, error)
- func (c *Client) SearchVerses(ctx context.Context, translation, query string) (Reading, error)
- func (c *Client) SetLive(ctx context.Context, id string, field LiveField, values ...string) (LiveResult, error)
- type CodeExchange
- type Command
- func AccountInfoCommand() Command
- func AccountQuotasCommand() Command
- func AccountTokensCommand() Command
- func AddTranslationCommand(slug string) (Command, error)
- func CreateLiveCommand(name string) (Command, error)
- func DeleteAllLivesCommand() Command
- func HelpCommand(topic string) (Command, error)
- func IdentityCommand() Command
- func LiveCommand(id string, action LiveAction) (Command, error)
- func LiveListCommand() Command
- func LiveSecretCommand(id string, action SecretAction, value string) (Command, error)
- func LiveStackCommand(id string, action StackAction) (Command, error)
- func OrganizationApplicationStatusCommand(id string) (Command, error)
- func OrganizationListCommand(cursor string) (Command, error)
- func PingCommand() Command
- func PopLiveCommand(id string, count int) (Command, error)
- func PushLiveCommand(id string, ref Reference) (Command, error)
- func ReadCommand(ref Reference) (Command, error)
- func RemoveTranslationCommand(slug string) (Command, error)
- func SearchCommand(translation, query string) (Command, error)
- func ServerInfoCommand() Command
- func SetLiveCommand(id string, field LiveField, values ...string) (Command, error)
- func TranslationCatalogCommand(slug string) (Command, error)
- func TranslationInfoCommand(slug string) (Command, error)
- func TranslationListCommand() Command
- type HTTPError
- type HelpEntry
- type HelpResult
- type IdentityInfo
- type LiveAction
- type LiveActionResult
- type LiveConnection
- type LiveField
- type LiveList
- type LiveResult
- type LiveStack
- type LiveState
- type LiveStatistics
- type LiveVerse
- type LiveVerseResult
- type OrganizationApplicationResult
- type OrganizationDirectory
- type OrganizationDirectoryEntry
- type Quota
- type QuotaLimit
- type QuotaResult
- type Reading
- type Record
- type Reference
- type RequestSizeError
- type Response
- type SecretAction
- type ServerError
- type ServerInfo
- type StackAction
- type StackEntry
- type TokenList
- type TokenMetadata
- type TranslationCatalog
- type TranslationInfo
- type VerseText
Constants ¶
const MaxCommandBytes = 8192
const MaxRequestBytes = 16384
const ServerEndpoint = "https://bibleit.app"
ServerEndpoint is the project-managed Bibleit service address. Applications cannot override it through configuration or environment variables. HTTPS certificate verification is enabled by the default transport.
Variables ¶
var ErrIncompleteTerm = errors.New("unterminated protocol term")
ErrIncompleteTerm means an opaque compound field needs another input line. Stream readers may append the next line and retry ParseRecord.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type AuthClient ¶
type AuthClient struct {
// contains filtered or unexported fields
}
AuthClient exchanges an approved browser code. It does not run a browser, validate callback state, persist credentials, or retry a consumed code.
func NewAuthClient ¶
func NewAuthClient() (*AuthClient, error)
NewAuthClient creates an unauthenticated client for browser-code exchange.
func NewAuthClientWithHTTPClient ¶
func NewAuthClientWithHTTPClient(httpClient *http.Client) (*AuthClient, error)
NewAuthClientWithHTTPClient configures transport/timeouts for code exchange at the same fixed service endpoint. It copies the supplied HTTP client.
func (*AuthClient) ExchangeCode ¶
func (c *AuthClient) ExchangeCode(ctx context.Context, exchange CodeExchange) (AuthorizationResult, error)
ExchangeCode redeems an approved one-use code with its PKCE verifier. Even a rejected verifier can consume the code on the current server.
type AuthorizationResult ¶
type AuthorizationResult struct {
Actor, IdentityName, DisplayName, AuthProvider, TokenID, AccessToken string
Fields map[string]json.RawMessage
}
AuthorizationResult contains a secret AccessToken; Fields also contains the original JSON response, including that secret. Callers own secure storage.
type CatalogBook ¶
type CatalogBook struct {
ID int64 // Server source book identifier; not the book's position in Books.
Name string
Chapters []CatalogChapter
Fields map[string]string
}
type CatalogChapter ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient creates a client using an API token and the project-managed service. The default HTTP timeout is 15 seconds. Operations are never retried automatically.
func NewClientWithHTTPClient ¶
NewClientWithHTTPClient configures HTTP transport/timeouts while retaining the fixed service endpoint. The supplied HTTP client is copied and redirects blocked.
func (*Client) ControlLive ¶
func (c *Client) ControlLive(ctx context.Context, id string, action LiveAction) (LiveActionResult, error)
func (*Client) CreateLive ¶
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo(ctx context.Context) (AccountInfo, error)
func (*Client) GetIdentity ¶
func (c *Client) GetIdentity(ctx context.Context) (IdentityInfo, error)
func (*Client) GetLiveStack ¶
func (*Client) GetLiveStats ¶
func (*Client) GetOrganizationApplicationStatus ¶ added in v0.0.2
func (*Client) GetServerInfo ¶
func (c *Client) GetServerInfo(ctx context.Context) (ServerInfo, error)
func (*Client) GetTranslationCatalog ¶
func (*Client) GetTranslationInfo ¶
func (*Client) ListOrganizations ¶ added in v0.0.2
func (*Client) ListQuotas ¶
func (c *Client) ListQuotas(ctx context.Context) (QuotaResult, error)
func (*Client) ListTokens ¶
ListTokens lists active personal token metadata. The server filters expired, revoked and expired rotation-grace credentials; it does not return a history.
func (*Client) ListTranslations ¶
func (*Client) ReadVerses ¶
func (*Client) RevokeCredential ¶
RevokeCredential revokes this client's bearer credential via CLI logout. Only HTTP 204 is a successful acknowledgement; errors never mutate the client.
func (*Client) SearchVerses ¶
type CodeExchange ¶
type CodeExchange struct {
Code, Verifier, DeviceName string
}
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command is a validated customer operation. Its zero value is invalid. String exposes the wire representation for transport adapters; it may contain secrets.
func AccountInfoCommand ¶
func AccountInfoCommand() Command
func AccountQuotasCommand ¶
func AccountQuotasCommand() Command
func AccountTokensCommand ¶
func AccountTokensCommand() Command
func AddTranslationCommand ¶
func CreateLiveCommand ¶
func DeleteAllLivesCommand ¶
func DeleteAllLivesCommand() Command
func HelpCommand ¶
HelpCommand asks the server for commands visible to the current principal. An empty topic selects the root. The server decides permission visibility.
func IdentityCommand ¶
func IdentityCommand() Command
func LiveCommand ¶
func LiveCommand(id string, action LiveAction) (Command, error)
func LiveListCommand ¶
func LiveListCommand() Command
func LiveSecretCommand ¶
func LiveSecretCommand(id string, action SecretAction, value string) (Command, error)
func LiveStackCommand ¶
func LiveStackCommand(id string, action StackAction) (Command, error)
func OrganizationApplicationStatusCommand ¶ added in v0.0.2
func OrganizationListCommand ¶ added in v0.0.2
OrganizationListCommand returns one page; pass the previous Next cursor unchanged.
func PingCommand ¶
func PingCommand() Command
func ReadCommand ¶
func SearchCommand ¶
func ServerInfoCommand ¶
func ServerInfoCommand() Command
func SetLiveCommand ¶
func TranslationInfoCommand ¶
func TranslationListCommand ¶
func TranslationListCommand() Command
type HelpResult ¶
type IdentityInfo ¶
type LiveAction ¶
type LiveAction string
const ( LiveInfo LiveAction = "INFO" LiveStats LiveAction = "STATS" LiveStart LiveAction = "START" LiveStop LiveAction = "STOP" LivePause LiveAction = "PAUSE" LiveResume LiveAction = "RESUME" LiveClear LiveAction = "CLEAR" LiveDelete LiveAction = "DELETE" LiveSubscribe LiveAction = "SUBSCRIBE" )
type LiveActionResult ¶
LiveActionResult reflects the server acknowledgement without fetching state.
type LiveConnection ¶
type LiveResult ¶
type LiveStack ¶
type LiveStack struct {
ID string
Entries []StackEntry
Raw Response
}
type LiveStatistics ¶
type LiveStatistics struct {
ID string
RunningForSeconds, Revision, StackEntries, ActorConnections, AnonymousConnections int64
Connections []LiveConnection
Raw Response
}
type LiveVerseResult ¶
type OrganizationApplicationResult ¶ added in v0.0.2
type OrganizationApplicationResult struct {
Application OrganizationDirectoryEntry
Raw Response
}
type OrganizationDirectory ¶ added in v0.0.2
type OrganizationDirectory struct {
Entries []OrganizationDirectoryEntry
Next *string
Raw Response
}
type OrganizationDirectoryEntry ¶ added in v0.0.2
type OrganizationDirectoryEntry struct {
Kind, ID, ApplicationID, Handle, Name, Domain, Role string
Verification, Status, State, NextAction, VerificationURL string
OrganizationID *string
Fields map[string]string
}
OrganizationDirectoryEntry represents either a membership or a private application. State and verification strings remain open to future server values.
type Quota ¶
type Quota struct {
Permission string
Limit QuotaLimit
Used int64
Fields map[string]string
}
type QuotaLimit ¶
type QuotaResult ¶
type Record ¶
Record preserves unknown v1 fields and their wire order.
func ParseRecord ¶
ParseRecord decodes response quoting and escaping, rejecting truncated strings.
type RequestSizeError ¶
RequestSizeError reports a request rejected locally before any network call.
func (*RequestSizeError) Error ¶
func (e *RequestSizeError) Error() string
type Response ¶
Response retains original lines for CLI raw output. END is excluded. Protocol v1 fields remain strings; future typed models can build on Records.
func DecodeCommandResponse ¶
DecodeCommandResponse uses the command's framing contract for a finite reply. Account translation replies contain count but are single records without END.
type SecretAction ¶
type SecretAction string
const ( SecretAuthenticate SecretAction = "" SecretCreate SecretAction = "CREATE" SecretRotate SecretAction = "ROTATE" SecretDelete SecretAction = "DELETE" )
type ServerError ¶
ServerError preserves the server code and metadata, including unknown codes.
func (*ServerError) Error ¶
func (e *ServerError) Error() string
func (*ServerError) RetryAfter ¶
func (e *ServerError) RetryAfter() time.Duration
type ServerInfo ¶
Typed results retain Raw for unknown fields and original wire records.
type StackAction ¶
type StackAction string
const ( StackInfo StackAction = "INFO" StackClear StackAction = "CLEAR" )
type StackEntry ¶
type TokenList ¶
type TokenList struct {
Actor string
Tokens []TokenMetadata
Raw Response
}
type TokenMetadata ¶
type TokenMetadata struct {
ID, Source string
IssuedAt int64
IssuedBy, Label *string
// Empty scopes inherit the actor's permissions. Nil means the field was absent;
// it must not be interpreted as unrestricted authority.
Scopes []string
LastUsedAt, ExpiresAt *int64
Retiring *bool
Fields map[string]string
}
TokenMetadata describes a currently active personal credential, never its value. Timestamp fields are Unix seconds. Optional fields remain nil when absent.
type TranslationCatalog ¶
type TranslationCatalog struct {
Translation string
Books []CatalogBook
Raw Response
}