Skip to content

Commit dac40cd

Browse files
author
stlc-bot
committed
docs(openapi): complete concise API reference metadata (#1329)
Stainless-Generated-From: 5bc944a
1 parent 3220e46 commit dac40cd

17 files changed

Lines changed: 1809 additions & 1873 deletions

‎batch.go‎

Lines changed: 133 additions & 197 deletions
Large diffs are not rendered by default.

‎brand.go‎

Lines changed: 68 additions & 125 deletions
Large diffs are not rendered by default.

‎client.go‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@ type Client struct {
2323
Brand BrandService
2424
Industry IndustryService
2525
Utility UtilityService
26-
// Monitor pages, sitemaps, and extracted website data for exact or semantic
27-
// changes. Webhook payloads are documented by the
28-
// MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
29-
// schemas.
26+
// Watch websites for exact or meaningful changes.
3027
Monitors MonitorService
3128
// Scrape many pages or crawl a site asynchronously.
3229
Batch BatchService
3330
Webhooks WebhookService
3431
People PersonService
35-
// Search live first-party RSS and free historical news data by company identity.
32+
// Search live and historical news about a company.
3633
News NewsService
37-
// Read your organization's API request logs to debug failed calls. These endpoints
38-
// cost no credits and use a separate rate limit.
34+
// Read your organization's API request logs.
3935
Logs LogService
40-
// Report bugs, docs mismatches, and friction with any Context.dev API. Submissions
41-
// cost no credits and use a separate rate limit.
36+
// Report API issues and documentation mismatches.
4237
Feedback FeedbackService
4338
}
4439

‎feedback.go‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import (
1414
"github.com/context-dot-dev/context-go-sdk/v2/packages/respjson"
1515
)
1616

17-
// Report bugs, docs mismatches, and friction with any Context.dev API. Submissions
18-
// cost no credits and use a separate rate limit.
17+
// Report API issues and documentation mismatches.
1918
//
2019
// FeedbackService contains methods and other services that help with interacting
2120
// with the context.dev API.
@@ -36,8 +35,8 @@ func NewFeedbackService(opts ...option.RequestOption) (r FeedbackService) {
3635
return
3736
}
3837

39-
// Report a problem with a Context.dev API call, docs page, SDK, or CLI. Include
40-
// request_id, url, or both.
38+
// Report an API issue or documentation mismatch, including request IDs when
39+
// available.
4140
func (r *FeedbackService) Submit(ctx context.Context, body FeedbackSubmitParams, opts ...option.RequestOption) (res *FeedbackSubmitResponse, err error) {
4241
opts = slices.Concat(r.options, opts)
4342
path := "feedback"
@@ -51,10 +50,10 @@ type FeedbackSubmitResponse struct {
5150
AlreadySubmitted bool `json:"already_submitted" api:"required"`
5251
// ID of the stored feedback.
5352
FeedbackID string `json:"feedback_id" api:"required"`
54-
// Unique id of this API call, also sent in the X-Request-Id response header. Quote
55-
// it when contacting support about a failed request.
53+
// Unique ID of this request, also in `X-Request-Id`. Include it when contacting
54+
// support.
5655
RequestID string `json:"request_id" api:"required" format:"uuid"`
57-
// Credit usage, included whenever a valid API key is provided.
56+
// Credits this request used and your remaining balance.
5857
KeyMetadata FeedbackSubmitResponseKeyMetadata `json:"key_metadata"`
5958
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
6059
JSON struct {
@@ -73,9 +72,9 @@ func (r *FeedbackSubmitResponse) UnmarshalJSON(data []byte) error {
7372
return apijson.UnmarshalRoot(data, r)
7473
}
7574

76-
// Credit usage, included whenever a valid API key is provided.
75+
// Credits this request used and your remaining balance.
7776
type FeedbackSubmitResponseKeyMetadata struct {
78-
// Credits used by this request.
77+
// Credits charged for this request.
7978
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
8079
// Credits remaining for your organization.
8180
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
@@ -107,7 +106,7 @@ type FeedbackSubmitParams struct {
107106
RequestID param.Opt[string] `json:"request_id,omitzero" format:"uuid"`
108107
// The page the feedback is about, such as one page of a crawl or a docs page.
109108
URL param.Opt[string] `json:"url,omitzero" format:"uri"`
110-
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
109+
// Labels for filtering usage in the dashboard.
111110
Tags []string `json:"tags,omitzero"`
112111
paramObj
113112
}

‎industry.go‎

Lines changed: 36 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,15 @@ func NewIndustryService(opts ...option.RequestOption) (r IndustryService) {
3535
return
3636
}
3737

38-
// Classify any brand into 2022 NAICS industry codes from its domain or name.
38+
// Classify a company into NAICS industry codes.
3939
func (r *IndustryService) GetNaics(ctx context.Context, query IndustryGetNaicsParams, opts ...option.RequestOption) (res *IndustryGetNaicsResponse, err error) {
4040
opts = slices.Concat(r.options, opts)
4141
path := "web/naics"
4242
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
4343
return res, err
4444
}
4545

46-
// Classify any brand into Standard Industrial Classification (SIC) codes from its
47-
// domain or name. Choose between the original SIC system (`original_sic`) or the
48-
// latest SIC list maintained by the SEC (`latest_sec`).
46+
// Classify a company into SIC industry codes.
4947
func (r *IndustryService) GetSic(ctx context.Context, query IndustryGetSicParams, opts ...option.RequestOption) (res *IndustryGetSicResponse, err error) {
5048
opts = slices.Concat(r.options, opts)
5149
path := "web/sic"
@@ -54,19 +52,19 @@ func (r *IndustryService) GetSic(ctx context.Context, query IndustryGetSicParams
5452
}
5553

5654
type IndustryGetNaicsResponse struct {
57-
// Unique id of this API call, also sent in the X-Request-Id response header. Quote
58-
// it when contacting support about a failed request.
55+
// Unique ID of this request, also in `X-Request-Id`. Include it when contacting
56+
// support.
5957
RequestID string `json:"request_id" api:"required" format:"uuid"`
6058
// Array of NAICS codes and titles.
6159
Codes []IndustryGetNaicsResponseCode `json:"codes"`
6260
// Domain found for the brand
6361
Domain string `json:"domain"`
64-
// Credit usage, included whenever a valid API key is provided.
62+
// Credits this request used and your remaining balance.
6563
KeyMetadata IndustryGetNaicsResponseKeyMetadata `json:"key_metadata"`
6664
// True when the timeout ended processing and this response contains only usable
6765
// results completed so far. Unfinished results are omitted.
6866
Partial bool `json:"partial"`
69-
// Status of the response, e.g., 'ok'
67+
// Always `ok` on success.
7068
Status string `json:"status"`
7169
// Industry classification type, for naics api it will be `naics`
7270
Type string `json:"type"`
@@ -115,9 +113,9 @@ func (r *IndustryGetNaicsResponseCode) UnmarshalJSON(data []byte) error {
115113
return apijson.UnmarshalRoot(data, r)
116114
}
117115

118-
// Credit usage, included whenever a valid API key is provided.
116+
// Credits this request used and your remaining balance.
119117
type IndustryGetNaicsResponseKeyMetadata struct {
120-
// Credits used by this request.
118+
// Credits charged for this request.
121119
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
122120
// Credits remaining for your organization.
123121
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
@@ -137,8 +135,8 @@ func (r *IndustryGetNaicsResponseKeyMetadata) UnmarshalJSON(data []byte) error {
137135
}
138136

139137
type IndustryGetSicResponse struct {
140-
// Unique id of this API call, also sent in the X-Request-Id response header. Quote
141-
// it when contacting support about a failed request.
138+
// Unique ID of this request, also in `X-Request-Id`. Include it when contacting
139+
// support.
142140
RequestID string `json:"request_id" api:"required" format:"uuid"`
143141
// Echoes back which SIC dataset was used to classify the brand.
144142
//
@@ -150,12 +148,12 @@ type IndustryGetSicResponse struct {
150148
Codes []IndustryGetSicResponseCode `json:"codes"`
151149
// Domain found for the brand
152150
Domain string `json:"domain"`
153-
// Credit usage, included whenever a valid API key is provided.
151+
// Credits this request used and your remaining balance.
154152
KeyMetadata IndustryGetSicResponseKeyMetadata `json:"key_metadata"`
155153
// True when the timeout ended processing and this response contains only usable
156154
// results completed so far. Unfinished results are omitted.
157155
Partial bool `json:"partial"`
158-
// Status of the response, e.g., 'ok'
156+
// Always `ok` on success.
159157
Status string `json:"status"`
160158
// Industry classification type, for sic api it will be `sic`
161159
Type string `json:"type"`
@@ -225,9 +223,9 @@ func (r *IndustryGetSicResponseCode) UnmarshalJSON(data []byte) error {
225223
return apijson.UnmarshalRoot(data, r)
226224
}
227225

228-
// Credit usage, included whenever a valid API key is provided.
226+
// Credits this request used and your remaining balance.
229227
type IndustryGetSicResponseKeyMetadata struct {
230-
// Credits used by this request.
228+
// Credits charged for this request.
231229
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
232230
// Credits remaining for your organization.
233231
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
@@ -256,18 +254,12 @@ type IndustryGetNaicsParams struct {
256254
MaxResults param.Opt[int64] `query:"maxResults,omitzero" json:"-"`
257255
// Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1.
258256
MinResults param.Opt[int64] `query:"minResults,omitzero" json:"-"`
259-
// Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
260-
// characters.
257+
// Comma-separated labels for filtering usage, e.g. `production,team-alpha`.
261258
Tags []string `query:"tags,omitzero" json:"-"`
262-
// Optional request deadline and behavior on timeout. For GET requests, use
263-
// timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
264-
// timeoutOpts object.
259+
// Request deadline and what to return when it passes.
265260
TimeoutOpts IndustryGetNaicsParamsTimeoutOpts `query:"timeoutOpts,omitzero" json:"-"`
266-
// Set to enabled to bypass shared caches and omit request and response content
267-
// from retained usage logs. Asset uploads are skipped, so hosted image URLs are
268-
// omitted. Requires zero data retention to be enabled for your organization
269-
// (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
270-
// Successful ZDR responses include X-Context-ZDR: true.
261+
// `enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless
262+
// your organization has ZDR.
271263
//
272264
// Any of "enabled", "disabled".
273265
Zdr IndustryGetNaicsParamsZdr `query:"zdr,omitzero" json:"-"`
@@ -282,18 +274,14 @@ func (r IndustryGetNaicsParams) URLQuery() (v url.Values, err error) {
282274
})
283275
}
284276

285-
// Optional request deadline and behavior on timeout. For GET requests, use
286-
// timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
287-
// timeoutOpts object.
277+
// Request deadline and what to return when it passes.
288278
//
289279
// The property Milliseconds is required.
290280
type IndustryGetNaicsParamsTimeoutOpts struct {
291-
// Request deadline in milliseconds. Maximum: 300000 (5 minutes).
281+
// Deadline in milliseconds.
292282
Milliseconds int64 `query:"milliseconds" api:"required" json:"-"`
293-
// What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
294-
// credits. "return-partial" returns usable results collected so far; if none are
295-
// available, the request still fails without charging credits. Partial results are
296-
// not cached as complete results.
283+
// "fail" returns 408 at the deadline. "return-partial" returns available results;
284+
// inspect the response’s partial flag.
297285
//
298286
// Any of "fail", "return-partial".
299287
Behavior string `query:"behavior,omitzero" json:"-"`
@@ -309,11 +297,8 @@ func (r IndustryGetNaicsParamsTimeoutOpts) URLQuery() (v url.Values, err error)
309297
})
310298
}
311299

312-
// Set to enabled to bypass shared caches and omit request and response content
313-
// from retained usage logs. Asset uploads are skipped, so hosted image URLs are
314-
// omitted. Requires zero data retention to be enabled for your organization
315-
// (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
316-
// Successful ZDR responses include X-Context-ZDR: true.
300+
// `enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless
301+
// your organization has ZDR.
317302
type IndustryGetNaicsParamsZdr string
318303

319304
const (
@@ -330,24 +315,16 @@ type IndustryGetSicParams struct {
330315
MaxResults param.Opt[int64] `query:"maxResults,omitzero" json:"-"`
331316
// Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
332317
MinResults param.Opt[int64] `query:"minResults,omitzero" json:"-"`
333-
// Comma-separated tags for tracking request usage. Up to 20 tags, each 1-50
334-
// characters.
318+
// Comma-separated labels for filtering usage, e.g. `production,team-alpha`.
335319
Tags []string `query:"tags,omitzero" json:"-"`
336-
// Optional request deadline and behavior on timeout. For GET requests, use
337-
// timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
338-
// timeoutOpts object.
320+
// Request deadline and what to return when it passes.
339321
TimeoutOpts IndustryGetSicParamsTimeoutOpts `query:"timeoutOpts,omitzero" json:"-"`
340-
// Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
341-
// Industrial Classification system; `latest_sec` uses the current SIC list as
342-
// published by the SEC. Defaults to `original_sic`.
322+
// SIC dataset: `original_sic` (1987) or `latest_sec` (current SEC list).
343323
//
344324
// Any of "original_sic", "latest_sec".
345325
Type IndustryGetSicParamsType `query:"type,omitzero" json:"-"`
346-
// Set to enabled to bypass shared caches and omit request and response content
347-
// from retained usage logs. Asset uploads are skipped, so hosted image URLs are
348-
// omitted. Requires zero data retention to be enabled for your organization
349-
// (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
350-
// Successful ZDR responses include X-Context-ZDR: true.
326+
// `enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless
327+
// your organization has ZDR.
351328
//
352329
// Any of "enabled", "disabled".
353330
Zdr IndustryGetSicParamsZdr `query:"zdr,omitzero" json:"-"`
@@ -362,18 +339,14 @@ func (r IndustryGetSicParams) URLQuery() (v url.Values, err error) {
362339
})
363340
}
364341

365-
// Optional request deadline and behavior on timeout. For GET requests, use
366-
// timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
367-
// timeoutOpts object.
342+
// Request deadline and what to return when it passes.
368343
//
369344
// The property Milliseconds is required.
370345
type IndustryGetSicParamsTimeoutOpts struct {
371-
// Request deadline in milliseconds. Maximum: 300000 (5 minutes).
346+
// Deadline in milliseconds.
372347
Milliseconds int64 `query:"milliseconds" api:"required" json:"-"`
373-
// What to do at the deadline. "fail" returns 408 REQUEST_TIMEOUT without charging
374-
// credits. "return-partial" returns usable results collected so far; if none are
375-
// available, the request still fails without charging credits. Partial results are
376-
// not cached as complete results.
348+
// "fail" returns 408 at the deadline. "return-partial" returns available results;
349+
// inspect the response’s partial flag.
377350
//
378351
// Any of "fail", "return-partial".
379352
Behavior string `query:"behavior,omitzero" json:"-"`
@@ -389,21 +362,16 @@ func (r IndustryGetSicParamsTimeoutOpts) URLQuery() (v url.Values, err error) {
389362
})
390363
}
391364

392-
// Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
393-
// Industrial Classification system; `latest_sec` uses the current SIC list as
394-
// published by the SEC. Defaults to `original_sic`.
365+
// SIC dataset: `original_sic` (1987) or `latest_sec` (current SEC list).
395366
type IndustryGetSicParamsType string
396367

397368
const (
398369
IndustryGetSicParamsTypeOriginalSic IndustryGetSicParamsType = "original_sic"
399370
IndustryGetSicParamsTypeLatestSec IndustryGetSicParamsType = "latest_sec"
400371
)
401372

402-
// Set to enabled to bypass shared caches and omit request and response content
403-
// from retained usage logs. Asset uploads are skipped, so hosted image URLs are
404-
// omitted. Requires zero data retention to be enabled for your organization
405-
// (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
406-
// Successful ZDR responses include X-Context-ZDR: true.
373+
// `enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless
374+
// your organization has ZDR.
407375
type IndustryGetSicParamsZdr string
408376

409377
const (

0 commit comments

Comments
 (0)