Documentation
¶
Index ¶
- func GetThread(ctx context.Context, c *client.Client, uuid string) (*models.Thread, error)
- func GetUser(ctx context.Context, c *client.Client) (*models.User, error)
- func ListCollections(ctx context.Context, c *client.Client) ([]models.Space, error)
- func ListThreads(ctx context.Context, c *client.Client, onProgress func(int)) ([]models.Thread, error)
- func ListThreadsFrom(ctx context.Context, c *client.Client, startOffset int, ...) ([]models.Thread, error)
- type Block
- type MarkdownBlock
- type PlanBlock
- type PlanGoal
- type SessionResponse
- type SessionUser
- type SpaceItem
- type SpacesResponse
- type ThreadCollection
- type ThreadDetailResponse
- type ThreadEntry
- type ThreadListItem
- type ThreadListRequest
- type ThreadListResponse
- type ThreadMetadata
- type UserResponse
- type WebResult
- type WebResultBlock
- type WebResultMeta
- type WorkflowBlock
- type WorkflowItem
- type WorkflowStep
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListCollections ¶
ListCollections fetches all user spaces/collections via GET /rest/spaces.
func ListThreads ¶
func ListThreads(ctx context.Context, c *client.Client, onProgress func(int)) ([]models.Thread, error)
ListThreads fetches all user threads via POST /rest/thread/list_ask_threads. If onProgress is non-nil, it is called after each page with the total count so far.
func ListThreadsFrom ¶
func ListThreadsFrom(ctx context.Context, c *client.Client, startOffset int, seenUUIDs map[string]bool, onProgress func(int)) ([]models.Thread, error)
ListThreadsFrom fetches threads starting at a given offset via POST /rest/thread/list_ask_threads. Stops when a page returns fewer than limit results (end of data) or when all results are duplicates (safety net for API recycling behavior).
Types ¶
type Block ¶
type Block struct {
IntendedUsage string `json:"intended_usage"`
MarkdownBlock *MarkdownBlock `json:"markdown_block,omitempty"`
WebResultBlock *WebResultBlock `json:"web_result_block,omitempty"`
PlanBlock *PlanBlock `json:"plan_block,omitempty"`
WorkflowBlock *WorkflowBlock `json:"workflow_block,omitempty"`
}
Block represents a content block within an entry.
type MarkdownBlock ¶
MarkdownBlock contains the answer text in markdown format.
type PlanGoal ¶
type PlanGoal struct {
ID string `json:"id"`
Description string `json:"description"`
Final bool `json:"final"`
}
PlanGoal is a single step in the plan.
type SessionResponse ¶
type SessionResponse struct {
Expires string `json:"expires"`
PreventUsernameRedirect bool `json:"preventUsernameRedirect"`
User SessionUser `json:"user"`
}
SessionResponse is the shape of GET /api/auth/session.
func ValidateSession ¶
ValidateSession checks if the current session is valid by calling the auth endpoint.
type SessionUser ¶
type SessionUser struct {
ID string `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
OrgRole string `json:"org_role"`
OrgUUID string `json:"org_uuid"`
SubscriptionStatus string `json:"subscription_status"`
SubscriptionSource string `json:"subscription_source"`
}
SessionUser is the user info within the session response.
type SpaceItem ¶
type SpaceItem struct {
UUID string `json:"uuid"`
Title string `json:"title"`
Slug string `json:"slug"`
Emoji string `json:"emoji"`
Updated string `json:"updated"`
HasNextPage bool `json:"has_next_page"`
}
SpaceItem is a space/collection in the spaces response.
type SpacesResponse ¶
type SpacesResponse struct {
InvitedSpaces []SpaceItem `json:"invited_spaces"`
PrivateSpaces []SpaceItem `json:"private_spaces"`
SavedSpaces []SpaceItem `json:"saved_spaces"`
OrganizationSpaces []SpaceItem `json:"organization_spaces"`
}
SpacesResponse is the shape of GET /rest/spaces.
type ThreadCollection ¶
type ThreadCollection struct {
UUID string `json:"uuid"`
Title string `json:"title"`
Emoji string `json:"emoji"`
Slug string `json:"slug"`
}
ThreadCollection is the inline collection/space info returned with each thread.
type ThreadDetailResponse ¶
type ThreadDetailResponse struct {
Entries []ThreadEntry `json:"entries"`
BackgroundEntries []interface{} `json:"background_entries"`
HasNextPage bool `json:"has_next_page"`
NextCursor *string `json:"next_cursor"`
Status string `json:"status"`
ThreadMetadata ThreadMetadata `json:"thread_metadata"`
}
ThreadDetailResponse is the shape of GET /rest/thread/{uuid}.
type ThreadEntry ¶
type ThreadEntry struct {
UUID string `json:"uuid"`
BackendUUID string `json:"backend_uuid"`
ContextUUID string `json:"context_uuid"`
QueryStr string `json:"query_str"`
DisplayModel string `json:"display_model"`
SearchFocus string `json:"search_focus"`
Status string `json:"status"`
Mode string `json:"mode"`
Personalized bool `json:"personalized"`
ThreadTitle string `json:"thread_title"`
ThreadURLSlug string `json:"thread_url_slug"`
BookmarkState string `json:"bookmark_state"`
Blocks []Block `json:"blocks"`
RelatedQueries []string `json:"related_queries"`
CreatedAt string `json:"entry_created_datetime"`
UpdatedAt string `json:"entry_updated_datetime"`
}
ThreadEntry represents a single Q&A entry within a thread.
type ThreadListItem ¶
type ThreadListItem struct {
UUID string `json:"uuid"`
Title string `json:"title"`
Slug string `json:"slug"`
ThreadNumber int `json:"thread_number"`
Mode string `json:"mode"`
Status string `json:"status"`
ContextUUID string `json:"context_uuid"`
DisplayModel string `json:"display_model"`
SearchFocus string `json:"search_focus"`
QueryStr string `json:"query_str"`
AnswerPreview string `json:"answer_preview"`
LastQueryTime string `json:"last_query_datetime"`
HasNextPage bool `json:"has_next_page"`
TotalThreads int `json:"total_threads"`
Collection *ThreadCollection `json:"collection,omitempty"`
Source string `json:"source"`
QueryCount int `json:"query_count"`
}
ThreadListItem is a thread summary in the list_ask_threads response.
type ThreadListRequest ¶
type ThreadListRequest struct {
Limit int `json:"limit"`
Ascending bool `json:"ascending"`
Offset int `json:"offset"`
SearchTerm string `json:"search_term"`
ExcludeASI bool `json:"exclude_asi"`
IncludeAssets bool `json:"include_assets"`
}
ThreadListRequest is the POST body for list_ask_threads.
type ThreadListResponse ¶
type ThreadListResponse []ThreadListItem
ThreadListResponse is the shape of POST /rest/thread/list_ask_threads.
type ThreadMetadata ¶
type ThreadMetadata struct {
Title string `json:"title"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Mode string `json:"mode"`
Status string `json:"thread_status"`
}
ThreadMetadata contains thread-level metadata.
type UserResponse ¶
type UserResponse struct {
ID string `json:"id"`
Email string `json:"email"`
Username string `json:"username,omitempty"`
PaymentTier string `json:"payment_tier"`
SubscriptionStatus string `json:"subscription_status"`
SubscriptionSource string `json:"subscription_source"`
IsInOrganization bool `json:"is_in_organization"`
Created bool `json:"created"`
}
UserResponse is the shape of GET /api/user.
type WebResult ¶
type WebResult struct {
Name string `json:"name"`
URL string `json:"url"`
Snippet string `json:"snippet"`
Timestamp string `json:"timestamp,omitempty"`
MetaData WebResultMeta `json:"meta_data"`
IsAttachment bool `json:"is_attachment"`
}
WebResult is a single source/citation.
type WebResultBlock ¶
type WebResultBlock struct {
Progress string `json:"progress"`
WebResults []WebResult `json:"web_results"`
}
WebResultBlock contains web search results/sources.
type WebResultMeta ¶
type WebResultMeta struct {
Client string `json:"client"`
CitationDomain *string `json:"citation_domain_name"`
DomainName string `json:"domain_name,omitempty"`
Description string `json:"description,omitempty"`
PublishedDate string `json:"published_date,omitempty"`
Images []string `json:"images,omitempty"`
}
WebResultMeta contains metadata for a web result.
type WorkflowBlock ¶
type WorkflowBlock struct {
Version string `json:"version"`
Status string `json:"status"`
Steps []WorkflowStep `json:"steps"`
}
WorkflowBlock contains workflow/step information.
type WorkflowItem ¶
type WorkflowItem struct {
ID string `json:"id"`
Type string `json:"type"`
Payload interface{} `json:"payload"`
}
WorkflowItem is an item within a workflow step.
type WorkflowStep ¶
type WorkflowStep struct {
Status string `json:"status"`
Title string `json:"title"`
Items []WorkflowItem `json:"items"`
}
WorkflowStep is a step in the workflow.