api

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearCapabilitiesCache

func ClearCapabilitiesCache() error

Types

type ActivityFeedOptions

type ActivityFeedOptions struct {
	UserID     string
	Page       int
	PageSize   int
	IncludeOwn bool
}

type ActivityFeedResponse

type ActivityFeedResponse struct {
	Activities []ActivityItem `json:"activities"`
	TotalCount int            `json:"total_count"`
}

type ActivityItem

type ActivityItem struct {
	User       string      `json:"user"`
	UserID     string      `json:"user_id"`
	GroupID    string      `json:"group_id"`
	Action     string      `json:"action"`
	Object     string      `json:"object"`
	ObjectType string      `json:"object_type"`
	ObjectName string      `json:"object_name"`
	ObjectID   string      `json:"object_id"`
	Timestamp  interface{} `json:"timestamp"`
	Tooltip    string      `json:"tooltip,omitempty"`
}

type Capabilities

type Capabilities struct {
	Auth struct {
		PasswordLogin bool `json:"password_login"`
		PasswordReset bool `json:"password_reset"`
		DeviceFlow    bool `json:"device_flow"`
		GoogleOAuth   bool `json:"google_oauth"`
		Required      bool `json:"required"`
		SingleUser    bool `json:"single_user"`
	} `json:"auth"`
	Inputs struct {
		Text  bool `json:"text"`
		OCR   bool `json:"ocr"`
		Repos bool `json:"repos"`
	} `json:"inputs"`
	Models struct {
		Premium bool `json:"premium"`
		Open    bool `json:"open"`
	} `json:"models"`
	Integrations struct {
		Slack  bool `json:"slack"`
		Github bool `json:"github"`
	} `json:"integrations"`
	Limits struct {
		Docs           *int `json:"docs"`
		FeedbackPerDay *int `json:"feedback_per_day"`
	} `json:"limits"`
	Features struct {
		OCRUpload               bool `json:"ocr_upload"`
		ActivityFeed            bool `json:"activity_feed"`
		NotificationEvents      bool `json:"notification_events"`
		NotificationScoring     bool `json:"notification_scoring"`
		NotificationPreferences bool `json:"notification_preferences"`
		NotificationDelivery    bool `json:"notification_delivery"`
	} `json:"features"`
	Server       string `json:"server,omitempty"`
	Version      string `json:"version,omitempty"`
	LegacyRoutes bool   `json:"legacy_routes,omitempty"`
}

type Chunk

type Chunk struct {
	ChunkID string `json:"chunk_id"`
	Content string `json:"content,omitempty"`
	Text    string `json:"text,omitempty"`
}

type Client

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

func NewClient

func NewClient(base string) *Client

func (*Client) AcknowledgeNotificationEvent

func (c *Client) AcknowledgeNotificationEvent(eventID string) error

func (*Client) Capabilities

func (c *Client) Capabilities(ttl time.Duration) (*Capabilities, error)

func (*Client) ClearNotificationDeliveryEmail added in v0.3.3

func (c *Client) ClearNotificationDeliveryEmail() error

func (*Client) CreateDoc

func (c *Client) CreateDoc(title, docType, content, groupIDs string, published bool) (CreateDocResp, error)

func (*Client) CreateGroup

func (c *Client) CreateGroup(name, category, description, visibility, imagePath string) (GroupItem, error)

func (*Client) CreateNote

func (c *Client) CreateNote(documentID, content, groupID string) (Note, error)

func (*Client) CreateReviewNowCreditCheckout added in v0.5.3

func (c *Client) CreateReviewNowCreditCheckout() (ReviewNowCreditCheckoutResp, error)

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(groupID string) error

func (*Client) DismissNotificationEvent

func (c *Client) DismissNotificationEvent(eventID string) error

func (*Client) EnsureSession

func (c *Client) EnsureSession() (SessionResponse, error)

func (*Client) GetActivityFeed

func (c *Client) GetActivityFeed(opts ActivityFeedOptions) (ActivityFeedResponse, error)

func (*Client) GetDocumentByID

func (c *Client) GetDocumentByID(docID string) (Document, error)

func (*Client) GetDocumentByTitle

func (c *Client) GetDocumentByTitle(title string) (Document, error)

func (*Client) GetDocumentMetadataByID added in v0.5.3

func (c *Client) GetDocumentMetadataByID(docID string) (Document, error)

func (*Client) GetNote

func (c *Client) GetNote(noteID string) (Note, error)

func (*Client) GetNotificationPreferences added in v0.3.3

func (c *Client) GetNotificationPreferences() (NotificationPreferences, error)

func (*Client) GetOCRFileResult

func (c *Client) GetOCRFileResult(taskID string) (OCRFileResult, error)

func (*Client) GetTaskStatus

func (c *Client) GetTaskStatus(taskID string) (TaskStatus, error)

func (*Client) HideFeedback

func (c *Client) HideFeedback(feedbackID string, hidden bool) error

func (*Client) JoinGroup

func (c *Client) JoinGroup(groupID string) error

func (*Client) ListAdminGroupIDs

func (c *Client) ListAdminGroupIDs() ([]string, error)

ListAdminGroupIDs attempts to fetch the set of group IDs where the current user is an admin. It supports multiple response shapes for compatibility: - {"groups": [{"id":"...","group_id":"..."}, ...]} - [{"id":"...","group_id":"..."}, ...] - ["group-id-1", "group-id-2", ...]

func (*Client) ListDocuments

func (c *Client) ListDocuments(groupID string, ownOnly bool) ([]Document, error)

func (*Client) ListDocumentsWithOptions

func (c *Client) ListDocumentsWithOptions(opts ListDocumentsOptions) ([]Document, error)

func (*Client) ListFeedback

func (c *Client) ListFeedback(docID string) ([]FeedbackEntry, error)

func (*Client) ListGroupUsers

func (c *Client) ListGroupUsers(groupID string) ([]GroupUser, error)

func (*Client) ListGroups

func (c *Client) ListGroups(ownOnly bool) ([]GroupItem, error)

func (*Client) ListNotes

func (c *Client) ListNotes(documentID string) ([]Note, error)

func (*Client) ListNotificationEvents

func (c *Client) ListNotificationEvents(opts NotificationEventsOptions) (NotificationEventsResponse, error)

func (*Client) LoadChunks

func (c *Client) LoadChunks(docID string) ([]Chunk, error)

func (*Client) LoadReferences

func (c *Client) LoadReferences(chunkID string) ([]Reference, error)

func (*Client) LoadReviewNowCredits added in v0.5.3

func (c *Client) LoadReviewNowCredits() (ReviewNowCreditsResp, error)

func (*Client) LoadUserByID

func (c *Client) LoadUserByID(userID string) (UserInfo, error)

func (*Client) LoadUserPlan

func (c *Client) LoadUserPlan() (string, error)

func (*Client) Login

func (c *Client) Login(email, password string) (LoginResponse, error)

func (*Client) PollGoogleOAuthDevice

func (c *Client) PollGoogleOAuthDevice(pollToken string) (GoogleOAuthDevicePollResponse, error)

func (*Client) ProcessDoc

func (c *Client) ProcessDoc(docID, text string, generateFeedback bool) (ProcessDocResp, error)

func (*Client) ProcessDocWithMode

func (c *Client) ProcessDocWithMode(docID, text string, generateFeedback bool, chunkMode string) (ProcessDocResp, error)

func (*Client) ProcessDocWithOptions added in v0.1.4

func (c *Client) ProcessDocWithOptions(docID, text string, generateFeedback bool, opts ProcessDocOptions) (ProcessDocResp, error)

func (*Client) RateFeedback

func (c *Client) RateFeedback(feedbackID, value string) error

func (*Client) RequestNotificationDeliveryEmail added in v0.3.3

func (c *Client) RequestNotificationDeliveryEmail(email string) error

func (*Client) ReviewNow added in v0.3.22

func (c *Client) ReviewNow(opts ReviewNowOptions) (ReviewNowResp, error)

func (*Client) ReviewNowQuote added in v0.5.3

func (c *Client) ReviewNowQuote(opts ReviewNowOptions) (ReviewNowQuoteResp, error)

func (*Client) SetDocumentPublished

func (c *Client) SetDocumentPublished(docID string, published bool) error

Documents: publish/unpublish

func (*Client) ShareNotificationEvent

func (c *Client) ShareNotificationEvent(eventID, note string) error

func (*Client) SignUp

func (c *Client) SignUp(email, name, password string, referral string) (SignUpResponse, error)

func (*Client) StartGoogleOAuthDevice

func (c *Client) StartGoogleOAuthDevice() (GoogleOAuthDeviceStartResponse, error)

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(groupID string, attrs map[string]string) error

Group update

func (*Client) UpdateNotificationPreferences added in v0.3.3

func (c *Client) UpdateNotificationPreferences(update NotificationPreferencesUpdate) error

func (*Client) UpdateUser

func (c *Client) UpdateUser(attrs map[string]string) error

func (*Client) UploadOCRFile

func (c *Client) UploadOCRFile(path string, docID string) (OCRUploadResp, error)

type CreateDocResp

type CreateDocResp struct {
	DocumentID string `json:"document_id"`
}

Documents

type Document

type Document struct {
	DocumentID       string      `json:"document_id"`
	UserID           string      `json:"user_id,omitempty"`
	AuthorID         string      `json:"author_id,omitempty"`
	Title            string      `json:"title"`
	Content          string      `json:"content,omitempty"`
	DocType          string      `json:"doc_type,omitempty"`
	DatetimeCreated  interface{} `json:"datetime_created,omitempty"`
	DatetimeModified interface{} `json:"datetime_modified,omitempty"`
	IsPublished      bool        `json:"is_published,omitempty"`
	Groups           []GroupItem `json:"groups,omitempty"`
}

---- Feedback & Documents ----

type FeedbackEntry

type FeedbackEntry struct {
	FeedbackID   string              `json:"feedback_id"`
	ChunkID      string              `json:"chunk_id"`
	ChunkContent string              `json:"chunk_content,omitempty"`
	Feedback     string              `json:"feedback"`
	UserFeedback string              `json:"user_feedback,omitempty"`
	Timestamp    interface{}         `json:"timestamp"`
	References   []FeedbackReference `json:"references,omitempty"`
}

type FeedbackReference

type FeedbackReference struct {
	ReferenceID string `json:"reference_id"`
	Type        string `json:"type"`
	DocumentID  string `json:"document_id"`
	NoteID      string `json:"note_id"`
	Title       string `json:"title"`
	Author      string `json:"author"`
	Content     string `json:"content"`
}

type GoogleOAuthDevicePollResponse

type GoogleOAuthDevicePollResponse struct {
	Status        string `json:"status,omitempty"`
	Error         string `json:"error,omitempty"`
	AuthToken     string `json:"auth_token,omitempty"`
	UserID        string `json:"user_id,omitempty"`
	Username      string `json:"username,omitempty"`
	Name          string `json:"name,omitempty"`
	AccountStatus string `json:"account_status,omitempty"`
}

type GoogleOAuthDeviceStartResponse

type GoogleOAuthDeviceStartResponse struct {
	AuthURL   string `json:"auth_url,omitempty"`
	PollToken string `json:"poll_token,omitempty"`
	ExpiresAt string `json:"expires_at,omitempty"`
}

type GroupItem

type GroupItem struct {
	ID         string `json:"id,omitempty"`
	GroupID    string `json:"group_id,omitempty"`
	Name       string `json:"name"`
	Visibility string `json:"visibility,omitempty"`
}

Groups

type GroupListResp

type GroupListResp struct {
	Groups     []GroupItem `json:"groups"`
	TotalCount int         `json:"total_count"`
}

type GroupUser

type GroupUser struct {
	ID           string `json:"user_id"`
	Username     string `json:"username"`
	Name         string `json:"name"`
	Status       string `json:"status"`
	Role         string `json:"role"`
	ProfileImage string `json:"profile_image"`
}

type ListDocumentsOptions

type ListDocumentsOptions struct {
	GroupID    string
	OwnOnly    bool
	FilterType string
	Page       int
	PageSize   int
	AllPages   bool
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"username"`
	Password string `json:"password"`
}

Login

type LoginResponse

type LoginResponse struct {
	AuthToken    string `json:"auth_token,omitempty"`
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
	UserID       string `json:"user_id,omitempty"`
	Username     string `json:"username,omitempty"`
}

type Note

type Note struct {
	NoteID          string      `json:"note_id"`
	DocumentID      string      `json:"document_id"`
	AuthorID        string      `json:"author_id"`
	GroupID         string      `json:"group_id,omitempty"`
	Content         string      `json:"content"`
	DatetimeCreated interface{} `json:"datetime_created"`
	Author          *NoteAuthor `json:"author,omitempty"`
}

type NoteAuthor

type NoteAuthor struct {
	UserID   string `json:"user_id"`
	Username string `json:"username"`
	Name     string `json:"name"`
}

type NotificationEvent

type NotificationEvent struct {
	EventID        string      `json:"event_id"`
	UserID         string      `json:"user_id"`
	GroupID        string      `json:"group_id"`
	Intent         string      `json:"intent"`
	DedupeKey      string      `json:"dedupe_key"`
	TargetDocID    string      `json:"target_doc_id"`
	TargetChunkID  string      `json:"target_chunk_id"`
	PeerDocIDs     []string    `json:"peer_doc_ids"`
	Relevance      string      `json:"relevance"`
	Novelty        string      `json:"novelty"`
	Severity       string      `json:"severity"`
	Certainty      string      `json:"certainty"`
	DeliveryAction string      `json:"delivery_action"`
	Channel        string      `json:"channel"`
	ParseMode      string      `json:"parse_mode"`
	Model          string      `json:"model"`
	RunID          string      `json:"run_id"`
	DigestBucket   string      `json:"digest_bucket"`
	Rationale      []string    `json:"rationale"`
	EvidenceTarget string      `json:"evidence_target"`
	EvidencePeer   string      `json:"evidence_peer"`
	CreatedAt      interface{} `json:"created_at"`
	DeliveredAt    interface{} `json:"delivered_at"`
	AcknowledgedAt interface{} `json:"acknowledged_at"`
	DismissedAt    interface{} `json:"dismissed_at"`
}

type NotificationEventsOptions

type NotificationEventsOptions struct {
	GroupID             string
	Page                int
	PageSize            int
	IncludeAcknowledged bool
	IncludeDismissed    bool
	IncludeDrop         bool
}

type NotificationEventsResponse

type NotificationEventsResponse struct {
	Events     []NotificationEvent `json:"events"`
	TotalCount int                 `json:"total_count"`
}

type NotificationPreferences added in v0.3.3

type NotificationPreferences struct {
	PreferencesID                       string   `json:"preferences_id"`
	EmailDigestEnabled                  bool     `json:"email_digest_enabled"`
	EmailDigestFrequency                string   `json:"email_digest_frequency"`
	PushNotificationsEnabled            bool     `json:"push_notifications_enabled"`
	DigestBucketsEnabled                []string `json:"digest_buckets_enabled"`
	QuietHoursStart                     string   `json:"quiet_hours_start"`
	QuietHoursEnd                       string   `json:"quiet_hours_end"`
	MaxDailyPushEmails                  int      `json:"max_daily_push_emails"`
	AccountEmail                        string   `json:"account_email"`
	NotificationDeliveryEmail           string   `json:"notification_delivery_email"`
	NotificationDeliveryEmailPending    string   `json:"notification_delivery_email_pending"`
	NotificationDeliveryEmailVerified   bool     `json:"notification_delivery_email_verified"`
	NotificationDeliveryEmailVerifiedAt string   `json:"notification_delivery_email_verified_at"`
	NotificationDeliveryEmailEffective  string   `json:"notification_delivery_email_effective"`
	NotificationDeliveryEmailSource     string   `json:"notification_delivery_email_source"`
}

type NotificationPreferencesUpdate added in v0.3.3

type NotificationPreferencesUpdate map[string]any

type OCRFileResult

type OCRFileResult struct {
	TaskID string          `json:"task_id"`
	Status string          `json:"status"`
	Result json.RawMessage `json:"result"`
}

type OCRUploadResp

type OCRUploadResp struct {
	TaskID string `json:"task_id"`
}

type ProcessDocOptions added in v0.1.4

type ProcessDocOptions struct {
	ChunkMode         string
	ReanalyzeExisting bool
	ReferenceDocIDs   []string
	SkipIndex         bool
}

type ProcessDocResp

type ProcessDocResp struct {
	TaskID       string `json:"task_id"`
	SkippedIndex bool   `json:"skipped_index,omitempty"`
}

Processing

type Reference

type Reference struct {
	ReferenceID    string       `json:"reference_id"`
	SourceChunkID  string       `json:"source_chunk_id"`
	Document       ReferenceDoc `json:"document"`
	DocumentAuthor string       `json:"document_author"`
}

type ReferenceDoc

type ReferenceDoc struct {
	DocumentID string `json:"document_id"`
	Title      string `json:"title"`
}

type ReviewNowCreditCheckoutResp added in v0.5.3

type ReviewNowCreditCheckoutResp struct {
	URL             string `json:"url"`
	CreditPackCents int    `json:"credit_pack_cents"`
	Currency        string `json:"currency"`
}

type ReviewNowCreditsResp added in v0.5.3

type ReviewNowCreditsResp struct {
	BalanceCents    int    `json:"balance_cents"`
	Currency        string `json:"currency"`
	CreditUnit      string `json:"credit_unit"`
	CreditPackCents int    `json:"credit_pack_cents"`
	CheckoutEnabled bool   `json:"checkout_enabled"`
	MaxQuoteCents   int    `json:"max_quote_cents"`
}

type ReviewNowFinding added in v0.3.22

type ReviewNowFinding struct {
	Intent         string   `json:"intent"`
	Severity       string   `json:"severity"`
	Certainty      string   `json:"certainty"`
	Title          string   `json:"title"`
	Summary        string   `json:"summary"`
	WhyItMatters   string   `json:"why_it_matters"`
	TargetRepos    []string `json:"target_repos,omitempty"`
	TargetFiles    []string `json:"target_files,omitempty"`
	PeerRepos      []string `json:"peer_repos,omitempty"`
	PeerFiles      []string `json:"peer_files,omitempty"`
	EvidenceTarget string   `json:"evidence_target"`
	EvidencePeer   string   `json:"evidence_peer"`
	FollowUp       string   `json:"follow_up"`
}

type ReviewNowOptions added in v0.3.22

type ReviewNowOptions struct {
	GroupID     string   `json:"group_id"`
	DocumentIDs []string `json:"document_ids,omitempty"`
	MaxFindings int      `json:"max_findings,omitempty"`
	Model       string   `json:"model,omitempty"`
	QuoteID     string   `json:"quote_id,omitempty"`
}

type ReviewNowQuoteResp added in v0.5.3

type ReviewNowQuoteResp struct {
	GroupID     string                 `json:"group_id"`
	GroupName   string                 `json:"group_name"`
	DocumentIDs []string               `json:"document_ids"`
	Meta        map[string]interface{} `json:"meta"`
}

type ReviewNowResp added in v0.3.22

type ReviewNowResp struct {
	GroupID     string                 `json:"group_id"`
	GroupName   string                 `json:"group_name"`
	DocumentIDs []string               `json:"document_ids"`
	Markdown    string                 `json:"markdown"`
	Findings    []ReviewNowFinding     `json:"findings"`
	Meta        map[string]interface{} `json:"meta"`
}

type SessionResponse

type SessionResponse struct {
	ID                 string `json:"id"`
	UserID             string `json:"user_id"`
	Username           string `json:"username,omitempty"`
	DatetimeCreated    string `json:"datetime_created,omitempty"`
	DatetimeValidUntil string `json:"datetime_valid_until,omitempty"`
}

type SignUpRequest

type SignUpRequest struct {
	Username     string    `json:"username"`
	Name         string    `json:"name"`
	Password     string    `json:"password"`
	Groups       *[]string `json:"groups"`
	ReferralCode *string   `json:"referral_code"`
}

type SignUpResponse

type SignUpResponse struct {
	Message string `json:"message,omitempty"`
}

type TaskStatus

type TaskStatus struct {
	Status  string         `json:"status"` // PENDING|STARTED|PROGRESS|SUCCESS|FAILED
	Result  interface{}    `json:"result,omitempty"`
	Message string         `json:"message,omitempty"`
	Meta    map[string]any `json:"meta,omitempty"`
}

type UserInfo

type UserInfo struct {
	UserID                        string `json:"user_id"`
	Username                      string `json:"username"`
	Name                          string `json:"name"`
	IncludeOwnDocumentsInFeedback *bool  `json:"include_own_documents_in_feedback,omitempty"`
	PreferredFeedbackLength       string `json:"preferred_feedback_length,omitempty"`
}

Jump to

Keyboard shortcuts

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