Documentation
¶
Index ¶
- Constants
- type AggregateFunc
- type AggregateResponse
- type Attachment
- type BalanceResponse
- type Client
- func (c *Client) AddColumn(ctx context.Context, tableID string, input *CreateColumnInput) (*Table, error)
- func (c *Client) AggregateRows(ctx context.Context, tableID string, req *QueryRequest) (*AggregateResponse, error)
- func (c *Client) ArchiveEmail(ctx context.Context, id string) (*EmailDetail, error)
- func (c *Client) CompleteUpload(ctx context.Context, id, etag string, sizeBytes int64) (*DriveObject, error)
- func (c *Client) CreateMailbox(ctx context.Context, req *CreateMailboxRequest) (*Mailbox, error)
- func (c *Client) CreateNote(ctx context.Context, subject, content string, labels []string) (*Note, error)
- func (c *Client) CreateRow(ctx context.Context, tableID string, data map[string]any) (*Row, error)
- func (c *Client) CreateTable(ctx context.Context, req *CreateTableRequest) (*Table, error)
- func (c *Client) CreateTicket(ctx context.Context, ticketType, subject, message string) (*Ticket, error)
- func (c *Client) DeleteColumn(ctx context.Context, tableID, colID string) error
- func (c *Client) DeleteDriveObject(ctx context.Context, id string) (*DriveObject, error)
- func (c *Client) DeleteDriveObjectByPath(ctx context.Context, path string) (*DriveObject, error)
- func (c *Client) DeleteEmail(ctx context.Context, id string) error
- func (c *Client) DeleteMailbox(ctx context.Context, id string) error
- func (c *Client) DeleteNote(ctx context.Context, id string) (*Note, error)
- func (c *Client) DeleteRow(ctx context.Context, tableID, rowID string) error
- func (c *Client) DeleteTable(ctx context.Context, id string) error
- func (c *Client) DownloadFromURL(ctx context.Context, downloadURL string) (io.ReadCloser, error)
- func (c *Client) GenerateImage(ctx context.Context, req *ImageGenerateRequest) (*ImageGenerateResponse, error)
- func (c *Client) GenerateVideo(ctx context.Context, req *VideoGenerateRequest) (*VideoGenerateResponse, error)
- func (c *Client) GetBalance(ctx context.Context) (*BalanceResponse, error)
- func (c *Client) GetDownloadURL(ctx context.Context, id string) (*DownloadResponse, error)
- func (c *Client) GetDownloadURLByPath(ctx context.Context, path string) (*DownloadResponse, error)
- func (c *Client) GetDriveObject(ctx context.Context, id string) (*DriveObject, error)
- func (c *Client) GetDriveObjectByPath(ctx context.Context, path string) (*DriveObject, error)
- func (c *Client) GetEmail(ctx context.Context, id string) (*EmailDetail, error)
- func (c *Client) GetMe(ctx context.Context) (*UserProfile, error)
- func (c *Client) GetNote(ctx context.Context, id string) (*Note, error)
- func (c *Client) GetRow(ctx context.Context, tableID, rowID string) (*Row, error)
- func (c *Client) GetTable(ctx context.Context, id string) (*Table, error)
- func (c *Client) GetTrashedDownloadURL(ctx context.Context, id string) (*DownloadResponse, error)
- func (c *Client) GetTrashedDriveObject(ctx context.Context, id string) (*DriveObject, error)
- func (c *Client) GetTrashedEmail(ctx context.Context, id string) (*EmailDetail, error)
- func (c *Client) GetTrashedNote(ctx context.Context, id string) (*Note, error)
- func (c *Client) GetTrashedRow(ctx context.Context, tableID, rowID string) (*Row, error)
- func (c *Client) GetTrashedTable(ctx context.Context, id string) (*Table, error)
- func (c *Client) GetVideoStatus(ctx context.Context, requestID string) (*VideoStatusResponse, error)
- func (c *Client) GroupByRows(ctx context.Context, tableID string, req *QueryRequest) (*GroupByResponse, error)
- func (c *Client) ImageSearch(ctx context.Context, req *ImageSearchRequest) (*ImageSearchResponse, error)
- func (c *Client) InitUpload(ctx context.Context, req *InitUploadRequest) (*InitUploadResponse, error)
- func (c *Client) ListDriveObjects(ctx context.Context, page, pageSize int, prefix string) (*DriveListResponse, error)
- func (c *Client) ListEmails(ctx context.Context, page, pageSize int, direction string, isRead *bool, ...) (*EmailListResponse, error)
- func (c *Client) ListMailboxes(ctx context.Context) ([]*Mailbox, error)
- func (c *Client) ListNotes(ctx context.Context, page, pageSize int, labels []string, status, query string) (*NoteListResponse, error)
- func (c *Client) ListRows(ctx context.Context, tableID string, page, pageSize int) (*RowListResponse, error)
- func (c *Client) ListTables(ctx context.Context, page, pageSize int) (*TableListResponse, error)
- func (c *Client) ListTrashedDriveObjects(ctx context.Context, page, pageSize int) (*DriveListResponse, error)
- func (c *Client) ListTrashedEmails(ctx context.Context, page, pageSize int, direction string) (*EmailListResponse, error)
- func (c *Client) ListTrashedRows(ctx context.Context, tableID string, page, pageSize int) (*RowListResponse, error)
- func (c *Client) ListTrashedTables(ctx context.Context, page, pageSize int) (*TableListResponse, error)
- func (c *Client) MarkEmailAsRead(ctx context.Context, id string) (*EmailDetail, error)
- func (c *Client) MarkEmailAsUnread(ctx context.Context, id string) (*EmailDetail, error)
- func (c *Client) NewsSearch(ctx context.Context, req *NewsSearchRequest) (*NewsSearchResponse, error)
- func (c *Client) PatchColumn(ctx context.Context, tableID, colID string, patch *ColumnPatch) (*Table, error)
- func (c *Client) PatchMailbox(ctx context.Context, id string, patch *MailboxPatch) (*Mailbox, error)
- func (c *Client) PatchNote(ctx context.Context, id string, patch *NotePatch) (*Note, error)
- func (c *Client) PatchRow(ctx context.Context, tableID, rowID string, data map[string]any) (*Row, error)
- func (c *Client) PatchTable(ctx context.Context, id string, patch *TablePatch) (*Table, error)
- func (c *Client) PermanentlyDeleteDriveObject(ctx context.Context, id string) error
- func (c *Client) PermanentlyDeleteEmail(ctx context.Context, id string) error
- func (c *Client) PermanentlyDeleteNote(ctx context.Context, id string) error
- func (c *Client) PermanentlyDeleteRow(ctx context.Context, tableID, rowID string) error
- func (c *Client) PermanentlyDeleteTable(ctx context.Context, id string) error
- func (c *Client) QueryRows(ctx context.Context, tableID string, req *QueryRequest) (*RowListResponse, error)
- func (c *Client) RestoreDriveObject(ctx context.Context, id string) (*DriveObject, error)
- func (c *Client) RestoreEmail(ctx context.Context, id string) (*EmailDetail, error)
- func (c *Client) RestoreNote(ctx context.Context, id string) (*Note, error)
- func (c *Client) RestoreRow(ctx context.Context, tableID, rowID string) (*Row, error)
- func (c *Client) RestoreTable(ctx context.Context, id string) (*Table, error)
- func (c *Client) Scrape(ctx context.Context, req *ScrapeRequest) (*ScrapeResponse, error)
- func (c *Client) SendEmail(ctx context.Context, req *SendEmailRequest) (*EmailDetail, error)
- func (c *Client) UnarchiveEmail(ctx context.Context, id string) (*EmailDetail, error)
- func (c *Client) UploadToPresignedURL(ctx context.Context, uploadURL, contentType string, body io.Reader, size int64) (string, error)
- func (c *Client) WebSearch(ctx context.Context, req *WebSearchRequest) (*WebSearchResponse, error)
- type Column
- type ColumnPatch
- type CompleteUploadRequest
- type CreateColumnInput
- type CreateMailboxRequest
- type CreateNoteRequest
- type CreateTableRequest
- type CreateTicketRequest
- type DownloadResponse
- type DriveListResponse
- type DriveObject
- type Email
- type EmailDetail
- type EmailListResponse
- type Error
- type ErrorBody
- type GroupByResponse
- type ImageGenerateRequest
- type ImageGenerateResponse
- type ImageResult
- type ImageSearchRequest
- type ImageSearchResponse
- type InitUploadRequest
- type InitUploadResponse
- type Mailbox
- type MailboxPatch
- type NewsResult
- type NewsSearchRequest
- type NewsSearchResponse
- type Note
- type NoteListResponse
- type NotePatch
- type OrganicResult
- type QueryCondition
- type QueryFilter
- type QueryRequest
- type QuerySort
- type ReferenceImage
- type Response
- type Row
- type RowListResponse
- type ScrapeRequest
- type ScrapeResponse
- type SearchParameters
- type SendEmailRequest
- type Table
- type TableListResponse
- type TablePatch
- type Ticket
- type TokenRefresher
- type UserProfile
- type VideoGenerateRequest
- type VideoGenerateResponse
- type VideoReady
- type VideoRef
- type VideoStatusResponse
- type WebSearchRequest
- type WebSearchResponse
Constants ¶
const ( CodeAuthRequired = "AUTH_REQUIRED" CodeCommandError = "COMMAND_ERROR" CodeConfigNotFound = "CONFIG_KEY_NOT_FOUND" CodeNetworkError = "NETWORK_ERROR" CodeUnexpectedResp = "UNEXPECTED_RESPONSE" CodeUnknownError = "UNKNOWN_ERROR" )
CLI-originated error codes.
const ( // AUTH_* — authentication / authorization failures. CodeAuthForbidden = "AUTH_FORBIDDEN" CodeAuthTokenExpired = "AUTH_TOKEN_EXPIRED" CodeAuthInvalidToken = "AUTH_INVALID_TOKEN" // VALIDATION_* — request validation failures. CodeValidationError = "VALIDATION_ERROR" CodeValidationBadRequest = "VALIDATION_BAD_REQUEST" CodeValidationInvalidInput = "VALIDATION_INVALID_INPUT" // NETWORK_* — network-level failures. CodeNetworkTimeout = "NETWORK_TIMEOUT" // SERVER_* — server-side failures. CodeServerInternal = "SERVER_INTERNAL" // RESOURCE_* — resource state errors. CodeResourceNotFound = "RESOURCE_NOT_FOUND" CodeResourceConflict = "RESOURCE_CONFLICT" // RATE_* — rate limiting. CodeRateLimitExceeded = "RATE_LIMIT_EXCEEDED" )
Server-originated error codes — must match the server's envelope values exactly.
const ( ExitSuccess = 0 ExitBusiness = 1 ExitUsage = 2 ExitAuth = 3 ExitNetwork = 4 ExitServer = 5 )
Exit codes for structured errors.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateFunc ¶
type AggregateResponse ¶
type Attachment ¶
type BalanceResponse ¶
type BalanceResponse struct {
Balance int64 `json:"balance"`
}
type Client ¶
type Client struct {
BaseURL string
AccessToken string
HTTPClient *resty.Client
TokenRefresher TokenRefresher
}
func (*Client) AggregateRows ¶
func (c *Client) AggregateRows(ctx context.Context, tableID string, req *QueryRequest) (*AggregateResponse, error)
func (*Client) ArchiveEmail ¶ added in v0.5.0
func (*Client) CompleteUpload ¶
func (*Client) CreateMailbox ¶
func (*Client) CreateNote ¶
func (*Client) CreateTable ¶
func (*Client) CreateTicket ¶ added in v0.5.1
func (*Client) DeleteColumn ¶
func (*Client) DeleteDriveObject ¶
func (*Client) DeleteDriveObjectByPath ¶
func (*Client) DeleteNote ¶
func (*Client) DownloadFromURL ¶
DownloadFromURL downloads binary data from a presigned R2 URL. Caller must close the returned ReadCloser.
func (*Client) GenerateImage ¶ added in v0.2.1
func (c *Client) GenerateImage(ctx context.Context, req *ImageGenerateRequest) (*ImageGenerateResponse, error)
func (*Client) GenerateVideo ¶ added in v0.3.0
func (c *Client) GenerateVideo(ctx context.Context, req *VideoGenerateRequest) (*VideoGenerateResponse, error)
func (*Client) GetBalance ¶
func (c *Client) GetBalance(ctx context.Context) (*BalanceResponse, error)
func (*Client) GetDownloadURL ¶
func (*Client) GetDownloadURLByPath ¶
func (*Client) GetDriveObject ¶
func (*Client) GetDriveObjectByPath ¶
func (*Client) GetTrashedDownloadURL ¶
func (*Client) GetTrashedDriveObject ¶
func (*Client) GetTrashedEmail ¶
func (*Client) GetTrashedNote ¶
func (*Client) GetTrashedRow ¶
func (*Client) GetTrashedTable ¶
func (*Client) GetVideoStatus ¶ added in v0.3.0
func (*Client) GroupByRows ¶
func (c *Client) GroupByRows(ctx context.Context, tableID string, req *QueryRequest) (*GroupByResponse, error)
func (*Client) ImageSearch ¶
func (c *Client) ImageSearch(ctx context.Context, req *ImageSearchRequest) (*ImageSearchResponse, error)
func (*Client) InitUpload ¶
func (c *Client) InitUpload(ctx context.Context, req *InitUploadRequest) (*InitUploadResponse, error)
func (*Client) ListDriveObjects ¶
func (*Client) ListEmails ¶
func (*Client) ListMailboxes ¶
func (*Client) ListTables ¶
func (*Client) ListTrashedDriveObjects ¶
func (*Client) ListTrashedEmails ¶
func (*Client) ListTrashedRows ¶
func (*Client) ListTrashedTables ¶
func (*Client) MarkEmailAsRead ¶ added in v0.4.1
func (*Client) MarkEmailAsUnread ¶ added in v0.4.1
func (*Client) NewsSearch ¶
func (c *Client) NewsSearch(ctx context.Context, req *NewsSearchRequest) (*NewsSearchResponse, error)
func (*Client) PatchColumn ¶
func (*Client) PatchMailbox ¶
func (*Client) PatchTable ¶
func (*Client) PermanentlyDeleteDriveObject ¶
func (*Client) PermanentlyDeleteEmail ¶
func (*Client) PermanentlyDeleteNote ¶
func (*Client) PermanentlyDeleteRow ¶
func (*Client) PermanentlyDeleteTable ¶
func (*Client) QueryRows ¶
func (c *Client) QueryRows(ctx context.Context, tableID string, req *QueryRequest) (*RowListResponse, error)
func (*Client) RestoreDriveObject ¶
func (*Client) RestoreEmail ¶
func (*Client) RestoreNote ¶
func (*Client) RestoreRow ¶
func (*Client) RestoreTable ¶
func (*Client) Scrape ¶
func (c *Client) Scrape(ctx context.Context, req *ScrapeRequest) (*ScrapeResponse, error)
func (*Client) SendEmail ¶
func (c *Client) SendEmail(ctx context.Context, req *SendEmailRequest) (*EmailDetail, error)
func (*Client) UnarchiveEmail ¶ added in v0.5.0
func (*Client) UploadToPresignedURL ¶
func (c *Client) UploadToPresignedURL(ctx context.Context, uploadURL, contentType string, body io.Reader, size int64) (string, error)
UploadToPresignedURL uploads binary data to a presigned R2 URL. Returns the ETag from the response header.
func (*Client) WebSearch ¶
func (c *Client) WebSearch(ctx context.Context, req *WebSearchRequest) (*WebSearchResponse, error)
type ColumnPatch ¶
type CompleteUploadRequest ¶
type CreateColumnInput ¶
type CreateMailboxRequest ¶
type CreateNoteRequest ¶
type CreateTableRequest ¶
type CreateTableRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Columns []*CreateColumnInput `json:"columns,omitempty"`
}
type CreateTicketRequest ¶ added in v0.5.1
type DownloadResponse ¶
type DriveListResponse ¶
type DriveListResponse struct {
Items []DriveObject `json:"items"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
type DriveObject ¶
type DriveObject struct {
ID string `json:"id"`
Path string `json:"path"`
SizeBytes int64 `json:"sizeBytes"`
MimeType string `json:"mimeType,omitempty"`
ETag string `json:"etag,omitempty"`
Visibility string `json:"visibility"`
Properties map[string]any `json:"properties"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
}
type Email ¶
type Email struct {
ID string `json:"id"`
MailboxID string `json:"mailboxId"`
Direction string `json:"direction"`
From string `json:"from"`
To []string `json:"to"`
CC []string `json:"cc"`
BCC []string `json:"bcc"`
ReplyTo []string `json:"replyTo"`
Subject string `json:"subject"`
Snippet string `json:"snippet,omitempty"`
Status string `json:"status"`
Attachments []*Attachment `json:"attachments"`
ReadAt *time.Time `json:"readAt,omitempty"`
ArchivedAt *time.Time `json:"archivedAt,omitempty"`
SentAt *time.Time `json:"sentAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
}
type EmailDetail ¶
type EmailListResponse ¶
type Error ¶
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
RequestID string `json:"requestId,omitempty"`
StatusCode int `json:"-"`
Hint string `json:"hint,omitempty"`
Details map[string]any `json:"details,omitempty"`
Cause error `json:"-"`
}
Error is a structured API error that preserves the server's error envelope fields (code, message, requestId, hint, details) through Go's error chain.
func NewErrorFrom ¶
NewErrorFrom creates a new structured Error wrapping a cause.
func (*Error) ExitCode ¶
ExitCode maps the error code prefix to a CLI exit code. The CATEGORY_DETAIL convention means prefix matching is sufficient — adding new server codes under an existing prefix works automatically.
func (*Error) WithDetails ¶
WithDetails returns the error with added details.
type GroupByResponse ¶
type ImageGenerateRequest ¶ added in v0.2.1
type ImageGenerateRequest struct {
Model string `json:"model,omitempty"`
Prompt string `json:"prompt"`
Images []*ReferenceImage `json:"images,omitempty"`
AspectRatio string `json:"aspectRatio,omitempty"`
ImageSize string `json:"imageSize,omitempty"`
}
type ImageGenerateResponse ¶ added in v0.2.1
type ImageResult ¶
type ImageResult struct {
Title string `json:"title"`
ImageURL string `json:"imageUrl"`
ImageWidth int `json:"imageWidth"`
ImageHeight int `json:"imageHeight"`
ThumbnailURL string `json:"thumbnailUrl"`
Source string `json:"source"`
Domain string `json:"domain"`
Link string `json:"link"`
Position int `json:"position"`
}
type ImageSearchRequest ¶
type ImageSearchResponse ¶
type ImageSearchResponse struct {
SearchParameters *SearchParameters `json:"searchParameters"`
Images []*ImageResult `json:"images"`
Credits int `json:"credits"`
}
type InitUploadRequest ¶
type InitUploadResponse ¶
type MailboxPatch ¶
type NewsResult ¶
type NewsSearchRequest ¶
type NewsSearchResponse ¶
type NewsSearchResponse struct {
SearchParameters *SearchParameters `json:"searchParameters"`
News []*NewsResult `json:"news"`
Credits int `json:"credits"`
}
type NoteListResponse ¶
type OrganicResult ¶
type QueryCondition ¶
type QueryFilter ¶
type QueryFilter struct {
And []*QueryCondition `json:"and,omitempty"`
Or []*QueryCondition `json:"or,omitempty"`
}
type QueryRequest ¶
type QueryRequest struct {
Filter *QueryFilter `json:"filter,omitempty"`
Sort []*QuerySort `json:"sort,omitempty"`
Aggregate []*AggregateFunc `json:"aggregate,omitempty"`
GroupBy []string `json:"groupBy,omitempty"`
Page int `json:"page,omitempty"`
PageSize int `json:"pageSize,omitempty"`
}
type ReferenceImage ¶ added in v0.2.1
type Response ¶
type Response struct {
Success bool `json:"success"`
Data json.RawMessage `json:"data"`
Error *ErrorBody `json:"error"`
RequestID string `json:"requestId"`
}
type RowListResponse ¶
type ScrapeRequest ¶
type ScrapeResponse ¶
type SearchParameters ¶
type SendEmailRequest ¶
type SendEmailRequest struct {
MailboxID string `json:"mailboxId"`
To []string `json:"to"`
CC []string `json:"cc,omitempty"`
BCC []string `json:"bcc,omitempty"`
ReplyTo string `json:"replyTo,omitempty"`
Subject string `json:"subject"`
HTML string `json:"html,omitempty"`
Text string `json:"text,omitempty"`
}
type Table ¶
type Table struct {
ID string `json:"id"`
UserID string `json:"userId"`
Name string `json:"name"`
Description string `json:"description"`
Columns []*Column `json:"columns"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
}
type TableListResponse ¶
type TablePatch ¶
type TokenRefresher ¶
TokenRefresher is a callback that refreshes the access token. It receives the request context so cancellation propagates correctly. It returns the new access token or an error.
type UserProfile ¶
type VideoGenerateRequest ¶ added in v0.3.0
type VideoGenerateRequest struct {
Model string `json:"model,omitempty"`
Prompt string `json:"prompt"`
Duration int `json:"duration"`
AspectRatio string `json:"aspectRatio,omitempty"`
Resolution string `json:"resolution,omitempty"`
Image *VideoRef `json:"image,omitempty"`
Video *VideoRef `json:"video,omitempty"`
}
type VideoGenerateResponse ¶ added in v0.3.0
type VideoGenerateResponse struct {
RequestID string `json:"requestId"`
}
type VideoReady ¶ added in v0.3.0
type VideoStatusResponse ¶ added in v0.3.0
type VideoStatusResponse struct {
Status string `json:"status"`
Video *VideoReady `json:"video,omitempty"`
}
type WebSearchRequest ¶
type WebSearchResponse ¶
type WebSearchResponse struct {
SearchParameters *SearchParameters `json:"searchParameters"`
Organic []*OrganicResult `json:"organic"`
Credits int `json:"credits"`
}