Documentation
¶
Overview ¶
Package datacircle gives a GitHub Copilot SDK session four tools on Datacircle's open API: find the best GTM APIs.
The API needs no key: https://api.datacircle.dev/v1 (its spec: https://api.datacircle.dev/v1/openapi.json). More at https://datacircle.dev
Index ¶
- Constants
- Variables
- func Tools() []copilot.Tool
- type API
- type BestPlansInput
- type BestPlansOutput
- type Config
- type ListAPIsInput
- type ListAPIsOutput
- type Plan
- type ProviderAPI
- type ProviderInput
- type ProviderOutput
- type ProviderPlan
- type SearchPlansInput
- type SearchPlansOutput
- type Toolset
- func (t *Toolset) BestPlans(ctx context.Context, in BestPlansInput) (BestPlansOutput, error)
- func (t *Toolset) ListAPIs(ctx context.Context, in ListAPIsInput) (ListAPIsOutput, error)
- func (t *Toolset) Provider(ctx context.Context, in ProviderInput) (ProviderOutput, error)
- func (t *Toolset) SearchPlans(ctx context.Context, in SearchPlansInput) (SearchPlansOutput, error)
- func (t *Toolset) Tools() []copilot.Tool
- type TopPlan
Constants ¶
const ( ListAPIsName = "datacircle_list_apis" BestPlansName = "datacircle_best_plans" SearchPlansName = "datacircle_search_plans" ProviderName = "datacircle_provider" )
const BaseURL = "https://api.datacircle.dev/v1"
BaseURL is the API's address.
const Version = "0.1.0"
Version is this module's version, sent in each call's User-Agent.
Variables ¶
var Names = []string{ListAPIsName, BestPlansName, SearchPlansName, ProviderName}
Names are the four tools' names, in the order Tools gives them.
Functions ¶
Types ¶
type API ¶
type API struct {
API string `json:"api" jsonschema:"The API's name on the sheet"`
Slug string `json:"slug" jsonschema:"Its slug, as datacircle_best_plans takes it"`
Plans int `json:"plans" jsonschema:"How many plans it has"`
Providers int `json:"providers" jsonschema:"How many providers sell it"`
Best *TopPlan `json:"best,omitempty" jsonschema:"Its best plan"`
BestPage string `json:"bestPage,omitempty" jsonschema:"Its page on datacircle.dev that ranks its providers"`
}
API is one API on the sheet.
type BestPlansInput ¶
type BestPlansInput struct {
Slug string `json:"slug" jsonschema:"The API's slug, like email-finder or linkedin-profile, as datacircle_list_apis gives it"`
Limit int `json:"limit,omitempty" jsonschema:"How many plans to give, 1 to 50. 10 when left out"`
}
BestPlansInput is datacircle_best_plans' input.
type BestPlansOutput ¶
type BestPlansOutput struct {
API string `json:"api"`
Slug string `json:"slug"`
SheetPage string `json:"sheetPage,omitempty" jsonschema:"The API's sheet on datacircle.dev, its plans and their prices"`
BestPage string `json:"bestPage,omitempty" jsonschema:"The API's page on datacircle.dev that ranks its providers"`
Total int `json:"total" jsonschema:"How many plans the API has"`
Plans []Plan `json:"plans" jsonschema:"Up to limit of its plans, best first"`
}
BestPlansOutput is datacircle_best_plans' result.
type Config ¶
Config sets where the tools call. Its zero value, or nil, calls BaseURL with http.DefaultClient.
type ListAPIsInput ¶
type ListAPIsInput struct {
Query string `` /* 180-byte string literal not displayed */
Limit int `json:"limit,omitempty" jsonschema:"How many APIs to give, 1 to 200. 10 when left out: total says how many matched"`
}
ListAPIsInput is datacircle_list_apis' input.
type ListAPIsOutput ¶
type ListAPIsOutput struct {
Total int `json:"total" jsonschema:"How many APIs matched"`
APIs []API `json:"apis" jsonschema:"Up to limit of them"`
Note string `json:"note,omitempty" jsonschema:"Where to look instead, when no API's name holds every word of the query"`
}
ListAPIsOutput is datacircle_list_apis' result.
type Plan ¶
type Plan struct {
API string `json:"api" jsonschema:"The API, as the sheet names it"`
Rank *int `json:"rank,omitempty" jsonschema:"The plan's place among its API's scored plans, 1 the best. Absent on a plan with no score"`
Provider string `json:"provider" jsonschema:"Who sells it"`
Plan string `json:"plan" jsonschema:"The plan's name on the provider's pricing page"`
Score *float64 `json:"score,omitempty" jsonschema:"Its score out of 100 on Datacircle's benchmark. Absent until its call is benchmarked"`
PerThousand *float64 `json:"perThousand,omitempty" jsonschema:"What 1,000 items cost on it, in dollars. Absent with no public price"`
NotFoundPerThousand *float64 `json:"notFoundPerThousand,omitempty" jsonschema:"What 1,000 items it has no answer for cost, in dollars"`
Billing string `json:"billing" jsonschema:"How you pay, like free, on-demand, one-time, contact or monthly"`
Pay *float64 `json:"pay,omitempty" jsonschema:"The plan's whole price, in its currency"`
Currency string `json:"currency" jsonschema:"The currency of pay, as an ISO 4217 code"`
Page string `json:"page" jsonschema:"The plan's page on datacircle.dev"`
}
Plan is one plan: the keys that choose a plan. Its page on datacircle.dev gives every other.
type ProviderAPI ¶
type ProviderAPI struct {
API string `json:"api"`
Slug string `json:"slug"`
Rank *int `json:"rank,omitempty" jsonschema:"Its place among the API's providers, 1 the best. Absent where it has none"`
BestPage string `json:"bestPage,omitempty"`
Plans int `json:"plans" jsonschema:"How many plans it has on the API"`
Best *ProviderPlan `json:"best,omitempty" jsonschema:"Its best plan on the API"`
}
ProviderAPI is one API a provider sells.
type ProviderInput ¶
type ProviderInput struct {
Slug string `json:"slug" jsonschema:"The provider's slug, like bright-data, or its name, like Bright Data: the name is made a slug"`
Limit int `json:"limit,omitempty" jsonschema:"How many of its APIs to give, its best rank first, 1 to 200. 10 when left out"`
}
ProviderInput is datacircle_provider's input.
type ProviderOutput ¶
type ProviderOutput struct {
About string `json:"about" jsonschema:"The counts and its best rank, in words"`
Provider string `json:"provider"`
Slug string `json:"slug"`
Website string `json:"website,omitempty"`
Total int `json:"total" jsonschema:"How many APIs it sells"`
Ranked int `json:"ranked" jsonschema:"On how many of them it has a rank"`
APIs []ProviderAPI `json:"apis" jsonschema:"Up to limit of them, its best rank first"`
}
ProviderOutput is datacircle_provider's result.
type ProviderPlan ¶
type ProviderPlan struct {
Plan string `json:"plan"`
Score *float64 `json:"score,omitempty"`
PerThousand *float64 `json:"perThousand,omitempty"`
Page string `json:"page"`
}
ProviderPlan is a provider's best plan on one API.
type SearchPlansInput ¶
type SearchPlansInput struct {
API string `` /* 162-byte string literal not displayed */
Query string `json:"query,omitempty" jsonschema:"Words that must all appear in the provider's or plan's name, like bright data"`
Sort string `json:"sort,omitempty" jsonschema:"score (best first, the default), provider (A to Z) or price ($ per 1,000, lowest first)"`
Limit int `json:"limit,omitempty" jsonschema:"How many plans to give, 1 to 50. 10 when left out"`
Offset int `json:"offset,omitempty" jsonschema:"How many found plans to skip first. 0 when left out"`
}
SearchPlansInput is datacircle_search_plans' input.
type SearchPlansOutput ¶
type SearchPlansOutput struct {
Total int `json:"total" jsonschema:"How many plans were found"`
Offset int `json:"offset" jsonschema:"How many found plans were skipped first"`
SheetPage string `json:"sheetPage,omitempty" jsonschema:"The API's sheet on datacircle.dev, for one API's plans"`
BestPage string `json:"bestPage,omitempty" jsonschema:"The API's page on datacircle.dev that ranks its providers"`
Plans []Plan `json:"plans" jsonschema:"Up to limit of the plans found"`
Note string `json:"note,omitempty" jsonschema:"What was searched instead of the input, when it found nothing as it was"`
}
SearchPlansOutput is datacircle_search_plans' result.
type Toolset ¶
type Toolset struct {
// contains filtered or unexported fields
}
Toolset runs the four tools: datacircle_list_apis, datacircle_best_plans, datacircle_search_plans and datacircle_provider. Its methods are safe to call from many goroutines.
func New ¶
New gives the four tools, calling where cfg says: nil calls BaseURL with http.DefaultClient.
func (*Toolset) BestPlans ¶
func (t *Toolset) BestPlans(ctx context.Context, in BestPlansInput) (BestPlansOutput, error)
BestPlans runs datacircle_best_plans: an API's plans, best first.
func (*Toolset) ListAPIs ¶
func (t *Toolset) ListAPIs(ctx context.Context, in ListAPIsInput) (ListAPIsOutput, error)
ListAPIs runs datacircle_list_apis: the APIs on the sheet, those whose name holds the most of the query's words first.
func (*Toolset) Provider ¶
func (t *Toolset) Provider(ctx context.Context, in ProviderInput) (ProviderOutput, error)
Provider runs datacircle_provider: the APIs one provider sells, its best rank first, with its best plan on each.
func (*Toolset) SearchPlans ¶
func (t *Toolset) SearchPlans(ctx context.Context, in SearchPlansInput) (SearchPlansOutput, error)
SearchPlans runs datacircle_search_plans: the plans whose provider's or plan's name holds the query, on every API or one.
func (*Toolset) Tools ¶
Tools gives the four tools for a session's Tools.Definitions, beside the app's own: datacircle_list_apis (GET /apis), datacircle_best_plans (GET /apis/{slug}/best), datacircle_search_plans (GET /plans) and datacircle_provider (GET /providers/{slug}). Each is made by copilot.DefineTool from its input struct, its schema given each limit's bounds and sort's values. Each runs with no permission prompt (SkipPermission), as the four only read: set a tool's SkipPermission to false for the session's permission handler to decide. A new copy at each call.