Documentation
¶
Overview ¶
Package tracore is the official Go SDK for the Tracore API — a schema-driven document-to-JSON extraction service.
client, err := tracore.New(tracore.ClientOptions{APIKey: os.Getenv("TRACORE_API_KEY")})
if err != nil { log.Fatal(err) }
run, err := client.Extract(ctx, "my-workspace", "invoice",
tracore.ExtractInput{DocumentID: "doc-123"},
&tracore.ExtractOptions{Poll: true})
if err != nil { log.Fatal(err) }
fmt.Println(run.Status, run.ExtractedData)
Index ¶
- Constants
- type ApiErrorCode
- type Client
- type ClientOptions
- type CreateDocumentRequest
- type CreateSchemaFamilyRequest
- type CreateWebhookRequest
- type CreateWorkspaceRequest
- type Document
- type DocumentExtractRequest
- type DocumentsResource
- func (r *DocumentsResource) Create(ctx context.Context, workspace, schemaKey string, body CreateDocumentRequest, ...) (*Document, error)
- func (r *DocumentsResource) Delete(ctx context.Context, id string) error
- func (r *DocumentsResource) Download(ctx context.Context, id string) ([]byte, error)
- func (r *DocumentsResource) Get(ctx context.Context, id string) (*Document, error)
- func (r *DocumentsResource) List(ctx context.Context, workspace, schemaKey string, params *ListParams) (*List[Document], error)
- func (r *DocumentsResource) Upload(ctx context.Context, workspace, schemaKey string, file io.Reader, name string, ...) (*Document, error)
- type Env
- type Environment
- type EnvironmentWithResolved
- type EnvironmentsResource
- func (r *EnvironmentsResource) Get(ctx context.Context, workspace, envSlug string) (*EnvironmentWithResolved, error)
- func (r *EnvironmentsResource) List(ctx context.Context, workspace string, params *ListParams) (*List[Environment], error)
- func (r *EnvironmentsResource) Update(ctx context.Context, workspace, envSlug string, body UpdateEnvironmentRequest) (*EnvironmentWithResolved, error)
- type ExtractAcceptedResponse
- type ExtractInput
- type ExtractOptions
- type List
- type ListParams
- type PollOptions
- type ProviderKey
- type ProviderKeyListResponse
- type ProviderKeyPutRequest
- type ProviderKeyTestResponse
- type ProviderType
- type Run
- type RunListItem
- type RunStatus
- type RunsResource
- type SchemaFamily
- type SchemaFamilyWithVersion
- type SchemaVersion
- type SchemasResource
- func (r *SchemasResource) Create(ctx context.Context, workspace string, body CreateSchemaFamilyRequest) (*SchemaFamilyWithVersion, error)
- func (r *SchemasResource) Get(ctx context.Context, workspace, schemaKey string) (*SchemaFamily, error)
- func (r *SchemasResource) GetVersion(ctx context.Context, workspace, schemaKey string, versionNumber int) (*SchemaVersion, error)
- func (r *SchemasResource) List(ctx context.Context, workspace string, params *ListParams) (*List[SchemaFamily], error)
- func (r *SchemasResource) ListVersions(ctx context.Context, workspace, schemaKey string, params *ListParams) (*List[SchemaVersion], error)
- type SendTestWebhookRequest
- type TracoreError
- type UpdateEnvironmentRequest
- type UpdateWebhookRequest
- type UpdateWorkspaceRequest
- type UserPlanResponse
- type UserProviderKeysResource
- func (r *UserProviderKeysResource) Get(ctx context.Context, provider ProviderType) (*ProviderKey, error)
- func (r *UserProviderKeysResource) List(ctx context.Context) (*ProviderKeyListResponse, error)
- func (r *UserProviderKeysResource) Remove(ctx context.Context, provider ProviderType) error
- func (r *UserProviderKeysResource) Set(ctx context.Context, provider ProviderType, body ProviderKeyPutRequest) (*ProviderKey, error)
- func (r *UserProviderKeysResource) Test(ctx context.Context, provider ProviderType) (*ProviderKeyTestResponse, error)
- type UserResource
- type WebhookDelivery
- type WebhookEndpoint
- type WebhookEventType
- type WebhookPayload
- type WebhooksResource
- func (r *WebhooksResource) Create(ctx context.Context, workspace, schemaKey string, body CreateWebhookRequest, ...) (*WebhookEndpoint, error)
- func (r *WebhooksResource) Delete(ctx context.Context, id string) error
- func (r *WebhooksResource) Get(ctx context.Context, id string) (*WebhookEndpoint, error)
- func (r *WebhooksResource) List(ctx context.Context, workspace, schemaKey string, params *ListParams) (*List[WebhookEndpoint], error)
- func (r *WebhooksResource) ListDeliveries(ctx context.Context, id string, params *ListParams) (*List[WebhookDelivery], error)
- func (r *WebhooksResource) SendTest(ctx context.Context, id string, body SendTestWebhookRequest) (bool, error)
- func (r *WebhooksResource) Update(ctx context.Context, id string, body UpdateWebhookRequest) (*WebhookEndpoint, error)
- type Workspace
- type WorkspacesResource
- func (r *WorkspacesResource) Create(ctx context.Context, body CreateWorkspaceRequest) (*Workspace, error)
- func (r *WorkspacesResource) Delete(ctx context.Context, slug string) error
- func (r *WorkspacesResource) Get(ctx context.Context, slug string) (*Workspace, error)
- func (r *WorkspacesResource) List(ctx context.Context, params *ListParams) (*List[Workspace], error)
- func (r *WorkspacesResource) Update(ctx context.Context, slug string, body UpdateWorkspaceRequest) (*Workspace, error)
Constants ¶
const ( // ErrCodeTransport marks a network, timeout, or encoding failure (retryable). ErrCodeTransport = "transport_error" // ErrCodeConfig marks invalid client-side input (permanent; a caller bug). ErrCodeConfig = "config_error" // ErrCodePollingTimeout marks a poll loop that exhausted MaxAttempts without // the run reaching a terminal status. The run is still live server-side. ErrCodePollingTimeout = "polling_timeout" )
Synthetic client-side error codes. Set on TracoreError.Code for failures that never produced an HTTP response, so retry/breaker layers can classify without restating string literals.
const ( ErrCodeNotFound = "NOT_FOUND" ErrCodeValidation = "VALIDATION_ERROR" ErrCodeInternal = "INTERNAL_ERROR" ErrCodePlanLimitExceeded = "plan_limit_exceeded" ErrCodeRateLimited = "rate_limited" ErrCodeForbiddenKey = "forbidden_key" ErrCodeInvalidProvider = "invalid_provider" ErrCodeInvalidModel = "invalid_model" ErrCodeNoKey = "no_key" ErrCodeNotImplemented = "not_implemented" ErrCodeEmailNotVerified = "email_not_verified" ErrCodeStripeNotConfigured = "stripe_not_configured" ErrCodeNoStripeCustomer = "no_stripe_customer" ErrCodeCheckoutMissingUser = "checkout_missing_user" ErrCodeInvalidSignature = "invalid_signature" )
Server-side `error.code` vocabulary, mirroring the contract's ApiErrorCode schema. The wire field stays a free-form string — new codes are not a breaking change — so match on these constants rather than an exhaustive switch. Note: key-validation failures arrive as ErrCodeValidation with `Details["code"] == "invalid_key"`, not as a top-level code. The last five constants surface only on internal billing surfaces and the Stripe webhook, never on public API endpoints.
const ( RunStatusCompleted = generated.RunStatusCompleted RunStatusFailed = generated.RunStatusFailed RunStatusValidationFailed = generated.RunStatusValidationFailed RunStatusPending = generated.RunStatusPending RunStatusProcessing = generated.RunStatusProcessing )
Run statuses. A run in Completed, Failed, or ValidationFailed is terminal.
const APIVersion = "0.6.0"
APIVersion is the Tracore API contract version this SDK was generated from — the `api-vX.Y.Z` release / .api-version, NOT this module's own Version. It is sent on every request as the `Tracore-Version` header and exposed as Client.APIVersion. Kept in sync with .api-version by sync.yml.
const DefaultBaseURL = "https://api.tracore.io"
DefaultBaseURL is the production Tracore API origin used when ClientOptions.BaseURL is empty.
const Version = "0.2.0"
Version is this SDK module's own semantic version. It is the version the publish workflow turns into the git tag vX.Y.Z (and thus the version `go get` resolves); it is independent of the API contract version below. sync.yml bumps it on regen.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiErrorCode ¶ added in v0.2.0
type ApiErrorCode = generated.ApiErrorCode
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type Client ¶
type Client struct {
// APIVersion is the API contract version this SDK was generated from, sent as
// the Tracore-Version header. It is the API version, not this module's Version.
APIVersion string
// Workspaces manages workspaces.
Workspaces *WorkspacesResource
// Schemas manages schema families and versions.
Schemas *SchemasResource
// Documents manages documents (upload, download, delete).
Documents *DocumentsResource
// Runs lists, fetches, and polls extraction runs.
Runs *RunsResource
// Webhooks manages webhook endpoints and deliveries.
Webhooks *WebhooksResource
// Environments manages environments within a workspace.
Environments *EnvironmentsResource
// User exposes user-scoped resources for the authenticated user.
User *UserResource
// contains filtered or unexported fields
}
Client is the Tracore API client. Construct one with New and use its resource groups (Workspaces, Schemas, Documents, Runs, Webhooks, Environments, User) or the top-level Extract convenience.
func New ¶
func New(opts ClientOptions) (*Client, error)
New constructs a Client. It returns an error only for invalid configuration; no network call is made here.
func (*Client) Extract ¶
func (c *Client) Extract(ctx context.Context, workspace, schemaKey string, input ExtractInput, opts *ExtractOptions) (*Run, error)
Extract triggers an extraction run and, when ExtractOptions.Poll is set, waits for it to complete. It is a convenience over Documents.Upload + the schema extract endpoint + Runs.Poll.
Extract is NOT idempotent across retries: it issues a billed POST and then at least one follow-up GET, so retrying the whole call after a failure can start a second billed run even though the first one is live. Webhook-driven consumers that only need the run id should use ExtractAsync, which performs the single POST and returns the accepted envelope as-is.
func (*Client) ExtractAsync ¶ added in v0.2.0
func (c *Client) ExtractAsync(ctx context.Context, workspace, schemaKey string, input ExtractInput, opts *ExtractOptions) (*ExtractAcceptedResponse, error)
ExtractAsync triggers an extraction run and returns the API's 202 accepted envelope (run id + `pending` status) without any follow-up request. This is the fire-and-forget variant for webhook-driven consumers: the run id is never lost to a failed follow-up GET. Error semantics: a *TracoreError with Status != 0 means the API rejected the request and no run exists; a transport error (Status 0, ErrCodeTransport) is ambiguous — in the narrow window where the connection drops after the server responded, a billed run may already be live, so treat transport errors as "unknown outcome" (as with any HTTP client) and retry only if a duplicate run is acceptable. ExtractOptions.Poll and PollOptions are ignored.
type ClientOptions ¶
type ClientOptions struct {
// APIKey authenticates every request (sent as the x-api-key header). Required.
APIKey string
// BaseURL overrides the API origin. Defaults to DefaultBaseURL.
BaseURL string
// Environment is the default environment for environment-scoped requests.
// Individual calls may override it. Empty defers to the server default.
Environment Env
// HTTPClient overrides the underlying *http.Client (timeouts, proxies, etc.).
HTTPClient *http.Client
}
ClientOptions configures a Client.
type CreateDocumentRequest ¶
type CreateDocumentRequest = generated.CreateDocumentRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type CreateSchemaFamilyRequest ¶
type CreateSchemaFamilyRequest = generated.CreateSchemaFamilyRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type CreateWebhookRequest ¶
type CreateWebhookRequest = generated.CreateWebhookRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type CreateWorkspaceRequest ¶
type CreateWorkspaceRequest = generated.CreateWorkspaceRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type Document ¶
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type DocumentExtractRequest ¶
type DocumentExtractRequest = generated.DocumentExtractRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type DocumentsResource ¶
type DocumentsResource struct {
// contains filtered or unexported fields
}
DocumentsResource manages documents. Documents are environment-scoped.
func (*DocumentsResource) Create ¶
func (r *DocumentsResource) Create(ctx context.Context, workspace, schemaKey string, body CreateDocumentRequest, env Env) (*Document, error)
Create creates a document from text content. env is the target environment ("" uses the client default).
func (*DocumentsResource) Delete ¶
func (r *DocumentsResource) Delete(ctx context.Context, id string) error
Delete deletes a document, its stored file, and all associated runs.
func (*DocumentsResource) List ¶
func (r *DocumentsResource) List(ctx context.Context, workspace, schemaKey string, params *ListParams) (*List[Document], error)
List returns the documents for a schema in an environment.
type Env ¶
type Env string
Env names a Tracore environment for environment-scoped requests. The zero value ("") means "use the client default" (and, absent that, the server default of production).
type Environment ¶
type Environment = generated.Environment
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type EnvironmentWithResolved ¶
type EnvironmentWithResolved = generated.EnvironmentWithResolved
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type EnvironmentsResource ¶
type EnvironmentsResource struct {
// contains filtered or unexported fields
}
EnvironmentsResource manages the environments within a workspace. Each workspace has three: production (default) plus locked staging and development.
func (*EnvironmentsResource) Get ¶
func (r *EnvironmentsResource) Get(ctx context.Context, workspace, envSlug string) (*EnvironmentWithResolved, error)
Get returns an environment by slug, including its resolved provider/model.
func (*EnvironmentsResource) List ¶
func (r *EnvironmentsResource) List(ctx context.Context, workspace string, params *ListParams) (*List[Environment], error)
List returns the environments in a workspace.
func (*EnvironmentsResource) Update ¶
func (r *EnvironmentsResource) Update(ctx context.Context, workspace, envSlug string, body UpdateEnvironmentRequest) (*EnvironmentWithResolved, error)
Update updates an environment's provider/model assignment.
type ExtractAcceptedResponse ¶ added in v0.2.0
type ExtractAcceptedResponse = generated.ExtractAcceptedResponse
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type ExtractInput ¶
type ExtractInput struct {
// DocumentID extracts from an already-uploaded document.
DocumentID string
// File is the document content for an inline upload.
File io.Reader
// FileName is the display/file name for an inline upload.
FileName string
}
ExtractInput selects what to extract from: either an existing document by ID (DocumentID) or an inline file upload (File + FileName). Provide exactly one.
type ExtractOptions ¶
type ExtractOptions struct {
// Env overrides the client's default environment.
Env Env
// VersionNumber pins a schema version. 0 uses the latest.
VersionNumber int
// Model is an optional `<provider>/<model>` override for this run.
Model string
// Poll, when true, blocks until the run reaches a terminal status.
Poll bool
// PollOptions tunes the poll loop (only used when Poll is true).
PollOptions *PollOptions
}
ExtractOptions tunes an Extract call.
type List ¶
type List[T any] struct { Data []T `json:"data"` Page int `json:"page"` PageSize int `json:"pageSize"` Total int `json:"total"` }
List is a paginated result set. It mirrors the API's PaginatedResponse envelope.
type ListParams ¶
type ListParams struct {
// Page is the 1-based page number. 0 means the server default.
Page int
// PageSize is the items per page (1-100). 0 means the server default.
PageSize int
// Env overrides the client's default environment for this call.
Env Env
}
ListParams are the optional query parameters for paginated, environment-scoped list endpoints. A nil *ListParams (or zero fields) requests server defaults.
type PollOptions ¶
type PollOptions struct {
// Interval between poll requests. Default 1s.
Interval time.Duration
// MaxAttempts before giving up. Default 60.
MaxAttempts int
// OnProgress, if set, is called with the current run on each non-terminal poll.
OnProgress func(*Run)
}
PollOptions configures Runs.Poll and the Extract auto-poll. The zero value polls every second for up to 60 attempts.
type ProviderKey ¶
type ProviderKey = generated.ProviderKey
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type ProviderKeyListResponse ¶
type ProviderKeyListResponse = generated.ProviderKeyListResponse
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type ProviderKeyPutRequest ¶
type ProviderKeyPutRequest = generated.ProviderKeyPutRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type ProviderKeyTestResponse ¶
type ProviderKeyTestResponse = generated.ProviderKeyTestResponse
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type ProviderType ¶
type ProviderType = generated.ProviderType
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type Run ¶
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type RunListItem ¶
type RunListItem = generated.RunListItem
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type RunStatus ¶
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type RunsResource ¶
type RunsResource struct {
// contains filtered or unexported fields
}
RunsResource lists, fetches, and polls extraction runs. Runs are environment-scoped.
func (*RunsResource) List ¶
func (r *RunsResource) List(ctx context.Context, workspace, schemaKey string, params *ListParams) (*List[RunListItem], error)
List returns the runs for a schema in an environment.
func (*RunsResource) Poll ¶
func (r *RunsResource) Poll(ctx context.Context, id string, opts *PollOptions) (*Run, error)
Poll blocks until a run reaches a terminal status (completed, failed, or validation_failed), ctx is cancelled, or the attempt budget is exhausted.
type SchemaFamily ¶
type SchemaFamily = generated.SchemaFamily
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type SchemaFamilyWithVersion ¶
type SchemaFamilyWithVersion = generated.SchemaFamilyWithVersion
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type SchemaVersion ¶
type SchemaVersion = generated.SchemaVersion
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type SchemasResource ¶
type SchemasResource struct {
// contains filtered or unexported fields
}
SchemasResource manages schema families and their immutable versions. Schemas are workspace-scoped (shared across environments).
func (*SchemasResource) Create ¶
func (r *SchemasResource) Create(ctx context.Context, workspace string, body CreateSchemaFamilyRequest) (*SchemaFamilyWithVersion, error)
Create creates a schema family and its first version. Returns the family with the resolved version.
func (*SchemasResource) Get ¶
func (r *SchemasResource) Get(ctx context.Context, workspace, schemaKey string) (*SchemaFamily, error)
Get returns a schema family by key.
func (*SchemasResource) GetVersion ¶
func (r *SchemasResource) GetVersion(ctx context.Context, workspace, schemaKey string, versionNumber int) (*SchemaVersion, error)
GetVersion returns a specific schema version by number.
func (*SchemasResource) List ¶
func (r *SchemasResource) List(ctx context.Context, workspace string, params *ListParams) (*List[SchemaFamily], error)
List returns the schema families in a workspace.
func (*SchemasResource) ListVersions ¶
func (r *SchemasResource) ListVersions(ctx context.Context, workspace, schemaKey string, params *ListParams) (*List[SchemaVersion], error)
ListVersions returns the versions of a schema family.
type SendTestWebhookRequest ¶
type SendTestWebhookRequest = generated.SendTestWebhookRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type TracoreError ¶
type TracoreError struct {
// Status is the HTTP status code, or 0 for a client-side failure.
Status int
// Code is the machine-readable error code from the API, when provided.
Code string
// Message is the human-readable error message.
Message string
// Details carries additional structured error context, when provided.
Details map[string]interface{}
// contains filtered or unexported fields
}
TracoreError is returned by every SDK call that fails. For HTTP failures Status is the response status code and Code/Message/Details come from the API's `{ "error": { code, message, details } }` envelope. For client-side failures (transport, encoding) Status is 0 and Code is ErrCodeTransport.
func AsTracoreError ¶
func AsTracoreError(err error) (*TracoreError, bool)
AsTracoreError unwraps err into a *TracoreError if it is one. It is a thin convenience over errors.As for the common call-site check.
if te, ok := tracore.AsTracoreError(err); ok && te.Status == 404 { ... }
func (*TracoreError) Error ¶
func (e *TracoreError) Error() string
func (*TracoreError) Unwrap ¶ added in v0.2.0
func (e *TracoreError) Unwrap() error
Unwrap returns the underlying cause (nil for pure HTTP envelope errors), making the wrapper transparent to errors.Is and errors.As.
type UpdateEnvironmentRequest ¶
type UpdateEnvironmentRequest = generated.UpdateEnvironmentRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type UpdateWebhookRequest ¶
type UpdateWebhookRequest = generated.UpdateWebhookRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type UpdateWorkspaceRequest ¶
type UpdateWorkspaceRequest = generated.UpdateWorkspaceRequest
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type UserPlanResponse ¶
type UserPlanResponse = generated.UserPlanResponse
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type UserProviderKeysResource ¶
type UserProviderKeysResource struct {
// contains filtered or unexported fields
}
UserProviderKeysResource manages the current user's AI provider keys (BYOK). Keys are user-scoped (one per provider, reused across the user's workspaces). These endpoints require session-cookie auth; API-key auth is rejected by design.
func (*UserProviderKeysResource) Get ¶
func (r *UserProviderKeysResource) Get(ctx context.Context, provider ProviderType) (*ProviderKey, error)
Get returns a single provider key's metadata.
func (*UserProviderKeysResource) List ¶
func (r *UserProviderKeysResource) List(ctx context.Context) (*ProviderKeyListResponse, error)
List returns the user's provider keys (masked previews, never plaintext).
func (*UserProviderKeysResource) Remove ¶
func (r *UserProviderKeysResource) Remove(ctx context.Context, provider ProviderType) error
Remove deletes the user's key for a provider, reverting any environment that referenced it to the system Mistral fallback.
func (*UserProviderKeysResource) Set ¶
func (r *UserProviderKeysResource) Set(ctx context.Context, provider ProviderType, body ProviderKeyPutRequest) (*ProviderKey, error)
Set creates, replaces, or updates the user's key for a provider. Supply ProviderKeyPutRequest.Key to test-and-store a key, or only DefaultModel to change the profile default model without re-encrypting.
func (*UserProviderKeysResource) Test ¶
func (r *UserProviderKeysResource) Test(ctx context.Context, provider ProviderType) (*ProviderKeyTestResponse, error)
Test re-tests the stored provider key against the provider and returns the new status.
type UserResource ¶
type UserResource struct {
// ProviderKeys manages the user's AI provider keys (BYOK).
ProviderKeys *UserProviderKeysResource
// contains filtered or unexported fields
}
UserResource groups user-scoped resources for the authenticated user.
func (*UserResource) Plan ¶
func (r *UserResource) Plan(ctx context.Context) (*UserPlanResponse, error)
Plan returns the authenticated user's plan and current usage counters.
type WebhookDelivery ¶
type WebhookDelivery = generated.WebhookDelivery
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type WebhookEndpoint ¶
type WebhookEndpoint = generated.WebhookEndpoint
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type WebhookEventType ¶ added in v0.2.0
type WebhookEventType = generated.WebhookEventType
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type WebhookPayload ¶ added in v0.2.0
type WebhookPayload = generated.WebhookPayload
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type WebhooksResource ¶
type WebhooksResource struct {
// contains filtered or unexported fields
}
WebhooksResource manages webhook endpoints and their deliveries. Endpoints are scoped to a schema and environment; delivery dispatch is environment-wide.
func (*WebhooksResource) Create ¶
func (r *WebhooksResource) Create(ctx context.Context, workspace, schemaKey string, body CreateWebhookRequest, env Env) (*WebhookEndpoint, error)
Create creates a webhook endpoint for a schema in an environment. env is the target environment ("" uses the client default).
func (*WebhooksResource) Delete ¶
func (r *WebhooksResource) Delete(ctx context.Context, id string) error
Delete deletes a webhook endpoint.
func (*WebhooksResource) Get ¶
func (r *WebhooksResource) Get(ctx context.Context, id string) (*WebhookEndpoint, error)
Get returns a webhook endpoint by ID.
func (*WebhooksResource) List ¶
func (r *WebhooksResource) List(ctx context.Context, workspace, schemaKey string, params *ListParams) (*List[WebhookEndpoint], error)
List returns the webhook endpoints for a schema in an environment.
func (*WebhooksResource) ListDeliveries ¶
func (r *WebhooksResource) ListDeliveries(ctx context.Context, id string, params *ListParams) (*List[WebhookDelivery], error)
ListDeliveries returns the delivery attempts for a webhook endpoint.
func (*WebhooksResource) SendTest ¶
func (r *WebhooksResource) SendTest(ctx context.Context, id string, body SendTestWebhookRequest) (bool, error)
SendTest dispatches a synthetic test event to a webhook endpoint. It reports whether the event was sent.
func (*WebhooksResource) Update ¶
func (r *WebhooksResource) Update(ctx context.Context, id string, body UpdateWebhookRequest) (*WebhookEndpoint, error)
Update updates a webhook endpoint.
type Workspace ¶
Re-exported model types. Callers use these instead of the internal generated package (which is import-restricted to this module). They are type aliases, so they are identical to the generated types — no conversion is needed.
type WorkspacesResource ¶
type WorkspacesResource struct {
// contains filtered or unexported fields
}
WorkspacesResource manages workspaces.
func (*WorkspacesResource) Create ¶
func (r *WorkspacesResource) Create(ctx context.Context, body CreateWorkspaceRequest) (*Workspace, error)
Create creates a workspace.
func (*WorkspacesResource) Delete ¶
func (r *WorkspacesResource) Delete(ctx context.Context, slug string) error
Delete deletes a workspace and all of its schemas, documents, and runs.
func (*WorkspacesResource) List ¶
func (r *WorkspacesResource) List(ctx context.Context, params *ListParams) (*List[Workspace], error)
List returns the caller's workspaces.
func (*WorkspacesResource) Update ¶
func (r *WorkspacesResource) Update(ctx context.Context, slug string, body UpdateWorkspaceRequest) (*Workspace, error)
Update updates a workspace.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
downconvert
command
Command downconvert performs a minimal OpenAPI 3.1 -> 3.0 rewrite so oapi-codegen (which does not yet support 3.1, see oapi-codegen/oapi-codegen#373) can consume the Tracore spec.
|
Command downconvert performs a minimal OpenAPI 3.1 -> 3.0 rewrite so oapi-codegen (which does not yet support 3.1, see oapi-codegen/oapi-codegen#373) can consume the Tracore spec. |
|
Command examples demonstrates the Tracore Go SDK end to end.
|
Command examples demonstrates the Tracore Go SDK end to end. |
|
internal
|
|
|
generated
Package generated provides primitives to interact with the openapi HTTP API.
|
Package generated provides primitives to interact with the openapi HTTP API. |