Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AIExtractProductParams
- type AIExtractProductResponse
- type AIExtractProductResponseKeyMetadata
- type AIExtractProductResponsePlatform
- type AIExtractProductResponseProduct
- type AIExtractProductsParams
- type AIExtractProductsParamsBodyByDirectURL
- type AIExtractProductsParamsBodyByDomain
- type AIExtractProductsResponse
- type AIExtractProductsResponseKeyMetadata
- type AIExtractProductsResponseProduct
- type AIService
- type BatchCancelResponse
- type BatchCancelResponseCredits
- type BatchCancelResponseFormat
- type BatchCancelResponseKeyMetadata
- type BatchCancelResponseMode
- type BatchCancelResponseProgress
- type BatchCancelResponseStatus
- type BatchCancelResponseTiming
- type BatchDeleteResponse
- type BatchDeleteResponseKeyMetadata
- type BatchGetResponse
- type BatchGetResponseCredits
- type BatchGetResponseFormat
- type BatchGetResponseInvalidURL
- type BatchGetResponseKeyMetadata
- type BatchGetResponseMode
- type BatchGetResponseProgress
- type BatchGetResponseResults
- type BatchGetResponseResultsFile
- type BatchGetResponseStatus
- type BatchGetResponseTiming
- type BatchGetResultsParams
- type BatchGetResultsResponse
- type BatchGetResultsResponseDataError
- type BatchGetResultsResponseDataOk
- type BatchGetResultsResponseDataOkMetadata
- type BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion
- func (u BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) AsString() (v string)
- func (u BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) AsStringArray() (v []string)
- func (u BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) RawJSON() string
- func (r *BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
- type BatchGetResultsResponseDataOkMetadataAlternate
- type BatchGetResultsResponseDataOkMetadataHeading
- type BatchGetResultsResponseDataOkMetadataOpenGraphUnion
- func (u BatchGetResultsResponseDataOkMetadataOpenGraphUnion) AsString() (v string)
- func (u BatchGetResultsResponseDataOkMetadataOpenGraphUnion) AsStringArray() (v []string)
- func (u BatchGetResultsResponseDataOkMetadataOpenGraphUnion) RawJSON() string
- func (r *BatchGetResultsResponseDataOkMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
- type BatchGetResultsResponseDataOkMetadataTwitterUnion
- func (u BatchGetResultsResponseDataOkMetadataTwitterUnion) AsString() (v string)
- func (u BatchGetResultsResponseDataOkMetadataTwitterUnion) AsStringArray() (v []string)
- func (u BatchGetResultsResponseDataOkMetadataTwitterUnion) RawJSON() string
- func (r *BatchGetResultsResponseDataOkMetadataTwitterUnion) UnmarshalJSON(data []byte) error
- type BatchGetResultsResponseDataUnion
- func (u BatchGetResultsResponseDataUnion) AsAny() anyBatchGetResultsResponseData
- func (u BatchGetResultsResponseDataUnion) AsError() (v BatchGetResultsResponseDataError)
- func (u BatchGetResultsResponseDataUnion) AsOk() (v BatchGetResultsResponseDataOk)
- func (u BatchGetResultsResponseDataUnion) RawJSON() string
- func (r *BatchGetResultsResponseDataUnion) UnmarshalJSON(data []byte) error
- type BatchGetResultsResponseKeyMetadata
- type BatchListParams
- type BatchListParamsSearchType
- type BatchListParamsStatus
- type BatchListResponse
- type BatchListResponseData
- type BatchListResponseDataCredits
- type BatchListResponseDataProgress
- type BatchListResponseDataResults
- type BatchListResponseDataResultsFile
- type BatchListResponseDataTiming
- type BatchListResponseKeyMetadata
- type BatchService
- func (r *BatchService) Cancel(ctx context.Context, batchID string, opts ...option.RequestOption) (res *BatchCancelResponse, err error)
- func (r *BatchService) Delete(ctx context.Context, batchID string, opts ...option.RequestOption) (res *BatchDeleteResponse, err error)
- func (r *BatchService) Get(ctx context.Context, batchID string, opts ...option.RequestOption) (res *BatchGetResponse, err error)
- func (r *BatchService) GetResults(ctx context.Context, batchID string, query BatchGetResultsParams, ...) (res *BatchGetResultsResponse, err error)
- func (r *BatchService) List(ctx context.Context, query BatchListParams, opts ...option.RequestOption) (res *BatchListResponse, err error)
- func (r *BatchService) Submit(ctx context.Context, params BatchSubmitParams, opts ...option.RequestOption) (res *BatchSubmitResponse, err error)
- type BatchSubmitParams
- type BatchSubmitParamsInputCrawl
- type BatchSubmitParamsInputCrawlDataHTML
- type BatchSubmitParamsInputCrawlDataHTMLOptions
- type BatchSubmitParamsInputCrawlDataHTMLOptionsPdf
- type BatchSubmitParamsInputCrawlDataHTMLSourceSitemap
- type BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls
- type BatchSubmitParamsInputCrawlDataHTMLSourceStartURL
- type BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls
- type BatchSubmitParamsInputCrawlDataHTMLSourceUnion
- type BatchSubmitParamsInputCrawlDataMarkdown
- type BatchSubmitParamsInputCrawlDataMarkdownOptions
- type BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf
- type BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap
- type BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls
- type BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL
- type BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls
- type BatchSubmitParamsInputCrawlDataMarkdownSourceUnion
- type BatchSubmitParamsInputCrawlDataUnion
- type BatchSubmitParamsInputScrape
- type BatchSubmitParamsInputScrapeDataHTML
- type BatchSubmitParamsInputScrapeDataHTMLOptions
- type BatchSubmitParamsInputScrapeDataHTMLOptionsPdf
- type BatchSubmitParamsInputScrapeDataHTMLURL
- type BatchSubmitParamsInputScrapeDataMarkdown
- type BatchSubmitParamsInputScrapeDataMarkdownOptions
- type BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf
- type BatchSubmitParamsInputScrapeDataMarkdownURL
- type BatchSubmitParamsInputScrapeDataUnion
- type BatchSubmitParamsInputUnion
- type BatchSubmitResponse
- type BatchSubmitResponseCredits
- type BatchSubmitResponseFormat
- type BatchSubmitResponseInvalidURL
- type BatchSubmitResponseKeyMetadata
- type BatchSubmitResponseMode
- type BatchSubmitResponseStatus
- type BrandGetParams
- type BrandGetParamsBodyByDirectURL
- type BrandGetParamsBodyByDomain
- type BrandGetParamsBodyByEmail
- type BrandGetParamsBodyByName
- type BrandGetParamsBodyByTicker
- type BrandGetParamsBodyByTransaction
- type BrandGetParamsBodyByTransactionMccUnion
- type BrandGetParamsBodyByTransactionPhoneUnion
- type BrandGetResponse
- type BrandGetResponseBrand
- type BrandGetResponseBrandAddress
- type BrandGetResponseBrandBackdrop
- type BrandGetResponseBrandBackdropColor
- type BrandGetResponseBrandBackdropResolution
- type BrandGetResponseBrandColor
- type BrandGetResponseBrandEmployees
- type BrandGetResponseBrandIndustries
- type BrandGetResponseBrandIndustriesEic
- type BrandGetResponseBrandLinks
- type BrandGetResponseBrandLogo
- type BrandGetResponseBrandLogoColor
- type BrandGetResponseBrandLogoResolution
- type BrandGetResponseBrandSocial
- type BrandGetResponseBrandStock
- type BrandGetResponseKeyMetadata
- type BrandGetSimplifiedParams
- type BrandGetSimplifiedParamsTheme
- type BrandGetSimplifiedResponse
- type BrandGetSimplifiedResponseBrand
- type BrandGetSimplifiedResponseBrandBackdrop
- type BrandGetSimplifiedResponseBrandBackdropColor
- type BrandGetSimplifiedResponseBrandBackdropResolution
- type BrandGetSimplifiedResponseBrandColor
- type BrandGetSimplifiedResponseBrandLogo
- type BrandGetSimplifiedResponseBrandLogoColor
- type BrandGetSimplifiedResponseBrandLogoResolution
- type BrandGetSimplifiedResponseKeyMetadata
- type BrandSearchParams
- type BrandSearchResponse
- type BrandSearchResponseKeyMetadata
- type BrandSearchResponseResult
- type BrandService
- func (r *BrandService) Get(ctx context.Context, body BrandGetParams, opts ...option.RequestOption) (res *BrandGetResponse, err error)
- func (r *BrandService) GetSimplified(ctx context.Context, query BrandGetSimplifiedParams, ...) (res *BrandGetSimplifiedResponse, err error)
- func (r *BrandService) Search(ctx context.Context, query BrandSearchParams, opts ...option.RequestOption) (res *BrandSearchResponse, err error)
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type CrawlControls
- type CrawlControlsSourceSitemap
- type CrawlControlsSourceStartURL
- type CrawlControlsSourceUnion
- type Error
- type Failure
- type IndustryGetNaicsParams
- type IndustryGetNaicsResponse
- type IndustryGetNaicsResponseCode
- type IndustryGetNaicsResponseKeyMetadata
- type IndustryGetSicParams
- type IndustryGetSicParamsType
- type IndustryGetSicResponse
- type IndustryGetSicResponseClassification
- type IndustryGetSicResponseCode
- type IndustryGetSicResponseKeyMetadata
- type IndustryService
- type Intake
- type MonitorDeleteResponse
- type MonitorGetChangeResponse
- type MonitorGetChangeResponseChangeDetectionType
- type MonitorGetChangeResponseEvidence
- type MonitorGetChangeResponseImportance
- type MonitorGetChangeResponseMode
- type MonitorGetChangeResponseTargetType
- type MonitorGetCreditUsageParams
- type MonitorGetCreditUsageResponse
- type MonitorGetCreditUsageResponseData
- type MonitorGetLimitsResponse
- type MonitorGetLimitsResponsePlan
- type MonitorGetResponse
- type MonitorGetResponseBaselineExtractBaseline
- type MonitorGetResponseBaselinePageBaseline
- type MonitorGetResponseBaselineSitemapBaseline
- type MonitorGetResponseBaselineUnion
- func (u MonitorGetResponseBaselineUnion) AsExtractBaseline() (v MonitorGetResponseBaselineExtractBaseline)
- func (u MonitorGetResponseBaselineUnion) AsPageBaseline() (v MonitorGetResponseBaselinePageBaseline)
- func (u MonitorGetResponseBaselineUnion) AsSitemapBaseline() (v MonitorGetResponseBaselineSitemapBaseline)
- func (u MonitorGetResponseBaselineUnion) RawJSON() string
- func (r *MonitorGetResponseBaselineUnion) UnmarshalJSON(data []byte) error
- type MonitorGetResponseChangeDetectionExact
- type MonitorGetResponseChangeDetectionSemantic
- type MonitorGetResponseChangeDetectionUnion
- func (u MonitorGetResponseChangeDetectionUnion) AsAny() anyMonitorGetResponseChangeDetection
- func (u MonitorGetResponseChangeDetectionUnion) AsExact() (v MonitorGetResponseChangeDetectionExact)
- func (u MonitorGetResponseChangeDetectionUnion) AsSemantic() (v MonitorGetResponseChangeDetectionSemantic)
- func (u MonitorGetResponseChangeDetectionUnion) RawJSON() string
- func (r *MonitorGetResponseChangeDetectionUnion) UnmarshalJSON(data []byte) error
- type MonitorGetResponseLastError
- type MonitorGetResponseMode
- type MonitorGetResponseSchedule
- type MonitorGetResponseStatus
- type MonitorGetResponseTargetExtract
- type MonitorGetResponseTargetPage
- type MonitorGetResponseTargetSitemap
- type MonitorGetResponseTargetUnion
- func (u MonitorGetResponseTargetUnion) AsAny() anyMonitorGetResponseTarget
- func (u MonitorGetResponseTargetUnion) AsExtract() (v MonitorGetResponseTargetExtract)
- func (u MonitorGetResponseTargetUnion) AsPage() (v MonitorGetResponseTargetPage)
- func (u MonitorGetResponseTargetUnion) AsSitemap() (v MonitorGetResponseTargetSitemap)
- func (u MonitorGetResponseTargetUnion) RawJSON() string
- func (r *MonitorGetResponseTargetUnion) UnmarshalJSON(data []byte) error
- type MonitorGetResponseWebhook
- type MonitorGetResponseWebhookFailure
- type MonitorListAccountChangesParams
- type MonitorListAccountChangesParamsChangeDetectionType
- type MonitorListAccountChangesParamsTargetType
- type MonitorListAccountChangesResponse
- type MonitorListAccountChangesResponseData
- type MonitorListAccountRunsParams
- type MonitorListAccountRunsParamsStatus
- type MonitorListAccountRunsResponse
- type MonitorListAccountRunsResponseData
- type MonitorListAccountRunsResponseDataError
- type MonitorListChangesParams
- type MonitorListChangesResponse
- type MonitorListChangesResponseData
- type MonitorListParams
- type MonitorListParamsChangeDetectionType
- type MonitorListParamsSearchType
- type MonitorListParamsStatus
- type MonitorListParamsTargetType
- type MonitorListResponse
- type MonitorListResponseData
- type MonitorListResponseDataBaselineExtractBaseline
- type MonitorListResponseDataBaselinePageBaseline
- type MonitorListResponseDataBaselineSitemapBaseline
- type MonitorListResponseDataBaselineUnion
- func (u MonitorListResponseDataBaselineUnion) AsExtractBaseline() (v MonitorListResponseDataBaselineExtractBaseline)
- func (u MonitorListResponseDataBaselineUnion) AsPageBaseline() (v MonitorListResponseDataBaselinePageBaseline)
- func (u MonitorListResponseDataBaselineUnion) AsSitemapBaseline() (v MonitorListResponseDataBaselineSitemapBaseline)
- func (u MonitorListResponseDataBaselineUnion) RawJSON() string
- func (r *MonitorListResponseDataBaselineUnion) UnmarshalJSON(data []byte) error
- type MonitorListResponseDataChangeDetectionExact
- type MonitorListResponseDataChangeDetectionSemantic
- type MonitorListResponseDataChangeDetectionUnion
- func (u MonitorListResponseDataChangeDetectionUnion) AsAny() anyMonitorListResponseDataChangeDetection
- func (u MonitorListResponseDataChangeDetectionUnion) AsExact() (v MonitorListResponseDataChangeDetectionExact)
- func (u MonitorListResponseDataChangeDetectionUnion) AsSemantic() (v MonitorListResponseDataChangeDetectionSemantic)
- func (u MonitorListResponseDataChangeDetectionUnion) RawJSON() string
- func (r *MonitorListResponseDataChangeDetectionUnion) UnmarshalJSON(data []byte) error
- type MonitorListResponseDataLastError
- type MonitorListResponseDataSchedule
- type MonitorListResponseDataTargetExtract
- type MonitorListResponseDataTargetPage
- type MonitorListResponseDataTargetSitemap
- type MonitorListResponseDataTargetUnion
- func (u MonitorListResponseDataTargetUnion) AsAny() anyMonitorListResponseDataTarget
- func (u MonitorListResponseDataTargetUnion) AsExtract() (v MonitorListResponseDataTargetExtract)
- func (u MonitorListResponseDataTargetUnion) AsPage() (v MonitorListResponseDataTargetPage)
- func (u MonitorListResponseDataTargetUnion) AsSitemap() (v MonitorListResponseDataTargetSitemap)
- func (u MonitorListResponseDataTargetUnion) RawJSON() string
- func (r *MonitorListResponseDataTargetUnion) UnmarshalJSON(data []byte) error
- type MonitorListResponseDataWebhook
- type MonitorListResponseDataWebhookFailure
- type MonitorListRunsParams
- type MonitorListRunsParamsStatus
- type MonitorListRunsResponse
- type MonitorListRunsResponseData
- type MonitorListRunsResponseDataError
- type MonitorNewParams
- type MonitorNewParamsChangeDetectionExact
- type MonitorNewParamsChangeDetectionSemantic
- type MonitorNewParamsChangeDetectionUnion
- type MonitorNewParamsMode
- type MonitorNewParamsSchedule
- type MonitorNewParamsTargetExtract
- type MonitorNewParamsTargetPage
- type MonitorNewParamsTargetSitemap
- type MonitorNewParamsTargetUnion
- type MonitorNewParamsWebhook
- type MonitorNewResponse
- type MonitorNewResponseBaselineExtractBaseline
- type MonitorNewResponseBaselinePageBaseline
- type MonitorNewResponseBaselineSitemapBaseline
- type MonitorNewResponseBaselineUnion
- func (u MonitorNewResponseBaselineUnion) AsExtractBaseline() (v MonitorNewResponseBaselineExtractBaseline)
- func (u MonitorNewResponseBaselineUnion) AsPageBaseline() (v MonitorNewResponseBaselinePageBaseline)
- func (u MonitorNewResponseBaselineUnion) AsSitemapBaseline() (v MonitorNewResponseBaselineSitemapBaseline)
- func (u MonitorNewResponseBaselineUnion) RawJSON() string
- func (r *MonitorNewResponseBaselineUnion) UnmarshalJSON(data []byte) error
- type MonitorNewResponseChangeDetectionExact
- type MonitorNewResponseChangeDetectionSemantic
- type MonitorNewResponseChangeDetectionUnion
- func (u MonitorNewResponseChangeDetectionUnion) AsAny() anyMonitorNewResponseChangeDetection
- func (u MonitorNewResponseChangeDetectionUnion) AsExact() (v MonitorNewResponseChangeDetectionExact)
- func (u MonitorNewResponseChangeDetectionUnion) AsSemantic() (v MonitorNewResponseChangeDetectionSemantic)
- func (u MonitorNewResponseChangeDetectionUnion) RawJSON() string
- func (r *MonitorNewResponseChangeDetectionUnion) UnmarshalJSON(data []byte) error
- type MonitorNewResponseLastError
- type MonitorNewResponseMode
- type MonitorNewResponseSchedule
- type MonitorNewResponseStatus
- type MonitorNewResponseTargetExtract
- type MonitorNewResponseTargetPage
- type MonitorNewResponseTargetSitemap
- type MonitorNewResponseTargetUnion
- func (u MonitorNewResponseTargetUnion) AsAny() anyMonitorNewResponseTarget
- func (u MonitorNewResponseTargetUnion) AsExtract() (v MonitorNewResponseTargetExtract)
- func (u MonitorNewResponseTargetUnion) AsPage() (v MonitorNewResponseTargetPage)
- func (u MonitorNewResponseTargetUnion) AsSitemap() (v MonitorNewResponseTargetSitemap)
- func (u MonitorNewResponseTargetUnion) RawJSON() string
- func (r *MonitorNewResponseTargetUnion) UnmarshalJSON(data []byte) error
- type MonitorNewResponseWebhook
- type MonitorNewResponseWebhookFailure
- type MonitorRunResponse
- type MonitorService
- func (r *MonitorService) Delete(ctx context.Context, monitorID string, opts ...option.RequestOption) (res *MonitorDeleteResponse, err error)
- func (r *MonitorService) Get(ctx context.Context, monitorID string, opts ...option.RequestOption) (res *MonitorGetResponse, err error)
- func (r *MonitorService) GetChange(ctx context.Context, changeID string, opts ...option.RequestOption) (res *MonitorGetChangeResponse, err error)
- func (r *MonitorService) GetCreditUsage(ctx context.Context, query MonitorGetCreditUsageParams, ...) (res *MonitorGetCreditUsageResponse, err error)
- func (r *MonitorService) GetLimits(ctx context.Context, opts ...option.RequestOption) (res *MonitorGetLimitsResponse, err error)
- func (r *MonitorService) List(ctx context.Context, query MonitorListParams, opts ...option.RequestOption) (res *MonitorListResponse, err error)
- func (r *MonitorService) ListAccountChanges(ctx context.Context, query MonitorListAccountChangesParams, ...) (res *MonitorListAccountChangesResponse, err error)
- func (r *MonitorService) ListAccountRuns(ctx context.Context, query MonitorListAccountRunsParams, ...) (res *MonitorListAccountRunsResponse, err error)
- func (r *MonitorService) ListChanges(ctx context.Context, monitorID string, query MonitorListChangesParams, ...) (res *MonitorListChangesResponse, err error)
- func (r *MonitorService) ListRuns(ctx context.Context, monitorID string, query MonitorListRunsParams, ...) (res *MonitorListRunsResponse, err error)
- func (r *MonitorService) New(ctx context.Context, body MonitorNewParams, opts ...option.RequestOption) (res *MonitorNewResponse, err error)
- func (r *MonitorService) Run(ctx context.Context, monitorID string, opts ...option.RequestOption) (res *MonitorRunResponse, err error)
- func (r *MonitorService) Update(ctx context.Context, monitorID string, body MonitorUpdateParams, ...) (res *MonitorUpdateResponse, err error)
- type MonitorUpdateParams
- type MonitorUpdateParamsChangeDetectionExact
- type MonitorUpdateParamsChangeDetectionSemantic
- type MonitorUpdateParamsChangeDetectionUnion
- type MonitorUpdateParamsSchedule
- type MonitorUpdateParamsStatus
- type MonitorUpdateParamsTargetExtract
- type MonitorUpdateParamsTargetPage
- type MonitorUpdateParamsTargetSitemap
- type MonitorUpdateParamsTargetUnion
- type MonitorUpdateParamsWebhook
- type MonitorUpdateResponse
- type MonitorUpdateResponseBaselineExtractBaseline
- type MonitorUpdateResponseBaselinePageBaseline
- type MonitorUpdateResponseBaselineSitemapBaseline
- type MonitorUpdateResponseBaselineUnion
- func (u MonitorUpdateResponseBaselineUnion) AsExtractBaseline() (v MonitorUpdateResponseBaselineExtractBaseline)
- func (u MonitorUpdateResponseBaselineUnion) AsPageBaseline() (v MonitorUpdateResponseBaselinePageBaseline)
- func (u MonitorUpdateResponseBaselineUnion) AsSitemapBaseline() (v MonitorUpdateResponseBaselineSitemapBaseline)
- func (u MonitorUpdateResponseBaselineUnion) RawJSON() string
- func (r *MonitorUpdateResponseBaselineUnion) UnmarshalJSON(data []byte) error
- type MonitorUpdateResponseChangeDetectionExact
- type MonitorUpdateResponseChangeDetectionSemantic
- type MonitorUpdateResponseChangeDetectionUnion
- func (u MonitorUpdateResponseChangeDetectionUnion) AsAny() anyMonitorUpdateResponseChangeDetection
- func (u MonitorUpdateResponseChangeDetectionUnion) AsExact() (v MonitorUpdateResponseChangeDetectionExact)
- func (u MonitorUpdateResponseChangeDetectionUnion) AsSemantic() (v MonitorUpdateResponseChangeDetectionSemantic)
- func (u MonitorUpdateResponseChangeDetectionUnion) RawJSON() string
- func (r *MonitorUpdateResponseChangeDetectionUnion) UnmarshalJSON(data []byte) error
- type MonitorUpdateResponseLastError
- type MonitorUpdateResponseMode
- type MonitorUpdateResponseSchedule
- type MonitorUpdateResponseStatus
- type MonitorUpdateResponseTargetExtract
- type MonitorUpdateResponseTargetPage
- type MonitorUpdateResponseTargetSitemap
- type MonitorUpdateResponseTargetUnion
- func (u MonitorUpdateResponseTargetUnion) AsAny() anyMonitorUpdateResponseTarget
- func (u MonitorUpdateResponseTargetUnion) AsExtract() (v MonitorUpdateResponseTargetExtract)
- func (u MonitorUpdateResponseTargetUnion) AsPage() (v MonitorUpdateResponseTargetPage)
- func (u MonitorUpdateResponseTargetUnion) AsSitemap() (v MonitorUpdateResponseTargetSitemap)
- func (u MonitorUpdateResponseTargetUnion) RawJSON() string
- func (r *MonitorUpdateResponseTargetUnion) UnmarshalJSON(data []byte) error
- type MonitorUpdateResponseWebhook
- type MonitorUpdateResponseWebhookFailure
- type NewsSearchParams
- type NewsSearchParamsFilterBy
- type NewsSearchParamsFilterByDate
- type NewsSearchParamsSearchBy
- type NewsSearchParamsSearchByEntityDomain
- type NewsSearchParamsSearchByEntityIsin
- type NewsSearchParamsSearchByEntityName
- type NewsSearchParamsSearchByEntityTicker
- type NewsSearchParamsSearchByEntityUnion
- type NewsSearchParamsSortBy
- type NewsSearchResponse
- type NewsSearchResponseData
- type NewsSearchResponseDataMatch
- type NewsSearchResponseDataSource
- type NewsSearchResponseKeyMetadata
- type NewsSearchResponseMeta
- type NewsService
- type PageErrorCount
- type ParseHandleParams
- type ParseHandleParamsExtension
- type ParseHandleParamsPdf
- type ParseHandleParamsZdr
- type ParseHandleResponse
- type ParseHandleResponseKeyMetadata
- type ParseHandleResponseType
- type ParseService
- type PersonEnrichParams
- type PersonEnrichParamsCompany
- type PersonEnrichParamsEducation
- type PersonEnrichParamsEducationInstitution
- type PersonEnrichParamsLocation
- type PersonEnrichParamsName
- type PersonEnrichResponse
- type PersonEnrichResponseKeyMetadata
- type PersonEnrichResponseMatchCandidate
- type PersonEnrichResponseMatchCandidatePerson
- type PersonEnrichResponseMatchCandidatePersonCurrentRole
- type PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate
- type PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization
- type PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate
- type PersonEnrichResponseMatchCandidatePersonEducation
- type PersonEnrichResponseMatchCandidatePersonEducationEndDate
- type PersonEnrichResponseMatchCandidatePersonEducationInstitution
- type PersonEnrichResponseMatchCandidatePersonEducationStartDate
- type PersonEnrichResponseMatchCandidatePersonExperience
- type PersonEnrichResponseMatchCandidatePersonExperienceEndDate
- type PersonEnrichResponseMatchCandidatePersonExperienceOrganization
- type PersonEnrichResponseMatchCandidatePersonExperienceStartDate
- type PersonEnrichResponseMatchCandidatePersonLocation
- type PersonEnrichResponseMatchCandidatePersonName
- type PersonEnrichResponseMatchNotFound
- type PersonEnrichResponseMatchUnion
- func (u PersonEnrichResponseMatchUnion) AsAny() anyPersonEnrichResponseMatch
- func (u PersonEnrichResponseMatchUnion) AsCandidate() (v PersonEnrichResponseMatchCandidate)
- func (u PersonEnrichResponseMatchUnion) AsNotFound() (v PersonEnrichResponseMatchNotFound)
- func (u PersonEnrichResponseMatchUnion) RawJSON() string
- func (r *PersonEnrichResponseMatchUnion) UnmarshalJSON(data []byte) error
- type PersonEnrichResponseMatchUnionPerson
- type PersonEnrichResponseMatchUnionScore
- type PersonService
- type UtilityPrefetchParams
- type UtilityPrefetchParamsIdentifierByDomain
- type UtilityPrefetchParamsIdentifierByEmail
- type UtilityPrefetchParamsIdentifierUnion
- type UtilityPrefetchParamsType
- type UtilityPrefetchResponse
- type UtilityPrefetchResponseKeyMetadata
- type UtilityPrefetchResponseType
- type UtilityService
- type WebExtractCompetitorsParams
- type WebExtractCompetitorsResponse
- type WebExtractCompetitorsResponseCompetitor
- type WebExtractCompetitorsResponseKeyMetadata
- type WebExtractCompetitorsResponseStatus
- type WebExtractCompetitorsResponseTarget
- type WebExtractFontsParams
- type WebExtractFontsResponse
- type WebExtractFontsResponseFont
- type WebExtractFontsResponseFontLink
- type WebExtractFontsResponseKeyMetadata
- type WebExtractParams
- type WebExtractParamsPdf
- type WebExtractResponse
- type WebExtractResponseKeyMetadata
- type WebExtractResponseMetadata
- type WebExtractStyleguideParams
- type WebExtractStyleguideParamsColorScheme
- type WebExtractStyleguideResponse
- type WebExtractStyleguideResponseKeyMetadata
- type WebExtractStyleguideResponseStyleguide
- type WebExtractStyleguideResponseStyleguideColors
- type WebExtractStyleguideResponseStyleguideComponents
- type WebExtractStyleguideResponseStyleguideComponentsButton
- type WebExtractStyleguideResponseStyleguideComponentsButtonLink
- type WebExtractStyleguideResponseStyleguideComponentsButtonPrimary
- type WebExtractStyleguideResponseStyleguideComponentsButtonSecondary
- type WebExtractStyleguideResponseStyleguideComponentsCard
- type WebExtractStyleguideResponseStyleguideElementSpacing
- type WebExtractStyleguideResponseStyleguideFontLink
- type WebExtractStyleguideResponseStyleguideShadows
- type WebExtractStyleguideResponseStyleguideTypography
- type WebExtractStyleguideResponseStyleguideTypographyHeadings
- type WebExtractStyleguideResponseStyleguideTypographyHeadingsH1
- type WebExtractStyleguideResponseStyleguideTypographyHeadingsH2
- type WebExtractStyleguideResponseStyleguideTypographyHeadingsH3
- type WebExtractStyleguideResponseStyleguideTypographyHeadingsH4
- type WebExtractStyleguideResponseStyleguideTypographyP
- type WebScreenshotParams
- type WebScreenshotParamsColorScheme
- type WebScreenshotParamsCountry
- type WebScreenshotParamsFullScreenshot
- type WebScreenshotParamsPage
- type WebScreenshotParamsViewport
- type WebScreenshotParamsZdr
- type WebScreenshotResponse
- type WebScreenshotResponseKeyMetadata
- type WebScreenshotResponseScreenshotType
- type WebSearchParams
- type WebSearchParamsCountry
- type WebSearchParamsFreshness
- type WebSearchParamsMarkdownOptions
- type WebSearchParamsMarkdownOptionsPdf
- type WebSearchResponse
- type WebSearchResponseKeyMetadata
- type WebSearchResponseResult
- type WebSearchResponseResultMarkdown
- type WebService
- func (r *WebService) Extract(ctx context.Context, body WebExtractParams, opts ...option.RequestOption) (res *WebExtractResponse, err error)
- func (r *WebService) ExtractCompetitors(ctx context.Context, query WebExtractCompetitorsParams, ...) (res *WebExtractCompetitorsResponse, err error)
- func (r *WebService) ExtractFonts(ctx context.Context, query WebExtractFontsParams, opts ...option.RequestOption) (res *WebExtractFontsResponse, err error)
- func (r *WebService) ExtractStyleguide(ctx context.Context, query WebExtractStyleguideParams, ...) (res *WebExtractStyleguideResponse, err error)
- func (r *WebService) Screenshot(ctx context.Context, query WebScreenshotParams, opts ...option.RequestOption) (res *WebScreenshotResponse, err error)
- func (r *WebService) Search(ctx context.Context, body WebSearchParams, opts ...option.RequestOption) (res *WebSearchResponse, err error)
- func (r *WebService) WebCrawlMd(ctx context.Context, body WebWebCrawlMdParams, opts ...option.RequestOption) (res *WebWebCrawlMdResponse, err error)
- func (r *WebService) WebScrapeHTML(ctx context.Context, query WebWebScrapeHTMLParams, ...) (res *WebWebScrapeHTMLResponse, err error)
- func (r *WebService) WebScrapeImages(ctx context.Context, query WebWebScrapeImagesParams, ...) (res *WebWebScrapeImagesResponse, err error)
- func (r *WebService) WebScrapeMd(ctx context.Context, query WebWebScrapeMdParams, opts ...option.RequestOption) (res *WebWebScrapeMdResponse, err error)
- func (r *WebService) WebScrapeSitemap(ctx context.Context, query WebWebScrapeSitemapParams, ...) (res *WebWebScrapeSitemapResponse, err error)
- type WebWebCrawlMdParams
- type WebWebCrawlMdParamsCountry
- type WebWebCrawlMdParamsPdf
- type WebWebCrawlMdParamsZdr
- type WebWebCrawlMdResponse
- type WebWebCrawlMdResponseKeyMetadata
- type WebWebCrawlMdResponseMetadata
- type WebWebCrawlMdResponseResult
- type WebWebCrawlMdResponseResultMetadata
- type WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion
- func (u WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) AsString() (v string)
- func (u WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) AsStringArray() (v []string)
- func (u WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) RawJSON() string
- func (r *WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
- type WebWebCrawlMdResponseResultMetadataAlternate
- type WebWebCrawlMdResponseResultMetadataHeading
- type WebWebCrawlMdResponseResultMetadataOpenGraphUnion
- func (u WebWebCrawlMdResponseResultMetadataOpenGraphUnion) AsString() (v string)
- func (u WebWebCrawlMdResponseResultMetadataOpenGraphUnion) AsStringArray() (v []string)
- func (u WebWebCrawlMdResponseResultMetadataOpenGraphUnion) RawJSON() string
- func (r *WebWebCrawlMdResponseResultMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
- type WebWebCrawlMdResponseResultMetadataTwitterUnion
- func (u WebWebCrawlMdResponseResultMetadataTwitterUnion) AsString() (v string)
- func (u WebWebCrawlMdResponseResultMetadataTwitterUnion) AsStringArray() (v []string)
- func (u WebWebCrawlMdResponseResultMetadataTwitterUnion) RawJSON() string
- func (r *WebWebCrawlMdResponseResultMetadataTwitterUnion) UnmarshalJSON(data []byte) error
- type WebWebScrapeHTMLParams
- type WebWebScrapeHTMLParamsActionPerform
- type WebWebScrapeHTMLParamsActionUnion
- type WebWebScrapeHTMLParamsActionWait
- type WebWebScrapeHTMLParamsCountry
- type WebWebScrapeHTMLParamsPdf
- type WebWebScrapeHTMLParamsZdr
- type WebWebScrapeHTMLResponse
- type WebWebScrapeHTMLResponseActionsApplied
- type WebWebScrapeHTMLResponseKeyMetadata
- type WebWebScrapeHTMLResponseMetadata
- type WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion
- func (u WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) AsString() (v string)
- func (u WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) AsStringArray() (v []string)
- func (u WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) RawJSON() string
- func (r *WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
- type WebWebScrapeHTMLResponseMetadataAlternate
- type WebWebScrapeHTMLResponseMetadataHeading
- type WebWebScrapeHTMLResponseMetadataOpenGraphUnion
- func (u WebWebScrapeHTMLResponseMetadataOpenGraphUnion) AsString() (v string)
- func (u WebWebScrapeHTMLResponseMetadataOpenGraphUnion) AsStringArray() (v []string)
- func (u WebWebScrapeHTMLResponseMetadataOpenGraphUnion) RawJSON() string
- func (r *WebWebScrapeHTMLResponseMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
- type WebWebScrapeHTMLResponseMetadataTwitterUnion
- func (u WebWebScrapeHTMLResponseMetadataTwitterUnion) AsString() (v string)
- func (u WebWebScrapeHTMLResponseMetadataTwitterUnion) AsStringArray() (v []string)
- func (u WebWebScrapeHTMLResponseMetadataTwitterUnion) RawJSON() string
- func (r *WebWebScrapeHTMLResponseMetadataTwitterUnion) UnmarshalJSON(data []byte) error
- type WebWebScrapeHTMLResponseType
- type WebWebScrapeImagesParams
- type WebWebScrapeImagesParamsActionPerform
- type WebWebScrapeImagesParamsActionUnion
- type WebWebScrapeImagesParamsActionWait
- type WebWebScrapeImagesParamsEnrichment
- type WebWebScrapeImagesResponse
- type WebWebScrapeImagesResponseImage
- type WebWebScrapeImagesResponseImageEnrichment
- type WebWebScrapeImagesResponseKeyMetadata
- type WebWebScrapeMdParams
- type WebWebScrapeMdParamsActionPerform
- type WebWebScrapeMdParamsActionUnion
- type WebWebScrapeMdParamsActionWait
- type WebWebScrapeMdParamsCountry
- type WebWebScrapeMdParamsPdf
- type WebWebScrapeMdParamsZdr
- type WebWebScrapeMdResponse
- type WebWebScrapeMdResponseActionsApplied
- type WebWebScrapeMdResponseKeyMetadata
- type WebWebScrapeMdResponseMetadata
- type WebWebScrapeMdResponseMetadataAdditionalMetaUnion
- func (u WebWebScrapeMdResponseMetadataAdditionalMetaUnion) AsString() (v string)
- func (u WebWebScrapeMdResponseMetadataAdditionalMetaUnion) AsStringArray() (v []string)
- func (u WebWebScrapeMdResponseMetadataAdditionalMetaUnion) RawJSON() string
- func (r *WebWebScrapeMdResponseMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
- type WebWebScrapeMdResponseMetadataAlternate
- type WebWebScrapeMdResponseMetadataHeading
- type WebWebScrapeMdResponseMetadataOpenGraphUnion
- func (u WebWebScrapeMdResponseMetadataOpenGraphUnion) AsString() (v string)
- func (u WebWebScrapeMdResponseMetadataOpenGraphUnion) AsStringArray() (v []string)
- func (u WebWebScrapeMdResponseMetadataOpenGraphUnion) RawJSON() string
- func (r *WebWebScrapeMdResponseMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
- type WebWebScrapeMdResponseMetadataTwitterUnion
- func (u WebWebScrapeMdResponseMetadataTwitterUnion) AsString() (v string)
- func (u WebWebScrapeMdResponseMetadataTwitterUnion) AsStringArray() (v []string)
- func (u WebWebScrapeMdResponseMetadataTwitterUnion) RawJSON() string
- func (r *WebWebScrapeMdResponseMetadataTwitterUnion) UnmarshalJSON(data []byte) error
- type WebWebScrapeSitemapParams
- type WebWebScrapeSitemapParamsZdr
- type WebWebScrapeSitemapResponse
- type WebWebScrapeSitemapResponseKeyMetadata
- type WebWebScrapeSitemapResponseMeta
- type WebhookDelivery
- type WebhookDeliveryError
- type WebhookDeliveryEvent
- type WebhookDeliveryStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (CONTEXT_DEV_API_KEY, CONTEXT_DEV_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AIExtractProductParams ¶
type AIExtractProductParams struct {
// The product page URL to extract product data from.
URL string `json:"url" api:"required" format:"uri"`
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (AIExtractProductParams) MarshalJSON ¶
func (r AIExtractProductParams) MarshalJSON() (data []byte, err error)
func (*AIExtractProductParams) UnmarshalJSON ¶
func (r *AIExtractProductParams) UnmarshalJSON(data []byte) error
type AIExtractProductResponse ¶
type AIExtractProductResponse struct {
// Whether the given URL is a product detail page
IsProductPage bool `json:"is_product_page"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata AIExtractProductResponseKeyMetadata `json:"key_metadata"`
// The detected ecommerce platform, or null if not a product page
//
// Any of "amazon", "tiktok_shop", "etsy", "generic".
Platform AIExtractProductResponsePlatform `json:"platform" api:"nullable"`
// The extracted product data, or null if not a product page
Product AIExtractProductResponseProduct `json:"product" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
IsProductPage respjson.Field
KeyMetadata respjson.Field
Platform respjson.Field
Product respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIExtractProductResponse) RawJSON ¶
func (r AIExtractProductResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIExtractProductResponse) UnmarshalJSON ¶
func (r *AIExtractProductResponse) UnmarshalJSON(data []byte) error
type AIExtractProductResponseKeyMetadata ¶
type AIExtractProductResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (AIExtractProductResponseKeyMetadata) RawJSON ¶
func (r AIExtractProductResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIExtractProductResponseKeyMetadata) UnmarshalJSON ¶
func (r *AIExtractProductResponseKeyMetadata) UnmarshalJSON(data []byte) error
type AIExtractProductResponsePlatform ¶
type AIExtractProductResponsePlatform string
The detected ecommerce platform, or null if not a product page
const ( AIExtractProductResponsePlatformAmazon AIExtractProductResponsePlatform = "amazon" AIExtractProductResponsePlatformTiktokShop AIExtractProductResponsePlatform = "tiktok_shop" AIExtractProductResponsePlatformEtsy AIExtractProductResponsePlatform = "etsy" AIExtractProductResponsePlatformGeneric AIExtractProductResponsePlatform = "generic" )
type AIExtractProductResponseProduct ¶
type AIExtractProductResponseProduct struct {
// Description of the product
Description string `json:"description" api:"required"`
// List of product features
Features []string `json:"features" api:"required"`
// URLs to product images on the page (up to 7)
Images []string `json:"images" api:"required"`
// Name of the product
Name string `json:"name" api:"required"`
// Stock Keeping Unit (product identifier). Null if no identifier is found.
SKU string `json:"sku" api:"required"`
// Tags associated with the product
Tags []string `json:"tags" api:"required"`
// Target audience for the product (array of strings)
TargetAudience []string `json:"target_audience" api:"required"`
// Billing frequency for the product
//
// Any of "monthly", "yearly", "one_time", "usage_based".
BillingFrequency string `json:"billing_frequency" api:"nullable"`
// Category of the product
Category string `json:"category" api:"nullable"`
// Currency code for the price (e.g., USD, EUR)
Currency string `json:"currency" api:"nullable"`
// URL to the product image
ImageURL string `json:"image_url" api:"nullable"`
// Price of the product
Price float64 `json:"price" api:"nullable"`
// Pricing model for the product
//
// Any of "per_seat", "flat", "tiered", "freemium", "custom".
PricingModel string `json:"pricing_model" api:"nullable"`
// URL to the product page
URL string `json:"url" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
Features respjson.Field
Images respjson.Field
Name respjson.Field
SKU respjson.Field
Tags respjson.Field
TargetAudience respjson.Field
BillingFrequency respjson.Field
Category respjson.Field
Currency respjson.Field
ImageURL respjson.Field
Price respjson.Field
PricingModel respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The extracted product data, or null if not a product page
func (AIExtractProductResponseProduct) RawJSON ¶
func (r AIExtractProductResponseProduct) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIExtractProductResponseProduct) UnmarshalJSON ¶
func (r *AIExtractProductResponseProduct) UnmarshalJSON(data []byte) error
type AIExtractProductsParams ¶
type AIExtractProductsParams struct {
// This field is a request body variant, only one variant field can be set.
OfByDomain *AIExtractProductsParamsBodyByDomain `json:",inline"`
// This field is a request body variant, only one variant field can be set.
OfByDirectURL *AIExtractProductsParamsBodyByDirectURL `json:",inline"`
// contains filtered or unexported fields
}
func (AIExtractProductsParams) MarshalJSON ¶
func (u AIExtractProductsParams) MarshalJSON() ([]byte, error)
func (*AIExtractProductsParams) UnmarshalJSON ¶
func (r *AIExtractProductsParams) UnmarshalJSON(data []byte) error
type AIExtractProductsParamsBodyByDirectURL ¶
type AIExtractProductsParamsBodyByDirectURL struct {
// A specific URL to use directly as the starting point for extraction without
// domain resolution.
DirectURL string `json:"directUrl" api:"required" format:"uri"`
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Maximum number of products to extract.
MaxProducts param.Opt[int64] `json:"maxProducts,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
The property DirectURL is required.
func (AIExtractProductsParamsBodyByDirectURL) MarshalJSON ¶
func (r AIExtractProductsParamsBodyByDirectURL) MarshalJSON() (data []byte, err error)
func (*AIExtractProductsParamsBodyByDirectURL) UnmarshalJSON ¶
func (r *AIExtractProductsParamsBodyByDirectURL) UnmarshalJSON(data []byte) error
type AIExtractProductsParamsBodyByDomain ¶
type AIExtractProductsParamsBodyByDomain struct {
// The domain name to analyze.
Domain string `json:"domain" api:"required"`
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Maximum number of products to extract.
MaxProducts param.Opt[int64] `json:"maxProducts,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
The property Domain is required.
func (AIExtractProductsParamsBodyByDomain) MarshalJSON ¶
func (r AIExtractProductsParamsBodyByDomain) MarshalJSON() (data []byte, err error)
func (*AIExtractProductsParamsBodyByDomain) UnmarshalJSON ¶
func (r *AIExtractProductsParamsBodyByDomain) UnmarshalJSON(data []byte) error
type AIExtractProductsResponse ¶
type AIExtractProductsResponse struct {
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata AIExtractProductsResponseKeyMetadata `json:"key_metadata"`
// Array of products extracted from the website
Products []AIExtractProductsResponseProduct `json:"products"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
KeyMetadata respjson.Field
Products respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIExtractProductsResponse) RawJSON ¶
func (r AIExtractProductsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIExtractProductsResponse) UnmarshalJSON ¶
func (r *AIExtractProductsResponse) UnmarshalJSON(data []byte) error
type AIExtractProductsResponseKeyMetadata ¶
type AIExtractProductsResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (AIExtractProductsResponseKeyMetadata) RawJSON ¶
func (r AIExtractProductsResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIExtractProductsResponseKeyMetadata) UnmarshalJSON ¶
func (r *AIExtractProductsResponseKeyMetadata) UnmarshalJSON(data []byte) error
type AIExtractProductsResponseProduct ¶
type AIExtractProductsResponseProduct struct {
// Description of the product
Description string `json:"description" api:"required"`
// List of product features
Features []string `json:"features" api:"required"`
// URLs to product images on the page (up to 7)
Images []string `json:"images" api:"required"`
// Name of the product
Name string `json:"name" api:"required"`
// Stock Keeping Unit (product identifier). Null if no identifier is found.
SKU string `json:"sku" api:"required"`
// Tags associated with the product
Tags []string `json:"tags" api:"required"`
// Target audience for the product (array of strings)
TargetAudience []string `json:"target_audience" api:"required"`
// Billing frequency for the product
//
// Any of "monthly", "yearly", "one_time", "usage_based".
BillingFrequency string `json:"billing_frequency" api:"nullable"`
// Category of the product
Category string `json:"category" api:"nullable"`
// Currency code for the price (e.g., USD, EUR)
Currency string `json:"currency" api:"nullable"`
// URL to the product image
ImageURL string `json:"image_url" api:"nullable"`
// Price of the product
Price float64 `json:"price" api:"nullable"`
// Pricing model for the product
//
// Any of "per_seat", "flat", "tiered", "freemium", "custom".
PricingModel string `json:"pricing_model" api:"nullable"`
// URL to the product page
URL string `json:"url" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
Features respjson.Field
Images respjson.Field
Name respjson.Field
SKU respjson.Field
Tags respjson.Field
TargetAudience respjson.Field
BillingFrequency respjson.Field
Category respjson.Field
Currency respjson.Field
ImageURL respjson.Field
Price respjson.Field
PricingModel respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AIExtractProductsResponseProduct) RawJSON ¶
func (r AIExtractProductsResponseProduct) RawJSON() string
Returns the unmodified JSON received from the API
func (*AIExtractProductsResponseProduct) UnmarshalJSON ¶
func (r *AIExtractProductsResponseProduct) UnmarshalJSON(data []byte) error
type AIService ¶
type AIService struct {
// contains filtered or unexported fields
}
AIService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAIService method instead.
func NewAIService ¶
func NewAIService(opts ...option.RequestOption) (r AIService)
NewAIService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AIService) ExtractProduct ¶
func (r *AIService) ExtractProduct(ctx context.Context, body AIExtractProductParams, opts ...option.RequestOption) (res *AIExtractProductResponse, err error)
Given a single URL, determines if it is a product page and extracts the product information.
func (*AIService) ExtractProducts ¶
func (r *AIService) ExtractProducts(ctx context.Context, body AIExtractProductsParams, opts ...option.RequestOption) (res *AIExtractProductsResponse, err error)
Extract product information from a brand's website. We will analyze the website and return a list of products with details such as name, description, image, pricing, features, and more.
type BatchCancelResponse ¶ added in v2.6.0
type BatchCancelResponse struct {
// Batch ID.
ID string `json:"id" api:"required"`
// The crawl controls as submitted, so the limits requested can be compared against
// what the crawl reached.
Crawl CrawlControls `json:"crawl" api:"required"`
// What this batch cost so far.
Credits BatchCancelResponseCredits `json:"credits" api:"required"`
// What each page is returned as.
//
// Any of "markdown", "html".
Format BatchCancelResponseFormat `json:"format" api:"required"`
// What submission took in, and what it charged for.
Input Intake `json:"input" api:"required"`
// How pages were selected.
//
// Any of "scrape", "crawl".
Mode BatchCancelResponseMode `json:"mode" api:"required"`
// Page failures so far, grouped by error code and sorted by count.
PageErrors []PageErrorCount `json:"page_errors" api:"required"`
// How far the batch got before cancellation.
Progress BatchCancelResponseProgress `json:"progress" api:"required"`
// Always `cancelling`. Work already in flight finishes; the batch reaches
// `cancelled` shortly after.
//
// Any of "cancelling".
Status BatchCancelResponseStatus `json:"status" api:"required"`
// Tags stored on the batch at submission.
Tags []string `json:"tags" api:"required"`
// There is no finish time yet — the batch is still winding down.
Timing BatchCancelResponseTiming `json:"timing" api:"required"`
// API key usage for this request.
KeyMetadata BatchCancelResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Crawl respjson.Field
Credits respjson.Field
Format respjson.Field
Input respjson.Field
Mode respjson.Field
PageErrors respjson.Field
Progress respjson.Field
Status respjson.Field
Tags respjson.Field
Timing respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchCancelResponse) RawJSON ¶ added in v2.6.0
func (r BatchCancelResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchCancelResponse) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchCancelResponse) UnmarshalJSON(data []byte) error
type BatchCancelResponseCredits ¶ added in v2.6.0
type BatchCancelResponseCredits struct {
// Credits debited at submission. The unspent remainder is refunded once the batch
// settles — read `credits.refunded` from GET /batch/{batch_id} then.
Reserved int64 `json:"reserved" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Reserved respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What this batch cost so far.
func (BatchCancelResponseCredits) RawJSON ¶ added in v2.6.0
func (r BatchCancelResponseCredits) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchCancelResponseCredits) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchCancelResponseCredits) UnmarshalJSON(data []byte) error
type BatchCancelResponseFormat ¶ added in v2.7.0
type BatchCancelResponseFormat string
What each page is returned as.
const ( BatchCancelResponseFormatMarkdown BatchCancelResponseFormat = "markdown" BatchCancelResponseFormatHTML BatchCancelResponseFormat = "html" )
type BatchCancelResponseKeyMetadata ¶ added in v2.6.0
type BatchCancelResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
API key usage for this request.
func (BatchCancelResponseKeyMetadata) RawJSON ¶ added in v2.6.0
func (r BatchCancelResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchCancelResponseKeyMetadata) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchCancelResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BatchCancelResponseMode ¶ added in v2.6.0
type BatchCancelResponseMode string
How pages were selected.
const ( BatchCancelResponseModeScrape BatchCancelResponseMode = "scrape" BatchCancelResponseModeCrawl BatchCancelResponseMode = "crawl" )
type BatchCancelResponseProgress ¶ added in v2.6.0
type BatchCancelResponseProgress struct {
// Pages that could not be scraped before the request landed.
Failed int64 `json:"failed" api:"required"`
// Reserved pages that will now be skipped, and refunded when the batch settles.
Pending int64 `json:"pending" api:"required"`
// Pages scraped successfully before the request landed.
Succeeded int64 `json:"succeeded" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Failed respjson.Field
Pending respjson.Field
Succeeded respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
How far the batch got before cancellation.
func (BatchCancelResponseProgress) RawJSON ¶ added in v2.6.0
func (r BatchCancelResponseProgress) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchCancelResponseProgress) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchCancelResponseProgress) UnmarshalJSON(data []byte) error
type BatchCancelResponseStatus ¶ added in v2.6.0
type BatchCancelResponseStatus string
Always `cancelling`. Work already in flight finishes; the batch reaches `cancelled` shortly after.
const (
BatchCancelResponseStatusCancelling BatchCancelResponseStatus = "cancelling"
)
type BatchCancelResponseTiming ¶ added in v2.6.0
type BatchCancelResponseTiming struct {
// When the batch was created.
CreatedAt string `json:"created_at" api:"required"`
// When processing started. Null if it was cancelled while still queued.
StartedAt string `json:"started_at" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
StartedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
There is no finish time yet — the batch is still winding down.
func (BatchCancelResponseTiming) RawJSON ¶ added in v2.6.0
func (r BatchCancelResponseTiming) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchCancelResponseTiming) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchCancelResponseTiming) UnmarshalJSON(data []byte) error
type BatchDeleteResponse ¶ added in v2.9.0
type BatchDeleteResponse struct {
// ID of the deleted batch.
ID string `json:"id"`
// Always true on success.
Deleted bool `json:"deleted"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata BatchDeleteResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Deleted respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchDeleteResponse) RawJSON ¶ added in v2.9.0
func (r BatchDeleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchDeleteResponse) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchDeleteResponse) UnmarshalJSON(data []byte) error
type BatchDeleteResponseKeyMetadata ¶ added in v2.9.0
type BatchDeleteResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (BatchDeleteResponseKeyMetadata) RawJSON ¶ added in v2.9.0
func (r BatchDeleteResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchDeleteResponseKeyMetadata) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchDeleteResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BatchGetResponse ¶ added in v2.6.0
type BatchGetResponse struct {
// Batch ID used to retrieve or cancel the job.
ID string `json:"id" api:"required"`
// The crawl controls as submitted, so the limits requested can be compared against
// what the crawl reached.
Crawl CrawlControls `json:"crawl" api:"required"`
// What this batch has done to your credit balance.
Credits BatchGetResponseCredits `json:"credits" api:"required"`
// A failure of the batch as a whole, distinct from the per-page failures in
// `page_errors`.
Failure Failure `json:"failure" api:"required"`
// What each page is returned as. Matches `input.data.format` on the submit
// request.
//
// Any of "markdown", "html".
Format BatchGetResponseFormat `json:"format" api:"required"`
// What submission took in, and what it charged for.
Input Intake `json:"input" api:"required"`
// Rejected URLs, up to 100. These are not charged.
InvalidURLs []BatchGetResponseInvalidURL `json:"invalid_urls" api:"required"`
// How pages were selected. Matches `input.mode` on the submit request.
//
// Any of "scrape", "crawl".
Mode BatchGetResponseMode `json:"mode" api:"required"`
// Individual page failures grouped by error code, sorted by count. Unrelated to
// `failure`, which is the batch itself failing.
PageErrors []PageErrorCount `json:"page_errors" api:"required"`
// Pages attempted so far. Use `status` to check completion.
Progress BatchGetResponseProgress `json:"progress" api:"required"`
// Download links, available once the batch reaches a final status and null before
// then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
Results BatchGetResponseResults `json:"results" api:"required"`
// Current state. `completed`, `cancelled`, and `failed` are final.
//
// Any of "queued", "running", "cancelling", "completed", "cancelled", "failed".
Status BatchGetResponseStatus `json:"status" api:"required"`
// Tags stored on the batch at submission.
Tags []string `json:"tags" api:"required"`
Timing BatchGetResponseTiming `json:"timing" api:"required"`
// API key usage for this request.
KeyMetadata BatchGetResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Crawl respjson.Field
Credits respjson.Field
Failure respjson.Field
Format respjson.Field
Input respjson.Field
InvalidURLs respjson.Field
Mode respjson.Field
PageErrors respjson.Field
Progress respjson.Field
Results respjson.Field
Status respjson.Field
Tags respjson.Field
Timing respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchGetResponse) RawJSON ¶ added in v2.6.0
func (r BatchGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponse) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponse) UnmarshalJSON(data []byte) error
type BatchGetResponseCredits ¶ added in v2.6.0
type BatchGetResponseCredits struct {
// `reserved` minus `refunded` plus `ocr_charged` — what the batch has cost so far.
// Equal to `reserved` until the batch settles.
Net int64 `json:"net" api:"required"`
// Credits charged for PDF pages recovered by OCR (pdf.ocr=true), 1 per recovered
// page, on top of `reserved`. Stays 0 until the batch settles.
OcrCharged int64 `json:"ocr_charged" api:"required"`
// Credits returned for pages that did not succeed. Stays 0 until the batch reaches
// a final status, then settles in one movement.
Refunded int64 `json:"refunded" api:"required"`
// Credits debited from your balance the moment the batch was accepted. This is a
// charge, not a forecast — the whole amount leaves the balance up front.
Reserved int64 `json:"reserved" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Net respjson.Field
OcrCharged respjson.Field
Refunded respjson.Field
Reserved respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What this batch has done to your credit balance.
func (BatchGetResponseCredits) RawJSON ¶ added in v2.6.0
func (r BatchGetResponseCredits) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponseCredits) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponseCredits) UnmarshalJSON(data []byte) error
type BatchGetResponseFormat ¶ added in v2.7.0
type BatchGetResponseFormat string
What each page is returned as. Matches `input.data.format` on the submit request.
const ( BatchGetResponseFormatMarkdown BatchGetResponseFormat = "markdown" BatchGetResponseFormatHTML BatchGetResponseFormat = "html" )
type BatchGetResponseInvalidURL ¶ added in v2.6.0
type BatchGetResponseInvalidURL struct {
// Why it was rejected.
Reason string `json:"reason" api:"required"`
// Rejected URL.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Reason respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchGetResponseInvalidURL) RawJSON ¶ added in v2.6.0
func (r BatchGetResponseInvalidURL) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponseInvalidURL) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponseInvalidURL) UnmarshalJSON(data []byte) error
type BatchGetResponseKeyMetadata ¶ added in v2.6.0
type BatchGetResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
API key usage for this request.
func (BatchGetResponseKeyMetadata) RawJSON ¶ added in v2.6.0
func (r BatchGetResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponseKeyMetadata) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BatchGetResponseMode ¶ added in v2.6.0
type BatchGetResponseMode string
How pages were selected. Matches `input.mode` on the submit request.
const ( BatchGetResponseModeScrape BatchGetResponseMode = "scrape" BatchGetResponseModeCrawl BatchGetResponseMode = "crawl" )
type BatchGetResponseProgress ¶ added in v2.6.0
type BatchGetResponseProgress struct {
// Pages that could not be scraped.
Failed int64 `json:"failed" api:"required"`
// Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it
// never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once
// final, because its unspent budget was never real pages.
Pending int64 `json:"pending" api:"required"`
// Pages scraped successfully.
Succeeded int64 `json:"succeeded" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Failed respjson.Field
Pending respjson.Field
Succeeded respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Pages attempted so far. Use `status` to check completion.
func (BatchGetResponseProgress) RawJSON ¶ added in v2.6.0
func (r BatchGetResponseProgress) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponseProgress) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponseProgress) UnmarshalJSON(data []byte) error
type BatchGetResponseResults ¶ added in v2.6.0
type BatchGetResponseResults struct {
// When the download URLs expire.
ExpiresAt string `json:"expires_at" api:"required"`
// Result files. Order is not guaranteed.
Files []BatchGetResponseResultsFile `json:"files" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ExpiresAt respjson.Field
Files respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
func (BatchGetResponseResults) RawJSON ¶ added in v2.6.0
func (r BatchGetResponseResults) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponseResults) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponseResults) UnmarshalJSON(data []byte) error
type BatchGetResponseResultsFile ¶ added in v2.6.0
type BatchGetResponseResultsFile struct {
// Compressed file size in bytes.
Bytes int64 `json:"bytes" api:"required"`
// Results in this file.
Items int64 `json:"items" api:"required"`
// Temporary URL for a gzipped NDJSON file.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Bytes respjson.Field
Items respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchGetResponseResultsFile) RawJSON ¶ added in v2.6.0
func (r BatchGetResponseResultsFile) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponseResultsFile) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponseResultsFile) UnmarshalJSON(data []byte) error
type BatchGetResponseStatus ¶ added in v2.6.0
type BatchGetResponseStatus string
Current state. `completed`, `cancelled`, and `failed` are final.
const ( BatchGetResponseStatusQueued BatchGetResponseStatus = "queued" BatchGetResponseStatusRunning BatchGetResponseStatus = "running" BatchGetResponseStatusCancelling BatchGetResponseStatus = "cancelling" BatchGetResponseStatusCompleted BatchGetResponseStatus = "completed" BatchGetResponseStatusCancelled BatchGetResponseStatus = "cancelled" BatchGetResponseStatusFailed BatchGetResponseStatus = "failed" )
type BatchGetResponseTiming ¶ added in v2.6.0
type BatchGetResponseTiming struct {
// When processing finished. Null while active.
CompletedAt string `json:"completed_at" api:"required"`
// When the batch was created.
CreatedAt string `json:"created_at" api:"required"`
// When processing started. Null while queued.
StartedAt string `json:"started_at" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CompletedAt respjson.Field
CreatedAt respjson.Field
StartedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchGetResponseTiming) RawJSON ¶ added in v2.6.0
func (r BatchGetResponseTiming) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResponseTiming) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResponseTiming) UnmarshalJSON(data []byte) error
type BatchGetResultsParams ¶ added in v2.6.0
type BatchGetResultsParams struct {
// next_cursor from the previous page.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Records per page. Defaults to 25. A page can close early so its payload stays
// under ~8 MB; rely on next_cursor rather than counting records.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BatchGetResultsParams) URLQuery ¶ added in v2.6.0
func (r BatchGetResultsParams) URLQuery() (v url.Values, err error)
URLQuery serializes BatchGetResultsParams's query parameters as `url.Values`.
type BatchGetResultsResponse ¶ added in v2.6.0
type BatchGetResultsResponse struct {
// Result records on this page.
Data []BatchGetResultsResponseDataUnion `json:"data"`
// Whether another page is available.
HasMore bool `json:"has_more"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata BatchGetResultsResponseKeyMetadata `json:"key_metadata"`
// Cursor for the next page.
NextCursor string `json:"next_cursor" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
KeyMetadata respjson.Field
NextCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchGetResultsResponse) RawJSON ¶ added in v2.6.0
func (r BatchGetResultsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponse) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponse) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataError ¶ added in v2.6.0
type BatchGetResultsResponseDataError struct {
// Why the page failed.
ErrorCode string `json:"error_code" api:"required"`
// Human-readable failure detail.
Message string `json:"message" api:"required"`
// The page could not be scraped.
Status constant.Error `json:"status" default:"error"`
// URL as submitted, or as discovered by the crawl.
URL string `json:"url" api:"required"`
// Caller-supplied identifier echoed from submission.
ItemID string `json:"itemId"`
// Caller-supplied metadata echoed from submission.
Meta map[string]any `json:"meta"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ErrorCode respjson.Field
Message respjson.Field
Status respjson.Field
URL respjson.Field
ItemID respjson.Field
Meta respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A page the batch could not fetch.
func (BatchGetResultsResponseDataError) RawJSON ¶ added in v2.6.0
func (r BatchGetResultsResponseDataError) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataError) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataError) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataOk ¶ added in v2.6.0
type BatchGetResultsResponseDataOk struct {
// URL the content was read from, after redirects.
FinalURL string `json:"final_url" api:"required"`
// HTTP status of the final response, when known.
HTTPStatus int64 `json:"http_status" api:"required"`
// Metadata extracted from the scraped page HTML.
Metadata BatchGetResultsResponseDataOkMetadata `json:"metadata" api:"required"`
// The page was scraped.
Status constant.Ok `json:"status" default:"ok"`
// URL as submitted, or as discovered by the crawl.
URL string `json:"url" api:"required"`
// Page HTML. Present on html batches, and on markdown batches submitted with
// `options.includeHTML`.
HTML string `json:"html"`
// Caller-supplied identifier echoed from submission.
ItemID string `json:"itemId"`
// Page content as Markdown. Present on markdown batches.
Markdown string `json:"markdown"`
// Caller-supplied metadata echoed from submission.
Meta map[string]any `json:"meta"`
// PDF pages of this document recovered by OCR (pdf.ocr=true). Each recovered page
// bills 1 credit on top of the page base credit; absent when no OCR ran.
OcrPages int64 `json:"ocr_pages"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FinalURL respjson.Field
HTTPStatus respjson.Field
Metadata respjson.Field
Status respjson.Field
URL respjson.Field
HTML respjson.Field
ItemID respjson.Field
Markdown respjson.Field
Meta respjson.Field
OcrPages respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A page the batch fetched successfully.
func (BatchGetResultsResponseDataOk) RawJSON ¶ added in v2.6.0
func (r BatchGetResultsResponseDataOk) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataOk) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataOk) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataOkMetadata ¶ added in v2.6.0
type BatchGetResultsResponseDataOkMetadata struct {
// Final URL scraped after redirects or scraper fallback, when known. Falls back to
// sourceUrl when unavailable.
FinalURL string `json:"finalUrl" api:"required"`
// Original URL requested by the caller.
SourceURL string `json:"sourceUrl" api:"required"`
// Additional non-social meta tags not promoted to top-level metadata fields.
AdditionalMeta map[string]BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion `json:"additionalMeta"`
// Resolved alternate links from link rel=alternate tags.
Alternates []BatchGetResultsResponseDataOkMetadataAlternate `json:"alternates"`
// Author metadata, when present.
Author string `json:"author"`
// Resolved canonical URL, when present.
CanonicalURL string `json:"canonicalUrl"`
// Best description extracted from standard, Open Graph, or Twitter metadata.
Description string `json:"description"`
// Resolved favicon URL, when present.
Favicon string `json:"favicon"`
// Page headings (h1–h6) in document order, extracted from the unfiltered document.
// Capped at the first 500 headings. Omitted when the page has none.
Headings []BatchGetResultsResponseDataOkMetadataHeading `json:"headings"`
// Primary resolved preview image from Open Graph, Twitter, or image metadata.
Image string `json:"image"`
// JSON-LD structured data blocks parsed from the page.
JsonLd []map[string]any `json:"jsonLd"`
// Keywords extracted from the page's keywords meta tag.
Keywords []string `json:"keywords"`
// Language extracted from html lang or language meta tags.
Language string `json:"language"`
// Modified timestamp/date from page metadata, when present.
ModifiedTime string `json:"modifiedTime"`
// Open Graph metadata with the og: prefix removed and keys camel-cased.
OpenGraph map[string]BatchGetResultsResponseDataOkMetadataOpenGraphUnion `json:"openGraph"`
// Published timestamp/date from page metadata, when present.
PublishedTime string `json:"publishedTime"`
// Robots meta directive, when present.
Robots string `json:"robots"`
// Site or application name from page metadata.
SiteName string `json:"siteName"`
// Best title extracted from the page.
Title string `json:"title"`
// Twitter card metadata with the twitter: prefix removed and keys camel-cased.
Twitter map[string]BatchGetResultsResponseDataOkMetadataTwitterUnion `json:"twitter"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FinalURL respjson.Field
SourceURL respjson.Field
AdditionalMeta respjson.Field
Alternates respjson.Field
Author respjson.Field
CanonicalURL respjson.Field
Description respjson.Field
Favicon respjson.Field
Headings respjson.Field
Image respjson.Field
JsonLd respjson.Field
Keywords respjson.Field
Language respjson.Field
ModifiedTime respjson.Field
OpenGraph respjson.Field
PublishedTime respjson.Field
Robots respjson.Field
SiteName respjson.Field
Title respjson.Field
Twitter respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata extracted from the scraped page HTML.
func (BatchGetResultsResponseDataOkMetadata) RawJSON ¶ added in v2.6.0
func (r BatchGetResultsResponseDataOkMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataOkMetadata) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataOkMetadata) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion ¶ added in v2.6.0
type BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) AsString ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) AsString() (v string)
func (BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) AsStringArray ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) AsStringArray() (v []string)
func (BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) RawJSON ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataOkMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataOkMetadataAlternate ¶ added in v2.6.0
type BatchGetResultsResponseDataOkMetadataAlternate struct {
// Resolved alternate URL.
Href string `json:"href" api:"required"`
// Language or locale for the alternate URL, when present.
Hreflang string `json:"hreflang"`
// Alternate resource title, when present.
Title string `json:"title"`
// Alternate resource MIME type, when present.
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Href respjson.Field
Hreflang respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchGetResultsResponseDataOkMetadataAlternate) RawJSON ¶ added in v2.6.0
func (r BatchGetResultsResponseDataOkMetadataAlternate) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataOkMetadataAlternate) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataOkMetadataAlternate) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataOkMetadataHeading ¶ added in v2.10.0
type BatchGetResultsResponseDataOkMetadataHeading struct {
// Heading level, 1–6 (from h1–h6).
Level int64 `json:"level" api:"required"`
// Heading text with whitespace collapsed, truncated to 1000 characters.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Level respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchGetResultsResponseDataOkMetadataHeading) RawJSON ¶ added in v2.10.0
func (r BatchGetResultsResponseDataOkMetadataHeading) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataOkMetadataHeading) UnmarshalJSON ¶ added in v2.10.0
func (r *BatchGetResultsResponseDataOkMetadataHeading) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataOkMetadataOpenGraphUnion ¶ added in v2.6.0
type BatchGetResultsResponseDataOkMetadataOpenGraphUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BatchGetResultsResponseDataOkMetadataOpenGraphUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (BatchGetResultsResponseDataOkMetadataOpenGraphUnion) AsString ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataOpenGraphUnion) AsString() (v string)
func (BatchGetResultsResponseDataOkMetadataOpenGraphUnion) AsStringArray ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataOpenGraphUnion) AsStringArray() (v []string)
func (BatchGetResultsResponseDataOkMetadataOpenGraphUnion) RawJSON ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataOpenGraphUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataOkMetadataOpenGraphUnion) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataOkMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataOkMetadataTwitterUnion ¶ added in v2.6.0
type BatchGetResultsResponseDataOkMetadataTwitterUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BatchGetResultsResponseDataOkMetadataTwitterUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (BatchGetResultsResponseDataOkMetadataTwitterUnion) AsString ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataTwitterUnion) AsString() (v string)
func (BatchGetResultsResponseDataOkMetadataTwitterUnion) AsStringArray ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataTwitterUnion) AsStringArray() (v []string)
func (BatchGetResultsResponseDataOkMetadataTwitterUnion) RawJSON ¶ added in v2.6.0
func (u BatchGetResultsResponseDataOkMetadataTwitterUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataOkMetadataTwitterUnion) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataOkMetadataTwitterUnion) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseDataUnion ¶ added in v2.6.0
type BatchGetResultsResponseDataUnion struct {
// This field is from variant [BatchGetResultsResponseDataOk].
FinalURL string `json:"final_url"`
// This field is from variant [BatchGetResultsResponseDataOk].
HTTPStatus int64 `json:"http_status"`
// This field is from variant [BatchGetResultsResponseDataOk].
Metadata BatchGetResultsResponseDataOkMetadata `json:"metadata"`
// Any of "ok", "error".
Status string `json:"status"`
URL string `json:"url"`
// This field is from variant [BatchGetResultsResponseDataOk].
HTML string `json:"html"`
ItemID string `json:"itemId"`
// This field is from variant [BatchGetResultsResponseDataOk].
Markdown string `json:"markdown"`
Meta any `json:"meta"`
// This field is from variant [BatchGetResultsResponseDataOk].
OcrPages int64 `json:"ocr_pages"`
// This field is from variant [BatchGetResultsResponseDataError].
ErrorCode string `json:"error_code"`
// This field is from variant [BatchGetResultsResponseDataError].
Message string `json:"message"`
JSON struct {
FinalURL respjson.Field
HTTPStatus respjson.Field
Metadata respjson.Field
Status respjson.Field
URL respjson.Field
HTML respjson.Field
ItemID respjson.Field
Markdown respjson.Field
Meta respjson.Field
OcrPages respjson.Field
ErrorCode respjson.Field
Message respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
BatchGetResultsResponseDataUnion contains all possible properties and values from BatchGetResultsResponseDataOk, BatchGetResultsResponseDataError.
Use the BatchGetResultsResponseDataUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (BatchGetResultsResponseDataUnion) AsAny ¶ added in v2.6.0
func (u BatchGetResultsResponseDataUnion) AsAny() anyBatchGetResultsResponseData
Use the following switch statement to find the correct variant
switch variant := BatchGetResultsResponseDataUnion.AsAny().(type) {
case contextdev.BatchGetResultsResponseDataOk:
case contextdev.BatchGetResultsResponseDataError:
default:
fmt.Errorf("no variant present")
}
func (BatchGetResultsResponseDataUnion) AsError ¶ added in v2.6.0
func (u BatchGetResultsResponseDataUnion) AsError() (v BatchGetResultsResponseDataError)
func (BatchGetResultsResponseDataUnion) AsOk ¶ added in v2.6.0
func (u BatchGetResultsResponseDataUnion) AsOk() (v BatchGetResultsResponseDataOk)
func (BatchGetResultsResponseDataUnion) RawJSON ¶ added in v2.6.0
func (u BatchGetResultsResponseDataUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseDataUnion) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseDataUnion) UnmarshalJSON(data []byte) error
type BatchGetResultsResponseKeyMetadata ¶ added in v2.6.0
type BatchGetResultsResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (BatchGetResultsResponseKeyMetadata) RawJSON ¶ added in v2.6.0
func (r BatchGetResultsResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchGetResultsResponseKeyMetadata) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchGetResultsResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BatchListParams ¶ added in v2.6.0
type BatchListParams struct {
// Cursor from the previous page.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Batches per page. Defaults to 25.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Free-text search term, matched against the batch id, crawl source (start URL or
// sitemap domain), and tags.
Q param.Opt[string] `query:"q,omitzero" json:"-"`
// Comma-separated list of tags to filter by (matches batches having any of them).
Tags param.Opt[string] `query:"tags,omitzero" json:"-"`
// `prefix` for as-you-type prefix matching (default), `exact` for full-token
// matching.
//
// Any of "exact", "prefix".
SearchType BatchListParamsSearchType `query:"search_type,omitzero" json:"-"`
// Filter by status.
//
// Any of "queued", "running", "cancelling", "completed", "cancelled", "failed".
Status BatchListParamsStatus `query:"status,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BatchListParams) URLQuery ¶ added in v2.6.0
func (r BatchListParams) URLQuery() (v url.Values, err error)
URLQuery serializes BatchListParams's query parameters as `url.Values`.
type BatchListParamsSearchType ¶ added in v2.6.0
type BatchListParamsSearchType string
`prefix` for as-you-type prefix matching (default), `exact` for full-token matching.
const ( BatchListParamsSearchTypeExact BatchListParamsSearchType = "exact" BatchListParamsSearchTypePrefix BatchListParamsSearchType = "prefix" )
type BatchListParamsStatus ¶ added in v2.6.0
type BatchListParamsStatus string
Filter by status.
const ( BatchListParamsStatusQueued BatchListParamsStatus = "queued" BatchListParamsStatusRunning BatchListParamsStatus = "running" BatchListParamsStatusCancelling BatchListParamsStatus = "cancelling" BatchListParamsStatusCompleted BatchListParamsStatus = "completed" BatchListParamsStatusCancelled BatchListParamsStatus = "cancelled" BatchListParamsStatusFailed BatchListParamsStatus = "failed" )
type BatchListResponse ¶ added in v2.6.0
type BatchListResponse struct {
// Batches on this page.
Data []BatchListResponseData `json:"data"`
// Whether another page is available.
HasMore bool `json:"has_more"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata BatchListResponseKeyMetadata `json:"key_metadata"`
// Cursor for the next page.
NextCursor string `json:"next_cursor" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
KeyMetadata respjson.Field
NextCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchListResponse) RawJSON ¶ added in v2.6.0
func (r BatchListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponse) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponse) UnmarshalJSON(data []byte) error
type BatchListResponseData ¶ added in v2.6.0
type BatchListResponseData struct {
// Batch ID used to retrieve or cancel the job.
ID string `json:"id" api:"required"`
// The crawl controls as submitted, so the limits requested can be compared against
// what the crawl reached.
Crawl CrawlControls `json:"crawl" api:"required"`
// What this batch has done to your credit balance.
Credits BatchListResponseDataCredits `json:"credits" api:"required"`
// A failure of the batch as a whole, distinct from the per-page failures in
// `page_errors`.
Failure Failure `json:"failure" api:"required"`
// What each page is returned as. Matches `input.data.format` on the submit
// request.
//
// Any of "markdown", "html".
Format string `json:"format" api:"required"`
// What submission took in, and what it charged for.
Input Intake `json:"input" api:"required"`
// How pages were selected. Matches `input.mode` on the submit request.
//
// Any of "scrape", "crawl".
Mode string `json:"mode" api:"required"`
// Individual page failures grouped by error code, sorted by count. Unrelated to
// `failure`, which is the batch itself failing.
PageErrors []PageErrorCount `json:"page_errors" api:"required"`
// Pages attempted so far. Use `status` to check completion.
Progress BatchListResponseDataProgress `json:"progress" api:"required"`
// Download links, available once the batch reaches a final status and null before
// then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
Results BatchListResponseDataResults `json:"results" api:"required"`
// Current state. `completed`, `cancelled`, and `failed` are final.
//
// Any of "queued", "running", "cancelling", "completed", "cancelled", "failed".
Status string `json:"status" api:"required"`
// Tags stored on the batch at submission.
Tags []string `json:"tags" api:"required"`
Timing BatchListResponseDataTiming `json:"timing" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Crawl respjson.Field
Credits respjson.Field
Failure respjson.Field
Format respjson.Field
Input respjson.Field
Mode respjson.Field
PageErrors respjson.Field
Progress respjson.Field
Results respjson.Field
Status respjson.Field
Tags respjson.Field
Timing respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An asynchronous web scraping job.
func (BatchListResponseData) RawJSON ¶ added in v2.6.0
func (r BatchListResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponseData) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponseData) UnmarshalJSON(data []byte) error
type BatchListResponseDataCredits ¶ added in v2.6.0
type BatchListResponseDataCredits struct {
// `reserved` minus `refunded` plus `ocr_charged` — what the batch has cost so far.
// Equal to `reserved` until the batch settles.
Net int64 `json:"net" api:"required"`
// Credits charged for PDF pages recovered by OCR (pdf.ocr=true), 1 per recovered
// page, on top of `reserved`. Stays 0 until the batch settles.
OcrCharged int64 `json:"ocr_charged" api:"required"`
// Credits returned for pages that did not succeed. Stays 0 until the batch reaches
// a final status, then settles in one movement.
Refunded int64 `json:"refunded" api:"required"`
// Credits debited from your balance the moment the batch was accepted. This is a
// charge, not a forecast — the whole amount leaves the balance up front.
Reserved int64 `json:"reserved" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Net respjson.Field
OcrCharged respjson.Field
Refunded respjson.Field
Reserved respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What this batch has done to your credit balance.
func (BatchListResponseDataCredits) RawJSON ¶ added in v2.6.0
func (r BatchListResponseDataCredits) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponseDataCredits) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponseDataCredits) UnmarshalJSON(data []byte) error
type BatchListResponseDataProgress ¶ added in v2.6.0
type BatchListResponseDataProgress struct {
// Pages that could not be scraped.
Failed int64 `json:"failed" api:"required"`
// Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it
// never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once
// final, because its unspent budget was never real pages.
Pending int64 `json:"pending" api:"required"`
// Pages scraped successfully.
Succeeded int64 `json:"succeeded" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Failed respjson.Field
Pending respjson.Field
Succeeded respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Pages attempted so far. Use `status` to check completion.
func (BatchListResponseDataProgress) RawJSON ¶ added in v2.6.0
func (r BatchListResponseDataProgress) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponseDataProgress) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponseDataProgress) UnmarshalJSON(data []byte) error
type BatchListResponseDataResults ¶ added in v2.6.0
type BatchListResponseDataResults struct {
// When the download URLs expire.
ExpiresAt string `json:"expires_at" api:"required"`
// Result files. Order is not guaranteed.
Files []BatchListResponseDataResultsFile `json:"files" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ExpiresAt respjson.Field
Files respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON.
func (BatchListResponseDataResults) RawJSON ¶ added in v2.6.0
func (r BatchListResponseDataResults) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponseDataResults) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponseDataResults) UnmarshalJSON(data []byte) error
type BatchListResponseDataResultsFile ¶ added in v2.6.0
type BatchListResponseDataResultsFile struct {
// Compressed file size in bytes.
Bytes int64 `json:"bytes" api:"required"`
// Results in this file.
Items int64 `json:"items" api:"required"`
// Temporary URL for a gzipped NDJSON file.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Bytes respjson.Field
Items respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchListResponseDataResultsFile) RawJSON ¶ added in v2.6.0
func (r BatchListResponseDataResultsFile) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponseDataResultsFile) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponseDataResultsFile) UnmarshalJSON(data []byte) error
type BatchListResponseDataTiming ¶ added in v2.6.0
type BatchListResponseDataTiming struct {
// When processing finished. Null while active.
CompletedAt string `json:"completed_at" api:"required"`
// When the batch was created.
CreatedAt string `json:"created_at" api:"required"`
// When processing started. Null while queued.
StartedAt string `json:"started_at" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CompletedAt respjson.Field
CreatedAt respjson.Field
StartedAt respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchListResponseDataTiming) RawJSON ¶ added in v2.6.0
func (r BatchListResponseDataTiming) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponseDataTiming) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponseDataTiming) UnmarshalJSON(data []byte) error
type BatchListResponseKeyMetadata ¶ added in v2.6.0
type BatchListResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (BatchListResponseKeyMetadata) RawJSON ¶ added in v2.6.0
func (r BatchListResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchListResponseKeyMetadata) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchListResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BatchService ¶ added in v2.6.0
type BatchService struct {
// contains filtered or unexported fields
}
Scrape many pages or crawl a site asynchronously.
BatchService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBatchService method instead.
func NewBatchService ¶ added in v2.6.0
func NewBatchService(opts ...option.RequestOption) (r BatchService)
NewBatchService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BatchService) Cancel ¶ added in v2.6.0
func (r *BatchService) Cancel(ctx context.Context, batchID string, opts ...option.RequestOption) (res *BatchCancelResponse, err error)
Stop a batch from starting new pages. In-progress pages finish, and unused credits are refunded.
func (*BatchService) Delete ¶ added in v2.9.0
func (r *BatchService) Delete(ctx context.Context, batchID string, opts ...option.RequestOption) (res *BatchDeleteResponse, err error)
Permanently delete a finished batch and its stored results. Active batches must settle first.
func (*BatchService) Get ¶ added in v2.6.0
func (r *BatchService) Get(ctx context.Context, batchID string, opts ...option.RequestOption) (res *BatchGetResponse, err error)
Check progress, and get download links once the batch finishes.
func (*BatchService) GetResults ¶ added in v2.6.0
func (r *BatchService) GetResults(ctx context.Context, batchID string, query BatchGetResultsParams, opts ...option.RequestOption) (res *BatchGetResultsResponse, err error)
Page through a finished batch's results as JSON instead of downloading the NDJSON files.
func (*BatchService) List ¶ added in v2.6.0
func (r *BatchService) List(ctx context.Context, query BatchListParams, opts ...option.RequestOption) (res *BatchListResponse, err error)
List your batches from newest to oldest. Filter by status or continue with a cursor.
func (*BatchService) Submit ¶ added in v2.6.0
func (r *BatchService) Submit(ctx context.Context, params BatchSubmitParams, opts ...option.RequestOption) (res *BatchSubmitResponse, err error)
Scrape 25K URLs or crawl large websites asynchronously.
type BatchSubmitParams ¶ added in v2.6.0
type BatchSubmitParams struct {
// Choose a URL list or a site crawl.
Input BatchSubmitParamsInputUnion `json:"input,omitzero" api:"required"`
// URL notified when the batch finishes.
WebhookURL param.Opt[string] `json:"webhookUrl,omitzero"`
// Any string unique to this submission. Retries with the same key return the
// original batch.
IdempotencyKey param.Opt[string] `header:"Idempotency-Key,omitzero" json:"-"`
// Tags stored on the batch. Filter the batch list by them later.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (BatchSubmitParams) MarshalJSON ¶ added in v2.6.0
func (r BatchSubmitParams) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParams) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchSubmitParams) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawl ¶ added in v2.9.0
type BatchSubmitParamsInputCrawl struct {
// Crawl source and output format.
Data BatchSubmitParamsInputCrawlDataUnion `json:"data,omitzero" api:"required"`
// Discover and scrape pages from `data.source`.
//
// This field can be elided, and will marshal its zero value as "crawl".
Mode constant.Crawl `json:"mode" default:"crawl"`
// contains filtered or unexported fields
}
Crawl pages starting from a URL or from a domain's sitemap.
The properties Data, Mode are required.
func (BatchSubmitParamsInputCrawl) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawl) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawl) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawl) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTML ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTML struct {
// How to find pages to crawl.
Source BatchSubmitParamsInputCrawlDataHTMLSourceUnion `json:"source,omitzero" api:"required"`
// Options for HTML output.
Options BatchSubmitParamsInputCrawlDataHTMLOptions `json:"options,omitzero"`
// Return page content as HTML.
//
// This field can be elided, and will marshal its zero value as "html".
Format constant.HTML `json:"format" default:"html"`
// contains filtered or unexported fields
}
Crawl pages and return HTML.
The properties Format, Source are required.
func (BatchSubmitParamsInputCrawlDataHTML) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataHTML) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataHTML) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataHTML) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTMLOptions ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTMLOptions struct {
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Wait briefly for CSS and transition animations to settle before extraction, on
// pages that render in a browser.
SettleAnimations param.Opt[bool] `json:"settleAnimations,omitzero"`
// Return the main content without navigation or footers.
UseMainContentOnly param.Opt[bool] `json:"useMainContentOnly,omitzero"`
// How long to wait after initial page load, in milliseconds. `0` waits 500 ms.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
// Remove elements matching these CSS selectors. Applied after `includeSelectors`,
// so an element matching both is removed.
ExcludeSelectors []string `json:"excludeSelectors,omitzero"`
// Keep only the subtrees matching these CSS selectors. Filtered pages are always
// fetched fresh, ignoring `maxAgeMs`.
IncludeSelectors []string `json:"includeSelectors,omitzero"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country string `json:"country,omitzero"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf BatchSubmitParamsInputCrawlDataHTMLOptionsPdf `json:"pdf,omitzero"`
// contains filtered or unexported fields
}
Options for HTML output.
func (BatchSubmitParamsInputCrawlDataHTMLOptions) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataHTMLOptions) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataHTMLOptions) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataHTMLOptions) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTMLOptionsPdf ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTMLOptionsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `json:"end,omitzero"`
// When true, OCR the selected PDF pages that have no usable text layer (scans),
// replacing each recovered page's text with the OCR result while pages with a real
// text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
// of the base request cost. When false, no OCR runs.
Ocr param.Opt[bool] `json:"ocr,omitzero"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 PDF_SKIPPED is returned.
ShouldParse param.Opt[bool] `json:"shouldParse,omitzero"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `json:"start,omitzero"`
// contains filtered or unexported fields
}
PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
func (BatchSubmitParamsInputCrawlDataHTMLOptionsPdf) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataHTMLOptionsPdf) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataHTMLOptionsPdf) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataHTMLOptionsPdf) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTMLSourceSitemap ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTMLSourceSitemap struct {
// Domain whose sitemap lists the pages to scrape. A full URL is reduced to its
// domain.
Domain string `json:"domain" api:"required"`
// Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those
// URLs and never follows links off them, so there is no crawl depth here.
Controls BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls `json:"controls,omitzero"`
// Scrape the URLs in the domain's sitemap.
//
// This field can be elided, and will marshal its zero value as "sitemap".
Type constant.Sitemap `json:"type" default:"sitemap"`
// contains filtered or unexported fields
}
Scrape the pages listed in a domain's sitemap. Links on those pages are not followed.
The properties Domain, Type are required.
func (BatchSubmitParamsInputCrawlDataHTMLSourceSitemap) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataHTMLSourceSitemap) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataHTMLSourceSitemap) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataHTMLSourceSitemap) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls struct {
// Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000.
MaxURLs param.Opt[int64] `json:"maxUrls,omitzero"`
// RE2 pattern; only sitemap URLs matching it are scraped.
Regex param.Opt[string] `json:"regex,omitzero"`
// contains filtered or unexported fields
}
Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those URLs and never follows links off them, so there is no crawl depth here.
func (BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataHTMLSourceSitemapControls) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTMLSourceStartURL ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTMLSourceStartURL struct {
// Page where crawling begins. A URL without a scheme is read as https://.
URL string `json:"url" api:"required"`
// Limits and filters for page discovery.
Controls BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls `json:"controls,omitzero"`
// Start from one page.
//
// This field can be elided, and will marshal its zero value as "start_url".
Type constant.StartURL `json:"type" default:"start_url"`
// contains filtered or unexported fields
}
Discover pages by following links from one URL.
The properties Type, URL are required.
func (BatchSubmitParamsInputCrawlDataHTMLSourceStartURL) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataHTMLSourceStartURL) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataHTMLSourceStartURL) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataHTMLSourceStartURL) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls struct {
// Follow links to subdomains.
FollowSubdomains param.Opt[bool] `json:"followSubdomains,omitzero"`
// Maximum link depth. Source pages are depth 0. No limit when omitted.
MaxDepth param.Opt[int64] `json:"maxDepth,omitzero"`
// Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000.
MaxURLs param.Opt[int64] `json:"maxUrls,omitzero"`
// RE2 pattern for URLs to include. The `start_url` itself is always included.
Regex param.Opt[string] `json:"regex,omitzero"`
// contains filtered or unexported fields
}
Limits and filters for page discovery.
func (BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataHTMLSourceStartURLControls) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataHTMLSourceUnion ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataHTMLSourceUnion struct {
OfStartURL *BatchSubmitParamsInputCrawlDataHTMLSourceStartURL `json:",omitzero,inline"`
OfSitemap *BatchSubmitParamsInputCrawlDataHTMLSourceSitemap `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BatchSubmitParamsInputCrawlDataHTMLSourceUnion) MarshalJSON ¶ added in v2.9.0
func (u BatchSubmitParamsInputCrawlDataHTMLSourceUnion) MarshalJSON() ([]byte, error)
func (*BatchSubmitParamsInputCrawlDataHTMLSourceUnion) UnmarshalJSON ¶ added in v2.9.0
func (u *BatchSubmitParamsInputCrawlDataHTMLSourceUnion) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdown ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdown struct {
// How to find pages to crawl.
Source BatchSubmitParamsInputCrawlDataMarkdownSourceUnion `json:"source,omitzero" api:"required"`
// Options for Markdown output.
Options BatchSubmitParamsInputCrawlDataMarkdownOptions `json:"options,omitzero"`
// Return page content as Markdown.
//
// This field can be elided, and will marshal its zero value as "markdown".
Format constant.Markdown `json:"format" default:"markdown"`
// contains filtered or unexported fields
}
Crawl pages and return Markdown.
The properties Format, Source are required.
func (BatchSubmitParamsInputCrawlDataMarkdown) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataMarkdown) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataMarkdown) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataMarkdown) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdownOptions ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdownOptions struct {
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Also include each page's HTML in its result record, as an `html` field alongside
// the Markdown.
IncludeHTML param.Opt[bool] `json:"includeHTML,omitzero"`
// Include image references in the Markdown.
IncludeImages param.Opt[bool] `json:"includeImages,omitzero"`
// Include links in the Markdown.
IncludeLinks param.Opt[bool] `json:"includeLinks,omitzero"`
// Wait briefly for CSS and transition animations to settle before extraction, on
// pages that render in a browser.
SettleAnimations param.Opt[bool] `json:"settleAnimations,omitzero"`
// Shorten inline base64 image data.
ShortenBase64Images param.Opt[bool] `json:"shortenBase64Images,omitzero"`
// Return the main content without navigation or footers.
UseMainContentOnly param.Opt[bool] `json:"useMainContentOnly,omitzero"`
// How long to wait after initial page load, in milliseconds. `0` waits 500 ms.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
// Remove elements matching these CSS selectors. Applied after `includeSelectors`,
// so an element matching both is removed.
ExcludeSelectors []string `json:"excludeSelectors,omitzero"`
// Keep only the subtrees matching these CSS selectors. Filtered pages are always
// fetched fresh, ignoring `maxAgeMs`.
IncludeSelectors []string `json:"includeSelectors,omitzero"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country string `json:"country,omitzero"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf `json:"pdf,omitzero"`
// contains filtered or unexported fields
}
Options for Markdown output.
func (BatchSubmitParamsInputCrawlDataMarkdownOptions) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataMarkdownOptions) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataMarkdownOptions) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataMarkdownOptions) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `json:"end,omitzero"`
// When true, OCR the selected PDF pages that have no usable text layer (scans),
// replacing each recovered page's text with the OCR result while pages with a real
// text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
// of the base request cost. When false, no OCR runs.
Ocr param.Opt[bool] `json:"ocr,omitzero"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 PDF_SKIPPED is returned.
ShouldParse param.Opt[bool] `json:"shouldParse,omitzero"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `json:"start,omitzero"`
// contains filtered or unexported fields
}
PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
func (BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataMarkdownOptionsPdf) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap struct {
// Domain whose sitemap lists the pages to scrape. A full URL is reduced to its
// domain.
Domain string `json:"domain" api:"required"`
// Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those
// URLs and never follows links off them, so there is no crawl depth here.
Controls BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls `json:"controls,omitzero"`
// Scrape the URLs in the domain's sitemap.
//
// This field can be elided, and will marshal its zero value as "sitemap".
Type constant.Sitemap `json:"type" default:"sitemap"`
// contains filtered or unexported fields
}
Scrape the pages listed in a domain's sitemap. Links on those pages are not followed.
The properties Domain, Type are required.
func (BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls struct {
// Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000.
MaxURLs param.Opt[int64] `json:"maxUrls,omitzero"`
// RE2 pattern; only sitemap URLs matching it are scraped.
Regex param.Opt[string] `json:"regex,omitzero"`
// contains filtered or unexported fields
}
Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those URLs and never follows links off them, so there is no crawl depth here.
func (BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataMarkdownSourceSitemapControls) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL struct {
// Page where crawling begins. A URL without a scheme is read as https://.
URL string `json:"url" api:"required"`
// Limits and filters for page discovery.
Controls BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls `json:"controls,omitzero"`
// Start from one page.
//
// This field can be elided, and will marshal its zero value as "start_url".
Type constant.StartURL `json:"type" default:"start_url"`
// contains filtered or unexported fields
}
Discover pages by following links from one URL.
The properties Type, URL are required.
func (BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls struct {
// Follow links to subdomains.
FollowSubdomains param.Opt[bool] `json:"followSubdomains,omitzero"`
// Maximum link depth. Source pages are depth 0. No limit when omitted.
MaxDepth param.Opt[int64] `json:"maxDepth,omitzero"`
// Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000.
MaxURLs param.Opt[int64] `json:"maxUrls,omitzero"`
// RE2 pattern for URLs to include. The `start_url` itself is always included.
Regex param.Opt[string] `json:"regex,omitzero"`
// contains filtered or unexported fields
}
Limits and filters for page discovery.
func (BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputCrawlDataMarkdownSourceStartURLControls) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataMarkdownSourceUnion ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataMarkdownSourceUnion struct {
OfStartURL *BatchSubmitParamsInputCrawlDataMarkdownSourceStartURL `json:",omitzero,inline"`
OfSitemap *BatchSubmitParamsInputCrawlDataMarkdownSourceSitemap `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BatchSubmitParamsInputCrawlDataMarkdownSourceUnion) MarshalJSON ¶ added in v2.9.0
func (u BatchSubmitParamsInputCrawlDataMarkdownSourceUnion) MarshalJSON() ([]byte, error)
func (*BatchSubmitParamsInputCrawlDataMarkdownSourceUnion) UnmarshalJSON ¶ added in v2.9.0
func (u *BatchSubmitParamsInputCrawlDataMarkdownSourceUnion) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputCrawlDataUnion ¶ added in v2.9.0
type BatchSubmitParamsInputCrawlDataUnion struct {
OfMarkdown *BatchSubmitParamsInputCrawlDataMarkdown `json:",omitzero,inline"`
OfHTML *BatchSubmitParamsInputCrawlDataHTML `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BatchSubmitParamsInputCrawlDataUnion) MarshalJSON ¶ added in v2.9.0
func (u BatchSubmitParamsInputCrawlDataUnion) MarshalJSON() ([]byte, error)
func (*BatchSubmitParamsInputCrawlDataUnion) UnmarshalJSON ¶ added in v2.9.0
func (u *BatchSubmitParamsInputCrawlDataUnion) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrape ¶ added in v2.9.0
type BatchSubmitParamsInputScrape struct {
// Pages to scrape and their output format.
Data BatchSubmitParamsInputScrapeDataUnion `json:"data,omitzero" api:"required"`
// Scrape the pages in `data.urls`.
//
// This field can be elided, and will marshal its zero value as "scrape".
Mode constant.Scrape `json:"mode" default:"scrape"`
// contains filtered or unexported fields
}
Scrape up to 25K URLs in one batch.
The properties Data, Mode are required.
func (BatchSubmitParamsInputScrape) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrape) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrape) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrape) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataHTML ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataHTML struct {
// Pages to scrape. Maximum 25000.
URLs []BatchSubmitParamsInputScrapeDataHTMLURL `json:"urls,omitzero" api:"required"`
// Options for HTML output.
Options BatchSubmitParamsInputScrapeDataHTMLOptions `json:"options,omitzero"`
// Return page content as HTML.
//
// This field can be elided, and will marshal its zero value as "html".
Format constant.HTML `json:"format" default:"html"`
// contains filtered or unexported fields
}
Scrape the listed pages as HTML.
The properties Format, URLs are required.
func (BatchSubmitParamsInputScrapeDataHTML) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataHTML) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataHTML) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataHTML) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataHTMLOptions ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataHTMLOptions struct {
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Wait briefly for CSS and transition animations to settle before extraction, on
// pages that render in a browser.
SettleAnimations param.Opt[bool] `json:"settleAnimations,omitzero"`
// Return the main content without navigation or footers.
UseMainContentOnly param.Opt[bool] `json:"useMainContentOnly,omitzero"`
// How long to wait after initial page load, in milliseconds. `0` waits 500 ms.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
// Remove elements matching these CSS selectors. Applied after `includeSelectors`,
// so an element matching both is removed.
ExcludeSelectors []string `json:"excludeSelectors,omitzero"`
// Keep only the subtrees matching these CSS selectors. Filtered pages are always
// fetched fresh, ignoring `maxAgeMs`.
IncludeSelectors []string `json:"includeSelectors,omitzero"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country string `json:"country,omitzero"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf BatchSubmitParamsInputScrapeDataHTMLOptionsPdf `json:"pdf,omitzero"`
// contains filtered or unexported fields
}
Options for HTML output.
func (BatchSubmitParamsInputScrapeDataHTMLOptions) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataHTMLOptions) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataHTMLOptions) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataHTMLOptions) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataHTMLOptionsPdf ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataHTMLOptionsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `json:"end,omitzero"`
// When true, OCR the selected PDF pages that have no usable text layer (scans),
// replacing each recovered page's text with the OCR result while pages with a real
// text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
// of the base request cost. When false, no OCR runs.
Ocr param.Opt[bool] `json:"ocr,omitzero"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 PDF_SKIPPED is returned.
ShouldParse param.Opt[bool] `json:"shouldParse,omitzero"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `json:"start,omitzero"`
// contains filtered or unexported fields
}
PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
func (BatchSubmitParamsInputScrapeDataHTMLOptionsPdf) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataHTMLOptionsPdf) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataHTMLOptionsPdf) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataHTMLOptionsPdf) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataHTMLURL ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataHTMLURL struct {
// Page URL to scrape.
URL string `json:"url" api:"required"`
// Your ID for this page, returned with its result. The same URL can use different
// IDs.
ItemID param.Opt[string] `json:"itemId,omitzero"`
// Custom JSON returned unchanged with this page result.
Meta map[string]any `json:"meta,omitzero"`
// contains filtered or unexported fields
}
A page to scrape, with optional data for matching results.
The property URL is required.
func (BatchSubmitParamsInputScrapeDataHTMLURL) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataHTMLURL) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataHTMLURL) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataHTMLURL) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataMarkdown ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataMarkdown struct {
// Pages to scrape. Maximum 25000.
URLs []BatchSubmitParamsInputScrapeDataMarkdownURL `json:"urls,omitzero" api:"required"`
// Options for Markdown output.
Options BatchSubmitParamsInputScrapeDataMarkdownOptions `json:"options,omitzero"`
// Return page content as Markdown.
//
// This field can be elided, and will marshal its zero value as "markdown".
Format constant.Markdown `json:"format" default:"markdown"`
// contains filtered or unexported fields
}
Scrape the listed pages as Markdown.
The properties Format, URLs are required.
func (BatchSubmitParamsInputScrapeDataMarkdown) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataMarkdown) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataMarkdown) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataMarkdown) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataMarkdownOptions ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataMarkdownOptions struct {
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Also include each page's HTML in its result record, as an `html` field alongside
// the Markdown.
IncludeHTML param.Opt[bool] `json:"includeHTML,omitzero"`
// Include image references in the Markdown.
IncludeImages param.Opt[bool] `json:"includeImages,omitzero"`
// Include links in the Markdown.
IncludeLinks param.Opt[bool] `json:"includeLinks,omitzero"`
// Wait briefly for CSS and transition animations to settle before extraction, on
// pages that render in a browser.
SettleAnimations param.Opt[bool] `json:"settleAnimations,omitzero"`
// Shorten inline base64 image data.
ShortenBase64Images param.Opt[bool] `json:"shortenBase64Images,omitzero"`
// Return the main content without navigation or footers.
UseMainContentOnly param.Opt[bool] `json:"useMainContentOnly,omitzero"`
// How long to wait after initial page load, in milliseconds. `0` waits 500 ms.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
// Remove elements matching these CSS selectors. Applied after `includeSelectors`,
// so an element matching both is removed.
ExcludeSelectors []string `json:"excludeSelectors,omitzero"`
// Keep only the subtrees matching these CSS selectors. Filtered pages are always
// fetched fresh, ignoring `maxAgeMs`.
IncludeSelectors []string `json:"includeSelectors,omitzero"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country string `json:"country,omitzero"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf `json:"pdf,omitzero"`
// contains filtered or unexported fields
}
Options for Markdown output.
func (BatchSubmitParamsInputScrapeDataMarkdownOptions) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataMarkdownOptions) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataMarkdownOptions) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataMarkdownOptions) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `json:"end,omitzero"`
// When true, OCR the selected PDF pages that have no usable text layer (scans),
// replacing each recovered page's text with the OCR result while pages with a real
// text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
// of the base request cost. When false, no OCR runs.
Ocr param.Opt[bool] `json:"ocr,omitzero"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 PDF_SKIPPED is returned.
ShouldParse param.Opt[bool] `json:"shouldParse,omitzero"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `json:"start,omitzero"`
// contains filtered or unexported fields
}
PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
func (BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataMarkdownOptionsPdf) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataMarkdownURL ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataMarkdownURL struct {
// Page URL to scrape.
URL string `json:"url" api:"required"`
// Your ID for this page, returned with its result. The same URL can use different
// IDs.
ItemID param.Opt[string] `json:"itemId,omitzero"`
// Custom JSON returned unchanged with this page result.
Meta map[string]any `json:"meta,omitzero"`
// contains filtered or unexported fields
}
A page to scrape, with optional data for matching results.
The property URL is required.
func (BatchSubmitParamsInputScrapeDataMarkdownURL) MarshalJSON ¶ added in v2.9.0
func (r BatchSubmitParamsInputScrapeDataMarkdownURL) MarshalJSON() (data []byte, err error)
func (*BatchSubmitParamsInputScrapeDataMarkdownURL) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitParamsInputScrapeDataMarkdownURL) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputScrapeDataUnion ¶ added in v2.9.0
type BatchSubmitParamsInputScrapeDataUnion struct {
OfMarkdown *BatchSubmitParamsInputScrapeDataMarkdown `json:",omitzero,inline"`
OfHTML *BatchSubmitParamsInputScrapeDataHTML `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BatchSubmitParamsInputScrapeDataUnion) MarshalJSON ¶ added in v2.9.0
func (u BatchSubmitParamsInputScrapeDataUnion) MarshalJSON() ([]byte, error)
func (*BatchSubmitParamsInputScrapeDataUnion) UnmarshalJSON ¶ added in v2.9.0
func (u *BatchSubmitParamsInputScrapeDataUnion) UnmarshalJSON(data []byte) error
type BatchSubmitParamsInputUnion ¶ added in v2.9.0
type BatchSubmitParamsInputUnion struct {
OfScrape *BatchSubmitParamsInputScrape `json:",omitzero,inline"`
OfCrawl *BatchSubmitParamsInputCrawl `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BatchSubmitParamsInputUnion) MarshalJSON ¶ added in v2.9.0
func (u BatchSubmitParamsInputUnion) MarshalJSON() ([]byte, error)
func (*BatchSubmitParamsInputUnion) UnmarshalJSON ¶ added in v2.9.0
func (u *BatchSubmitParamsInputUnion) UnmarshalJSON(data []byte) error
type BatchSubmitResponse ¶ added in v2.6.0
type BatchSubmitResponse struct {
// Batch ID. Poll GET /batch/{batch_id} with it.
ID string `json:"id" api:"required"`
// The crawl controls as submitted, so the limits requested can be compared against
// what the crawl reached.
Crawl CrawlControls `json:"crawl" api:"required"`
// When the batch was created.
CreatedAt string `json:"created_at" api:"required"`
// What accepting this batch cost.
Credits BatchSubmitResponseCredits `json:"credits" api:"required"`
// What each page will be returned as.
//
// Any of "markdown", "html".
Format BatchSubmitResponseFormat `json:"format" api:"required"`
// What submission took in, and what it charged for.
Input Intake `json:"input" api:"required"`
// Rejected URLs, up to 100. These are not charged.
InvalidURLs []BatchSubmitResponseInvalidURL `json:"invalid_urls" api:"required"`
// How pages will be selected.
//
// Any of "scrape", "crawl".
Mode BatchSubmitResponseMode `json:"mode" api:"required"`
// Always `queued`. An accepted batch has not started yet.
//
// Any of "queued".
Status BatchSubmitResponseStatus `json:"status" api:"required"`
// Tags stored on the batch.
Tags []string `json:"tags" api:"required"`
// API key usage for this request.
KeyMetadata BatchSubmitResponseKeyMetadata `json:"key_metadata"`
// Signing secret for the completion webhook, returned only here and never again.
// Store it now; it is not repeated by GET /batch/{batch_id}.
WebhookSecret string `json:"webhook_secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Crawl respjson.Field
CreatedAt respjson.Field
Credits respjson.Field
Format respjson.Field
Input respjson.Field
InvalidURLs respjson.Field
Mode respjson.Field
Status respjson.Field
Tags respjson.Field
KeyMetadata respjson.Field
WebhookSecret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchSubmitResponse) RawJSON ¶ added in v2.6.0
func (r BatchSubmitResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchSubmitResponse) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchSubmitResponse) UnmarshalJSON(data []byte) error
type BatchSubmitResponseCredits ¶ added in v2.9.0
type BatchSubmitResponseCredits struct {
// Credits just debited from your balance. Whatever the batch does not spend is
// refunded when it settles.
Reserved int64 `json:"reserved" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Reserved respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What accepting this batch cost.
func (BatchSubmitResponseCredits) RawJSON ¶ added in v2.9.0
func (r BatchSubmitResponseCredits) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchSubmitResponseCredits) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitResponseCredits) UnmarshalJSON(data []byte) error
type BatchSubmitResponseFormat ¶ added in v2.9.0
type BatchSubmitResponseFormat string
What each page will be returned as.
const ( BatchSubmitResponseFormatMarkdown BatchSubmitResponseFormat = "markdown" BatchSubmitResponseFormatHTML BatchSubmitResponseFormat = "html" )
type BatchSubmitResponseInvalidURL ¶ added in v2.9.0
type BatchSubmitResponseInvalidURL struct {
// Why it was rejected.
Reason string `json:"reason" api:"required"`
// Rejected URL.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Reason respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BatchSubmitResponseInvalidURL) RawJSON ¶ added in v2.9.0
func (r BatchSubmitResponseInvalidURL) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchSubmitResponseInvalidURL) UnmarshalJSON ¶ added in v2.9.0
func (r *BatchSubmitResponseInvalidURL) UnmarshalJSON(data []byte) error
type BatchSubmitResponseKeyMetadata ¶ added in v2.6.0
type BatchSubmitResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
API key usage for this request.
func (BatchSubmitResponseKeyMetadata) RawJSON ¶ added in v2.6.0
func (r BatchSubmitResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BatchSubmitResponseKeyMetadata) UnmarshalJSON ¶ added in v2.6.0
func (r *BatchSubmitResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BatchSubmitResponseMode ¶ added in v2.9.0
type BatchSubmitResponseMode string
How pages will be selected.
const ( BatchSubmitResponseModeScrape BatchSubmitResponseMode = "scrape" BatchSubmitResponseModeCrawl BatchSubmitResponseMode = "crawl" )
type BatchSubmitResponseStatus ¶ added in v2.6.0
type BatchSubmitResponseStatus string
Always `queued`. An accepted batch has not started yet.
const (
BatchSubmitResponseStatusQueued BatchSubmitResponseStatus = "queued"
)
type BrandGetParams ¶
type BrandGetParams struct {
// This field is a request body variant, only one variant field can be set.
// Retrieve brand data by domain. Cannot be combined with name, email, or ticker.
OfByDomain *BrandGetParamsBodyByDomain `json:",inline"`
// This field is a request body variant, only one variant field can be set.
// Retrieve brand data by company name. Cannot be combined with domain, email, or
// ticker.
OfByName *BrandGetParamsBodyByName `json:",inline"`
// This field is a request body variant, only one variant field can be set.
// Retrieve brand data by email address. The domain is extracted from the email.
// Free and disposable email providers are rejected with 422. Cannot be combined
// with domain, name, or ticker.
OfByEmail *BrandGetParamsBodyByEmail `json:",inline"`
// This field is a request body variant, only one variant field can be set.
// Retrieve brand data by stock ticker. Cannot be combined with domain, name, or
// email.
OfByTicker *BrandGetParamsBodyByTicker `json:",inline"`
// This field is a request body variant, only one variant field can be set.
// Retrieve brand data by fetching the provided URL directly. Note: if you use
// this, brand data is fetched only from the provided URL — not from the entire
// internet — so results are limited to what that single page contains. No domain
// resolution, database lookup, or cross-source enrichment is performed. Cannot be
// combined with domain, name, email, or ticker.
OfByDirectURL *BrandGetParamsBodyByDirectURL `json:",inline"`
// This field is a request body variant, only one variant field can be set.
// Identify brand data from a transaction descriptor. Cannot be combined with
// domain, name, email, or ticker.
OfByTransaction *BrandGetParamsBodyByTransaction `json:",inline"`
// contains filtered or unexported fields
}
func (BrandGetParams) MarshalJSON ¶
func (u BrandGetParams) MarshalJSON() ([]byte, error)
func (*BrandGetParams) UnmarshalJSON ¶
func (r *BrandGetParams) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByDirectURL ¶ added in v2.1.0
type BrandGetParamsBodyByDirectURL struct {
// Full http(s) URL to fetch brand data from (e.g.,
// 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire
// internet.
DirectURL string `json:"direct_url" api:"required" format:"uri"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for direct-URL-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_direct_url".
Type constant.ByDirectURL `json:"type" default:"by_direct_url"`
// contains filtered or unexported fields
}
Retrieve brand data by fetching the provided URL directly. Note: if you use this, brand data is fetched only from the provided URL — not from the entire internet — so results are limited to what that single page contains. No domain resolution, database lookup, or cross-source enrichment is performed. Cannot be combined with domain, name, email, or ticker.
The properties DirectURL, Type are required.
func (BrandGetParamsBodyByDirectURL) MarshalJSON ¶ added in v2.1.0
func (r BrandGetParamsBodyByDirectURL) MarshalJSON() (data []byte, err error)
func (*BrandGetParamsBodyByDirectURL) UnmarshalJSON ¶ added in v2.1.0
func (r *BrandGetParamsBodyByDirectURL) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByDomain ¶
type BrandGetParamsBodyByDomain struct {
// Domain name to retrieve brand data for (e.g., 'stripe.com').
Domain string `json:"domain" api:"required"`
// Maximum age in milliseconds for cached brand data before the API performs a hard
// refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
// are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
// year.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Optional parameter to optimize the API call for maximum speed. When set to true,
// the API will skip time-consuming operations for faster response at the cost of
// less comprehensive data.
MaxSpeed param.Opt[bool] `json:"maxSpeed,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Any of "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese",
// "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian",
// "burmese", "cantonese", "catalan", "cebuano", "chinese", "corsican", "croatian",
// "czech", "danish", "dutch", "english", "esperanto", "estonian", "farsi",
// "fijian", "finnish", "french", "galician", "georgian", "german", "greek",
// "guarani", "gujarati", "haitian-creole", "hausa", "hawaiian", "hebrew", "hindi",
// "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian",
// "japanese", "javanese", "kannada", "kazakh", "khmer", "kinyarwanda", "korean",
// "kurdish", "kyrgyz", "lao", "latin", "latvian", "lingala", "lithuanian",
// "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese",
// "maori", "marathi", "mongolian", "nepali", "norwegian", "odia", "oromo",
// "pashto", "pidgin", "polish", "portuguese", "punjabi", "quechua", "romanian",
// "russian", "samoan", "scottish-gaelic", "serbian", "sesotho", "shona", "sindhi",
// "sinhala", "slovak", "slovene", "somali", "spanish", "sundanese", "swahili",
// "swedish", "tagalog", "tajik", "tamil", "tatar", "telugu", "thai", "tibetan",
// "tigrinya", "tongan", "tswana", "turkish", "turkmen", "ukrainian", "urdu",
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for domain-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_domain".
Type constant.ByDomain `json:"type" default:"by_domain"`
// contains filtered or unexported fields
}
Retrieve brand data by domain. Cannot be combined with name, email, or ticker.
The properties Domain, Type are required.
func (BrandGetParamsBodyByDomain) MarshalJSON ¶
func (r BrandGetParamsBodyByDomain) MarshalJSON() (data []byte, err error)
func (*BrandGetParamsBodyByDomain) UnmarshalJSON ¶
func (r *BrandGetParamsBodyByDomain) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByEmail ¶
type BrandGetParamsBodyByEmail struct {
// Email address to retrieve brand data for (e.g., 'jane@stripe.com').
Email string `json:"email" api:"required" format:"email"`
// Maximum age in milliseconds for cached brand data before the API performs a hard
// refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
// are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
// year.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Optional parameter to optimize the API call for maximum speed. When set to true,
// the API will skip time-consuming operations for faster response at the cost of
// less comprehensive data.
MaxSpeed param.Opt[bool] `json:"maxSpeed,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Any of "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese",
// "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian",
// "burmese", "cantonese", "catalan", "cebuano", "chinese", "corsican", "croatian",
// "czech", "danish", "dutch", "english", "esperanto", "estonian", "farsi",
// "fijian", "finnish", "french", "galician", "georgian", "german", "greek",
// "guarani", "gujarati", "haitian-creole", "hausa", "hawaiian", "hebrew", "hindi",
// "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian",
// "japanese", "javanese", "kannada", "kazakh", "khmer", "kinyarwanda", "korean",
// "kurdish", "kyrgyz", "lao", "latin", "latvian", "lingala", "lithuanian",
// "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese",
// "maori", "marathi", "mongolian", "nepali", "norwegian", "odia", "oromo",
// "pashto", "pidgin", "polish", "portuguese", "punjabi", "quechua", "romanian",
// "russian", "samoan", "scottish-gaelic", "serbian", "sesotho", "shona", "sindhi",
// "sinhala", "slovak", "slovene", "somali", "spanish", "sundanese", "swahili",
// "swedish", "tagalog", "tajik", "tamil", "tatar", "telugu", "thai", "tibetan",
// "tigrinya", "tongan", "tswana", "turkish", "turkmen", "ukrainian", "urdu",
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for email-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_email".
Type constant.ByEmail `json:"type" default:"by_email"`
// contains filtered or unexported fields
}
Retrieve brand data by email address. The domain is extracted from the email. Free and disposable email providers are rejected with 422. Cannot be combined with domain, name, or ticker.
The properties Email, Type are required.
func (BrandGetParamsBodyByEmail) MarshalJSON ¶
func (r BrandGetParamsBodyByEmail) MarshalJSON() (data []byte, err error)
func (*BrandGetParamsBodyByEmail) UnmarshalJSON ¶
func (r *BrandGetParamsBodyByEmail) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByName ¶
type BrandGetParamsBodyByName struct {
// Company name to retrieve brand data for (e.g., 'Apple Inc').
Name string `json:"name" api:"required"`
// Optional country code hint (GL parameter) to specify the country when looking up
// by company name.
CountryGl param.Opt[string] `json:"country_gl,omitzero"`
// Maximum age in milliseconds for cached brand data before the API performs a hard
// refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
// are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
// year.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Optional parameter to optimize the API call for maximum speed. When set to true,
// the API will skip time-consuming operations for faster response at the cost of
// less comprehensive data.
MaxSpeed param.Opt[bool] `json:"maxSpeed,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Any of "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese",
// "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian",
// "burmese", "cantonese", "catalan", "cebuano", "chinese", "corsican", "croatian",
// "czech", "danish", "dutch", "english", "esperanto", "estonian", "farsi",
// "fijian", "finnish", "french", "galician", "georgian", "german", "greek",
// "guarani", "gujarati", "haitian-creole", "hausa", "hawaiian", "hebrew", "hindi",
// "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian",
// "japanese", "javanese", "kannada", "kazakh", "khmer", "kinyarwanda", "korean",
// "kurdish", "kyrgyz", "lao", "latin", "latvian", "lingala", "lithuanian",
// "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese",
// "maori", "marathi", "mongolian", "nepali", "norwegian", "odia", "oromo",
// "pashto", "pidgin", "polish", "portuguese", "punjabi", "quechua", "romanian",
// "russian", "samoan", "scottish-gaelic", "serbian", "sesotho", "shona", "sindhi",
// "sinhala", "slovak", "slovene", "somali", "spanish", "sundanese", "swahili",
// "swedish", "tagalog", "tajik", "tamil", "tatar", "telugu", "thai", "tibetan",
// "tigrinya", "tongan", "tswana", "turkish", "turkmen", "ukrainian", "urdu",
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for name-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_name".
Type constant.ByName `json:"type" default:"by_name"`
// contains filtered or unexported fields
}
Retrieve brand data by company name. Cannot be combined with domain, email, or ticker.
The properties Name, Type are required.
func (BrandGetParamsBodyByName) MarshalJSON ¶
func (r BrandGetParamsBodyByName) MarshalJSON() (data []byte, err error)
func (*BrandGetParamsBodyByName) UnmarshalJSON ¶
func (r *BrandGetParamsBodyByName) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByTicker ¶
type BrandGetParamsBodyByTicker struct {
// Stock ticker symbol to retrieve brand data for (e.g., 'AAPL').
Ticker string `json:"ticker" api:"required"`
// Maximum age in milliseconds for cached brand data before the API performs a hard
// refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
// are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
// year.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Optional parameter to optimize the API call for maximum speed. When set to true,
// the API will skip time-consuming operations for faster response at the cost of
// less comprehensive data.
MaxSpeed param.Opt[bool] `json:"maxSpeed,omitzero"`
// Optional stock exchange for the ticker. Defaults to NASDAQ if not specified.
TickerExchange param.Opt[string] `json:"ticker_exchange,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Any of "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese",
// "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian",
// "burmese", "cantonese", "catalan", "cebuano", "chinese", "corsican", "croatian",
// "czech", "danish", "dutch", "english", "esperanto", "estonian", "farsi",
// "fijian", "finnish", "french", "galician", "georgian", "german", "greek",
// "guarani", "gujarati", "haitian-creole", "hausa", "hawaiian", "hebrew", "hindi",
// "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian",
// "japanese", "javanese", "kannada", "kazakh", "khmer", "kinyarwanda", "korean",
// "kurdish", "kyrgyz", "lao", "latin", "latvian", "lingala", "lithuanian",
// "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese",
// "maori", "marathi", "mongolian", "nepali", "norwegian", "odia", "oromo",
// "pashto", "pidgin", "polish", "portuguese", "punjabi", "quechua", "romanian",
// "russian", "samoan", "scottish-gaelic", "serbian", "sesotho", "shona", "sindhi",
// "sinhala", "slovak", "slovene", "somali", "spanish", "sundanese", "swahili",
// "swedish", "tagalog", "tajik", "tamil", "tatar", "telugu", "thai", "tibetan",
// "tigrinya", "tongan", "tswana", "turkish", "turkmen", "ukrainian", "urdu",
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for ticker-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_ticker".
Type constant.ByTicker `json:"type" default:"by_ticker"`
// contains filtered or unexported fields
}
Retrieve brand data by stock ticker. Cannot be combined with domain, name, or email.
The properties Ticker, Type are required.
func (BrandGetParamsBodyByTicker) MarshalJSON ¶
func (r BrandGetParamsBodyByTicker) MarshalJSON() (data []byte, err error)
func (*BrandGetParamsBodyByTicker) UnmarshalJSON ¶
func (r *BrandGetParamsBodyByTicker) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByTransaction ¶
type BrandGetParamsBodyByTransaction struct {
// Transaction information to identify the brand.
TransactionInfo string `json:"transaction_info" api:"required"`
// Optional city name to prioritize when searching for the brand.
City param.Opt[string] `json:"city,omitzero"`
// Optional country code hint (GL parameter) to specify the country when
// identifying a transaction.
CountryGl param.Opt[string] `json:"country_gl,omitzero"`
// When set to true, the API performs additional verification to ensure the
// identified brand matches the transaction with high confidence.
HighConfidenceOnly param.Opt[bool] `json:"high_confidence_only,omitzero"`
// Optional parameter to optimize the API call for maximum speed. When set to true,
// the API will skip time-consuming operations for faster response at the cost of
// less comprehensive data.
MaxSpeed param.Opt[bool] `json:"maxSpeed,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Any of "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese",
// "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian",
// "burmese", "cantonese", "catalan", "cebuano", "chinese", "corsican", "croatian",
// "czech", "danish", "dutch", "english", "esperanto", "estonian", "farsi",
// "fijian", "finnish", "french", "galician", "georgian", "german", "greek",
// "guarani", "gujarati", "haitian-creole", "hausa", "hawaiian", "hebrew", "hindi",
// "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian",
// "japanese", "javanese", "kannada", "kazakh", "khmer", "kinyarwanda", "korean",
// "kurdish", "kyrgyz", "lao", "latin", "latvian", "lingala", "lithuanian",
// "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese",
// "maori", "marathi", "mongolian", "nepali", "norwegian", "odia", "oromo",
// "pashto", "pidgin", "polish", "portuguese", "punjabi", "quechua", "romanian",
// "russian", "samoan", "scottish-gaelic", "serbian", "sesotho", "shona", "sindhi",
// "sinhala", "slovak", "slovene", "somali", "spanish", "sundanese", "swahili",
// "swedish", "tagalog", "tajik", "tamil", "tatar", "telugu", "thai", "tibetan",
// "tigrinya", "tongan", "tswana", "turkish", "turkmen", "ukrainian", "urdu",
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
ForceLanguage string `json:"force_language,omitzero"`
// Optional Merchant Category Code (MCC) to help identify the business category or
// industry.
Mcc BrandGetParamsBodyByTransactionMccUnion `json:"mcc,omitzero"`
// Optional phone number from the transaction to help verify brand match.
Phone BrandGetParamsBodyByTransactionPhoneUnion `json:"phone,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Discriminator for transaction-based brand retrieval.
//
// This field can be elided, and will marshal its zero value as "by_transaction".
Type constant.ByTransaction `json:"type" default:"by_transaction"`
// contains filtered or unexported fields
}
Identify brand data from a transaction descriptor. Cannot be combined with domain, name, email, or ticker.
The properties TransactionInfo, Type are required.
func (BrandGetParamsBodyByTransaction) MarshalJSON ¶
func (r BrandGetParamsBodyByTransaction) MarshalJSON() (data []byte, err error)
func (*BrandGetParamsBodyByTransaction) UnmarshalJSON ¶
func (r *BrandGetParamsBodyByTransaction) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByTransactionMccUnion ¶ added in v2.5.0
type BrandGetParamsBodyByTransactionMccUnion struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BrandGetParamsBodyByTransactionMccUnion) MarshalJSON ¶ added in v2.5.0
func (u BrandGetParamsBodyByTransactionMccUnion) MarshalJSON() ([]byte, error)
func (*BrandGetParamsBodyByTransactionMccUnion) UnmarshalJSON ¶ added in v2.5.0
func (u *BrandGetParamsBodyByTransactionMccUnion) UnmarshalJSON(data []byte) error
type BrandGetParamsBodyByTransactionPhoneUnion ¶ added in v2.5.0
type BrandGetParamsBodyByTransactionPhoneUnion struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (BrandGetParamsBodyByTransactionPhoneUnion) MarshalJSON ¶ added in v2.5.0
func (u BrandGetParamsBodyByTransactionPhoneUnion) MarshalJSON() ([]byte, error)
func (*BrandGetParamsBodyByTransactionPhoneUnion) UnmarshalJSON ¶ added in v2.5.0
func (u *BrandGetParamsBodyByTransactionPhoneUnion) UnmarshalJSON(data []byte) error
type BrandGetResponse ¶
type BrandGetResponse struct {
// Detailed brand information
Brand BrandGetResponseBrand `json:"brand"`
// HTTP status code
Code int64 `json:"code"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata BrandGetResponseKeyMetadata `json:"key_metadata"`
// Status of the response, e.g., 'ok'
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Brand respjson.Field
Code respjson.Field
KeyMetadata respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponse) RawJSON ¶
func (r BrandGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponse) UnmarshalJSON ¶
func (r *BrandGetResponse) UnmarshalJSON(data []byte) error
type BrandGetResponseBrand ¶
type BrandGetResponseBrand struct {
// Physical address of the brand
Address BrandGetResponseBrandAddress `json:"address"`
// An array of backdrop images for the brand
Backdrops []BrandGetResponseBrandBackdrop `json:"backdrops"`
// An array of brand colors
Colors []BrandGetResponseBrandColor `json:"colors"`
// A brief description of the brand
Description string `json:"description"`
// The domain name of the brand
Domain string `json:"domain"`
// Company email address
Email string `json:"email"`
// Employee headcount information for the brand (will be null if unknown)
Employees BrandGetResponseBrandEmployees `json:"employees"`
// Industry classification information for the brand
Industries BrandGetResponseBrandIndustries `json:"industries"`
// Indicates whether the brand content is not safe for work (NSFW)
IsNsfw bool `json:"is_nsfw"`
// Important website links for the brand
Links BrandGetResponseBrandLinks `json:"links"`
// An array of logos associated with the brand
Logos []BrandGetResponseBrandLogo `json:"logos"`
// Company phone number
Phone string `json:"phone"`
// Language to force for the retrieved brand data.
//
// Any of "afrikaans", "albanian", "amharic", "arabic", "armenian", "assamese",
// "aymara", "azeri", "basque", "belarusian", "bengali", "bosnian", "bulgarian",
// "burmese", "cantonese", "catalan", "cebuano", "chinese", "corsican", "croatian",
// "czech", "danish", "dutch", "english", "esperanto", "estonian", "farsi",
// "fijian", "finnish", "french", "galician", "georgian", "german", "greek",
// "guarani", "gujarati", "haitian-creole", "hausa", "hawaiian", "hebrew", "hindi",
// "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian",
// "japanese", "javanese", "kannada", "kazakh", "khmer", "kinyarwanda", "korean",
// "kurdish", "kyrgyz", "lao", "latin", "latvian", "lingala", "lithuanian",
// "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese",
// "maori", "marathi", "mongolian", "nepali", "norwegian", "odia", "oromo",
// "pashto", "pidgin", "polish", "portuguese", "punjabi", "quechua", "romanian",
// "russian", "samoan", "scottish-gaelic", "serbian", "sesotho", "shona", "sindhi",
// "sinhala", "slovak", "slovene", "somali", "spanish", "sundanese", "swahili",
// "swedish", "tagalog", "tajik", "tamil", "tatar", "telugu", "thai", "tibetan",
// "tigrinya", "tongan", "tswana", "turkish", "turkmen", "ukrainian", "urdu",
// "uyghur", "uzbek", "vietnamese", "welsh", "wolof", "xhosa", "yiddish", "yoruba",
// "zulu".
PrimaryLanguage string `json:"primary_language" api:"nullable"`
// The brand's slogan
Slogan string `json:"slogan"`
// An array of social media links for the brand
Socials []BrandGetResponseBrandSocial `json:"socials"`
// Stock market information for this brand (will be null if not a publicly traded
// company)
Stock BrandGetResponseBrandStock `json:"stock"`
// The title or name of the brand
Title string `json:"title"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Address respjson.Field
Backdrops respjson.Field
Colors respjson.Field
Description respjson.Field
Domain respjson.Field
Email respjson.Field
Employees respjson.Field
Industries respjson.Field
IsNsfw respjson.Field
Links respjson.Field
Logos respjson.Field
Phone respjson.Field
PrimaryLanguage respjson.Field
Slogan respjson.Field
Socials respjson.Field
Stock respjson.Field
Title respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detailed brand information
func (BrandGetResponseBrand) RawJSON ¶
func (r BrandGetResponseBrand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrand) UnmarshalJSON ¶
func (r *BrandGetResponseBrand) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandAddress ¶
type BrandGetResponseBrandAddress struct {
// City name
City string `json:"city"`
// Country name
Country string `json:"country"`
// Country code
CountryCode string `json:"country_code"`
// Postal or ZIP code
PostalCode string `json:"postal_code"`
// State or province code
StateCode string `json:"state_code"`
// State or province name
StateProvince string `json:"state_province"`
// Street address
Street string `json:"street"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
City respjson.Field
Country respjson.Field
CountryCode respjson.Field
PostalCode respjson.Field
StateCode respjson.Field
StateProvince respjson.Field
Street respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Physical address of the brand
func (BrandGetResponseBrandAddress) RawJSON ¶
func (r BrandGetResponseBrandAddress) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandAddress) UnmarshalJSON ¶
func (r *BrandGetResponseBrandAddress) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandBackdrop ¶
type BrandGetResponseBrandBackdrop struct {
// Array of colors in the backdrop image
Colors []BrandGetResponseBrandBackdropColor `json:"colors"`
// Resolution of the backdrop image
Resolution BrandGetResponseBrandBackdropResolution `json:"resolution"`
// URL of the backdrop image
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Colors respjson.Field
Resolution respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponseBrandBackdrop) RawJSON ¶
func (r BrandGetResponseBrandBackdrop) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandBackdrop) UnmarshalJSON ¶
func (r *BrandGetResponseBrandBackdrop) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandBackdropColor ¶
type BrandGetResponseBrandBackdropColor struct {
// Color in hexadecimal format
Hex string `json:"hex"`
// Name of the color
Name string `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Hex respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponseBrandBackdropColor) RawJSON ¶
func (r BrandGetResponseBrandBackdropColor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandBackdropColor) UnmarshalJSON ¶
func (r *BrandGetResponseBrandBackdropColor) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandBackdropResolution ¶
type BrandGetResponseBrandBackdropResolution struct {
// Aspect ratio of the image (width/height)
AspectRatio float64 `json:"aspect_ratio"`
// Height of the image in pixels
Height int64 `json:"height"`
// Width of the image in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AspectRatio respjson.Field
Height respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolution of the backdrop image
func (BrandGetResponseBrandBackdropResolution) RawJSON ¶
func (r BrandGetResponseBrandBackdropResolution) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandBackdropResolution) UnmarshalJSON ¶
func (r *BrandGetResponseBrandBackdropResolution) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandColor ¶
type BrandGetResponseBrandColor struct {
// Color in hexadecimal format
Hex string `json:"hex"`
// Name of the color
Name string `json:"name"`
// Where the color was observed: 'site' colors come from the website's own theme
// signals (rendered page colors, manifest, theme-color meta), 'logo' colors from
// logo image pixels.
//
// Any of "site", "logo".
Source string `json:"source"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Hex respjson.Field
Name respjson.Field
Source respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponseBrandColor) RawJSON ¶
func (r BrandGetResponseBrandColor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandColor) UnmarshalJSON ¶
func (r *BrandGetResponseBrandColor) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandEmployees ¶ added in v2.9.0
type BrandGetResponseBrandEmployees struct {
// Exact employee count when a precise headcount is known
Exact int64 `json:"exact"`
// Employee count range for the brand (e.g. '11 to 50')
//
// Any of "1 to 10", "11 to 50", "51 to 200", "201 to 500", "501 to 1000", "1001 to
// 5000", "5001 to 10000", "10001+".
Range string `json:"range"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Exact respjson.Field
Range respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Employee headcount information for the brand (will be null if unknown)
func (BrandGetResponseBrandEmployees) RawJSON ¶ added in v2.9.0
func (r BrandGetResponseBrandEmployees) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandEmployees) UnmarshalJSON ¶ added in v2.9.0
func (r *BrandGetResponseBrandEmployees) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandIndustries ¶
type BrandGetResponseBrandIndustries struct {
// Easy Industry Classification - array of industry and subindustry pairs
Eic []BrandGetResponseBrandIndustriesEic `json:"eic"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Eic respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Industry classification information for the brand
func (BrandGetResponseBrandIndustries) RawJSON ¶
func (r BrandGetResponseBrandIndustries) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandIndustries) UnmarshalJSON ¶
func (r *BrandGetResponseBrandIndustries) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandIndustriesEic ¶
type BrandGetResponseBrandIndustriesEic struct {
// Industry classification enum
//
// Any of "Aerospace & Defense", "Technology", "Finance", "Healthcare", "Retail &
// E-commerce", "Entertainment", "Education", "Government & Nonprofit", "Industrial
// & Energy", "Automotive & Transportation", "Lifestyle & Leisure", "Luxury &
// Fashion", "News & Media", "Sports", "Real Estate & PropTech", "Legal &
// Compliance", "Telecommunications", "Agriculture & Food", "Professional Services
// & Agencies", "Chemicals & Materials", "Logistics & Supply Chain", "Hospitality &
// Tourism", "Construction & Built Environment", "Consumer Packaged Goods (CPG)".
Industry string `json:"industry" api:"required"`
// Subindustry classification enum
//
// Any of "Defense Systems & Military Hardware", "Aerospace Manufacturing",
// "Avionics & Navigation Technology", "Subsea & Naval Defense Systems", "Space &
// Satellite Technology", "Defense IT & Systems Integration", "Software (B2B)",
// "Software (B2C)", "Cloud Infrastructure & DevOps", "Cybersecurity", "Artificial
// Intelligence & Machine Learning", "Data Infrastructure & Analytics", "Hardware &
// Semiconductors", "Fintech Infrastructure", "eCommerce & Marketplace Platforms",
// "Developer Tools & APIs", "Web3 & Blockchain", "XR & Spatial Computing",
// "Banking & Lending", "Investment Management & WealthTech", "Insurance &
// InsurTech", "Payments & Money Movement", "Accounting, Tax & Financial Planning
// Tools", "Capital Markets & Trading Platforms", "Financial Infrastructure &
// APIs", "Credit Scoring & Risk Management", "Cryptocurrency & Digital Assets",
// "BNPL & Alternative Financing", "Healthcare Providers & Services",
// "Pharmaceuticals & Drug Development", "Medical Devices & Diagnostics",
// "Biotechnology & Genomics", "Digital Health & Telemedicine", "Health Insurance &
// Benefits Tech", "Clinical Trials & Research Platforms", "Mental Health &
// Wellness", "Healthcare IT & EHR Systems", "Consumer Health & Wellness Products",
// "Online Marketplaces", "Direct-to-Consumer (DTC) Brands", "Retail Tech &
// Point-of-Sale Systems", "Omnichannel & In-Store Retail", "E-commerce Enablement
// & Infrastructure", "Subscription & Membership Commerce", "Social Commerce &
// Influencer Platforms", "Fashion & Apparel Retail", "Food, Beverage & Grocery
// E-commerce", "Streaming Platforms (Video, Music, Audio)", "Gaming & Interactive
// Entertainment", "Creator Economy & Influencer Platforms", "Film, TV & Production
// Studios", "Events, Venues & Live Entertainment", "Virtual Worlds & Metaverse
// Experiences", "K-12 Education Platforms & Tools", "Higher Education & University
// Tech", "Online Learning & MOOCs", "Test Prep & Certification", "Corporate
// Training & Upskilling", "Tutoring & Supplemental Learning", "Education
// Management Systems (LMS/SIS)", "Language Learning", "Creator-Led & Cohort-Based
// Courses", "Special Education & Accessibility Tools", "Government Technology &
// Digital Services", "Civic Engagement & Policy Platforms", "International
// Development & Humanitarian Aid", "Philanthropy & Grantmaking", "Nonprofit
// Operations & Fundraising Tools", "Public Health & Social Services", "Education &
// Youth Development Programs", "Environmental & Climate Action Organizations",
// "Legal Aid & Social Justice Advocacy", "Municipal & Infrastructure Services",
// "Manufacturing & Industrial Automation", "Energy Production (Oil, Gas,
// Nuclear)", "Renewable Energy & Cleantech", "Utilities & Grid Infrastructure",
// "Industrial IoT & Monitoring Systems", "Construction & Heavy Equipment", "Mining
// & Natural Resources", "Environmental Engineering & Sustainability", "Energy
// Storage & Battery Technology", "Automotive OEMs & Vehicle Manufacturing",
// "Electric Vehicles (EVs) & Charging Infrastructure", "Mobility-as-a-Service
// (MaaS)", "Fleet Management", "Public Transit & Urban Mobility", "Autonomous
// Vehicles & ADAS", "Aftermarket Parts & Services", "Telematics & Vehicle
// Connectivity", "Aviation & Aerospace Transport", "Maritime Shipping", "Fitness &
// Wellness", "Beauty & Personal Care", "Home & Living", "Dating & Relationships",
// "Hobbies, Crafts & DIY", "Outdoor & Recreational Gear", "Events, Experiences &
// Ticketing Platforms", "Designer & Luxury Apparel", "Accessories, Jewelry &
// Watches", "Footwear & Leather Goods", "Beauty, Fragrance & Skincare", "Fashion
// Marketplaces & Retail Platforms", "Sustainable & Ethical Fashion", "Resale,
// Vintage & Circular Fashion", "Fashion Tech & Virtual Try-Ons", "Streetwear &
// Emerging Luxury", "Couture & Made-to-Measure", "News Publishing & Journalism",
// "Advertising, Adtech & Media Buying", "Digital Media & Content Platforms",
// "Broadcasting (TV & Radio)", "Podcasting & Audio Media", "News Aggregators &
// Curation Tools", "Independent & Creator-Led Media", "Newsletters &
// Substack-Style Platforms", "Political & Investigative Media", "Trade & Niche
// Publications", "Media Monitoring & Analytics", "Professional Teams & Leagues",
// "Sports Media & Broadcasting", "Sports Betting & Fantasy Sports", "Fitness &
// Athletic Training Platforms", "Sportswear & Equipment", "Esports & Competitive
// Gaming", "Sports Venues & Event Management", "Athlete Management & Talent
// Agencies", "Sports Tech & Performance Analytics", "Youth, Amateur & Collegiate
// Sports", "Real Estate Marketplaces", "Property Management Software", "Rental
// Platforms", "Mortgage & Lending Tech", "Real Estate Investment Platforms", "Law
// Firms & Legal Services", "Legal Tech & Automation", "Regulatory Compliance",
// "E-Discovery & Litigation Tools", "Contract Management", "Governance, Risk &
// Compliance (GRC)", "IP & Trademark Management", "Legal Research & Intelligence",
// "Compliance Training & Certification", "Whistleblower & Ethics Reporting",
// "Mobile & Wireless Networks (3G/4G/5G)", "Broadband & Fiber Internet",
// "Satellite & Space-Based Communications", "Network Equipment & Infrastructure",
// "Telecom Billing & OSS/BSS Systems", "VoIP & Unified Communications", "Internet
// Service Providers (ISPs)", "Edge Computing & Network Virtualization", "IoT
// Connectivity Platforms", "Precision Agriculture & AgTech", "Crop & Livestock
// Production", "Food & Beverage Manufacturing & Processing", "Food Distribution",
// "Restaurants & Food Service", "Agricultural Inputs & Equipment", "Sustainable &
// Regenerative Agriculture", "Seafood & Aquaculture", "Management Consulting",
// "Marketing & Advertising Agencies", "Design, Branding & Creative Studios", "IT
// Services & Managed Services", "Staffing, Recruiting & Talent", "Accounting & Tax
// Firms", "Public Relations & Communications", "Business Process Outsourcing
// (BPO)", "Professional Training & Coaching", "Specialty Chemicals", "Commodity &
// Petrochemicals", "Polymers, Plastics & Rubber", "Coatings, Adhesives &
// Sealants", "Industrial Gases", "Advanced Materials & Composites", "Battery
// Materials & Energy Storage", "Electronic Materials & Semiconductor Chemicals",
// "Agrochemicals & Fertilizers", "Freight & Transportation Tech", "Last-Mile
// Delivery", "Warehouse Automation", "Supply Chain Visibility Platforms",
// "Logistics Marketplaces", "Shipping & Freight Forwarding", "Cold Chain
// Logistics", "Reverse Logistics & Returns", "Cross-Border Trade Tech",
// "Transportation Management Systems (TMS)", "Hotels & Accommodation", "Vacation
// Rentals & Short-Term Stays", "Restaurant Tech & Management", "Travel Booking
// Platforms", "Tourism Experiences & Activities", "Cruise Lines & Marine Tourism",
// "Hospitality Management Systems", "Event & Venue Management", "Corporate Travel
// Management", "Travel Insurance & Protection", "Construction Management
// Software", "BIM/CAD & Design Tools", "Construction Marketplaces", "Equipment
// Rental & Management", "Building Materials & Procurement", "Construction
// Workforce Management", "Project Estimation & Bidding", "Modular & Prefab
// Construction", "Construction Safety & Compliance", "Smart Building Technology",
// "Food & Beverage CPG", "Home & Personal Care CPG", "CPG Analytics & Insights",
// "Direct-to-Consumer CPG Brands", "CPG Supply Chain & Distribution", "Private
// Label Manufacturing", "CPG Retail Intelligence", "Sustainable CPG & Packaging",
// "Beauty & Cosmetics CPG", "Health & Wellness CPG".
Subindustry string `json:"subindustry" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Industry respjson.Field
Subindustry respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponseBrandIndustriesEic) RawJSON ¶
func (r BrandGetResponseBrandIndustriesEic) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandIndustriesEic) UnmarshalJSON ¶
func (r *BrandGetResponseBrandIndustriesEic) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandLinks ¶
type BrandGetResponseBrandLinks struct {
// URL to the brand's blog or news page
Blog string `json:"blog" api:"nullable"`
// URL to the brand's careers or job opportunities page
Careers string `json:"careers" api:"nullable"`
// URL to the brand's contact or contact us page
Contact string `json:"contact" api:"nullable"`
// URL to the brand's pricing or plans page
Pricing string `json:"pricing" api:"nullable"`
// URL to the brand's privacy policy page
Privacy string `json:"privacy" api:"nullable"`
// URL to the brand's terms of service or terms and conditions page
Terms string `json:"terms" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Blog respjson.Field
Careers respjson.Field
Contact respjson.Field
Pricing respjson.Field
Privacy respjson.Field
Terms respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Important website links for the brand
func (BrandGetResponseBrandLinks) RawJSON ¶
func (r BrandGetResponseBrandLinks) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandLinks) UnmarshalJSON ¶
func (r *BrandGetResponseBrandLinks) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandLogo ¶
type BrandGetResponseBrandLogo struct {
// Array of colors in the logo
Colors []BrandGetResponseBrandLogoColor `json:"colors"`
// Indicates when this logo is best used: 'light' = best for light mode, 'dark' =
// best for dark mode, 'has_opaque_background' = can be used for either as image
// has its own background
//
// Any of "light", "dark", "has_opaque_background".
Mode string `json:"mode"`
// Resolution of the logo image
Resolution BrandGetResponseBrandLogoResolution `json:"resolution"`
// Type of the logo based on resolution (e.g., 'icon', 'logo')
//
// Any of "icon", "logo".
Type string `json:"type"`
// CDN hosted url of the logo (ready for display)
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Colors respjson.Field
Mode respjson.Field
Resolution respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponseBrandLogo) RawJSON ¶
func (r BrandGetResponseBrandLogo) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandLogo) UnmarshalJSON ¶
func (r *BrandGetResponseBrandLogo) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandLogoColor ¶
type BrandGetResponseBrandLogoColor struct {
// Color in hexadecimal format
Hex string `json:"hex"`
// Name of the color
Name string `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Hex respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponseBrandLogoColor) RawJSON ¶
func (r BrandGetResponseBrandLogoColor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandLogoColor) UnmarshalJSON ¶
func (r *BrandGetResponseBrandLogoColor) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandLogoResolution ¶
type BrandGetResponseBrandLogoResolution struct {
// Aspect ratio of the image (width/height)
AspectRatio float64 `json:"aspect_ratio"`
// Height of the image in pixels
Height int64 `json:"height"`
// Width of the image in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AspectRatio respjson.Field
Height respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolution of the logo image
func (BrandGetResponseBrandLogoResolution) RawJSON ¶
func (r BrandGetResponseBrandLogoResolution) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandLogoResolution) UnmarshalJSON ¶
func (r *BrandGetResponseBrandLogoResolution) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandSocial ¶
type BrandGetResponseBrandSocial struct {
// Type of social media platform
//
// Any of "x", "facebook", "instagram", "linkedin", "youtube", "pinterest",
// "tiktok", "dribbble", "github", "behance", "snapchat", "whatsapp", "telegram",
// "line", "discord", "twitch", "vimeo", "imdb", "tumblr", "flickr", "giphy",
// "medium", "spotify", "soundcloud", "tripadvisor", "yelp", "producthunt",
// "reddit", "crunchbase", "appstore", "playstore".
Type string `json:"type"`
// URL of the social media page
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetResponseBrandSocial) RawJSON ¶
func (r BrandGetResponseBrandSocial) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandSocial) UnmarshalJSON ¶
func (r *BrandGetResponseBrandSocial) UnmarshalJSON(data []byte) error
type BrandGetResponseBrandStock ¶
type BrandGetResponseBrandStock struct {
// Stock exchange name
Exchange string `json:"exchange"`
// Stock ticker symbol
Ticker string `json:"ticker"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Exchange respjson.Field
Ticker respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Stock market information for this brand (will be null if not a publicly traded company)
func (BrandGetResponseBrandStock) RawJSON ¶
func (r BrandGetResponseBrandStock) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseBrandStock) UnmarshalJSON ¶
func (r *BrandGetResponseBrandStock) UnmarshalJSON(data []byte) error
type BrandGetResponseKeyMetadata ¶
type BrandGetResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (BrandGetResponseKeyMetadata) RawJSON ¶
func (r BrandGetResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetResponseKeyMetadata) UnmarshalJSON ¶
func (r *BrandGetResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedParams ¶
type BrandGetSimplifiedParams struct {
// Domain name to retrieve simplified brand data for
Domain string `query:"domain" api:"required" json:"-"`
// Maximum age in milliseconds for cached brand data before the API performs a hard
// refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
// are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
// year.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// Optional theme preference used when selecting brand assets.
//
// Any of "light", "dark".
Theme BrandGetSimplifiedParamsTheme `query:"theme,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BrandGetSimplifiedParams) URLQuery ¶
func (r BrandGetSimplifiedParams) URLQuery() (v url.Values, err error)
URLQuery serializes BrandGetSimplifiedParams's query parameters as `url.Values`.
type BrandGetSimplifiedParamsTheme ¶ added in v2.5.0
type BrandGetSimplifiedParamsTheme string
Optional theme preference used when selecting brand assets.
const ( BrandGetSimplifiedParamsThemeLight BrandGetSimplifiedParamsTheme = "light" BrandGetSimplifiedParamsThemeDark BrandGetSimplifiedParamsTheme = "dark" )
type BrandGetSimplifiedResponse ¶
type BrandGetSimplifiedResponse struct {
// Simplified brand information
Brand BrandGetSimplifiedResponseBrand `json:"brand"`
// HTTP status code of the response
Code int64 `json:"code"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata BrandGetSimplifiedResponseKeyMetadata `json:"key_metadata"`
// Status of the response, e.g., 'ok'
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Brand respjson.Field
Code respjson.Field
KeyMetadata respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetSimplifiedResponse) RawJSON ¶
func (r BrandGetSimplifiedResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponse) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponse) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrand ¶
type BrandGetSimplifiedResponseBrand struct {
// An array of backdrop images for the brand
Backdrops []BrandGetSimplifiedResponseBrandBackdrop `json:"backdrops"`
// An array of brand colors
Colors []BrandGetSimplifiedResponseBrandColor `json:"colors"`
// The domain name of the brand
Domain string `json:"domain"`
// An array of logos associated with the brand
Logos []BrandGetSimplifiedResponseBrandLogo `json:"logos"`
// The title or name of the brand
Title string `json:"title"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Backdrops respjson.Field
Colors respjson.Field
Domain respjson.Field
Logos respjson.Field
Title respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Simplified brand information
func (BrandGetSimplifiedResponseBrand) RawJSON ¶
func (r BrandGetSimplifiedResponseBrand) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrand) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrand) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrandBackdrop ¶
type BrandGetSimplifiedResponseBrandBackdrop struct {
// Array of colors in the backdrop image
Colors []BrandGetSimplifiedResponseBrandBackdropColor `json:"colors"`
// Resolution of the backdrop image
Resolution BrandGetSimplifiedResponseBrandBackdropResolution `json:"resolution"`
// URL of the backdrop image
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Colors respjson.Field
Resolution respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetSimplifiedResponseBrandBackdrop) RawJSON ¶
func (r BrandGetSimplifiedResponseBrandBackdrop) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrandBackdrop) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrandBackdrop) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrandBackdropColor ¶
type BrandGetSimplifiedResponseBrandBackdropColor struct {
// Color in hexadecimal format
Hex string `json:"hex"`
// Name of the color
Name string `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Hex respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetSimplifiedResponseBrandBackdropColor) RawJSON ¶
func (r BrandGetSimplifiedResponseBrandBackdropColor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrandBackdropColor) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrandBackdropColor) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrandBackdropResolution ¶
type BrandGetSimplifiedResponseBrandBackdropResolution struct {
// Aspect ratio of the image (width/height)
AspectRatio float64 `json:"aspect_ratio"`
// Height of the image in pixels
Height int64 `json:"height"`
// Width of the image in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AspectRatio respjson.Field
Height respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolution of the backdrop image
func (BrandGetSimplifiedResponseBrandBackdropResolution) RawJSON ¶
func (r BrandGetSimplifiedResponseBrandBackdropResolution) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrandBackdropResolution) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrandBackdropResolution) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrandColor ¶
type BrandGetSimplifiedResponseBrandColor struct {
// Color in hexadecimal format
Hex string `json:"hex"`
// Name of the color
Name string `json:"name"`
// Where the color was observed: 'site' colors come from the website's own theme
// signals (rendered page colors, manifest, theme-color meta), 'logo' colors from
// logo image pixels.
//
// Any of "site", "logo".
Source string `json:"source"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Hex respjson.Field
Name respjson.Field
Source respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetSimplifiedResponseBrandColor) RawJSON ¶
func (r BrandGetSimplifiedResponseBrandColor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrandColor) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrandColor) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrandLogo ¶
type BrandGetSimplifiedResponseBrandLogo struct {
// Array of colors in the logo
Colors []BrandGetSimplifiedResponseBrandLogoColor `json:"colors"`
// Indicates when this logo is best used: 'light' = best for light mode, 'dark' =
// best for dark mode, 'has_opaque_background' = can be used for either as image
// has its own background
//
// Any of "light", "dark", "has_opaque_background".
Mode string `json:"mode"`
// Resolution of the logo image
Resolution BrandGetSimplifiedResponseBrandLogoResolution `json:"resolution"`
// Type of the logo based on resolution (e.g., 'icon', 'logo')
//
// Any of "icon", "logo".
Type string `json:"type"`
// CDN hosted url of the logo (ready for display)
URL string `json:"url"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Colors respjson.Field
Mode respjson.Field
Resolution respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetSimplifiedResponseBrandLogo) RawJSON ¶
func (r BrandGetSimplifiedResponseBrandLogo) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrandLogo) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrandLogo) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrandLogoColor ¶
type BrandGetSimplifiedResponseBrandLogoColor struct {
// Color in hexadecimal format
Hex string `json:"hex"`
// Name of the color
Name string `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Hex respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandGetSimplifiedResponseBrandLogoColor) RawJSON ¶
func (r BrandGetSimplifiedResponseBrandLogoColor) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrandLogoColor) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrandLogoColor) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseBrandLogoResolution ¶
type BrandGetSimplifiedResponseBrandLogoResolution struct {
// Aspect ratio of the image (width/height)
AspectRatio float64 `json:"aspect_ratio"`
// Height of the image in pixels
Height int64 `json:"height"`
// Width of the image in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AspectRatio respjson.Field
Height respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Resolution of the logo image
func (BrandGetSimplifiedResponseBrandLogoResolution) RawJSON ¶
func (r BrandGetSimplifiedResponseBrandLogoResolution) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseBrandLogoResolution) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseBrandLogoResolution) UnmarshalJSON(data []byte) error
type BrandGetSimplifiedResponseKeyMetadata ¶
type BrandGetSimplifiedResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (BrandGetSimplifiedResponseKeyMetadata) RawJSON ¶
func (r BrandGetSimplifiedResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandGetSimplifiedResponseKeyMetadata) UnmarshalJSON ¶
func (r *BrandGetSimplifiedResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BrandSearchParams ¶ added in v2.8.0
type BrandSearchParams struct {
// Search term, matched against the fields selected by queryBy (e.g. 'nike',
// 'nike.com', 'nik').
Query string `query:"query" api:"required" json:"-"`
// Whether the search term matches by prefix, so partial words match as they are
// typed (e.g. 'nik' matches Nike). Set to false to match whole words only.
Autocomplete param.Opt[bool] `query:"autocomplete,omitzero" json:"-"`
// Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no
// typo tolerance).
TypoTolerance param.Opt[int64] `query:"typoTolerance,omitzero" json:"-"`
// Fields to match the search term against, as a comma-separated list or repeated
// parameter: 'name', 'domain', or both. Defaults to both.
//
// Any of "name", "domain".
QueryBy []string `query:"queryBy,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (BrandSearchParams) URLQuery ¶ added in v2.8.0
func (r BrandSearchParams) URLQuery() (v url.Values, err error)
URLQuery serializes BrandSearchParams's query parameters as `url.Values`.
type BrandSearchResponse ¶ added in v2.8.0
type BrandSearchResponse struct {
// Up to 10 matching brands, name matches first, then domain matches, most popular
// first within each group. Empty when nothing matches.
Results []BrandSearchResponseResult `json:"results" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata BrandSearchResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Results respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandSearchResponse) RawJSON ¶ added in v2.8.0
func (r BrandSearchResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandSearchResponse) UnmarshalJSON ¶ added in v2.8.0
func (r *BrandSearchResponse) UnmarshalJSON(data []byte) error
type BrandSearchResponseKeyMetadata ¶ added in v2.8.0
type BrandSearchResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (BrandSearchResponseKeyMetadata) RawJSON ¶ added in v2.8.0
func (r BrandSearchResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandSearchResponseKeyMetadata) UnmarshalJSON ¶ added in v2.8.0
func (r *BrandSearchResponseKeyMetadata) UnmarshalJSON(data []byte) error
type BrandSearchResponseResult ¶ added in v2.8.0
type BrandSearchResponseResult struct {
// The brand's domain.
Domain string `json:"domain" api:"required"`
// Logo link URL that serves the brand's logo, generated per request for the
// calling organization.
Logo string `json:"logo" api:"required"`
// The brand's name. Empty string when unknown.
Name string `json:"name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Domain respjson.Field
Logo respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (BrandSearchResponseResult) RawJSON ¶ added in v2.8.0
func (r BrandSearchResponseResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*BrandSearchResponseResult) UnmarshalJSON ¶ added in v2.8.0
func (r *BrandSearchResponseResult) UnmarshalJSON(data []byte) error
type BrandService ¶
type BrandService struct {
// contains filtered or unexported fields
}
BrandService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBrandService method instead.
func NewBrandService ¶
func NewBrandService(opts ...option.RequestOption) (r BrandService)
NewBrandService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*BrandService) Get ¶
func (r *BrandService) Get(ctx context.Context, body BrandGetParams, opts ...option.RequestOption) (res *BrandGetResponse, err error)
Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, transaction descriptor, or direct URL. Note: `by_direct_url` fetches brand data only from the provided URL — not from the entire internet.
func (*BrandService) GetSimplified ¶
func (r *BrandService) GetSimplified(ctx context.Context, query BrandGetSimplifiedParams, opts ...option.RequestOption) (res *BrandGetSimplifiedResponse, err error)
Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. Optimized for faster responses and reduced data transfer.
func (*BrandService) Search ¶ added in v2.8.0
func (r *BrandService) Search(ctx context.Context, query BrandSearchParams, opts ...option.RequestOption) (res *BrandSearchResponse, err error)
Search indexed brands by name or domain
type Client ¶
type Client struct {
Parse ParseService
Web WebService
AI AIService
Brand BrandService
Industry IndustryService
Utility UtilityService
// Monitor pages, sitemaps, and extracted website data for exact or semantic
// changes. Webhook payloads are documented by the
// MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload
// schemas.
Monitors MonitorService
// Scrape many pages or crawl a site asynchronously.
Batch BatchService
People PersonService
// Search live first-party RSS and free historical news data by company identity.
News NewsService
// contains filtered or unexported fields
}
Client creates a struct with services and top level methods that help with interacting with the context.dev API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (CONTEXT_DEV_API_KEY, CONTEXT_DEV_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type CrawlControls ¶ added in v2.7.0
type CrawlControls struct {
// Whether links to subdomains were followed. Always false for a sitemap crawl.
FollowSubdomains bool `json:"follow_subdomains" api:"required"`
// Link depth limit. Always 0 for a sitemap crawl, which never follows links off
// its URLs; null when a `start_url` crawl set no limit.
MaxDepth int64 `json:"max_depth" api:"required"`
// The `maxUrls` submitted with the crawl. A sitemap crawl scrapes only the URLs
// its sitemap actually lists, up to this many, so `input.reserved` is often lower.
MaxPages int64 `json:"max_pages" api:"required"`
// Where the crawl started.
Source CrawlControlsSourceUnion `json:"source" api:"required"`
// RE2 pattern URLs had to match to be crawled. Null when the crawl set none.
URLPattern string `json:"url_pattern" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Source respjson.Field
URLPattern respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The crawl controls as submitted, so the limits requested can be compared against what the crawl reached.
func (CrawlControls) RawJSON ¶ added in v2.7.0
func (r CrawlControls) RawJSON() string
Returns the unmodified JSON received from the API
func (*CrawlControls) UnmarshalJSON ¶ added in v2.7.0
func (r *CrawlControls) UnmarshalJSON(data []byte) error
type CrawlControlsSourceSitemap ¶ added in v2.9.0
type CrawlControlsSourceSitemap struct {
// Domain whose sitemap supplied the pages.
Domain string `json:"domain" api:"required"`
// Any of "sitemap".
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Domain respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The crawl scraped the pages listed in the domain's sitemap.
func (CrawlControlsSourceSitemap) RawJSON ¶ added in v2.9.0
func (r CrawlControlsSourceSitemap) RawJSON() string
Returns the unmodified JSON received from the API
func (*CrawlControlsSourceSitemap) UnmarshalJSON ¶ added in v2.9.0
func (r *CrawlControlsSourceSitemap) UnmarshalJSON(data []byte) error
type CrawlControlsSourceStartURL ¶ added in v2.9.0
type CrawlControlsSourceStartURL struct {
// Any of "start_url".
Type string `json:"type" api:"required"`
// Page the crawl started from.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The crawl discovered pages by following links from one URL.
func (CrawlControlsSourceStartURL) RawJSON ¶ added in v2.9.0
func (r CrawlControlsSourceStartURL) RawJSON() string
Returns the unmodified JSON received from the API
func (*CrawlControlsSourceStartURL) UnmarshalJSON ¶ added in v2.9.0
func (r *CrawlControlsSourceStartURL) UnmarshalJSON(data []byte) error
type CrawlControlsSourceUnion ¶ added in v2.7.0
type CrawlControlsSourceUnion struct {
Type string `json:"type"`
// This field is from variant [CrawlControlsSourceStartURL].
URL string `json:"url"`
// This field is from variant [CrawlControlsSourceSitemap].
Domain string `json:"domain"`
JSON struct {
Type respjson.Field
URL respjson.Field
Domain respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
CrawlControlsSourceUnion contains all possible properties and values from CrawlControlsSourceStartURL, CrawlControlsSourceSitemap.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (CrawlControlsSourceUnion) AsSitemap ¶ added in v2.9.0
func (u CrawlControlsSourceUnion) AsSitemap() (v CrawlControlsSourceSitemap)
func (CrawlControlsSourceUnion) AsStartURL ¶ added in v2.9.0
func (u CrawlControlsSourceUnion) AsStartURL() (v CrawlControlsSourceStartURL)
func (CrawlControlsSourceUnion) RawJSON ¶ added in v2.7.0
func (u CrawlControlsSourceUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*CrawlControlsSourceUnion) UnmarshalJSON ¶ added in v2.7.0
func (r *CrawlControlsSourceUnion) UnmarshalJSON(data []byte) error
type Failure ¶ added in v2.7.0
type Failure struct {
// Why the batch itself stopped.
Code string `json:"code" api:"required"`
// Human-readable explanation.
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A failure of the batch as a whole, distinct from the per-page failures in `page_errors`.
func (*Failure) UnmarshalJSON ¶ added in v2.7.0
type IndustryGetNaicsParams ¶
type IndustryGetNaicsParams struct {
// Brand domain or title to retrieve NAICS code for. If a valid domain is provided,
// it will be used for classification, otherwise, we will search for the brand
// using the provided title.
Input string `query:"input" api:"required" json:"-"`
// Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults
// to 5.
MaxResults param.Opt[int64] `query:"maxResults,omitzero" json:"-"`
// Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1.
MinResults param.Opt[int64] `query:"minResults,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (IndustryGetNaicsParams) URLQuery ¶
func (r IndustryGetNaicsParams) URLQuery() (v url.Values, err error)
URLQuery serializes IndustryGetNaicsParams's query parameters as `url.Values`.
type IndustryGetNaicsResponse ¶
type IndustryGetNaicsResponse struct {
// Array of NAICS codes and titles.
Codes []IndustryGetNaicsResponseCode `json:"codes"`
// Domain found for the brand
Domain string `json:"domain"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata IndustryGetNaicsResponseKeyMetadata `json:"key_metadata"`
// Status of the response, e.g., 'ok'
Status string `json:"status"`
// Industry classification type, for naics api it will be `naics`
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Codes respjson.Field
Domain respjson.Field
KeyMetadata respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (IndustryGetNaicsResponse) RawJSON ¶
func (r IndustryGetNaicsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*IndustryGetNaicsResponse) UnmarshalJSON ¶
func (r *IndustryGetNaicsResponse) UnmarshalJSON(data []byte) error
type IndustryGetNaicsResponseCode ¶
type IndustryGetNaicsResponseCode struct {
// NAICS code
Code string `json:"code" api:"required"`
// Confidence level for how well this NAICS code matches the company description
//
// Any of "high", "medium", "low".
Confidence string `json:"confidence" api:"required"`
// NAICS title
Name string `json:"name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Confidence respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (IndustryGetNaicsResponseCode) RawJSON ¶
func (r IndustryGetNaicsResponseCode) RawJSON() string
Returns the unmodified JSON received from the API
func (*IndustryGetNaicsResponseCode) UnmarshalJSON ¶
func (r *IndustryGetNaicsResponseCode) UnmarshalJSON(data []byte) error
type IndustryGetNaicsResponseKeyMetadata ¶
type IndustryGetNaicsResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (IndustryGetNaicsResponseKeyMetadata) RawJSON ¶
func (r IndustryGetNaicsResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*IndustryGetNaicsResponseKeyMetadata) UnmarshalJSON ¶
func (r *IndustryGetNaicsResponseKeyMetadata) UnmarshalJSON(data []byte) error
type IndustryGetSicParams ¶
type IndustryGetSicParams struct {
// Brand domain or title to retrieve SIC code for. If a valid domain is provided,
// it will be used for classification, otherwise, we will search for the brand
// using the provided title.
Input string `query:"input" api:"required" json:"-"`
// Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.
MaxResults param.Opt[int64] `query:"maxResults,omitzero" json:"-"`
// Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
MinResults param.Opt[int64] `query:"minResults,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
// Industrial Classification system; `latest_sec` uses the current SIC list as
// published by the SEC. Defaults to `original_sic`.
//
// Any of "original_sic", "latest_sec".
Type IndustryGetSicParamsType `query:"type,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (IndustryGetSicParams) URLQuery ¶
func (r IndustryGetSicParams) URLQuery() (v url.Values, err error)
URLQuery serializes IndustryGetSicParams's query parameters as `url.Values`.
type IndustryGetSicParamsType ¶
type IndustryGetSicParamsType string
Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`.
const ( IndustryGetSicParamsTypeOriginalSic IndustryGetSicParamsType = "original_sic" IndustryGetSicParamsTypeLatestSec IndustryGetSicParamsType = "latest_sec" )
type IndustryGetSicResponse ¶
type IndustryGetSicResponse struct {
// Echoes back which SIC dataset was used to classify the brand.
//
// Any of "original_sic", "latest_sec".
Classification IndustryGetSicResponseClassification `json:"classification"`
// Array of SIC codes with confidence scores. Extra fields depend on the requested
// classification: `original_sic` results include `majorGroup` and
// `majorGroupName`; `latest_sec` results include `office`.
Codes []IndustryGetSicResponseCode `json:"codes"`
// Domain found for the brand
Domain string `json:"domain"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata IndustryGetSicResponseKeyMetadata `json:"key_metadata"`
// Status of the response, e.g., 'ok'
Status string `json:"status"`
// Industry classification type, for sic api it will be `sic`
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Classification respjson.Field
Codes respjson.Field
Domain respjson.Field
KeyMetadata respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (IndustryGetSicResponse) RawJSON ¶
func (r IndustryGetSicResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*IndustryGetSicResponse) UnmarshalJSON ¶
func (r *IndustryGetSicResponse) UnmarshalJSON(data []byte) error
type IndustryGetSicResponseClassification ¶
type IndustryGetSicResponseClassification string
Echoes back which SIC dataset was used to classify the brand.
const ( IndustryGetSicResponseClassificationOriginalSic IndustryGetSicResponseClassification = "original_sic" IndustryGetSicResponseClassificationLatestSec IndustryGetSicResponseClassification = "latest_sec" )
type IndustryGetSicResponseCode ¶
type IndustryGetSicResponseCode struct {
// SIC code (4-digit).
Code string `json:"code" api:"required"`
// Confidence level for how well this SIC code matches the company description.
//
// Any of "high", "medium", "low".
Confidence string `json:"confidence" api:"required"`
// SIC industry title.
Name string `json:"name" api:"required"`
// 2-digit major group identifier (the leading two digits of the code). Only
// present when `classification` is `original_sic`.
MajorGroup string `json:"majorGroup"`
// Description of the 2-digit major group. Only present when `classification` is
// `original_sic`.
MajorGroupName string `json:"majorGroupName"`
// SEC review office responsible for filings under this code. Only present when
// `classification` is `latest_sec`.
Office string `json:"office"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Confidence respjson.Field
Name respjson.Field
MajorGroup respjson.Field
MajorGroupName respjson.Field
Office respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (IndustryGetSicResponseCode) RawJSON ¶
func (r IndustryGetSicResponseCode) RawJSON() string
Returns the unmodified JSON received from the API
func (*IndustryGetSicResponseCode) UnmarshalJSON ¶
func (r *IndustryGetSicResponseCode) UnmarshalJSON(data []byte) error
type IndustryGetSicResponseKeyMetadata ¶
type IndustryGetSicResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (IndustryGetSicResponseKeyMetadata) RawJSON ¶
func (r IndustryGetSicResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*IndustryGetSicResponseKeyMetadata) UnmarshalJSON ¶
func (r *IndustryGetSicResponseKeyMetadata) UnmarshalJSON(data []byte) error
type IndustryService ¶
type IndustryService struct {
// contains filtered or unexported fields
}
IndustryService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewIndustryService method instead.
func NewIndustryService ¶
func NewIndustryService(opts ...option.RequestOption) (r IndustryService)
NewIndustryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*IndustryService) GetNaics ¶
func (r *IndustryService) GetNaics(ctx context.Context, query IndustryGetNaicsParams, opts ...option.RequestOption) (res *IndustryGetNaicsResponse, err error)
Classify any brand into 2022 NAICS industry codes from its domain or name.
func (*IndustryService) GetSic ¶
func (r *IndustryService) GetSic(ctx context.Context, query IndustryGetSicParams, opts ...option.RequestOption) (res *IndustryGetSicResponse, err error)
Classify any brand into Standard Industrial Classification (SIC) codes from its domain or name. Choose between the original SIC system (`original_sic`) or the latest SIC list maintained by the SEC (`latest_sec`).
type Intake ¶ added in v2.7.0
type Intake struct {
// URLs dropped before reserving because another entry resolved to the same page.
// Non-zero for sitemap crawls too, whose sitemaps routinely list a page more than
// once.
Duplicates int64 `json:"duplicates" api:"required"`
// URLs from your list rejected as unusable; the same ones are itemised in
// `invalid_urls` at submission. Null for a crawl — a crawl that resolves no usable
// page is rejected outright with a 400 rather than accepted with an empty list.
Invalid int64 `json:"invalid" api:"required"`
// Pages credits were reserved for. Everything else — progress, the refund, the
// completion percentage — is measured against this.
Reserved int64 `json:"reserved" api:"required"`
// Whether `reserved` is an upper bound the batch may finish under. True only for a
// crawl that follows links, whose reachable page count is unknowable until it
// runs. False for a scrape and for a sitemap crawl, where `reserved` is an exact
// page count.
ReservedIsCeiling bool `json:"reserved_is_ceiling" api:"required"`
// URLs in the list you sent, before validation and de-duplication. Null for a
// crawl, which is given a source rather than a list.
Submitted int64 `json:"submitted" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Duplicates respjson.Field
Invalid respjson.Field
Reserved respjson.Field
ReservedIsCeiling respjson.Field
Submitted respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
What submission took in, and what it charged for.
func (*Intake) UnmarshalJSON ¶ added in v2.7.0
type MonitorDeleteResponse ¶
type MonitorDeleteResponse struct {
ID string `json:"id" api:"required"`
Deleted bool `json:"deleted" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Deleted respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorDeleteResponse) RawJSON ¶
func (r MonitorDeleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorDeleteResponse) UnmarshalJSON ¶
func (r *MonitorDeleteResponse) UnmarshalJSON(data []byte) error
type MonitorGetChangeResponse ¶
type MonitorGetChangeResponse struct {
ID string `json:"id" api:"required"`
// Any of "exact", "semantic".
ChangeDetectionType MonitorGetChangeResponseChangeDetectionType `json:"change_detection_type" api:"required"`
DetectedAt time.Time `json:"detected_at" api:"required" format:"date-time"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode MonitorGetChangeResponseMode `json:"mode" api:"required"`
MonitorID string `json:"monitor_id" api:"required"`
// The run that detected this change.
RunID string `json:"run_id" api:"required"`
Summary string `json:"summary" api:"required"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags" api:"required"`
// Any of "page", "sitemap", "extract".
TargetType MonitorGetChangeResponseTargetType `json:"target_type" api:"required"`
Title string `json:"title" api:"required"`
URL string `json:"url" api:"required" format:"uri"`
AddedURLCount int64 `json:"added_url_count"`
// At most 500 URLs are included; the corresponding count field is always exact.
AddedURLs []string `json:"added_urls" format:"uri"`
AfterTextExcerpt string `json:"after_text_excerpt"`
BeforeTextExcerpt string `json:"before_text_excerpt"`
Confidence float64 `json:"confidence"`
// Text diff between the previous and current page baseline (page targets).
Diff string `json:"diff"`
Evidence []MonitorGetChangeResponseEvidence `json:"evidence"`
// Any of "low", "medium", "high".
Importance MonitorGetChangeResponseImportance `json:"importance"`
MatchedURLCount int64 `json:"matched_url_count"`
// At most 500 URLs are included; the corresponding count field is always exact.
MatchedURLs []string `json:"matched_urls" format:"uri"`
RemovedURLCount int64 `json:"removed_url_count"`
// At most 500 URLs are included; the corresponding count field is always exact.
RemovedURLs []string `json:"removed_urls" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChangeDetectionType respjson.Field
DetectedAt respjson.Field
Mode respjson.Field
MonitorID respjson.Field
RunID respjson.Field
Summary respjson.Field
Tags respjson.Field
TargetType respjson.Field
Title respjson.Field
URL respjson.Field
AddedURLCount respjson.Field
AddedURLs respjson.Field
AfterTextExcerpt respjson.Field
BeforeTextExcerpt respjson.Field
Confidence respjson.Field
Diff respjson.Field
Evidence respjson.Field
Importance respjson.Field
MatchedURLCount respjson.Field
MatchedURLs respjson.Field
RemovedURLCount respjson.Field
RemovedURLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A detected change. `mode` is the constant `web`; `target_type` and `change_detection_type` describe the change, and which optional fields are present depends on them (page: `diff` + excerpts; sitemap: `added_urls`/`removed_urls`; semantic: `confidence`/`importance`/`evidence`/`matched_urls`).
func (MonitorGetChangeResponse) RawJSON ¶
func (r MonitorGetChangeResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetChangeResponse) UnmarshalJSON ¶
func (r *MonitorGetChangeResponse) UnmarshalJSON(data []byte) error
type MonitorGetChangeResponseChangeDetectionType ¶
type MonitorGetChangeResponseChangeDetectionType string
const ( MonitorGetChangeResponseChangeDetectionTypeExact MonitorGetChangeResponseChangeDetectionType = "exact" MonitorGetChangeResponseChangeDetectionTypeSemantic MonitorGetChangeResponseChangeDetectionType = "semantic" )
type MonitorGetChangeResponseEvidence ¶
type MonitorGetChangeResponseEvidence struct {
// Snapshot of the content after the change.
After string `json:"after" api:"required"`
// Snapshot of the content before the change.
Before string `json:"before" api:"required"`
// Optional URL the evidence relates to. Absent for whole-target diffs.
URL string `json:"url" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
After respjson.Field
Before respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorGetChangeResponseEvidence) RawJSON ¶
func (r MonitorGetChangeResponseEvidence) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetChangeResponseEvidence) UnmarshalJSON ¶
func (r *MonitorGetChangeResponseEvidence) UnmarshalJSON(data []byte) error
type MonitorGetChangeResponseImportance ¶
type MonitorGetChangeResponseImportance string
const ( MonitorGetChangeResponseImportanceLow MonitorGetChangeResponseImportance = "low" MonitorGetChangeResponseImportanceMedium MonitorGetChangeResponseImportance = "medium" MonitorGetChangeResponseImportanceHigh MonitorGetChangeResponseImportance = "high" )
type MonitorGetChangeResponseMode ¶
type MonitorGetChangeResponseMode string
Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`.
const (
MonitorGetChangeResponseModeWeb MonitorGetChangeResponseMode = "web"
)
type MonitorGetChangeResponseTargetType ¶
type MonitorGetChangeResponseTargetType string
const ( MonitorGetChangeResponseTargetTypePage MonitorGetChangeResponseTargetType = "page" MonitorGetChangeResponseTargetTypeSitemap MonitorGetChangeResponseTargetType = "sitemap" MonitorGetChangeResponseTargetTypeExtract MonitorGetChangeResponseTargetType = "extract" )
type MonitorGetCreditUsageParams ¶ added in v2.5.0
type MonitorGetCreditUsageParams struct {
// Only include items at or after this ISO 8601 timestamp.
Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
// Only include items before this ISO 8601 timestamp.
Until param.Opt[time.Time] `query:"until,omitzero" format:"date-time" json:"-"`
// contains filtered or unexported fields
}
func (MonitorGetCreditUsageParams) URLQuery ¶ added in v2.5.0
func (r MonitorGetCreditUsageParams) URLQuery() (v url.Values, err error)
URLQuery serializes MonitorGetCreditUsageParams's query parameters as `url.Values`.
type MonitorGetCreditUsageResponse ¶ added in v2.5.0
type MonitorGetCreditUsageResponse struct {
Data []MonitorGetCreditUsageResponseData `json:"data" api:"required"`
// Sum of credits across all monitors in the window.
TotalCredits int64 `json:"total_credits" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
TotalCredits respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorGetCreditUsageResponse) RawJSON ¶ added in v2.5.0
func (r MonitorGetCreditUsageResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetCreditUsageResponse) UnmarshalJSON ¶ added in v2.5.0
func (r *MonitorGetCreditUsageResponse) UnmarshalJSON(data []byte) error
type MonitorGetCreditUsageResponseData ¶ added in v2.5.0
type MonitorGetCreditUsageResponseData struct {
// Credits charged to this monitor over the window.
Credits int64 `json:"credits" api:"required"`
MonitorID string `json:"monitor_id" api:"required"`
// Monitor name (falls back to the id when the monitor was deleted).
Name string `json:"name" api:"required"`
// Number of billed runs over the window.
Runs int64 `json:"runs" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Credits respjson.Field
MonitorID respjson.Field
Name respjson.Field
Runs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorGetCreditUsageResponseData) RawJSON ¶ added in v2.5.0
func (r MonitorGetCreditUsageResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetCreditUsageResponseData) UnmarshalJSON ¶ added in v2.5.0
func (r *MonitorGetCreditUsageResponseData) UnmarshalJSON(data []byte) error
type MonitorGetLimitsResponse ¶ added in v2.5.0
type MonitorGetLimitsResponse struct {
// Maximum number of monitors allowed for the account. Defaults to the plan
// allowance unless a custom limit is set for the organization.
MonitorsLimit int64 `json:"monitors_limit" api:"required"`
// Number of monitors the account currently has.
MonitorsUsed int64 `json:"monitors_used" api:"required"`
// The plan tier the limit was resolved from.
//
// Any of "free", "starter", "pro", "scale".
Plan MonitorGetLimitsResponsePlan `json:"plan" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MonitorsLimit respjson.Field
MonitorsUsed respjson.Field
Plan respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorGetLimitsResponse) RawJSON ¶ added in v2.5.0
func (r MonitorGetLimitsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetLimitsResponse) UnmarshalJSON ¶ added in v2.5.0
func (r *MonitorGetLimitsResponse) UnmarshalJSON(data []byte) error
type MonitorGetLimitsResponsePlan ¶ added in v2.5.0
type MonitorGetLimitsResponsePlan string
The plan tier the limit was resolved from.
const ( MonitorGetLimitsResponsePlanFree MonitorGetLimitsResponsePlan = "free" MonitorGetLimitsResponsePlanStarter MonitorGetLimitsResponsePlan = "starter" MonitorGetLimitsResponsePlanPro MonitorGetLimitsResponsePlan = "pro" MonitorGetLimitsResponsePlanScale MonitorGetLimitsResponsePlan = "scale" )
type MonitorGetResponse ¶
type MonitorGetResponse struct {
ID string `json:"id" api:"required"`
// Discriminated union describing how changes are detected.
ChangeDetection MonitorGetResponseChangeDetectionUnion `json:"change_detection" api:"required"`
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode MonitorGetResponseMode `json:"mode" api:"required"`
Name string `json:"name" api:"required"`
// Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
// every 6 hours or every 2 days. The total interval (frequency × unit) must be
// between 10 minutes and 1 year.
Schedule MonitorGetResponseSchedule `json:"schedule" api:"required"`
// Monitor lifecycle status. `failed` means the most recent run failed (see the
// monitor's `last_error`); failed monitors keep running on schedule and flip back
// to `active` on the next successful run. Monitors are auto-`paused` after
// repeated consecutive failures or insufficient-credit skips; resume by PATCHing
// status to `active`.
//
// Any of "active", "paused", "failed".
Status MonitorGetResponseStatus `json:"status" api:"required"`
// Discriminated union describing what the monitor watches.
Target MonitorGetResponseTargetUnion `json:"target" api:"required"`
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Current baseline: the last observed value the monitor compares new snapshots
// against. Its shape follows `target.type` (page/sitemap/extract). Only populated
// on GET /monitors/{monitor_id}; null until the first baseline run completes (and
// after a target or change_detection update, which resets the baseline).
Baseline MonitorGetResponseBaselineUnion `json:"baseline" api:"nullable"`
LastChangeAt time.Time `json:"last_change_at" api:"nullable" format:"date-time"`
// Error from the most recent failed run; null when the last run succeeded.
LastError MonitorGetResponseLastError `json:"last_error" api:"nullable"`
LastRunAt time.Time `json:"last_run_at" api:"nullable" format:"date-time"`
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorGetResponseWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
// are healthy or no webhook is configured. Cleared on the next successful delivery
// and when the webhook URL changes.
WebhookFailure MonitorGetResponseWebhookFailure `json:"webhook_failure" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChangeDetection respjson.Field
CreatedAt respjson.Field
Mode respjson.Field
Name respjson.Field
Schedule respjson.Field
Status respjson.Field
Target respjson.Field
UpdatedAt respjson.Field
Baseline respjson.Field
LastChangeAt respjson.Field
LastError respjson.Field
LastRunAt respjson.Field
NextRunAt respjson.Field
Tags respjson.Field
Webhook respjson.Field
WebhookFailure respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic).
func (MonitorGetResponse) RawJSON ¶
func (r MonitorGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponse) UnmarshalJSON ¶
func (r *MonitorGetResponse) UnmarshalJSON(data []byte) error
type MonitorGetResponseBaselineExtractBaseline ¶ added in v2.1.0
type MonitorGetResponseBaselineExtractBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The extracted structured data, matching the monitor's extraction schema (same
// shape as the /web/extract endpoint's `data`). Refreshed when the monitor
// re-discovers its page set (at most about once a day); `null` when no extraction
// has been captured yet.
Data any `json:"data" api:"required"`
// The page URLs the monitor tracks and analyzes for changes.
URLsAnalyzed []string `json:"urls_analyzed" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted.
func (MonitorGetResponseBaselineExtractBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorGetResponseBaselineExtractBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseBaselineExtractBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorGetResponseBaselineExtractBaseline) UnmarshalJSON(data []byte) error
type MonitorGetResponseBaselinePageBaseline ¶ added in v2.1.0
type MonitorGetResponseBaselinePageBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The page's visible text as last observed.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `page` monitor: the visible page text as last observed.
func (MonitorGetResponseBaselinePageBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorGetResponseBaselinePageBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseBaselinePageBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorGetResponseBaselinePageBaseline) UnmarshalJSON(data []byte) error
type MonitorGetResponseBaselineSitemapBaseline ¶ added in v2.1.0
type MonitorGetResponseBaselineSitemapBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// Number of URLs in the baseline.
URLCount int64 `json:"url_count" api:"required"`
// The sitemap URLs as last observed (sorted, normalized).
URLs []string `json:"urls" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
URLCount respjson.Field
URLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `sitemap` monitor: the normalized URL set as last observed.
func (MonitorGetResponseBaselineSitemapBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorGetResponseBaselineSitemapBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseBaselineSitemapBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorGetResponseBaselineSitemapBaseline) UnmarshalJSON(data []byte) error
type MonitorGetResponseBaselineUnion ¶ added in v2.1.0
type MonitorGetResponseBaselineUnion struct {
CapturedAt time.Time `json:"captured_at"`
// This field is from variant [MonitorGetResponseBaselinePageBaseline].
Text string `json:"text"`
// This field is from variant [MonitorGetResponseBaselineSitemapBaseline].
URLCount int64 `json:"url_count"`
// This field is from variant [MonitorGetResponseBaselineSitemapBaseline].
URLs []string `json:"urls"`
// This field is from variant [MonitorGetResponseBaselineExtractBaseline].
Data any `json:"data"`
// This field is from variant [MonitorGetResponseBaselineExtractBaseline].
URLsAnalyzed []string `json:"urls_analyzed"`
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
URLCount respjson.Field
URLs respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorGetResponseBaselineUnion contains all possible properties and values from MonitorGetResponseBaselinePageBaseline, MonitorGetResponseBaselineSitemapBaseline, MonitorGetResponseBaselineExtractBaseline.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorGetResponseBaselineUnion) AsExtractBaseline ¶ added in v2.1.0
func (u MonitorGetResponseBaselineUnion) AsExtractBaseline() (v MonitorGetResponseBaselineExtractBaseline)
func (MonitorGetResponseBaselineUnion) AsPageBaseline ¶ added in v2.1.0
func (u MonitorGetResponseBaselineUnion) AsPageBaseline() (v MonitorGetResponseBaselinePageBaseline)
func (MonitorGetResponseBaselineUnion) AsSitemapBaseline ¶ added in v2.1.0
func (u MonitorGetResponseBaselineUnion) AsSitemapBaseline() (v MonitorGetResponseBaselineSitemapBaseline)
func (MonitorGetResponseBaselineUnion) RawJSON ¶ added in v2.1.0
func (u MonitorGetResponseBaselineUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseBaselineUnion) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorGetResponseBaselineUnion) UnmarshalJSON(data []byte) error
type MonitorGetResponseChangeDetectionExact ¶
type MonitorGetResponseChangeDetectionExact struct {
Type constant.Exact `json:"type" default:"exact"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
func (MonitorGetResponseChangeDetectionExact) RawJSON ¶
func (r MonitorGetResponseChangeDetectionExact) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseChangeDetectionExact) UnmarshalJSON ¶
func (r *MonitorGetResponseChangeDetectionExact) UnmarshalJSON(data []byte) error
type MonitorGetResponseChangeDetectionSemantic ¶
type MonitorGetResponseChangeDetectionSemantic struct {
Type constant.Semantic `json:"type" default:"semantic"`
ConfidenceThreshold float64 `json:"confidence_threshold"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
func (MonitorGetResponseChangeDetectionSemantic) RawJSON ¶
func (r MonitorGetResponseChangeDetectionSemantic) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseChangeDetectionSemantic) UnmarshalJSON ¶
func (r *MonitorGetResponseChangeDetectionSemantic) UnmarshalJSON(data []byte) error
type MonitorGetResponseChangeDetectionUnion ¶
type MonitorGetResponseChangeDetectionUnion struct {
// Any of "exact", "semantic".
Type string `json:"type"`
// This field is from variant [MonitorGetResponseChangeDetectionSemantic].
ConfidenceThreshold float64 `json:"confidence_threshold"`
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorGetResponseChangeDetectionUnion contains all possible properties and values from MonitorGetResponseChangeDetectionExact, MonitorGetResponseChangeDetectionSemantic.
Use the MonitorGetResponseChangeDetectionUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorGetResponseChangeDetectionUnion) AsAny ¶
func (u MonitorGetResponseChangeDetectionUnion) AsAny() anyMonitorGetResponseChangeDetection
Use the following switch statement to find the correct variant
switch variant := MonitorGetResponseChangeDetectionUnion.AsAny().(type) {
case contextdev.MonitorGetResponseChangeDetectionExact:
case contextdev.MonitorGetResponseChangeDetectionSemantic:
default:
fmt.Errorf("no variant present")
}
func (MonitorGetResponseChangeDetectionUnion) AsExact ¶
func (u MonitorGetResponseChangeDetectionUnion) AsExact() (v MonitorGetResponseChangeDetectionExact)
func (MonitorGetResponseChangeDetectionUnion) AsSemantic ¶
func (u MonitorGetResponseChangeDetectionUnion) AsSemantic() (v MonitorGetResponseChangeDetectionSemantic)
func (MonitorGetResponseChangeDetectionUnion) RawJSON ¶
func (u MonitorGetResponseChangeDetectionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseChangeDetectionUnion) UnmarshalJSON ¶
func (r *MonitorGetResponseChangeDetectionUnion) UnmarshalJSON(data []byte) error
type MonitorGetResponseLastError ¶
type MonitorGetResponseLastError struct {
Code string `json:"code" api:"required"`
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error from the most recent failed run; null when the last run succeeded.
func (MonitorGetResponseLastError) RawJSON ¶
func (r MonitorGetResponseLastError) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseLastError) UnmarshalJSON ¶
func (r *MonitorGetResponseLastError) UnmarshalJSON(data []byte) error
type MonitorGetResponseMode ¶
type MonitorGetResponseMode string
Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`.
const (
MonitorGetResponseModeWeb MonitorGetResponseMode = "web"
)
type MonitorGetResponseSchedule ¶
type MonitorGetResponseSchedule struct {
// Number of units between runs. The resulting interval (frequency × unit) must be
// at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
// maximum 365 when unit is days).
Frequency int64 `json:"frequency" api:"required"`
// Any of "interval".
Type string `json:"type" api:"required"`
// Any of "minutes", "hours", "days".
Unit string `json:"unit" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Frequency respjson.Field
Type respjson.Field
Unit respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.
func (MonitorGetResponseSchedule) RawJSON ¶
func (r MonitorGetResponseSchedule) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseSchedule) UnmarshalJSON ¶
func (r *MonitorGetResponseSchedule) UnmarshalJSON(data []byte) error
type MonitorGetResponseStatus ¶
type MonitorGetResponseStatus string
Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`.
const ( MonitorGetResponseStatusActive MonitorGetResponseStatus = "active" MonitorGetResponseStatusPaused MonitorGetResponseStatus = "paused" MonitorGetResponseStatusFailed MonitorGetResponseStatus = "failed" )
type MonitorGetResponseTargetExtract ¶
type MonitorGetResponseTargetExtract struct {
// Natural-language instructions guiding which pages and facts to track and which
// changes to report.
Instructions string `json:"instructions" api:"required"`
Type constant.Extract `json:"type" default:"extract"`
// Root URL to extract structured data from.
URL string `json:"url" api:"required" format:"uri"`
FollowSubdomains bool `json:"follow_subdomains"`
// Optional maximum link depth from the starting URL (0 = only the starting page).
MaxDepth int64 `json:"max_depth"`
// Maximum number of pages to track.
MaxPages int64 `json:"max_pages"`
// JSON Schema describing the data you care about. It is used three ways: it guides
// which pages are selected for tracking, it gives the change judge extra context
// on which changes matter (alongside `instructions`), and it defines the shape of
// the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
// about once a day). It is not a response format for changes: change events and
// webhook payloads always contain diffs, summaries, and evidence excerpts — never
// data in this schema's shape. If omitted, a default summary + key-points schema
// is used.
Schema map[string]any `json:"schema"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Instructions respjson.Field
Type respjson.Field
URL respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
func (MonitorGetResponseTargetExtract) RawJSON ¶
func (r MonitorGetResponseTargetExtract) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseTargetExtract) UnmarshalJSON ¶
func (r *MonitorGetResponseTargetExtract) UnmarshalJSON(data []byte) error
type MonitorGetResponseTargetPage ¶
type MonitorGetResponseTargetPage struct {
Type constant.Page `json:"type" default:"page"`
URL string `json:"url" api:"required" format:"uri"`
// Plain-language goal describing which page changes matter. When provided without
// change_detection, semantic detection is inferred.
Instructions string `json:"instructions"`
// Normalize whitespace before comparing or analyzing text.
NormalizeWhitespace bool `json:"normalize_whitespace"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
func (MonitorGetResponseTargetPage) RawJSON ¶
func (r MonitorGetResponseTargetPage) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseTargetPage) UnmarshalJSON ¶
func (r *MonitorGetResponseTargetPage) UnmarshalJSON(data []byte) error
type MonitorGetResponseTargetSitemap ¶
type MonitorGetResponseTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
// URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
// URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
func (MonitorGetResponseTargetSitemap) RawJSON ¶
func (r MonitorGetResponseTargetSitemap) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseTargetSitemap) UnmarshalJSON ¶
func (r *MonitorGetResponseTargetSitemap) UnmarshalJSON(data []byte) error
type MonitorGetResponseTargetUnion ¶
type MonitorGetResponseTargetUnion struct {
// Any of "page", "sitemap", "extract".
Type string `json:"type"`
URL string `json:"url"`
Instructions string `json:"instructions"`
// This field is from variant [MonitorGetResponseTargetPage].
NormalizeWhitespace bool `json:"normalize_whitespace"`
// This field is from variant [MonitorGetResponseTargetSitemap].
Exclude []string `json:"exclude"`
// This field is from variant [MonitorGetResponseTargetSitemap].
Include []string `json:"include"`
// This field is from variant [MonitorGetResponseTargetSitemap].
MaxURLs int64 `json:"max_urls"`
// This field is from variant [MonitorGetResponseTargetExtract].
FollowSubdomains bool `json:"follow_subdomains"`
// This field is from variant [MonitorGetResponseTargetExtract].
MaxDepth int64 `json:"max_depth"`
// This field is from variant [MonitorGetResponseTargetExtract].
MaxPages int64 `json:"max_pages"`
// This field is from variant [MonitorGetResponseTargetExtract].
Schema map[string]any `json:"schema"`
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorGetResponseTargetUnion contains all possible properties and values from MonitorGetResponseTargetPage, MonitorGetResponseTargetSitemap, MonitorGetResponseTargetExtract.
Use the MonitorGetResponseTargetUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorGetResponseTargetUnion) AsAny ¶
func (u MonitorGetResponseTargetUnion) AsAny() anyMonitorGetResponseTarget
Use the following switch statement to find the correct variant
switch variant := MonitorGetResponseTargetUnion.AsAny().(type) {
case contextdev.MonitorGetResponseTargetPage:
case contextdev.MonitorGetResponseTargetSitemap:
case contextdev.MonitorGetResponseTargetExtract:
default:
fmt.Errorf("no variant present")
}
func (MonitorGetResponseTargetUnion) AsExtract ¶
func (u MonitorGetResponseTargetUnion) AsExtract() (v MonitorGetResponseTargetExtract)
func (MonitorGetResponseTargetUnion) AsPage ¶
func (u MonitorGetResponseTargetUnion) AsPage() (v MonitorGetResponseTargetPage)
func (MonitorGetResponseTargetUnion) AsSitemap ¶
func (u MonitorGetResponseTargetUnion) AsSitemap() (v MonitorGetResponseTargetSitemap)
func (MonitorGetResponseTargetUnion) RawJSON ¶
func (u MonitorGetResponseTargetUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseTargetUnion) UnmarshalJSON ¶
func (r *MonitorGetResponseTargetUnion) UnmarshalJSON(data []byte) error
type MonitorGetResponseWebhook ¶
type MonitorGetResponseWebhook struct {
// Webhook URL events are delivered to.
URL string `json:"url" api:"required" format:"uri"`
// Events delivered to this endpoint. `change.detected` fires only when a run
// detects a change; `run.completed` fires on every completed run — including runs
// that detected no change — and embeds the change when one was detected. Defaults
// to `["change.detected"]` when omitted.
//
// Any of "change.detected", "run.completed".
Events []string `json:"events"`
// Signing secret used to verify webhook authenticity. Each delivery includes an
// `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
// `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
// compare and reject stale timestamps to prevent replay. Generated by the API;
// cannot be set by clients.
Secret string `json:"secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
URL respjson.Field
Events respjson.Field
Secret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorGetResponseWebhook) RawJSON ¶
func (r MonitorGetResponseWebhook) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseWebhook) UnmarshalJSON ¶
func (r *MonitorGetResponseWebhook) UnmarshalJSON(data []byte) error
type MonitorGetResponseWebhookFailure ¶ added in v2.3.0
type MonitorGetResponseWebhookFailure struct {
// Number of consecutive delivery attempts that did not succeed.
ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"`
LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"`
// Human-readable description of the most recent failure.
LastMessage string `json:"last_message" api:"required"`
// Outcome of the most recent failed delivery. rejected means a non-2xx response;
// failed means no HTTP response was received; skipped_unsafe_url means the URL
// failed the public-endpoint safety check.
//
// Any of "rejected", "failed", "skipped_unsafe_url".
LastStatus string `json:"last_status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ConsecutiveFailures respjson.Field
LastFailedAt respjson.Field
LastMessage respjson.Field
LastStatus respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes.
func (MonitorGetResponseWebhookFailure) RawJSON ¶ added in v2.3.0
func (r MonitorGetResponseWebhookFailure) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorGetResponseWebhookFailure) UnmarshalJSON ¶ added in v2.3.0
func (r *MonitorGetResponseWebhookFailure) UnmarshalJSON(data []byte) error
type MonitorListAccountChangesParams ¶
type MonitorListAccountChangesParams struct {
// Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of items to return per page (1-100). Defaults to 25.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter changes to a single monitor.
MonitorID param.Opt[string] `query:"monitor_id,omitzero" json:"-"`
// Only include items at or after this ISO 8601 timestamp.
Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
// Filter to items that have this tag.
Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
// Only include items before this ISO 8601 timestamp.
Until param.Opt[time.Time] `query:"until,omitzero" format:"date-time" json:"-"`
// Filter by change detection type.
//
// Any of "exact", "semantic".
ChangeDetectionType MonitorListAccountChangesParamsChangeDetectionType `query:"change_detection_type,omitzero" json:"-"`
// Filter by target type.
//
// Any of "page", "sitemap", "extract".
TargetType MonitorListAccountChangesParamsTargetType `query:"target_type,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MonitorListAccountChangesParams) URLQuery ¶
func (r MonitorListAccountChangesParams) URLQuery() (v url.Values, err error)
URLQuery serializes MonitorListAccountChangesParams's query parameters as `url.Values`.
type MonitorListAccountChangesParamsChangeDetectionType ¶
type MonitorListAccountChangesParamsChangeDetectionType string
Filter by change detection type.
const ( MonitorListAccountChangesParamsChangeDetectionTypeExact MonitorListAccountChangesParamsChangeDetectionType = "exact" MonitorListAccountChangesParamsChangeDetectionTypeSemantic MonitorListAccountChangesParamsChangeDetectionType = "semantic" )
type MonitorListAccountChangesParamsTargetType ¶
type MonitorListAccountChangesParamsTargetType string
Filter by target type.
const ( MonitorListAccountChangesParamsTargetTypePage MonitorListAccountChangesParamsTargetType = "page" MonitorListAccountChangesParamsTargetTypeSitemap MonitorListAccountChangesParamsTargetType = "sitemap" MonitorListAccountChangesParamsTargetTypeExtract MonitorListAccountChangesParamsTargetType = "extract" )
type MonitorListAccountChangesResponse ¶
type MonitorListAccountChangesResponse struct {
Data []MonitorListAccountChangesResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
NextCursor string `json:"next_cursor" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
NextCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListAccountChangesResponse) RawJSON ¶
func (r MonitorListAccountChangesResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListAccountChangesResponse) UnmarshalJSON ¶
func (r *MonitorListAccountChangesResponse) UnmarshalJSON(data []byte) error
type MonitorListAccountChangesResponseData ¶
type MonitorListAccountChangesResponseData struct {
ID string `json:"id" api:"required"`
// Any of "exact", "semantic".
ChangeDetectionType string `json:"change_detection_type" api:"required"`
DetectedAt time.Time `json:"detected_at" api:"required" format:"date-time"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode string `json:"mode" api:"required"`
MonitorID string `json:"monitor_id" api:"required"`
Summary string `json:"summary" api:"required"`
// Any of "page", "sitemap", "extract".
TargetType string `json:"target_type" api:"required"`
Title string `json:"title" api:"required"`
URL string `json:"url" api:"required" format:"uri"`
AddedURLCount int64 `json:"added_url_count"`
Confidence float64 `json:"confidence"`
// Any of "low", "medium", "high".
Importance string `json:"importance"`
MatchedURLCount int64 `json:"matched_url_count"`
RemovedURLCount int64 `json:"removed_url_count"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChangeDetectionType respjson.Field
DetectedAt respjson.Field
Mode respjson.Field
MonitorID respjson.Field
Summary respjson.Field
TargetType respjson.Field
Title respjson.Field
URL respjson.Field
AddedURLCount respjson.Field
Confidence respjson.Field
Importance respjson.Field
MatchedURLCount respjson.Field
RemovedURLCount respjson.Field
Tags respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A lightweight change summary. `mode` is the constant `web`; `target_type` and `change_detection_type` describe the change, and which optional fields are present depends on them (e.g. sitemap changes include `added_url_count`/`removed_url_count`; semantic changes include `confidence`/`importance`).
func (MonitorListAccountChangesResponseData) RawJSON ¶
func (r MonitorListAccountChangesResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListAccountChangesResponseData) UnmarshalJSON ¶
func (r *MonitorListAccountChangesResponseData) UnmarshalJSON(data []byte) error
type MonitorListAccountRunsParams ¶
type MonitorListAccountRunsParams struct {
// Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of items to return per page (1-100). Defaults to 25.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter runs by lifecycle status.
//
// Any of "queued", "running", "completed", "failed", "skipped".
Status MonitorListAccountRunsParamsStatus `query:"status,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MonitorListAccountRunsParams) URLQuery ¶
func (r MonitorListAccountRunsParams) URLQuery() (v url.Values, err error)
URLQuery serializes MonitorListAccountRunsParams's query parameters as `url.Values`.
type MonitorListAccountRunsParamsStatus ¶
type MonitorListAccountRunsParamsStatus string
Filter runs by lifecycle status.
const ( MonitorListAccountRunsParamsStatusQueued MonitorListAccountRunsParamsStatus = "queued" MonitorListAccountRunsParamsStatusRunning MonitorListAccountRunsParamsStatus = "running" MonitorListAccountRunsParamsStatusCompleted MonitorListAccountRunsParamsStatus = "completed" MonitorListAccountRunsParamsStatusFailed MonitorListAccountRunsParamsStatus = "failed" MonitorListAccountRunsParamsStatusSkipped MonitorListAccountRunsParamsStatus = "skipped" )
type MonitorListAccountRunsResponse ¶
type MonitorListAccountRunsResponse struct {
Data []MonitorListAccountRunsResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
NextCursor string `json:"next_cursor" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
NextCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListAccountRunsResponse) RawJSON ¶
func (r MonitorListAccountRunsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListAccountRunsResponse) UnmarshalJSON ¶
func (r *MonitorListAccountRunsResponse) UnmarshalJSON(data []byte) error
type MonitorListAccountRunsResponseData ¶
type MonitorListAccountRunsResponseData struct {
ID string `json:"id" api:"required"`
// True when this run established the monitor's initial baseline; baseline runs
// perform no change detection.
BaselineCreated bool `json:"baseline_created" api:"required"`
ChangeDetected bool `json:"change_detected" api:"required"`
// Any of "exact", "semantic".
ChangeDetectionType string `json:"change_detection_type" api:"required"`
// Credits charged for this run (0 for skipped/failed runs).
CreditsCharged int64 `json:"credits_charged" api:"required"`
MonitorID string `json:"monitor_id" api:"required"`
// The first run after monitor creation is a baseline run.
//
// Any of "baseline", "scheduled".
RunType string `json:"run_type" api:"required"`
// Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
// (insufficient credits, monitor paused, or superseded by a concurrent run).
//
// Any of "queued", "running", "completed", "failed", "skipped".
Status string `json:"status" api:"required"`
// Any of "page", "sitemap", "extract".
TargetType string `json:"target_type" api:"required"`
ChangeID string `json:"change_id" api:"nullable"`
CompletedAt time.Time `json:"completed_at" api:"nullable" format:"date-time"`
Error MonitorListAccountRunsResponseDataError `json:"error" api:"nullable"`
// Why a skipped run never executed; null unless status is `skipped`.
//
// Any of "insufficient_credits", "monitor_paused", "superseded".
SkipReason string `json:"skip_reason" api:"nullable"`
StartedAt time.Time `json:"started_at" api:"nullable" format:"date-time"`
// All webhook deliveries attempted by this run — one per subscribed event that
// fired. Omitted when no webhook was attempted, including runs created before
// event selection was added.
WebhookDeliveries []WebhookDelivery `json:"webhook_deliveries"`
// Deprecated: use `webhook_deliveries`, which records every attempt now that a run
// can deliver multiple events. Omitted when no webhook was attempted, including
// historical runs created before delivery tracking was added.
//
// Deprecated: deprecated
WebhookDelivery WebhookDelivery `json:"webhook_delivery"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
BaselineCreated respjson.Field
ChangeDetected respjson.Field
ChangeDetectionType respjson.Field
CreditsCharged respjson.Field
MonitorID respjson.Field
RunType respjson.Field
Status respjson.Field
TargetType respjson.Field
ChangeID respjson.Field
CompletedAt respjson.Field
Error respjson.Field
SkipReason respjson.Field
StartedAt respjson.Field
WebhookDeliveries respjson.Field
WebhookDelivery respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListAccountRunsResponseData) RawJSON ¶
func (r MonitorListAccountRunsResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListAccountRunsResponseData) UnmarshalJSON ¶
func (r *MonitorListAccountRunsResponseData) UnmarshalJSON(data []byte) error
type MonitorListAccountRunsResponseDataError ¶
type MonitorListAccountRunsResponseDataError struct {
Code string `json:"code" api:"required"`
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListAccountRunsResponseDataError) RawJSON ¶
func (r MonitorListAccountRunsResponseDataError) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListAccountRunsResponseDataError) UnmarshalJSON ¶
func (r *MonitorListAccountRunsResponseDataError) UnmarshalJSON(data []byte) error
type MonitorListChangesParams ¶
type MonitorListChangesParams struct {
// Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of items to return per page (1-100). Defaults to 25.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Only include items at or after this ISO 8601 timestamp.
Since param.Opt[time.Time] `query:"since,omitzero" format:"date-time" json:"-"`
// Filter to items that have this tag.
Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
// Only include items before this ISO 8601 timestamp.
Until param.Opt[time.Time] `query:"until,omitzero" format:"date-time" json:"-"`
// contains filtered or unexported fields
}
func (MonitorListChangesParams) URLQuery ¶
func (r MonitorListChangesParams) URLQuery() (v url.Values, err error)
URLQuery serializes MonitorListChangesParams's query parameters as `url.Values`.
type MonitorListChangesResponse ¶
type MonitorListChangesResponse struct {
Data []MonitorListChangesResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
NextCursor string `json:"next_cursor" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
NextCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListChangesResponse) RawJSON ¶
func (r MonitorListChangesResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListChangesResponse) UnmarshalJSON ¶
func (r *MonitorListChangesResponse) UnmarshalJSON(data []byte) error
type MonitorListChangesResponseData ¶
type MonitorListChangesResponseData struct {
ID string `json:"id" api:"required"`
// Any of "exact", "semantic".
ChangeDetectionType string `json:"change_detection_type" api:"required"`
DetectedAt time.Time `json:"detected_at" api:"required" format:"date-time"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode string `json:"mode" api:"required"`
MonitorID string `json:"monitor_id" api:"required"`
Summary string `json:"summary" api:"required"`
// Any of "page", "sitemap", "extract".
TargetType string `json:"target_type" api:"required"`
Title string `json:"title" api:"required"`
URL string `json:"url" api:"required" format:"uri"`
AddedURLCount int64 `json:"added_url_count"`
Confidence float64 `json:"confidence"`
// Any of "low", "medium", "high".
Importance string `json:"importance"`
MatchedURLCount int64 `json:"matched_url_count"`
RemovedURLCount int64 `json:"removed_url_count"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChangeDetectionType respjson.Field
DetectedAt respjson.Field
Mode respjson.Field
MonitorID respjson.Field
Summary respjson.Field
TargetType respjson.Field
Title respjson.Field
URL respjson.Field
AddedURLCount respjson.Field
Confidence respjson.Field
Importance respjson.Field
MatchedURLCount respjson.Field
RemovedURLCount respjson.Field
Tags respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A lightweight change summary. `mode` is the constant `web`; `target_type` and `change_detection_type` describe the change, and which optional fields are present depends on them (e.g. sitemap changes include `added_url_count`/`removed_url_count`; semantic changes include `confidence`/`importance`).
func (MonitorListChangesResponseData) RawJSON ¶
func (r MonitorListChangesResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListChangesResponseData) UnmarshalJSON ¶
func (r *MonitorListChangesResponseData) UnmarshalJSON(data []byte) error
type MonitorListParams ¶
type MonitorListParams struct {
// Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of items to return per page (1-100). Defaults to 25.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Free-text search term, matched against the fields named in `search_by`.
Q param.Opt[string] `query:"q,omitzero" json:"-"`
// Filter to items that have this tag.
Tag param.Opt[string] `query:"tag,omitzero" json:"-"`
// Comma-separated fields to search with `q`. Defaults to all of them. Note
// `instructions` only exists on extract monitors.
//
// Any of "name", "url", "instructions", "tags".
SearchBy []string `query:"search_by,omitzero" json:"-"`
// Comma-separated list of tags to filter by (matches monitors having any of them).
Tags []string `query:"tags,omitzero" json:"-"`
// Filter by change detection type.
//
// Any of "exact", "semantic".
ChangeDetectionType MonitorListParamsChangeDetectionType `query:"change_detection_type,omitzero" json:"-"`
// `prefix` for as-you-type prefix matching (default), `exact` for full-token
// matching.
//
// Any of "exact", "prefix".
SearchType MonitorListParamsSearchType `query:"search_type,omitzero" json:"-"`
// Filter monitors by lifecycle status.
//
// Any of "active", "paused", "failed".
Status MonitorListParamsStatus `query:"status,omitzero" json:"-"`
// Filter by target type.
//
// Any of "page", "sitemap", "extract".
TargetType MonitorListParamsTargetType `query:"target_type,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MonitorListParams) URLQuery ¶
func (r MonitorListParams) URLQuery() (v url.Values, err error)
URLQuery serializes MonitorListParams's query parameters as `url.Values`.
type MonitorListParamsChangeDetectionType ¶
type MonitorListParamsChangeDetectionType string
Filter by change detection type.
const ( MonitorListParamsChangeDetectionTypeExact MonitorListParamsChangeDetectionType = "exact" MonitorListParamsChangeDetectionTypeSemantic MonitorListParamsChangeDetectionType = "semantic" )
type MonitorListParamsSearchType ¶
type MonitorListParamsSearchType string
`prefix` for as-you-type prefix matching (default), `exact` for full-token matching.
const ( MonitorListParamsSearchTypeExact MonitorListParamsSearchType = "exact" MonitorListParamsSearchTypePrefix MonitorListParamsSearchType = "prefix" )
type MonitorListParamsStatus ¶
type MonitorListParamsStatus string
Filter monitors by lifecycle status.
const ( MonitorListParamsStatusActive MonitorListParamsStatus = "active" MonitorListParamsStatusPaused MonitorListParamsStatus = "paused" MonitorListParamsStatusFailed MonitorListParamsStatus = "failed" )
type MonitorListParamsTargetType ¶
type MonitorListParamsTargetType string
Filter by target type.
const ( MonitorListParamsTargetTypePage MonitorListParamsTargetType = "page" MonitorListParamsTargetTypeSitemap MonitorListParamsTargetType = "sitemap" MonitorListParamsTargetTypeExtract MonitorListParamsTargetType = "extract" )
type MonitorListResponse ¶
type MonitorListResponse struct {
Data []MonitorListResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
NextCursor string `json:"next_cursor" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
NextCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListResponse) RawJSON ¶
func (r MonitorListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponse) UnmarshalJSON ¶
func (r *MonitorListResponse) UnmarshalJSON(data []byte) error
type MonitorListResponseData ¶
type MonitorListResponseData struct {
ID string `json:"id" api:"required"`
// Discriminated union describing how changes are detected.
ChangeDetection MonitorListResponseDataChangeDetectionUnion `json:"change_detection" api:"required"`
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode string `json:"mode" api:"required"`
Name string `json:"name" api:"required"`
// Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
// every 6 hours or every 2 days. The total interval (frequency × unit) must be
// between 10 minutes and 1 year.
Schedule MonitorListResponseDataSchedule `json:"schedule" api:"required"`
// Monitor lifecycle status. `failed` means the most recent run failed (see the
// monitor's `last_error`); failed monitors keep running on schedule and flip back
// to `active` on the next successful run. Monitors are auto-`paused` after
// repeated consecutive failures or insufficient-credit skips; resume by PATCHing
// status to `active`.
//
// Any of "active", "paused", "failed".
Status string `json:"status" api:"required"`
// Discriminated union describing what the monitor watches.
Target MonitorListResponseDataTargetUnion `json:"target" api:"required"`
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Current baseline: the last observed value the monitor compares new snapshots
// against. Its shape follows `target.type` (page/sitemap/extract). Only populated
// on GET /monitors/{monitor_id}; null until the first baseline run completes (and
// after a target or change_detection update, which resets the baseline).
Baseline MonitorListResponseDataBaselineUnion `json:"baseline" api:"nullable"`
LastChangeAt time.Time `json:"last_change_at" api:"nullable" format:"date-time"`
// Error from the most recent failed run; null when the last run succeeded.
LastError MonitorListResponseDataLastError `json:"last_error" api:"nullable"`
LastRunAt time.Time `json:"last_run_at" api:"nullable" format:"date-time"`
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorListResponseDataWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
// are healthy or no webhook is configured. Cleared on the next successful delivery
// and when the webhook URL changes.
WebhookFailure MonitorListResponseDataWebhookFailure `json:"webhook_failure" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChangeDetection respjson.Field
CreatedAt respjson.Field
Mode respjson.Field
Name respjson.Field
Schedule respjson.Field
Status respjson.Field
Target respjson.Field
UpdatedAt respjson.Field
Baseline respjson.Field
LastChangeAt respjson.Field
LastError respjson.Field
LastRunAt respjson.Field
NextRunAt respjson.Field
Tags respjson.Field
Webhook respjson.Field
WebhookFailure respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic).
func (MonitorListResponseData) RawJSON ¶
func (r MonitorListResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseData) UnmarshalJSON ¶
func (r *MonitorListResponseData) UnmarshalJSON(data []byte) error
type MonitorListResponseDataBaselineExtractBaseline ¶ added in v2.1.0
type MonitorListResponseDataBaselineExtractBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The extracted structured data, matching the monitor's extraction schema (same
// shape as the /web/extract endpoint's `data`). Refreshed when the monitor
// re-discovers its page set (at most about once a day); `null` when no extraction
// has been captured yet.
Data any `json:"data" api:"required"`
// The page URLs the monitor tracks and analyzes for changes.
URLsAnalyzed []string `json:"urls_analyzed" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted.
func (MonitorListResponseDataBaselineExtractBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorListResponseDataBaselineExtractBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataBaselineExtractBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorListResponseDataBaselineExtractBaseline) UnmarshalJSON(data []byte) error
type MonitorListResponseDataBaselinePageBaseline ¶ added in v2.1.0
type MonitorListResponseDataBaselinePageBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The page's visible text as last observed.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `page` monitor: the visible page text as last observed.
func (MonitorListResponseDataBaselinePageBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorListResponseDataBaselinePageBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataBaselinePageBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorListResponseDataBaselinePageBaseline) UnmarshalJSON(data []byte) error
type MonitorListResponseDataBaselineSitemapBaseline ¶ added in v2.1.0
type MonitorListResponseDataBaselineSitemapBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// Number of URLs in the baseline.
URLCount int64 `json:"url_count" api:"required"`
// The sitemap URLs as last observed (sorted, normalized).
URLs []string `json:"urls" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
URLCount respjson.Field
URLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `sitemap` monitor: the normalized URL set as last observed.
func (MonitorListResponseDataBaselineSitemapBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorListResponseDataBaselineSitemapBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataBaselineSitemapBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorListResponseDataBaselineSitemapBaseline) UnmarshalJSON(data []byte) error
type MonitorListResponseDataBaselineUnion ¶ added in v2.1.0
type MonitorListResponseDataBaselineUnion struct {
CapturedAt time.Time `json:"captured_at"`
// This field is from variant [MonitorListResponseDataBaselinePageBaseline].
Text string `json:"text"`
// This field is from variant [MonitorListResponseDataBaselineSitemapBaseline].
URLCount int64 `json:"url_count"`
// This field is from variant [MonitorListResponseDataBaselineSitemapBaseline].
URLs []string `json:"urls"`
// This field is from variant [MonitorListResponseDataBaselineExtractBaseline].
Data any `json:"data"`
// This field is from variant [MonitorListResponseDataBaselineExtractBaseline].
URLsAnalyzed []string `json:"urls_analyzed"`
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
URLCount respjson.Field
URLs respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorListResponseDataBaselineUnion contains all possible properties and values from MonitorListResponseDataBaselinePageBaseline, MonitorListResponseDataBaselineSitemapBaseline, MonitorListResponseDataBaselineExtractBaseline.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorListResponseDataBaselineUnion) AsExtractBaseline ¶ added in v2.1.0
func (u MonitorListResponseDataBaselineUnion) AsExtractBaseline() (v MonitorListResponseDataBaselineExtractBaseline)
func (MonitorListResponseDataBaselineUnion) AsPageBaseline ¶ added in v2.1.0
func (u MonitorListResponseDataBaselineUnion) AsPageBaseline() (v MonitorListResponseDataBaselinePageBaseline)
func (MonitorListResponseDataBaselineUnion) AsSitemapBaseline ¶ added in v2.1.0
func (u MonitorListResponseDataBaselineUnion) AsSitemapBaseline() (v MonitorListResponseDataBaselineSitemapBaseline)
func (MonitorListResponseDataBaselineUnion) RawJSON ¶ added in v2.1.0
func (u MonitorListResponseDataBaselineUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataBaselineUnion) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorListResponseDataBaselineUnion) UnmarshalJSON(data []byte) error
type MonitorListResponseDataChangeDetectionExact ¶
type MonitorListResponseDataChangeDetectionExact struct {
Type constant.Exact `json:"type" default:"exact"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
func (MonitorListResponseDataChangeDetectionExact) RawJSON ¶
func (r MonitorListResponseDataChangeDetectionExact) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataChangeDetectionExact) UnmarshalJSON ¶
func (r *MonitorListResponseDataChangeDetectionExact) UnmarshalJSON(data []byte) error
type MonitorListResponseDataChangeDetectionSemantic ¶
type MonitorListResponseDataChangeDetectionSemantic struct {
Type constant.Semantic `json:"type" default:"semantic"`
ConfidenceThreshold float64 `json:"confidence_threshold"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
func (MonitorListResponseDataChangeDetectionSemantic) RawJSON ¶
func (r MonitorListResponseDataChangeDetectionSemantic) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataChangeDetectionSemantic) UnmarshalJSON ¶
func (r *MonitorListResponseDataChangeDetectionSemantic) UnmarshalJSON(data []byte) error
type MonitorListResponseDataChangeDetectionUnion ¶
type MonitorListResponseDataChangeDetectionUnion struct {
// Any of "exact", "semantic".
Type string `json:"type"`
// This field is from variant [MonitorListResponseDataChangeDetectionSemantic].
ConfidenceThreshold float64 `json:"confidence_threshold"`
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorListResponseDataChangeDetectionUnion contains all possible properties and values from MonitorListResponseDataChangeDetectionExact, MonitorListResponseDataChangeDetectionSemantic.
Use the MonitorListResponseDataChangeDetectionUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorListResponseDataChangeDetectionUnion) AsAny ¶
func (u MonitorListResponseDataChangeDetectionUnion) AsAny() anyMonitorListResponseDataChangeDetection
Use the following switch statement to find the correct variant
switch variant := MonitorListResponseDataChangeDetectionUnion.AsAny().(type) {
case contextdev.MonitorListResponseDataChangeDetectionExact:
case contextdev.MonitorListResponseDataChangeDetectionSemantic:
default:
fmt.Errorf("no variant present")
}
func (MonitorListResponseDataChangeDetectionUnion) AsExact ¶
func (u MonitorListResponseDataChangeDetectionUnion) AsExact() (v MonitorListResponseDataChangeDetectionExact)
func (MonitorListResponseDataChangeDetectionUnion) AsSemantic ¶
func (u MonitorListResponseDataChangeDetectionUnion) AsSemantic() (v MonitorListResponseDataChangeDetectionSemantic)
func (MonitorListResponseDataChangeDetectionUnion) RawJSON ¶
func (u MonitorListResponseDataChangeDetectionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataChangeDetectionUnion) UnmarshalJSON ¶
func (r *MonitorListResponseDataChangeDetectionUnion) UnmarshalJSON(data []byte) error
type MonitorListResponseDataLastError ¶
type MonitorListResponseDataLastError struct {
Code string `json:"code" api:"required"`
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error from the most recent failed run; null when the last run succeeded.
func (MonitorListResponseDataLastError) RawJSON ¶
func (r MonitorListResponseDataLastError) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataLastError) UnmarshalJSON ¶
func (r *MonitorListResponseDataLastError) UnmarshalJSON(data []byte) error
type MonitorListResponseDataSchedule ¶
type MonitorListResponseDataSchedule struct {
// Number of units between runs. The resulting interval (frequency × unit) must be
// at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
// maximum 365 when unit is days).
Frequency int64 `json:"frequency" api:"required"`
// Any of "interval".
Type string `json:"type" api:"required"`
// Any of "minutes", "hours", "days".
Unit string `json:"unit" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Frequency respjson.Field
Type respjson.Field
Unit respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.
func (MonitorListResponseDataSchedule) RawJSON ¶
func (r MonitorListResponseDataSchedule) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataSchedule) UnmarshalJSON ¶
func (r *MonitorListResponseDataSchedule) UnmarshalJSON(data []byte) error
type MonitorListResponseDataTargetExtract ¶
type MonitorListResponseDataTargetExtract struct {
// Natural-language instructions guiding which pages and facts to track and which
// changes to report.
Instructions string `json:"instructions" api:"required"`
Type constant.Extract `json:"type" default:"extract"`
// Root URL to extract structured data from.
URL string `json:"url" api:"required" format:"uri"`
FollowSubdomains bool `json:"follow_subdomains"`
// Optional maximum link depth from the starting URL (0 = only the starting page).
MaxDepth int64 `json:"max_depth"`
// Maximum number of pages to track.
MaxPages int64 `json:"max_pages"`
// JSON Schema describing the data you care about. It is used three ways: it guides
// which pages are selected for tracking, it gives the change judge extra context
// on which changes matter (alongside `instructions`), and it defines the shape of
// the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
// about once a day). It is not a response format for changes: change events and
// webhook payloads always contain diffs, summaries, and evidence excerpts — never
// data in this schema's shape. If omitted, a default summary + key-points schema
// is used.
Schema map[string]any `json:"schema"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Instructions respjson.Field
Type respjson.Field
URL respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
func (MonitorListResponseDataTargetExtract) RawJSON ¶
func (r MonitorListResponseDataTargetExtract) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataTargetExtract) UnmarshalJSON ¶
func (r *MonitorListResponseDataTargetExtract) UnmarshalJSON(data []byte) error
type MonitorListResponseDataTargetPage ¶
type MonitorListResponseDataTargetPage struct {
Type constant.Page `json:"type" default:"page"`
URL string `json:"url" api:"required" format:"uri"`
// Plain-language goal describing which page changes matter. When provided without
// change_detection, semantic detection is inferred.
Instructions string `json:"instructions"`
// Normalize whitespace before comparing or analyzing text.
NormalizeWhitespace bool `json:"normalize_whitespace"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
func (MonitorListResponseDataTargetPage) RawJSON ¶
func (r MonitorListResponseDataTargetPage) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataTargetPage) UnmarshalJSON ¶
func (r *MonitorListResponseDataTargetPage) UnmarshalJSON(data []byte) error
type MonitorListResponseDataTargetSitemap ¶
type MonitorListResponseDataTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
// URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
// URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
func (MonitorListResponseDataTargetSitemap) RawJSON ¶
func (r MonitorListResponseDataTargetSitemap) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataTargetSitemap) UnmarshalJSON ¶
func (r *MonitorListResponseDataTargetSitemap) UnmarshalJSON(data []byte) error
type MonitorListResponseDataTargetUnion ¶
type MonitorListResponseDataTargetUnion struct {
// Any of "page", "sitemap", "extract".
Type string `json:"type"`
URL string `json:"url"`
Instructions string `json:"instructions"`
// This field is from variant [MonitorListResponseDataTargetPage].
NormalizeWhitespace bool `json:"normalize_whitespace"`
// This field is from variant [MonitorListResponseDataTargetSitemap].
Exclude []string `json:"exclude"`
// This field is from variant [MonitorListResponseDataTargetSitemap].
Include []string `json:"include"`
// This field is from variant [MonitorListResponseDataTargetSitemap].
MaxURLs int64 `json:"max_urls"`
// This field is from variant [MonitorListResponseDataTargetExtract].
FollowSubdomains bool `json:"follow_subdomains"`
// This field is from variant [MonitorListResponseDataTargetExtract].
MaxDepth int64 `json:"max_depth"`
// This field is from variant [MonitorListResponseDataTargetExtract].
MaxPages int64 `json:"max_pages"`
// This field is from variant [MonitorListResponseDataTargetExtract].
Schema map[string]any `json:"schema"`
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorListResponseDataTargetUnion contains all possible properties and values from MonitorListResponseDataTargetPage, MonitorListResponseDataTargetSitemap, MonitorListResponseDataTargetExtract.
Use the MonitorListResponseDataTargetUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorListResponseDataTargetUnion) AsAny ¶
func (u MonitorListResponseDataTargetUnion) AsAny() anyMonitorListResponseDataTarget
Use the following switch statement to find the correct variant
switch variant := MonitorListResponseDataTargetUnion.AsAny().(type) {
case contextdev.MonitorListResponseDataTargetPage:
case contextdev.MonitorListResponseDataTargetSitemap:
case contextdev.MonitorListResponseDataTargetExtract:
default:
fmt.Errorf("no variant present")
}
func (MonitorListResponseDataTargetUnion) AsExtract ¶
func (u MonitorListResponseDataTargetUnion) AsExtract() (v MonitorListResponseDataTargetExtract)
func (MonitorListResponseDataTargetUnion) AsPage ¶
func (u MonitorListResponseDataTargetUnion) AsPage() (v MonitorListResponseDataTargetPage)
func (MonitorListResponseDataTargetUnion) AsSitemap ¶
func (u MonitorListResponseDataTargetUnion) AsSitemap() (v MonitorListResponseDataTargetSitemap)
func (MonitorListResponseDataTargetUnion) RawJSON ¶
func (u MonitorListResponseDataTargetUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataTargetUnion) UnmarshalJSON ¶
func (r *MonitorListResponseDataTargetUnion) UnmarshalJSON(data []byte) error
type MonitorListResponseDataWebhook ¶
type MonitorListResponseDataWebhook struct {
// Webhook URL events are delivered to.
URL string `json:"url" api:"required" format:"uri"`
// Events delivered to this endpoint. `change.detected` fires only when a run
// detects a change; `run.completed` fires on every completed run — including runs
// that detected no change — and embeds the change when one was detected. Defaults
// to `["change.detected"]` when omitted.
//
// Any of "change.detected", "run.completed".
Events []string `json:"events"`
// Signing secret used to verify webhook authenticity. Each delivery includes an
// `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
// `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
// compare and reject stale timestamps to prevent replay. Generated by the API;
// cannot be set by clients.
Secret string `json:"secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
URL respjson.Field
Events respjson.Field
Secret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListResponseDataWebhook) RawJSON ¶
func (r MonitorListResponseDataWebhook) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataWebhook) UnmarshalJSON ¶
func (r *MonitorListResponseDataWebhook) UnmarshalJSON(data []byte) error
type MonitorListResponseDataWebhookFailure ¶ added in v2.3.0
type MonitorListResponseDataWebhookFailure struct {
// Number of consecutive delivery attempts that did not succeed.
ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"`
LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"`
// Human-readable description of the most recent failure.
LastMessage string `json:"last_message" api:"required"`
// Outcome of the most recent failed delivery. rejected means a non-2xx response;
// failed means no HTTP response was received; skipped_unsafe_url means the URL
// failed the public-endpoint safety check.
//
// Any of "rejected", "failed", "skipped_unsafe_url".
LastStatus string `json:"last_status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ConsecutiveFailures respjson.Field
LastFailedAt respjson.Field
LastMessage respjson.Field
LastStatus respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes.
func (MonitorListResponseDataWebhookFailure) RawJSON ¶ added in v2.3.0
func (r MonitorListResponseDataWebhookFailure) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListResponseDataWebhookFailure) UnmarshalJSON ¶ added in v2.3.0
func (r *MonitorListResponseDataWebhookFailure) UnmarshalJSON(data []byte) error
type MonitorListRunsParams ¶
type MonitorListRunsParams struct {
// Opaque pagination cursor from a previous response.
Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
// Maximum number of items to return per page (1-100). Defaults to 25.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Filter runs by lifecycle status.
//
// Any of "queued", "running", "completed", "failed", "skipped".
Status MonitorListRunsParamsStatus `query:"status,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MonitorListRunsParams) URLQuery ¶
func (r MonitorListRunsParams) URLQuery() (v url.Values, err error)
URLQuery serializes MonitorListRunsParams's query parameters as `url.Values`.
type MonitorListRunsParamsStatus ¶
type MonitorListRunsParamsStatus string
Filter runs by lifecycle status.
const ( MonitorListRunsParamsStatusQueued MonitorListRunsParamsStatus = "queued" MonitorListRunsParamsStatusRunning MonitorListRunsParamsStatus = "running" MonitorListRunsParamsStatusCompleted MonitorListRunsParamsStatus = "completed" MonitorListRunsParamsStatusFailed MonitorListRunsParamsStatus = "failed" MonitorListRunsParamsStatusSkipped MonitorListRunsParamsStatus = "skipped" )
type MonitorListRunsResponse ¶
type MonitorListRunsResponse struct {
Data []MonitorListRunsResponseData `json:"data" api:"required"`
HasMore bool `json:"has_more" api:"required"`
NextCursor string `json:"next_cursor" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
NextCursor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListRunsResponse) RawJSON ¶
func (r MonitorListRunsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListRunsResponse) UnmarshalJSON ¶
func (r *MonitorListRunsResponse) UnmarshalJSON(data []byte) error
type MonitorListRunsResponseData ¶
type MonitorListRunsResponseData struct {
ID string `json:"id" api:"required"`
// True when this run established the monitor's initial baseline; baseline runs
// perform no change detection.
BaselineCreated bool `json:"baseline_created" api:"required"`
ChangeDetected bool `json:"change_detected" api:"required"`
// Any of "exact", "semantic".
ChangeDetectionType string `json:"change_detection_type" api:"required"`
// Credits charged for this run (0 for skipped/failed runs).
CreditsCharged int64 `json:"credits_charged" api:"required"`
MonitorID string `json:"monitor_id" api:"required"`
// The first run after monitor creation is a baseline run.
//
// Any of "baseline", "scheduled".
RunType string `json:"run_type" api:"required"`
// Lifecycle status of a run. `skipped` runs never executed — see `skip_reason`
// (insufficient credits, monitor paused, or superseded by a concurrent run).
//
// Any of "queued", "running", "completed", "failed", "skipped".
Status string `json:"status" api:"required"`
// Any of "page", "sitemap", "extract".
TargetType string `json:"target_type" api:"required"`
ChangeID string `json:"change_id" api:"nullable"`
CompletedAt time.Time `json:"completed_at" api:"nullable" format:"date-time"`
Error MonitorListRunsResponseDataError `json:"error" api:"nullable"`
// Why a skipped run never executed; null unless status is `skipped`.
//
// Any of "insufficient_credits", "monitor_paused", "superseded".
SkipReason string `json:"skip_reason" api:"nullable"`
StartedAt time.Time `json:"started_at" api:"nullable" format:"date-time"`
// All webhook deliveries attempted by this run — one per subscribed event that
// fired. Omitted when no webhook was attempted, including runs created before
// event selection was added.
WebhookDeliveries []WebhookDelivery `json:"webhook_deliveries"`
// Deprecated: use `webhook_deliveries`, which records every attempt now that a run
// can deliver multiple events. Omitted when no webhook was attempted, including
// historical runs created before delivery tracking was added.
//
// Deprecated: deprecated
WebhookDelivery WebhookDelivery `json:"webhook_delivery"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
BaselineCreated respjson.Field
ChangeDetected respjson.Field
ChangeDetectionType respjson.Field
CreditsCharged respjson.Field
MonitorID respjson.Field
RunType respjson.Field
Status respjson.Field
TargetType respjson.Field
ChangeID respjson.Field
CompletedAt respjson.Field
Error respjson.Field
SkipReason respjson.Field
StartedAt respjson.Field
WebhookDeliveries respjson.Field
WebhookDelivery respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListRunsResponseData) RawJSON ¶
func (r MonitorListRunsResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListRunsResponseData) UnmarshalJSON ¶
func (r *MonitorListRunsResponseData) UnmarshalJSON(data []byte) error
type MonitorListRunsResponseDataError ¶
type MonitorListRunsResponseDataError struct {
Code string `json:"code" api:"required"`
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorListRunsResponseDataError) RawJSON ¶
func (r MonitorListRunsResponseDataError) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorListRunsResponseDataError) UnmarshalJSON ¶
func (r *MonitorListRunsResponseDataError) UnmarshalJSON(data []byte) error
type MonitorNewParams ¶
type MonitorNewParams struct {
Name string `json:"name" api:"required"`
// Discriminated union describing what the monitor watches.
Target MonitorNewParamsTargetUnion `json:"target,omitzero" api:"required"`
Webhook MonitorNewParamsWebhook `json:"webhook,omitzero"`
// Discriminated union describing how changes are detected.
ChangeDetection MonitorNewParamsChangeDetectionUnion `json:"change_detection,omitzero"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode MonitorNewParamsMode `json:"mode,omitzero"`
// Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
// every 6 hours or every 2 days. The total interval (frequency × unit) must be
// between 10 minutes and 1 year.
Schedule MonitorNewParamsSchedule `json:"schedule,omitzero"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (MonitorNewParams) MarshalJSON ¶
func (r MonitorNewParams) MarshalJSON() (data []byte, err error)
func (*MonitorNewParams) UnmarshalJSON ¶
func (r *MonitorNewParams) UnmarshalJSON(data []byte) error
type MonitorNewParamsChangeDetectionExact ¶
type MonitorNewParamsChangeDetectionExact struct {
Type constant.Exact `json:"type" default:"exact"`
// contains filtered or unexported fields
}
Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
This struct has a constant value, construct it with NewMonitorNewParamsChangeDetectionExact.
func NewMonitorNewParamsChangeDetectionExact ¶
func NewMonitorNewParamsChangeDetectionExact() MonitorNewParamsChangeDetectionExact
func (MonitorNewParamsChangeDetectionExact) MarshalJSON ¶
func (r MonitorNewParamsChangeDetectionExact) MarshalJSON() (data []byte, err error)
func (*MonitorNewParamsChangeDetectionExact) UnmarshalJSON ¶
func (r *MonitorNewParamsChangeDetectionExact) UnmarshalJSON(data []byte) error
type MonitorNewParamsChangeDetectionSemantic ¶
type MonitorNewParamsChangeDetectionSemantic struct {
ConfidenceThreshold param.Opt[float64] `json:"confidence_threshold,omitzero"`
// This field can be elided, and will marshal its zero value as "semantic".
Type constant.Semantic `json:"type" default:"semantic"`
// contains filtered or unexported fields
}
Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
The property Type is required.
func (MonitorNewParamsChangeDetectionSemantic) MarshalJSON ¶
func (r MonitorNewParamsChangeDetectionSemantic) MarshalJSON() (data []byte, err error)
func (*MonitorNewParamsChangeDetectionSemantic) UnmarshalJSON ¶
func (r *MonitorNewParamsChangeDetectionSemantic) UnmarshalJSON(data []byte) error
type MonitorNewParamsChangeDetectionUnion ¶
type MonitorNewParamsChangeDetectionUnion struct {
OfExact *MonitorNewParamsChangeDetectionExact `json:",omitzero,inline"`
OfSemantic *MonitorNewParamsChangeDetectionSemantic `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (MonitorNewParamsChangeDetectionUnion) MarshalJSON ¶
func (u MonitorNewParamsChangeDetectionUnion) MarshalJSON() ([]byte, error)
func (*MonitorNewParamsChangeDetectionUnion) UnmarshalJSON ¶
func (u *MonitorNewParamsChangeDetectionUnion) UnmarshalJSON(data []byte) error
type MonitorNewParamsMode ¶
type MonitorNewParamsMode string
Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`.
const (
MonitorNewParamsModeWeb MonitorNewParamsMode = "web"
)
type MonitorNewParamsSchedule ¶
type MonitorNewParamsSchedule struct {
// Number of units between runs. The resulting interval (frequency × unit) must be
// at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
// maximum 365 when unit is days).
Frequency int64 `json:"frequency" api:"required"`
// Any of "interval".
Type string `json:"type,omitzero" api:"required"`
// Any of "minutes", "hours", "days".
Unit string `json:"unit,omitzero" api:"required"`
// contains filtered or unexported fields
}
Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.
The properties Frequency, Type, Unit are required.
func (MonitorNewParamsSchedule) MarshalJSON ¶
func (r MonitorNewParamsSchedule) MarshalJSON() (data []byte, err error)
func (*MonitorNewParamsSchedule) UnmarshalJSON ¶
func (r *MonitorNewParamsSchedule) UnmarshalJSON(data []byte) error
type MonitorNewParamsTargetExtract ¶
type MonitorNewParamsTargetExtract struct {
// Natural-language instructions guiding which pages and facts to track and which
// changes to report.
Instructions string `json:"instructions" api:"required"`
// Root URL to extract structured data from.
URL string `json:"url" api:"required" format:"uri"`
FollowSubdomains param.Opt[bool] `json:"follow_subdomains,omitzero"`
// Optional maximum link depth from the starting URL (0 = only the starting page).
MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
// Maximum number of pages to track.
MaxPages param.Opt[int64] `json:"max_pages,omitzero"`
// JSON Schema describing the data you care about. It is used three ways: it guides
// which pages are selected for tracking, it gives the change judge extra context
// on which changes matter (alongside `instructions`), and it defines the shape of
// the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
// about once a day). It is not a response format for changes: change events and
// webhook payloads always contain diffs, summaries, and evidence excerpts — never
// data in this schema's shape. If omitted, a default summary + key-points schema
// is used.
Schema map[string]any `json:"schema,omitzero"`
// This field can be elided, and will marshal its zero value as "extract".
Type constant.Extract `json:"type" default:"extract"`
// contains filtered or unexported fields
}
Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
The properties Instructions, Type, URL are required.
func (MonitorNewParamsTargetExtract) MarshalJSON ¶
func (r MonitorNewParamsTargetExtract) MarshalJSON() (data []byte, err error)
func (*MonitorNewParamsTargetExtract) UnmarshalJSON ¶
func (r *MonitorNewParamsTargetExtract) UnmarshalJSON(data []byte) error
type MonitorNewParamsTargetPage ¶
type MonitorNewParamsTargetPage struct {
URL string `json:"url" api:"required" format:"uri"`
// Plain-language goal describing which page changes matter. When provided without
// change_detection, semantic detection is inferred.
Instructions param.Opt[string] `json:"instructions,omitzero"`
// Normalize whitespace before comparing or analyzing text.
NormalizeWhitespace param.Opt[bool] `json:"normalize_whitespace,omitzero"`
// This field can be elided, and will marshal its zero value as "page".
Type constant.Page `json:"type" default:"page"`
// contains filtered or unexported fields
}
Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
The properties Type, URL are required.
func (MonitorNewParamsTargetPage) MarshalJSON ¶
func (r MonitorNewParamsTargetPage) MarshalJSON() (data []byte, err error)
func (*MonitorNewParamsTargetPage) UnmarshalJSON ¶
func (r *MonitorNewParamsTargetPage) UnmarshalJSON(data []byte) error
type MonitorNewParamsTargetSitemap ¶
type MonitorNewParamsTargetSitemap struct {
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs param.Opt[int64] `json:"max_urls,omitzero"`
// URL path patterns to exclude (max 50).
Exclude []string `json:"exclude,omitzero"`
// URL path patterns to include (max 50).
Include []string `json:"include,omitzero"`
// This field can be elided, and will marshal its zero value as "sitemap".
Type constant.Sitemap `json:"type" default:"sitemap"`
// contains filtered or unexported fields
}
Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
The properties Type, URL are required.
func (MonitorNewParamsTargetSitemap) MarshalJSON ¶
func (r MonitorNewParamsTargetSitemap) MarshalJSON() (data []byte, err error)
func (*MonitorNewParamsTargetSitemap) UnmarshalJSON ¶
func (r *MonitorNewParamsTargetSitemap) UnmarshalJSON(data []byte) error
type MonitorNewParamsTargetUnion ¶
type MonitorNewParamsTargetUnion struct {
OfPage *MonitorNewParamsTargetPage `json:",omitzero,inline"`
OfSitemap *MonitorNewParamsTargetSitemap `json:",omitzero,inline"`
OfExtract *MonitorNewParamsTargetExtract `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (MonitorNewParamsTargetUnion) MarshalJSON ¶
func (u MonitorNewParamsTargetUnion) MarshalJSON() ([]byte, error)
func (*MonitorNewParamsTargetUnion) UnmarshalJSON ¶
func (u *MonitorNewParamsTargetUnion) UnmarshalJSON(data []byte) error
type MonitorNewParamsWebhook ¶
type MonitorNewParamsWebhook struct {
// Webhook URL events are delivered to.
URL string `json:"url" api:"required" format:"uri"`
// Events delivered to this endpoint. `change.detected` fires only when a run
// detects a change; `run.completed` fires on every completed run — including runs
// that detected no change — and embeds the change when one was detected. Defaults
// to `["change.detected"]` when omitted.
//
// Any of "change.detected", "run.completed".
Events []string `json:"events,omitzero"`
// contains filtered or unexported fields
}
The property URL is required.
func (MonitorNewParamsWebhook) MarshalJSON ¶
func (r MonitorNewParamsWebhook) MarshalJSON() (data []byte, err error)
func (*MonitorNewParamsWebhook) UnmarshalJSON ¶
func (r *MonitorNewParamsWebhook) UnmarshalJSON(data []byte) error
type MonitorNewResponse ¶
type MonitorNewResponse struct {
ID string `json:"id" api:"required"`
// Discriminated union describing how changes are detected.
ChangeDetection MonitorNewResponseChangeDetectionUnion `json:"change_detection" api:"required"`
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// The baseline run queued by this create call, or null if it could not be queued
// immediately (in which case the baseline runs on the next scheduled tick). Poll
// GET /monitors/{monitor_id}/runs/{run_id}.
InitialRunID string `json:"initial_run_id" api:"required"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode MonitorNewResponseMode `json:"mode" api:"required"`
Name string `json:"name" api:"required"`
// Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
// every 6 hours or every 2 days. The total interval (frequency × unit) must be
// between 10 minutes and 1 year.
Schedule MonitorNewResponseSchedule `json:"schedule" api:"required"`
// Monitor lifecycle status. `failed` means the most recent run failed (see the
// monitor's `last_error`); failed monitors keep running on schedule and flip back
// to `active` on the next successful run. Monitors are auto-`paused` after
// repeated consecutive failures or insufficient-credit skips; resume by PATCHing
// status to `active`.
//
// Any of "active", "paused", "failed".
Status MonitorNewResponseStatus `json:"status" api:"required"`
// Discriminated union describing what the monitor watches.
Target MonitorNewResponseTargetUnion `json:"target" api:"required"`
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Current baseline: the last observed value the monitor compares new snapshots
// against. Its shape follows `target.type` (page/sitemap/extract). Only populated
// on GET /monitors/{monitor_id}; null until the first baseline run completes (and
// after a target or change_detection update, which resets the baseline).
Baseline MonitorNewResponseBaselineUnion `json:"baseline" api:"nullable"`
LastChangeAt time.Time `json:"last_change_at" api:"nullable" format:"date-time"`
// Error from the most recent failed run; null when the last run succeeded.
LastError MonitorNewResponseLastError `json:"last_error" api:"nullable"`
LastRunAt time.Time `json:"last_run_at" api:"nullable" format:"date-time"`
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorNewResponseWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
// are healthy or no webhook is configured. Cleared on the next successful delivery
// and when the webhook URL changes.
WebhookFailure MonitorNewResponseWebhookFailure `json:"webhook_failure" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChangeDetection respjson.Field
CreatedAt respjson.Field
InitialRunID respjson.Field
Mode respjson.Field
Name respjson.Field
Schedule respjson.Field
Status respjson.Field
Target respjson.Field
UpdatedAt respjson.Field
Baseline respjson.Field
LastChangeAt respjson.Field
LastError respjson.Field
LastRunAt respjson.Field
NextRunAt respjson.Field
Tags respjson.Field
Webhook respjson.Field
WebhookFailure respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A newly created monitor plus `initial_run_id`, the id of the baseline run queued at creation.
func (MonitorNewResponse) RawJSON ¶
func (r MonitorNewResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponse) UnmarshalJSON ¶
func (r *MonitorNewResponse) UnmarshalJSON(data []byte) error
type MonitorNewResponseBaselineExtractBaseline ¶ added in v2.1.0
type MonitorNewResponseBaselineExtractBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The extracted structured data, matching the monitor's extraction schema (same
// shape as the /web/extract endpoint's `data`). Refreshed when the monitor
// re-discovers its page set (at most about once a day); `null` when no extraction
// has been captured yet.
Data any `json:"data" api:"required"`
// The page URLs the monitor tracks and analyzes for changes.
URLsAnalyzed []string `json:"urls_analyzed" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted.
func (MonitorNewResponseBaselineExtractBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorNewResponseBaselineExtractBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseBaselineExtractBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorNewResponseBaselineExtractBaseline) UnmarshalJSON(data []byte) error
type MonitorNewResponseBaselinePageBaseline ¶ added in v2.1.0
type MonitorNewResponseBaselinePageBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The page's visible text as last observed.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `page` monitor: the visible page text as last observed.
func (MonitorNewResponseBaselinePageBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorNewResponseBaselinePageBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseBaselinePageBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorNewResponseBaselinePageBaseline) UnmarshalJSON(data []byte) error
type MonitorNewResponseBaselineSitemapBaseline ¶ added in v2.1.0
type MonitorNewResponseBaselineSitemapBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// Number of URLs in the baseline.
URLCount int64 `json:"url_count" api:"required"`
// The sitemap URLs as last observed (sorted, normalized).
URLs []string `json:"urls" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
URLCount respjson.Field
URLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `sitemap` monitor: the normalized URL set as last observed.
func (MonitorNewResponseBaselineSitemapBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorNewResponseBaselineSitemapBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseBaselineSitemapBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorNewResponseBaselineSitemapBaseline) UnmarshalJSON(data []byte) error
type MonitorNewResponseBaselineUnion ¶ added in v2.1.0
type MonitorNewResponseBaselineUnion struct {
CapturedAt time.Time `json:"captured_at"`
// This field is from variant [MonitorNewResponseBaselinePageBaseline].
Text string `json:"text"`
// This field is from variant [MonitorNewResponseBaselineSitemapBaseline].
URLCount int64 `json:"url_count"`
// This field is from variant [MonitorNewResponseBaselineSitemapBaseline].
URLs []string `json:"urls"`
// This field is from variant [MonitorNewResponseBaselineExtractBaseline].
Data any `json:"data"`
// This field is from variant [MonitorNewResponseBaselineExtractBaseline].
URLsAnalyzed []string `json:"urls_analyzed"`
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
URLCount respjson.Field
URLs respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorNewResponseBaselineUnion contains all possible properties and values from MonitorNewResponseBaselinePageBaseline, MonitorNewResponseBaselineSitemapBaseline, MonitorNewResponseBaselineExtractBaseline.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorNewResponseBaselineUnion) AsExtractBaseline ¶ added in v2.1.0
func (u MonitorNewResponseBaselineUnion) AsExtractBaseline() (v MonitorNewResponseBaselineExtractBaseline)
func (MonitorNewResponseBaselineUnion) AsPageBaseline ¶ added in v2.1.0
func (u MonitorNewResponseBaselineUnion) AsPageBaseline() (v MonitorNewResponseBaselinePageBaseline)
func (MonitorNewResponseBaselineUnion) AsSitemapBaseline ¶ added in v2.1.0
func (u MonitorNewResponseBaselineUnion) AsSitemapBaseline() (v MonitorNewResponseBaselineSitemapBaseline)
func (MonitorNewResponseBaselineUnion) RawJSON ¶ added in v2.1.0
func (u MonitorNewResponseBaselineUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseBaselineUnion) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorNewResponseBaselineUnion) UnmarshalJSON(data []byte) error
type MonitorNewResponseChangeDetectionExact ¶
type MonitorNewResponseChangeDetectionExact struct {
Type constant.Exact `json:"type" default:"exact"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
func (MonitorNewResponseChangeDetectionExact) RawJSON ¶
func (r MonitorNewResponseChangeDetectionExact) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseChangeDetectionExact) UnmarshalJSON ¶
func (r *MonitorNewResponseChangeDetectionExact) UnmarshalJSON(data []byte) error
type MonitorNewResponseChangeDetectionSemantic ¶
type MonitorNewResponseChangeDetectionSemantic struct {
Type constant.Semantic `json:"type" default:"semantic"`
ConfidenceThreshold float64 `json:"confidence_threshold"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
func (MonitorNewResponseChangeDetectionSemantic) RawJSON ¶
func (r MonitorNewResponseChangeDetectionSemantic) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseChangeDetectionSemantic) UnmarshalJSON ¶
func (r *MonitorNewResponseChangeDetectionSemantic) UnmarshalJSON(data []byte) error
type MonitorNewResponseChangeDetectionUnion ¶
type MonitorNewResponseChangeDetectionUnion struct {
// Any of "exact", "semantic".
Type string `json:"type"`
// This field is from variant [MonitorNewResponseChangeDetectionSemantic].
ConfidenceThreshold float64 `json:"confidence_threshold"`
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorNewResponseChangeDetectionUnion contains all possible properties and values from MonitorNewResponseChangeDetectionExact, MonitorNewResponseChangeDetectionSemantic.
Use the MonitorNewResponseChangeDetectionUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorNewResponseChangeDetectionUnion) AsAny ¶
func (u MonitorNewResponseChangeDetectionUnion) AsAny() anyMonitorNewResponseChangeDetection
Use the following switch statement to find the correct variant
switch variant := MonitorNewResponseChangeDetectionUnion.AsAny().(type) {
case contextdev.MonitorNewResponseChangeDetectionExact:
case contextdev.MonitorNewResponseChangeDetectionSemantic:
default:
fmt.Errorf("no variant present")
}
func (MonitorNewResponseChangeDetectionUnion) AsExact ¶
func (u MonitorNewResponseChangeDetectionUnion) AsExact() (v MonitorNewResponseChangeDetectionExact)
func (MonitorNewResponseChangeDetectionUnion) AsSemantic ¶
func (u MonitorNewResponseChangeDetectionUnion) AsSemantic() (v MonitorNewResponseChangeDetectionSemantic)
func (MonitorNewResponseChangeDetectionUnion) RawJSON ¶
func (u MonitorNewResponseChangeDetectionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseChangeDetectionUnion) UnmarshalJSON ¶
func (r *MonitorNewResponseChangeDetectionUnion) UnmarshalJSON(data []byte) error
type MonitorNewResponseLastError ¶
type MonitorNewResponseLastError struct {
Code string `json:"code" api:"required"`
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error from the most recent failed run; null when the last run succeeded.
func (MonitorNewResponseLastError) RawJSON ¶
func (r MonitorNewResponseLastError) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseLastError) UnmarshalJSON ¶
func (r *MonitorNewResponseLastError) UnmarshalJSON(data []byte) error
type MonitorNewResponseMode ¶
type MonitorNewResponseMode string
Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`.
const (
MonitorNewResponseModeWeb MonitorNewResponseMode = "web"
)
type MonitorNewResponseSchedule ¶
type MonitorNewResponseSchedule struct {
// Number of units between runs. The resulting interval (frequency × unit) must be
// at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
// maximum 365 when unit is days).
Frequency int64 `json:"frequency" api:"required"`
// Any of "interval".
Type string `json:"type" api:"required"`
// Any of "minutes", "hours", "days".
Unit string `json:"unit" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Frequency respjson.Field
Type respjson.Field
Unit respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.
func (MonitorNewResponseSchedule) RawJSON ¶
func (r MonitorNewResponseSchedule) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseSchedule) UnmarshalJSON ¶
func (r *MonitorNewResponseSchedule) UnmarshalJSON(data []byte) error
type MonitorNewResponseStatus ¶
type MonitorNewResponseStatus string
Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`.
const ( MonitorNewResponseStatusActive MonitorNewResponseStatus = "active" MonitorNewResponseStatusPaused MonitorNewResponseStatus = "paused" MonitorNewResponseStatusFailed MonitorNewResponseStatus = "failed" )
type MonitorNewResponseTargetExtract ¶
type MonitorNewResponseTargetExtract struct {
// Natural-language instructions guiding which pages and facts to track and which
// changes to report.
Instructions string `json:"instructions" api:"required"`
Type constant.Extract `json:"type" default:"extract"`
// Root URL to extract structured data from.
URL string `json:"url" api:"required" format:"uri"`
FollowSubdomains bool `json:"follow_subdomains"`
// Optional maximum link depth from the starting URL (0 = only the starting page).
MaxDepth int64 `json:"max_depth"`
// Maximum number of pages to track.
MaxPages int64 `json:"max_pages"`
// JSON Schema describing the data you care about. It is used three ways: it guides
// which pages are selected for tracking, it gives the change judge extra context
// on which changes matter (alongside `instructions`), and it defines the shape of
// the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
// about once a day). It is not a response format for changes: change events and
// webhook payloads always contain diffs, summaries, and evidence excerpts — never
// data in this schema's shape. If omitted, a default summary + key-points schema
// is used.
Schema map[string]any `json:"schema"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Instructions respjson.Field
Type respjson.Field
URL respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
func (MonitorNewResponseTargetExtract) RawJSON ¶
func (r MonitorNewResponseTargetExtract) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseTargetExtract) UnmarshalJSON ¶
func (r *MonitorNewResponseTargetExtract) UnmarshalJSON(data []byte) error
type MonitorNewResponseTargetPage ¶
type MonitorNewResponseTargetPage struct {
Type constant.Page `json:"type" default:"page"`
URL string `json:"url" api:"required" format:"uri"`
// Plain-language goal describing which page changes matter. When provided without
// change_detection, semantic detection is inferred.
Instructions string `json:"instructions"`
// Normalize whitespace before comparing or analyzing text.
NormalizeWhitespace bool `json:"normalize_whitespace"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
func (MonitorNewResponseTargetPage) RawJSON ¶
func (r MonitorNewResponseTargetPage) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseTargetPage) UnmarshalJSON ¶
func (r *MonitorNewResponseTargetPage) UnmarshalJSON(data []byte) error
type MonitorNewResponseTargetSitemap ¶
type MonitorNewResponseTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
// URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
// URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
func (MonitorNewResponseTargetSitemap) RawJSON ¶
func (r MonitorNewResponseTargetSitemap) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseTargetSitemap) UnmarshalJSON ¶
func (r *MonitorNewResponseTargetSitemap) UnmarshalJSON(data []byte) error
type MonitorNewResponseTargetUnion ¶
type MonitorNewResponseTargetUnion struct {
// Any of "page", "sitemap", "extract".
Type string `json:"type"`
URL string `json:"url"`
Instructions string `json:"instructions"`
// This field is from variant [MonitorNewResponseTargetPage].
NormalizeWhitespace bool `json:"normalize_whitespace"`
// This field is from variant [MonitorNewResponseTargetSitemap].
Exclude []string `json:"exclude"`
// This field is from variant [MonitorNewResponseTargetSitemap].
Include []string `json:"include"`
// This field is from variant [MonitorNewResponseTargetSitemap].
MaxURLs int64 `json:"max_urls"`
// This field is from variant [MonitorNewResponseTargetExtract].
FollowSubdomains bool `json:"follow_subdomains"`
// This field is from variant [MonitorNewResponseTargetExtract].
MaxDepth int64 `json:"max_depth"`
// This field is from variant [MonitorNewResponseTargetExtract].
MaxPages int64 `json:"max_pages"`
// This field is from variant [MonitorNewResponseTargetExtract].
Schema map[string]any `json:"schema"`
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorNewResponseTargetUnion contains all possible properties and values from MonitorNewResponseTargetPage, MonitorNewResponseTargetSitemap, MonitorNewResponseTargetExtract.
Use the MonitorNewResponseTargetUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorNewResponseTargetUnion) AsAny ¶
func (u MonitorNewResponseTargetUnion) AsAny() anyMonitorNewResponseTarget
Use the following switch statement to find the correct variant
switch variant := MonitorNewResponseTargetUnion.AsAny().(type) {
case contextdev.MonitorNewResponseTargetPage:
case contextdev.MonitorNewResponseTargetSitemap:
case contextdev.MonitorNewResponseTargetExtract:
default:
fmt.Errorf("no variant present")
}
func (MonitorNewResponseTargetUnion) AsExtract ¶
func (u MonitorNewResponseTargetUnion) AsExtract() (v MonitorNewResponseTargetExtract)
func (MonitorNewResponseTargetUnion) AsPage ¶
func (u MonitorNewResponseTargetUnion) AsPage() (v MonitorNewResponseTargetPage)
func (MonitorNewResponseTargetUnion) AsSitemap ¶
func (u MonitorNewResponseTargetUnion) AsSitemap() (v MonitorNewResponseTargetSitemap)
func (MonitorNewResponseTargetUnion) RawJSON ¶
func (u MonitorNewResponseTargetUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseTargetUnion) UnmarshalJSON ¶
func (r *MonitorNewResponseTargetUnion) UnmarshalJSON(data []byte) error
type MonitorNewResponseWebhook ¶
type MonitorNewResponseWebhook struct {
// Webhook URL events are delivered to.
URL string `json:"url" api:"required" format:"uri"`
// Events delivered to this endpoint. `change.detected` fires only when a run
// detects a change; `run.completed` fires on every completed run — including runs
// that detected no change — and embeds the change when one was detected. Defaults
// to `["change.detected"]` when omitted.
//
// Any of "change.detected", "run.completed".
Events []string `json:"events"`
// Signing secret used to verify webhook authenticity. Each delivery includes an
// `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
// `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
// compare and reject stale timestamps to prevent replay. Generated by the API;
// cannot be set by clients.
Secret string `json:"secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
URL respjson.Field
Events respjson.Field
Secret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorNewResponseWebhook) RawJSON ¶
func (r MonitorNewResponseWebhook) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseWebhook) UnmarshalJSON ¶
func (r *MonitorNewResponseWebhook) UnmarshalJSON(data []byte) error
type MonitorNewResponseWebhookFailure ¶ added in v2.3.0
type MonitorNewResponseWebhookFailure struct {
// Number of consecutive delivery attempts that did not succeed.
ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"`
LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"`
// Human-readable description of the most recent failure.
LastMessage string `json:"last_message" api:"required"`
// Outcome of the most recent failed delivery. rejected means a non-2xx response;
// failed means no HTTP response was received; skipped_unsafe_url means the URL
// failed the public-endpoint safety check.
//
// Any of "rejected", "failed", "skipped_unsafe_url".
LastStatus string `json:"last_status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ConsecutiveFailures respjson.Field
LastFailedAt respjson.Field
LastMessage respjson.Field
LastStatus respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes.
func (MonitorNewResponseWebhookFailure) RawJSON ¶ added in v2.3.0
func (r MonitorNewResponseWebhookFailure) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorNewResponseWebhookFailure) UnmarshalJSON ¶ added in v2.3.0
func (r *MonitorNewResponseWebhookFailure) UnmarshalJSON(data []byte) error
type MonitorRunResponse ¶
type MonitorRunResponse struct {
MonitorID string `json:"monitor_id" api:"required"`
Queued bool `json:"queued" api:"required"`
// The queued run. Poll GET /monitors/{monitor_id}/runs or use it to correlate
// results.
RunID string `json:"run_id" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MonitorID respjson.Field
Queued respjson.Field
RunID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorRunResponse) RawJSON ¶
func (r MonitorRunResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorRunResponse) UnmarshalJSON ¶
func (r *MonitorRunResponse) UnmarshalJSON(data []byte) error
type MonitorService ¶
type MonitorService struct {
// contains filtered or unexported fields
}
Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas.
MonitorService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMonitorService method instead.
func NewMonitorService ¶
func NewMonitorService(opts ...option.RequestOption) (r MonitorService)
NewMonitorService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*MonitorService) Delete ¶
func (r *MonitorService) Delete(ctx context.Context, monitorID string, opts ...option.RequestOption) (res *MonitorDeleteResponse, err error)
Delete a monitor
func (*MonitorService) Get ¶
func (r *MonitorService) Get(ctx context.Context, monitorID string, opts ...option.RequestOption) (res *MonitorGetResponse, err error)
Get a monitor
func (*MonitorService) GetChange ¶
func (r *MonitorService) GetChange(ctx context.Context, changeID string, opts ...option.RequestOption) (res *MonitorGetChangeResponse, err error)
Get a change
func (*MonitorService) GetCreditUsage ¶ added in v2.5.0
func (r *MonitorService) GetCreditUsage(ctx context.Context, query MonitorGetCreditUsageParams, opts ...option.RequestOption) (res *MonitorGetCreditUsageResponse, err error)
Returns credits charged per monitor over an optional [since, until] window, newest spenders first.
func (*MonitorService) GetLimits ¶ added in v2.5.0
func (r *MonitorService) GetLimits(ctx context.Context, opts ...option.RequestOption) (res *MonitorGetLimitsResponse, err error)
Returns how many monitors the account has and the maximum it allows.
func (*MonitorService) List ¶
func (r *MonitorService) List(ctx context.Context, query MonitorListParams, opts ...option.RequestOption) (res *MonitorListResponse, err error)
Lists monitors for the authenticated organization. Supports free-text search (`q` over `search_by` fields, `prefix` or `exact` via `search_type`) plus status/type/tag filters. Results are paginated via the opaque `cursor`.
func (*MonitorService) ListAccountChanges ¶
func (r *MonitorService) ListAccountChanges(ctx context.Context, query MonitorListAccountChangesParams, opts ...option.RequestOption) (res *MonitorListAccountChangesResponse, err error)
Returns an account-wide feed of detected changes across monitors.
func (*MonitorService) ListAccountRuns ¶
func (r *MonitorService) ListAccountRuns(ctx context.Context, query MonitorListAccountRunsParams, opts ...option.RequestOption) (res *MonitorListAccountRunsResponse, err error)
Returns an account-wide feed of monitor runs across all monitors.
func (*MonitorService) ListChanges ¶
func (r *MonitorService) ListChanges(ctx context.Context, monitorID string, query MonitorListChangesParams, opts ...option.RequestOption) (res *MonitorListChangesResponse, err error)
List changes for a monitor
func (*MonitorService) ListRuns ¶
func (r *MonitorService) ListRuns(ctx context.Context, monitorID string, query MonitorListRunsParams, opts ...option.RequestOption) (res *MonitorListRunsResponse, err error)
List monitor runs
func (*MonitorService) New ¶
func (r *MonitorService) New(ctx context.Context, body MonitorNewParams, opts ...option.RequestOption) (res *MonitorNewResponse, err error)
Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline.
func (*MonitorService) Run ¶
func (r *MonitorService) Run(ctx context.Context, monitorID string, opts ...option.RequestOption) (res *MonitorRunResponse, err error)
Triggers an immediate run of the monitor outside its normal schedule. The run is queued and processed asynchronously.
func (*MonitorService) Update ¶
func (r *MonitorService) Update(ctx context.Context, monitorID string, body MonitorUpdateParams, opts ...option.RequestOption) (res *MonitorUpdateResponse, err error)
Updates a monitor. If `target` or `change_detection` changes, the monitor creates a new baseline. Unsupported target/change detection combinations are rejected.
type MonitorUpdateParams ¶
type MonitorUpdateParams struct {
Name param.Opt[string] `json:"name,omitzero"`
// Set to null to remove the webhook.
Webhook MonitorUpdateParamsWebhook `json:"webhook,omitzero"`
// Discriminated union describing how changes are detected.
ChangeDetection MonitorUpdateParamsChangeDetectionUnion `json:"change_detection,omitzero"`
// Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
// every 6 hours or every 2 days. The total interval (frequency × unit) must be
// between 10 minutes and 1 year.
Schedule MonitorUpdateParamsSchedule `json:"schedule,omitzero"`
// Any of "active", "paused".
Status MonitorUpdateParamsStatus `json:"status,omitzero"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags,omitzero"`
// Discriminated union describing what the monitor watches.
Target MonitorUpdateParamsTargetUnion `json:"target,omitzero"`
// contains filtered or unexported fields
}
func (MonitorUpdateParams) MarshalJSON ¶
func (r MonitorUpdateParams) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParams) UnmarshalJSON ¶
func (r *MonitorUpdateParams) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsChangeDetectionExact ¶
type MonitorUpdateParamsChangeDetectionExact struct {
Type constant.Exact `json:"type" default:"exact"`
// contains filtered or unexported fields
}
Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
This struct has a constant value, construct it with NewMonitorUpdateParamsChangeDetectionExact.
func NewMonitorUpdateParamsChangeDetectionExact ¶
func NewMonitorUpdateParamsChangeDetectionExact() MonitorUpdateParamsChangeDetectionExact
func (MonitorUpdateParamsChangeDetectionExact) MarshalJSON ¶
func (r MonitorUpdateParamsChangeDetectionExact) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParamsChangeDetectionExact) UnmarshalJSON ¶
func (r *MonitorUpdateParamsChangeDetectionExact) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsChangeDetectionSemantic ¶
type MonitorUpdateParamsChangeDetectionSemantic struct {
ConfidenceThreshold param.Opt[float64] `json:"confidence_threshold,omitzero"`
// This field can be elided, and will marshal its zero value as "semantic".
Type constant.Semantic `json:"type" default:"semantic"`
// contains filtered or unexported fields
}
Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
The property Type is required.
func (MonitorUpdateParamsChangeDetectionSemantic) MarshalJSON ¶
func (r MonitorUpdateParamsChangeDetectionSemantic) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParamsChangeDetectionSemantic) UnmarshalJSON ¶
func (r *MonitorUpdateParamsChangeDetectionSemantic) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsChangeDetectionUnion ¶
type MonitorUpdateParamsChangeDetectionUnion struct {
OfExact *MonitorUpdateParamsChangeDetectionExact `json:",omitzero,inline"`
OfSemantic *MonitorUpdateParamsChangeDetectionSemantic `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (MonitorUpdateParamsChangeDetectionUnion) MarshalJSON ¶
func (u MonitorUpdateParamsChangeDetectionUnion) MarshalJSON() ([]byte, error)
func (*MonitorUpdateParamsChangeDetectionUnion) UnmarshalJSON ¶
func (u *MonitorUpdateParamsChangeDetectionUnion) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsSchedule ¶
type MonitorUpdateParamsSchedule struct {
// Number of units between runs. The resulting interval (frequency × unit) must be
// at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
// maximum 365 when unit is days).
Frequency int64 `json:"frequency" api:"required"`
// Any of "interval".
Type string `json:"type,omitzero" api:"required"`
// Any of "minutes", "hours", "days".
Unit string `json:"unit,omitzero" api:"required"`
// contains filtered or unexported fields
}
Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.
The properties Frequency, Type, Unit are required.
func (MonitorUpdateParamsSchedule) MarshalJSON ¶
func (r MonitorUpdateParamsSchedule) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParamsSchedule) UnmarshalJSON ¶
func (r *MonitorUpdateParamsSchedule) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsStatus ¶
type MonitorUpdateParamsStatus string
const ( MonitorUpdateParamsStatusActive MonitorUpdateParamsStatus = "active" MonitorUpdateParamsStatusPaused MonitorUpdateParamsStatus = "paused" )
type MonitorUpdateParamsTargetExtract ¶
type MonitorUpdateParamsTargetExtract struct {
// Natural-language instructions guiding which pages and facts to track and which
// changes to report.
Instructions string `json:"instructions" api:"required"`
// Root URL to extract structured data from.
URL string `json:"url" api:"required" format:"uri"`
FollowSubdomains param.Opt[bool] `json:"follow_subdomains,omitzero"`
// Optional maximum link depth from the starting URL (0 = only the starting page).
MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
// Maximum number of pages to track.
MaxPages param.Opt[int64] `json:"max_pages,omitzero"`
// JSON Schema describing the data you care about. It is used three ways: it guides
// which pages are selected for tracking, it gives the change judge extra context
// on which changes matter (alongside `instructions`), and it defines the shape of
// the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
// about once a day). It is not a response format for changes: change events and
// webhook payloads always contain diffs, summaries, and evidence excerpts — never
// data in this schema's shape. If omitted, a default summary + key-points schema
// is used.
Schema map[string]any `json:"schema,omitzero"`
// This field can be elided, and will marshal its zero value as "extract".
Type constant.Extract `json:"type" default:"extract"`
// contains filtered or unexported fields
}
Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
The properties Instructions, Type, URL are required.
func (MonitorUpdateParamsTargetExtract) MarshalJSON ¶
func (r MonitorUpdateParamsTargetExtract) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParamsTargetExtract) UnmarshalJSON ¶
func (r *MonitorUpdateParamsTargetExtract) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsTargetPage ¶
type MonitorUpdateParamsTargetPage struct {
URL string `json:"url" api:"required" format:"uri"`
// Plain-language goal describing which page changes matter. When provided without
// change_detection, semantic detection is inferred.
Instructions param.Opt[string] `json:"instructions,omitzero"`
// Normalize whitespace before comparing or analyzing text.
NormalizeWhitespace param.Opt[bool] `json:"normalize_whitespace,omitzero"`
// This field can be elided, and will marshal its zero value as "page".
Type constant.Page `json:"type" default:"page"`
// contains filtered or unexported fields
}
Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
The properties Type, URL are required.
func (MonitorUpdateParamsTargetPage) MarshalJSON ¶
func (r MonitorUpdateParamsTargetPage) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParamsTargetPage) UnmarshalJSON ¶
func (r *MonitorUpdateParamsTargetPage) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsTargetSitemap ¶
type MonitorUpdateParamsTargetSitemap struct {
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs param.Opt[int64] `json:"max_urls,omitzero"`
// URL path patterns to exclude (max 50).
Exclude []string `json:"exclude,omitzero"`
// URL path patterns to include (max 50).
Include []string `json:"include,omitzero"`
// This field can be elided, and will marshal its zero value as "sitemap".
Type constant.Sitemap `json:"type" default:"sitemap"`
// contains filtered or unexported fields
}
Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
The properties Type, URL are required.
func (MonitorUpdateParamsTargetSitemap) MarshalJSON ¶
func (r MonitorUpdateParamsTargetSitemap) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParamsTargetSitemap) UnmarshalJSON ¶
func (r *MonitorUpdateParamsTargetSitemap) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsTargetUnion ¶
type MonitorUpdateParamsTargetUnion struct {
OfPage *MonitorUpdateParamsTargetPage `json:",omitzero,inline"`
OfSitemap *MonitorUpdateParamsTargetSitemap `json:",omitzero,inline"`
OfExtract *MonitorUpdateParamsTargetExtract `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (MonitorUpdateParamsTargetUnion) MarshalJSON ¶
func (u MonitorUpdateParamsTargetUnion) MarshalJSON() ([]byte, error)
func (*MonitorUpdateParamsTargetUnion) UnmarshalJSON ¶
func (u *MonitorUpdateParamsTargetUnion) UnmarshalJSON(data []byte) error
type MonitorUpdateParamsWebhook ¶
type MonitorUpdateParamsWebhook struct {
// Webhook URL events are delivered to.
URL string `json:"url" api:"required" format:"uri"`
// Events delivered to this endpoint. `change.detected` fires only when a run
// detects a change; `run.completed` fires on every completed run — including runs
// that detected no change — and embeds the change when one was detected. Defaults
// to `["change.detected"]` when omitted.
//
// Any of "change.detected", "run.completed".
Events []string `json:"events,omitzero"`
// contains filtered or unexported fields
}
Set to null to remove the webhook.
The property URL is required.
func (MonitorUpdateParamsWebhook) MarshalJSON ¶
func (r MonitorUpdateParamsWebhook) MarshalJSON() (data []byte, err error)
func (*MonitorUpdateParamsWebhook) UnmarshalJSON ¶
func (r *MonitorUpdateParamsWebhook) UnmarshalJSON(data []byte) error
type MonitorUpdateResponse ¶
type MonitorUpdateResponse struct {
ID string `json:"id" api:"required"`
// Discriminated union describing how changes are detected.
ChangeDetection MonitorUpdateResponseChangeDetectionUnion `json:"change_detection" api:"required"`
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Top-level monitor category. Always `web` today; the concrete behavior is
// described by `target` and `change_detection`.
//
// Any of "web".
Mode MonitorUpdateResponseMode `json:"mode" api:"required"`
Name string `json:"name" api:"required"`
// Run the monitor on a fixed interval defined by a frequency and a unit, e.g.
// every 6 hours or every 2 days. The total interval (frequency × unit) must be
// between 10 minutes and 1 year.
Schedule MonitorUpdateResponseSchedule `json:"schedule" api:"required"`
// Monitor lifecycle status. `failed` means the most recent run failed (see the
// monitor's `last_error`); failed monitors keep running on schedule and flip back
// to `active` on the next successful run. Monitors are auto-`paused` after
// repeated consecutive failures or insufficient-credit skips; resume by PATCHing
// status to `active`.
//
// Any of "active", "paused", "failed".
Status MonitorUpdateResponseStatus `json:"status" api:"required"`
// Discriminated union describing what the monitor watches.
Target MonitorUpdateResponseTargetUnion `json:"target" api:"required"`
UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
// Current baseline: the last observed value the monitor compares new snapshots
// against. Its shape follows `target.type` (page/sitemap/extract). Only populated
// on GET /monitors/{monitor_id}; null until the first baseline run completes (and
// after a target or change_detection update, which resets the baseline).
Baseline MonitorUpdateResponseBaselineUnion `json:"baseline" api:"nullable"`
LastChangeAt time.Time `json:"last_change_at" api:"nullable" format:"date-time"`
// Error from the most recent failed run; null when the last run succeeded.
LastError MonitorUpdateResponseLastError `json:"last_error" api:"nullable"`
LastRunAt time.Time `json:"last_run_at" api:"nullable" format:"date-time"`
// When the next scheduled run is due.
NextRunAt time.Time `json:"next_run_at" api:"nullable" format:"date-time"`
// User-defined tags for grouping and filtering monitors and their changes.
// Duplicates are removed.
Tags []string `json:"tags"`
Webhook MonitorUpdateResponseWebhook `json:"webhook" api:"nullable"`
// Present while webhook deliveries are failing consecutively; null when deliveries
// are healthy or no webhook is configured. Cleared on the next successful delivery
// and when the webhook URL changes.
WebhookFailure MonitorUpdateResponseWebhookFailure `json:"webhook_failure" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ChangeDetection respjson.Field
CreatedAt respjson.Field
Mode respjson.Field
Name respjson.Field
Schedule respjson.Field
Status respjson.Field
Target respjson.Field
UpdatedAt respjson.Field
Baseline respjson.Field
LastChangeAt respjson.Field
LastError respjson.Field
LastRunAt respjson.Field
NextRunAt respjson.Field
Tags respjson.Field
Webhook respjson.Field
WebhookFailure respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic).
func (MonitorUpdateResponse) RawJSON ¶
func (r MonitorUpdateResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponse) UnmarshalJSON ¶
func (r *MonitorUpdateResponse) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseBaselineExtractBaseline ¶ added in v2.1.0
type MonitorUpdateResponseBaselineExtractBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The extracted structured data, matching the monitor's extraction schema (same
// shape as the /web/extract endpoint's `data`). Refreshed when the monitor
// re-discovers its page set (at most about once a day); `null` when no extraction
// has been captured yet.
Data any `json:"data" api:"required"`
// The page URLs the monitor tracks and analyzes for changes.
URLsAnalyzed []string `json:"urls_analyzed" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted.
func (MonitorUpdateResponseBaselineExtractBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorUpdateResponseBaselineExtractBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseBaselineExtractBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorUpdateResponseBaselineExtractBaseline) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseBaselinePageBaseline ¶ added in v2.1.0
type MonitorUpdateResponseBaselinePageBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// The page's visible text as last observed.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `page` monitor: the visible page text as last observed.
func (MonitorUpdateResponseBaselinePageBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorUpdateResponseBaselinePageBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseBaselinePageBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorUpdateResponseBaselinePageBaseline) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseBaselineSitemapBaseline ¶ added in v2.1.0
type MonitorUpdateResponseBaselineSitemapBaseline struct {
// When this baseline was last captured or replaced.
CapturedAt time.Time `json:"captured_at" api:"required" format:"date-time"`
// Number of URLs in the baseline.
URLCount int64 `json:"url_count" api:"required"`
// The sitemap URLs as last observed (sorted, normalized).
URLs []string `json:"urls" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CapturedAt respjson.Field
URLCount respjson.Field
URLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Current baseline of a `sitemap` monitor: the normalized URL set as last observed.
func (MonitorUpdateResponseBaselineSitemapBaseline) RawJSON ¶ added in v2.1.0
func (r MonitorUpdateResponseBaselineSitemapBaseline) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseBaselineSitemapBaseline) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorUpdateResponseBaselineSitemapBaseline) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseBaselineUnion ¶ added in v2.1.0
type MonitorUpdateResponseBaselineUnion struct {
CapturedAt time.Time `json:"captured_at"`
// This field is from variant [MonitorUpdateResponseBaselinePageBaseline].
Text string `json:"text"`
// This field is from variant [MonitorUpdateResponseBaselineSitemapBaseline].
URLCount int64 `json:"url_count"`
// This field is from variant [MonitorUpdateResponseBaselineSitemapBaseline].
URLs []string `json:"urls"`
// This field is from variant [MonitorUpdateResponseBaselineExtractBaseline].
Data any `json:"data"`
// This field is from variant [MonitorUpdateResponseBaselineExtractBaseline].
URLsAnalyzed []string `json:"urls_analyzed"`
JSON struct {
CapturedAt respjson.Field
Text respjson.Field
URLCount respjson.Field
URLs respjson.Field
Data respjson.Field
URLsAnalyzed respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorUpdateResponseBaselineUnion contains all possible properties and values from MonitorUpdateResponseBaselinePageBaseline, MonitorUpdateResponseBaselineSitemapBaseline, MonitorUpdateResponseBaselineExtractBaseline.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorUpdateResponseBaselineUnion) AsExtractBaseline ¶ added in v2.1.0
func (u MonitorUpdateResponseBaselineUnion) AsExtractBaseline() (v MonitorUpdateResponseBaselineExtractBaseline)
func (MonitorUpdateResponseBaselineUnion) AsPageBaseline ¶ added in v2.1.0
func (u MonitorUpdateResponseBaselineUnion) AsPageBaseline() (v MonitorUpdateResponseBaselinePageBaseline)
func (MonitorUpdateResponseBaselineUnion) AsSitemapBaseline ¶ added in v2.1.0
func (u MonitorUpdateResponseBaselineUnion) AsSitemapBaseline() (v MonitorUpdateResponseBaselineSitemapBaseline)
func (MonitorUpdateResponseBaselineUnion) RawJSON ¶ added in v2.1.0
func (u MonitorUpdateResponseBaselineUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseBaselineUnion) UnmarshalJSON ¶ added in v2.1.0
func (r *MonitorUpdateResponseBaselineUnion) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseChangeDetectionExact ¶
type MonitorUpdateResponseChangeDetectionExact struct {
Type constant.Exact `json:"type" default:"exact"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals.
func (MonitorUpdateResponseChangeDetectionExact) RawJSON ¶
func (r MonitorUpdateResponseChangeDetectionExact) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseChangeDetectionExact) UnmarshalJSON ¶
func (r *MonitorUpdateResponseChangeDetectionExact) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseChangeDetectionSemantic ¶
type MonitorUpdateResponseChangeDetectionSemantic struct {
Type constant.Semantic `json:"type" default:"semantic"`
ConfidenceThreshold float64 `json:"confidence_threshold"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided).
func (MonitorUpdateResponseChangeDetectionSemantic) RawJSON ¶
func (r MonitorUpdateResponseChangeDetectionSemantic) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseChangeDetectionSemantic) UnmarshalJSON ¶
func (r *MonitorUpdateResponseChangeDetectionSemantic) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseChangeDetectionUnion ¶
type MonitorUpdateResponseChangeDetectionUnion struct {
// Any of "exact", "semantic".
Type string `json:"type"`
// This field is from variant [MonitorUpdateResponseChangeDetectionSemantic].
ConfidenceThreshold float64 `json:"confidence_threshold"`
JSON struct {
Type respjson.Field
ConfidenceThreshold respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorUpdateResponseChangeDetectionUnion contains all possible properties and values from MonitorUpdateResponseChangeDetectionExact, MonitorUpdateResponseChangeDetectionSemantic.
Use the MonitorUpdateResponseChangeDetectionUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorUpdateResponseChangeDetectionUnion) AsAny ¶
func (u MonitorUpdateResponseChangeDetectionUnion) AsAny() anyMonitorUpdateResponseChangeDetection
Use the following switch statement to find the correct variant
switch variant := MonitorUpdateResponseChangeDetectionUnion.AsAny().(type) {
case contextdev.MonitorUpdateResponseChangeDetectionExact:
case contextdev.MonitorUpdateResponseChangeDetectionSemantic:
default:
fmt.Errorf("no variant present")
}
func (MonitorUpdateResponseChangeDetectionUnion) AsExact ¶
func (u MonitorUpdateResponseChangeDetectionUnion) AsExact() (v MonitorUpdateResponseChangeDetectionExact)
func (MonitorUpdateResponseChangeDetectionUnion) AsSemantic ¶
func (u MonitorUpdateResponseChangeDetectionUnion) AsSemantic() (v MonitorUpdateResponseChangeDetectionSemantic)
func (MonitorUpdateResponseChangeDetectionUnion) RawJSON ¶
func (u MonitorUpdateResponseChangeDetectionUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseChangeDetectionUnion) UnmarshalJSON ¶
func (r *MonitorUpdateResponseChangeDetectionUnion) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseLastError ¶
type MonitorUpdateResponseLastError struct {
Code string `json:"code" api:"required"`
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Error from the most recent failed run; null when the last run succeeded.
func (MonitorUpdateResponseLastError) RawJSON ¶
func (r MonitorUpdateResponseLastError) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseLastError) UnmarshalJSON ¶
func (r *MonitorUpdateResponseLastError) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseMode ¶
type MonitorUpdateResponseMode string
Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`.
const (
MonitorUpdateResponseModeWeb MonitorUpdateResponseMode = "web"
)
type MonitorUpdateResponseSchedule ¶
type MonitorUpdateResponseSchedule struct {
// Number of units between runs. The resulting interval (frequency × unit) must be
// at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes;
// maximum 365 when unit is days).
Frequency int64 `json:"frequency" api:"required"`
// Any of "interval".
Type string `json:"type" api:"required"`
// Any of "minutes", "hours", "days".
Unit string `json:"unit" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Frequency respjson.Field
Type respjson.Field
Unit respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year.
func (MonitorUpdateResponseSchedule) RawJSON ¶
func (r MonitorUpdateResponseSchedule) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseSchedule) UnmarshalJSON ¶
func (r *MonitorUpdateResponseSchedule) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseStatus ¶
type MonitorUpdateResponseStatus string
Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`.
const ( MonitorUpdateResponseStatusActive MonitorUpdateResponseStatus = "active" MonitorUpdateResponseStatusPaused MonitorUpdateResponseStatus = "paused" MonitorUpdateResponseStatusFailed MonitorUpdateResponseStatus = "failed" )
type MonitorUpdateResponseTargetExtract ¶
type MonitorUpdateResponseTargetExtract struct {
// Natural-language instructions guiding which pages and facts to track and which
// changes to report.
Instructions string `json:"instructions" api:"required"`
Type constant.Extract `json:"type" default:"extract"`
// Root URL to extract structured data from.
URL string `json:"url" api:"required" format:"uri"`
FollowSubdomains bool `json:"follow_subdomains"`
// Optional maximum link depth from the starting URL (0 = only the starting page).
MaxDepth int64 `json:"max_depth"`
// Maximum number of pages to track.
MaxPages int64 `json:"max_pages"`
// JSON Schema describing the data you care about. It is used three ways: it guides
// which pages are selected for tracking, it gives the change judge extra context
// on which changes matter (alongside `instructions`), and it defines the shape of
// the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most
// about once a day). It is not a response format for changes: change events and
// webhook payloads always contain diffs, summaries, and evidence excerpts — never
// data in this schema's shape. If omitted, a default summary + key-points schema
// is used.
Schema map[string]any `json:"schema"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Instructions respjson.Field
Type respjson.Field
URL respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl.
func (MonitorUpdateResponseTargetExtract) RawJSON ¶
func (r MonitorUpdateResponseTargetExtract) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseTargetExtract) UnmarshalJSON ¶
func (r *MonitorUpdateResponseTargetExtract) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseTargetPage ¶
type MonitorUpdateResponseTargetPage struct {
Type constant.Page `json:"type" default:"page"`
URL string `json:"url" api:"required" format:"uri"`
// Plain-language goal describing which page changes matter. When provided without
// change_detection, semantic detection is inferred.
Instructions string `json:"instructions"`
// Normalize whitespace before comparing or analyzing text.
NormalizeWhitespace bool `json:"normalize_whitespace"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`.
func (MonitorUpdateResponseTargetPage) RawJSON ¶
func (r MonitorUpdateResponseTargetPage) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseTargetPage) UnmarshalJSON ¶
func (r *MonitorUpdateResponseTargetPage) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseTargetSitemap ¶
type MonitorUpdateResponseTargetSitemap struct {
Type constant.Sitemap `json:"type" default:"sitemap"`
// Sitemap URL to monitor.
URL string `json:"url" api:"required" format:"uri"`
// URL path patterns to exclude (max 50).
Exclude []string `json:"exclude"`
// URL path patterns to include (max 50).
Include []string `json:"include"`
// Maximum number of sitemap URLs to track (capped at 10,000).
MaxURLs int64 `json:"max_urls"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Type respjson.Field
URL respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps.
func (MonitorUpdateResponseTargetSitemap) RawJSON ¶
func (r MonitorUpdateResponseTargetSitemap) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseTargetSitemap) UnmarshalJSON ¶
func (r *MonitorUpdateResponseTargetSitemap) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseTargetUnion ¶
type MonitorUpdateResponseTargetUnion struct {
// Any of "page", "sitemap", "extract".
Type string `json:"type"`
URL string `json:"url"`
Instructions string `json:"instructions"`
// This field is from variant [MonitorUpdateResponseTargetPage].
NormalizeWhitespace bool `json:"normalize_whitespace"`
// This field is from variant [MonitorUpdateResponseTargetSitemap].
Exclude []string `json:"exclude"`
// This field is from variant [MonitorUpdateResponseTargetSitemap].
Include []string `json:"include"`
// This field is from variant [MonitorUpdateResponseTargetSitemap].
MaxURLs int64 `json:"max_urls"`
// This field is from variant [MonitorUpdateResponseTargetExtract].
FollowSubdomains bool `json:"follow_subdomains"`
// This field is from variant [MonitorUpdateResponseTargetExtract].
MaxDepth int64 `json:"max_depth"`
// This field is from variant [MonitorUpdateResponseTargetExtract].
MaxPages int64 `json:"max_pages"`
// This field is from variant [MonitorUpdateResponseTargetExtract].
Schema map[string]any `json:"schema"`
JSON struct {
Type respjson.Field
URL respjson.Field
Instructions respjson.Field
NormalizeWhitespace respjson.Field
Exclude respjson.Field
Include respjson.Field
MaxURLs respjson.Field
FollowSubdomains respjson.Field
MaxDepth respjson.Field
MaxPages respjson.Field
Schema respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
MonitorUpdateResponseTargetUnion contains all possible properties and values from MonitorUpdateResponseTargetPage, MonitorUpdateResponseTargetSitemap, MonitorUpdateResponseTargetExtract.
Use the MonitorUpdateResponseTargetUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (MonitorUpdateResponseTargetUnion) AsAny ¶
func (u MonitorUpdateResponseTargetUnion) AsAny() anyMonitorUpdateResponseTarget
Use the following switch statement to find the correct variant
switch variant := MonitorUpdateResponseTargetUnion.AsAny().(type) {
case contextdev.MonitorUpdateResponseTargetPage:
case contextdev.MonitorUpdateResponseTargetSitemap:
case contextdev.MonitorUpdateResponseTargetExtract:
default:
fmt.Errorf("no variant present")
}
func (MonitorUpdateResponseTargetUnion) AsExtract ¶
func (u MonitorUpdateResponseTargetUnion) AsExtract() (v MonitorUpdateResponseTargetExtract)
func (MonitorUpdateResponseTargetUnion) AsPage ¶
func (u MonitorUpdateResponseTargetUnion) AsPage() (v MonitorUpdateResponseTargetPage)
func (MonitorUpdateResponseTargetUnion) AsSitemap ¶
func (u MonitorUpdateResponseTargetUnion) AsSitemap() (v MonitorUpdateResponseTargetSitemap)
func (MonitorUpdateResponseTargetUnion) RawJSON ¶
func (u MonitorUpdateResponseTargetUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseTargetUnion) UnmarshalJSON ¶
func (r *MonitorUpdateResponseTargetUnion) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseWebhook ¶
type MonitorUpdateResponseWebhook struct {
// Webhook URL events are delivered to.
URL string `json:"url" api:"required" format:"uri"`
// Events delivered to this endpoint. `change.detected` fires only when a run
// detects a change; `run.completed` fires on every completed run — including runs
// that detected no change — and embeds the change when one was detected. Defaults
// to `["change.detected"]` when omitted.
//
// Any of "change.detected", "run.completed".
Events []string `json:"events"`
// Signing secret used to verify webhook authenticity. Each delivery includes an
// `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the HMAC is SHA-256 over
// `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time
// compare and reject stale timestamps to prevent replay. Generated by the API;
// cannot be set by clients.
Secret string `json:"secret"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
URL respjson.Field
Events respjson.Field
Secret respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MonitorUpdateResponseWebhook) RawJSON ¶
func (r MonitorUpdateResponseWebhook) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseWebhook) UnmarshalJSON ¶
func (r *MonitorUpdateResponseWebhook) UnmarshalJSON(data []byte) error
type MonitorUpdateResponseWebhookFailure ¶ added in v2.3.0
type MonitorUpdateResponseWebhookFailure struct {
// Number of consecutive delivery attempts that did not succeed.
ConsecutiveFailures int64 `json:"consecutive_failures" api:"required"`
LastFailedAt time.Time `json:"last_failed_at" api:"required" format:"date-time"`
// Human-readable description of the most recent failure.
LastMessage string `json:"last_message" api:"required"`
// Outcome of the most recent failed delivery. rejected means a non-2xx response;
// failed means no HTTP response was received; skipped_unsafe_url means the URL
// failed the public-endpoint safety check.
//
// Any of "rejected", "failed", "skipped_unsafe_url".
LastStatus string `json:"last_status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ConsecutiveFailures respjson.Field
LastFailedAt respjson.Field
LastMessage respjson.Field
LastStatus respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes.
func (MonitorUpdateResponseWebhookFailure) RawJSON ¶ added in v2.3.0
func (r MonitorUpdateResponseWebhookFailure) RawJSON() string
Returns the unmodified JSON received from the API
func (*MonitorUpdateResponseWebhookFailure) UnmarshalJSON ¶ added in v2.3.0
func (r *MonitorUpdateResponseWebhookFailure) UnmarshalJSON(data []byte) error
type NewsSearchParams ¶ added in v2.10.0
type NewsSearchParams struct {
// What to search for.
SearchBy NewsSearchParamsSearchBy `json:"searchBy,omitzero" api:"required"`
// Opaque next_cursor from the previous response, or null for the first page.
Cursor param.Opt[string] `json:"cursor,omitzero"`
// Maximum results to return. Defaults to 10.
Limit param.Opt[int64] `json:"limit,omitzero"`
// Optional result filters.
FilterBy NewsSearchParamsFilterBy `json:"filterBy,omitzero"`
// Result ordering. Defaults to newest.
SortBy NewsSearchParamsSortBy `json:"sortBy,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (NewsSearchParams) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParams) MarshalJSON() (data []byte, err error)
func (*NewsSearchParams) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParams) UnmarshalJSON(data []byte) error
type NewsSearchParamsFilterBy ¶ added in v2.10.0
type NewsSearchParamsFilterBy struct {
// Article languages to include. Up to 3.
//
// Any of "ar", "de", "en", "es", "fr", "hi", "it", "ja", "ko", "nl", "pt", "ru",
// "zh".
ArticleLanguage []string `json:"articleLanguage,omitzero"`
// Article types to include. Up to 3.
//
// Any of "editorial", "press_release", "regulatory_filing", "advisory".
ArticleType []string `json:"articleType,omitzero"`
// Published-at window in epoch milliseconds.
Date NewsSearchParamsFilterByDate `json:"date,omitzero"`
// Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3.
//
// Any of "ae", "ar", "au", "ca", "cg", "ch", "cl", "de", "fi", "fr", "gb", "hk",
// "il", "in", "jp", "kr", "mx", "ng", "nl", "qa", "sa", "se", "sg", "us", "za".
SourceCountry []string `json:"sourceCountry,omitzero"`
// Publisher domains to include. Up to 3.
SourceDomain []string `json:"sourceDomain,omitzero"`
// contains filtered or unexported fields
}
Optional result filters.
func (NewsSearchParamsFilterBy) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsFilterBy) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsFilterBy) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsFilterBy) UnmarshalJSON(data []byte) error
type NewsSearchParamsFilterByDate ¶ added in v2.10.0
type NewsSearchParamsFilterByDate struct {
// Inclusive start of the published-at window, in epoch milliseconds.
From param.Opt[int64] `json:"from,omitzero"`
// Inclusive end of the published-at window, in epoch milliseconds.
To param.Opt[int64] `json:"to,omitzero"`
// contains filtered or unexported fields
}
Published-at window in epoch milliseconds.
func (NewsSearchParamsFilterByDate) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsFilterByDate) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsFilterByDate) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsFilterByDate) UnmarshalJSON(data []byte) error
type NewsSearchParamsSearchBy ¶ added in v2.10.0
type NewsSearchParamsSearchBy struct {
// The company to search news for, identified by name, domain, ticker, or ISIN.
Entity NewsSearchParamsSearchByEntityUnion `json:"entity,omitzero" api:"required"`
// How to search. Only entity search is supported.
//
// Any of "entity".
Type string `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
What to search for.
The properties Entity, Type are required.
func (NewsSearchParamsSearchBy) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsSearchBy) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsSearchBy) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsSearchBy) UnmarshalJSON(data []byte) error
type NewsSearchParamsSearchByEntityDomain ¶ added in v2.10.0
type NewsSearchParamsSearchByEntityDomain struct {
// Company website domain, such as apple.com.
Domain string `json:"domain" api:"required"`
// This field can be elided, and will marshal its zero value as "domain".
Type constant.Domain `json:"type" default:"domain"`
// contains filtered or unexported fields
}
Identify the company by website domain.
The properties Domain, Type are required.
func (NewsSearchParamsSearchByEntityDomain) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsSearchByEntityDomain) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsSearchByEntityDomain) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsSearchByEntityDomain) UnmarshalJSON(data []byte) error
type NewsSearchParamsSearchByEntityIsin ¶ added in v2.10.0
type NewsSearchParamsSearchByEntityIsin struct {
// International Securities Identification Number.
Isin string `json:"isin" api:"required"`
// This field can be elided, and will marshal its zero value as "isin".
Type constant.Isin `json:"type" default:"isin"`
// contains filtered or unexported fields
}
Identify the company by International Securities Identification Number.
The properties Isin, Type are required.
func (NewsSearchParamsSearchByEntityIsin) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsSearchByEntityIsin) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsSearchByEntityIsin) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsSearchByEntityIsin) UnmarshalJSON(data []byte) error
type NewsSearchParamsSearchByEntityName ¶ added in v2.10.0
type NewsSearchParamsSearchByEntityName struct {
// Company name.
Name string `json:"name" api:"required"`
// This field can be elided, and will marshal its zero value as "name".
Type constant.Name `json:"type" default:"name"`
// contains filtered or unexported fields
}
Identify the company by name.
The properties Name, Type are required.
func (NewsSearchParamsSearchByEntityName) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsSearchByEntityName) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsSearchByEntityName) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsSearchByEntityName) UnmarshalJSON(data []byte) error
type NewsSearchParamsSearchByEntityTicker ¶ added in v2.10.0
type NewsSearchParamsSearchByEntityTicker struct {
// Public-company ticker.
Ticker string `json:"ticker" api:"required"`
// Stock exchange the ticker trades on, used to disambiguate tickers listed on
// multiple exchanges.
//
// Any of "AMEX", "AMS", "AQS", "ASX", "ATH", "BER", "BME", "BRU", "BSE", "BUD",
// "BUE", "BVC", "CBOE", "CNQ", "CPH", "DFM", "DOH", "DUB", "DUS", "DXE", "EGX",
// "FSX", "HAM", "HEL", "HKSE", "HOSE", "ICE", "IOB", "IST", "JKT", "JNB", "JPX",
// "KLS", "KOE", "KSC", "KUW", "LIS", "LSE", "MCX", "MEX", "MIL", "MUN", "NASDAQ",
// "NEO", "NSE", "NYSE", "NZE", "OSL", "OTC", "PAR", "PNK", "PRA", "RIS", "SAO",
// "SAU", "SES", "SET", "SGO", "SHH", "SHZ", "SIX", "STO", "STU", "TAI", "TAL",
// "TLV", "TSX", "TSXV", "TWO", "VIE", "WSE", "XETRA".
Exchange string `json:"exchange,omitzero"`
// This field can be elided, and will marshal its zero value as "ticker".
Type constant.Ticker `json:"type" default:"ticker"`
// contains filtered or unexported fields
}
Identify the company by stock ticker, optionally scoped to an exchange.
The properties Ticker, Type are required.
func (NewsSearchParamsSearchByEntityTicker) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsSearchByEntityTicker) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsSearchByEntityTicker) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsSearchByEntityTicker) UnmarshalJSON(data []byte) error
type NewsSearchParamsSearchByEntityUnion ¶ added in v2.10.0
type NewsSearchParamsSearchByEntityUnion struct {
OfName *NewsSearchParamsSearchByEntityName `json:",omitzero,inline"`
OfDomain *NewsSearchParamsSearchByEntityDomain `json:",omitzero,inline"`
OfTicker *NewsSearchParamsSearchByEntityTicker `json:",omitzero,inline"`
OfIsin *NewsSearchParamsSearchByEntityIsin `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (NewsSearchParamsSearchByEntityUnion) MarshalJSON ¶ added in v2.10.0
func (u NewsSearchParamsSearchByEntityUnion) MarshalJSON() ([]byte, error)
func (*NewsSearchParamsSearchByEntityUnion) UnmarshalJSON ¶ added in v2.10.0
func (u *NewsSearchParamsSearchByEntityUnion) UnmarshalJSON(data []byte) error
type NewsSearchParamsSortBy ¶ added in v2.10.0
type NewsSearchParamsSortBy struct {
// Result ordering.
//
// Any of "relevance", "newest".
Type string `json:"type,omitzero" api:"required"`
// contains filtered or unexported fields
}
Result ordering. Defaults to newest.
The property Type is required.
func (NewsSearchParamsSortBy) MarshalJSON ¶ added in v2.10.0
func (r NewsSearchParamsSortBy) MarshalJSON() (data []byte, err error)
func (*NewsSearchParamsSortBy) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchParamsSortBy) UnmarshalJSON(data []byte) error
type NewsSearchResponse ¶ added in v2.10.0
type NewsSearchResponse struct {
// Articles matching the search, in the requested order.
Data []NewsSearchResponseData `json:"data" api:"required"`
// True when more results are available beyond this page.
HasMore bool `json:"has_more" api:"required"`
// Summary information about this response.
Meta NewsSearchResponseMeta `json:"meta" api:"required"`
// Pass as cursor in the next request to fetch the following page. Null when there
// are no more results.
NextCursor string `json:"next_cursor" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata NewsSearchResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
HasMore respjson.Field
Meta respjson.Field
NextCursor respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (NewsSearchResponse) RawJSON ¶ added in v2.10.0
func (r NewsSearchResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*NewsSearchResponse) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchResponse) UnmarshalJSON(data []byte) error
type NewsSearchResponseData ¶ added in v2.10.0
type NewsSearchResponseData struct {
// Stable unique identifier for this article. Use it to deduplicate or reference an
// article across requests.
ID string `json:"id" api:"required"`
// Bylined authors. Empty when no byline is available.
Authors []string `json:"authors" api:"required"`
// Short summary or excerpt of the article, when the publisher provides one.
Description string `json:"description" api:"required"`
// Lead image for the article, when one is available.
ImageURL string `json:"image_url" api:"required"`
// Language the article is written in, as a lowercase ISO 639-1 code such as en.
// Null when unknown.
Language string `json:"language" api:"required"`
// How the article relates to the company you searched for.
Match NewsSearchResponseDataMatch `json:"match" api:"required"`
// When the article was published, as an ISO 8601 timestamp. Null when the
// publisher does not state a reliable date.
PublishedAt time.Time `json:"published_at" api:"required" format:"date-time"`
// The publication that published the article.
Source NewsSearchResponseDataSource `json:"source" api:"required"`
// Shared by articles covering the same story on the same day. Use it to group or
// collapse syndicated copies of one announcement across outlets.
StoryID string `json:"story_id" api:"required"`
// Article headline.
Title string `json:"title" api:"required"`
// Kind of coverage. Use it to separate independent reporting (editorial) from
// company-issued content (press_release, regulatory_filing, advisory).
//
// Any of "editorial", "press_release", "regulatory_filing", "advisory".
Type string `json:"type" api:"required"`
// Link to the article on the publisher site.
URL string `json:"url" api:"required" format:"uri"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Authors respjson.Field
Description respjson.Field
ImageURL respjson.Field
Language respjson.Field
Match respjson.Field
PublishedAt respjson.Field
Source respjson.Field
StoryID respjson.Field
Title respjson.Field
Type respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (NewsSearchResponseData) RawJSON ¶ added in v2.10.0
func (r NewsSearchResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*NewsSearchResponseData) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchResponseData) UnmarshalJSON(data []byte) error
type NewsSearchResponseDataMatch ¶ added in v2.10.0
type NewsSearchResponseDataMatch struct {
// How confident the match is, from 0 to 1. Null when a score is unavailable.
Confidence float64 `json:"confidence" api:"required"`
// primary when the article is mainly about the company, secondary when the company
// is mentioned but is not the main subject.
//
// Any of "primary", "secondary".
Level string `json:"level" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Confidence respjson.Field
Level respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
How the article relates to the company you searched for.
func (NewsSearchResponseDataMatch) RawJSON ¶ added in v2.10.0
func (r NewsSearchResponseDataMatch) RawJSON() string
Returns the unmodified JSON received from the API
func (*NewsSearchResponseDataMatch) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchResponseDataMatch) UnmarshalJSON(data []byte) error
type NewsSearchResponseDataSource ¶ added in v2.10.0
type NewsSearchResponseDataSource struct {
// True when Context observed this article in the publisher-owned feed.
Direct bool `json:"direct" api:"required"`
// Website domain of the publication.
Domain string `json:"domain" api:"required"`
// Name of the publication, such as Reuters.
Name string `json:"name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Direct respjson.Field
Domain respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The publication that published the article.
func (NewsSearchResponseDataSource) RawJSON ¶ added in v2.10.0
func (r NewsSearchResponseDataSource) RawJSON() string
Returns the unmodified JSON received from the API
func (*NewsSearchResponseDataSource) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchResponseDataSource) UnmarshalJSON(data []byte) error
type NewsSearchResponseKeyMetadata ¶ added in v2.10.0
type NewsSearchResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (NewsSearchResponseKeyMetadata) RawJSON ¶ added in v2.10.0
func (r NewsSearchResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*NewsSearchResponseKeyMetadata) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchResponseKeyMetadata) UnmarshalJSON(data []byte) error
type NewsSearchResponseMeta ¶ added in v2.10.0
type NewsSearchResponseMeta struct {
// Number of articles in this page.
Count int64 `json:"count" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Count respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Summary information about this response.
func (NewsSearchResponseMeta) RawJSON ¶ added in v2.10.0
func (r NewsSearchResponseMeta) RawJSON() string
Returns the unmodified JSON received from the API
func (*NewsSearchResponseMeta) UnmarshalJSON ¶ added in v2.10.0
func (r *NewsSearchResponseMeta) UnmarshalJSON(data []byte) error
type NewsService ¶ added in v2.10.0
type NewsService struct {
// contains filtered or unexported fields
}
Search live first-party RSS and free historical news data by company identity.
NewsService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewNewsService method instead.
func NewNewsService ¶ added in v2.10.0
func NewNewsService(opts ...option.RequestOption) (r NewsService)
NewNewsService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*NewsService) Search ¶ added in v2.10.0
func (r *NewsService) Search(ctx context.Context, body NewsSearchParams, opts ...option.RequestOption) (res *NewsSearchResponse, err error)
Searches live and historical company news for one company, identified in searchBy by name, domain, ticker (optionally disambiguated by exchange), or ISIN. Results can be filtered by publisher domain, publisher country, article language, article type, and published-at date, and include stable story IDs, source metadata, verified entity relevance, and cursor pagination.
type PageErrorCount ¶ added in v2.7.0
type PageErrorCount struct {
// Error code for these failures.
Code string `json:"code" api:"required"`
// Pages that failed with this code.
Count int64 `json:"count" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Count respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Page failures sharing one error code.
func (PageErrorCount) RawJSON ¶ added in v2.7.0
func (r PageErrorCount) RawJSON() string
Returns the unmodified JSON received from the API
func (*PageErrorCount) UnmarshalJSON ¶ added in v2.7.0
func (r *PageErrorCount) UnmarshalJSON(data []byte) error
type ParseHandleParams ¶ added in v2.3.0
type ParseHandleParams struct {
// Optional client identifier used for usage attribution.
Client param.Opt[string] `query:"client,omitzero" json:"-"`
// Include image references in Markdown output
IncludeImages param.Opt[bool] `query:"includeImages,omitzero" json:"-"`
// Preserve hyperlinks in Markdown output
IncludeLinks param.Opt[bool] `query:"includeLinks,omitzero" json:"-"`
// When true for PDF inputs, OCR the selected pages that have no usable text layer
// (scans), replacing each recovered page's text with the OCR result while pages
// with a real text layer keep it. pdf.start/pdf.end limit the inclusive page
// range. Billed at 1 credit per page OCR actually recovered, on top of the base
// request cost. When false, no OCR runs.
Ocr param.Opt[bool] `query:"ocr,omitzero" json:"-"`
// Shorten base64-encoded image data in the Markdown output
ShortenBase64Images param.Opt[bool] `query:"shortenBase64Images,omitzero" json:"-"`
// Extract only the main content from HTML-like inputs
UseMainContentOnly param.Opt[bool] `query:"useMainContentOnly,omitzero" json:"-"`
// Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv,
// md, py, rtf, jpg, png, or txt.
//
// Any of "txt", "text", "md", "markdown", "html", "htm", "xhtml", "xml", "rss",
// "atom", "csv", "tsv", "yaml", "yml", "py", "java", "js", "jsx", "mjs", "cjs",
// "json", "jsonl", "ndjson", "php", "sh", "bash", "zsh", "fish", "rb", "ts",
// "tsx", "rtf", "srt", "css", "scss", "less", "styl", "sass", "svg", "pdf",
// "docx", "doc", "xlsx", "xlsm", "xlsb", "xltx", "xltm", "xls", "pptx", "pptm",
// "ppsx", "ppsm", "potx", "potm", "ppt", "pps", "pot", "jpg", "jpeg", "jpe",
// "png", "gif", "bmp", "tiff", "tif", "webp", "ppm", "pbm", "pgm", "pnm".
Extension ParseHandleParamsExtension `query:"extension,omitzero" json:"-"`
// PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
Pdf ParseHandleParamsPdf `query:"pdf,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// Set to enabled to bypass shared caches and omit request and response content
// from retained usage logs. Requires zero data retention to be enabled for your
// organization (contact support@context.dev), otherwise the request fails with
// ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
//
// Any of "enabled", "disabled".
Zdr ParseHandleParamsZdr `query:"zdr,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ParseHandleParams) MarshalMultipart ¶ added in v2.3.0
func (r ParseHandleParams) MarshalMultipart() (data []byte, contentType string, err error)
func (ParseHandleParams) URLQuery ¶ added in v2.3.0
func (r ParseHandleParams) URLQuery() (v url.Values, err error)
URLQuery serializes ParseHandleParams's query parameters as `url.Values`.
type ParseHandleParamsExtension ¶ added in v2.4.0
type ParseHandleParamsExtension string
Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.
const ( ParseHandleParamsExtensionTxt ParseHandleParamsExtension = "txt" ParseHandleParamsExtensionText ParseHandleParamsExtension = "text" ParseHandleParamsExtensionMd ParseHandleParamsExtension = "md" ParseHandleParamsExtensionMarkdown ParseHandleParamsExtension = "markdown" ParseHandleParamsExtensionHTML ParseHandleParamsExtension = "html" ParseHandleParamsExtensionHtm ParseHandleParamsExtension = "htm" ParseHandleParamsExtensionXhtml ParseHandleParamsExtension = "xhtml" ParseHandleParamsExtensionXml ParseHandleParamsExtension = "xml" ParseHandleParamsExtensionRss ParseHandleParamsExtension = "rss" ParseHandleParamsExtensionAtom ParseHandleParamsExtension = "atom" ParseHandleParamsExtensionCsv ParseHandleParamsExtension = "csv" ParseHandleParamsExtensionTsv ParseHandleParamsExtension = "tsv" ParseHandleParamsExtensionYaml ParseHandleParamsExtension = "yaml" ParseHandleParamsExtensionYml ParseHandleParamsExtension = "yml" ParseHandleParamsExtensionPy ParseHandleParamsExtension = "py" ParseHandleParamsExtensionJava ParseHandleParamsExtension = "java" ParseHandleParamsExtensionJs ParseHandleParamsExtension = "js" ParseHandleParamsExtensionJsx ParseHandleParamsExtension = "jsx" ParseHandleParamsExtensionMjs ParseHandleParamsExtension = "mjs" ParseHandleParamsExtensionCjs ParseHandleParamsExtension = "cjs" ParseHandleParamsExtensionJson ParseHandleParamsExtension = "json" ParseHandleParamsExtensionJSONL ParseHandleParamsExtension = "jsonl" ParseHandleParamsExtensionNdjson ParseHandleParamsExtension = "ndjson" ParseHandleParamsExtensionPhp ParseHandleParamsExtension = "php" ParseHandleParamsExtensionSh ParseHandleParamsExtension = "sh" ParseHandleParamsExtensionBash ParseHandleParamsExtension = "bash" ParseHandleParamsExtensionZsh ParseHandleParamsExtension = "zsh" ParseHandleParamsExtensionFish ParseHandleParamsExtension = "fish" ParseHandleParamsExtensionRb ParseHandleParamsExtension = "rb" ParseHandleParamsExtensionTs ParseHandleParamsExtension = "ts" ParseHandleParamsExtensionTsx ParseHandleParamsExtension = "tsx" ParseHandleParamsExtensionRtf ParseHandleParamsExtension = "rtf" ParseHandleParamsExtensionSrt ParseHandleParamsExtension = "srt" ParseHandleParamsExtensionCss ParseHandleParamsExtension = "css" ParseHandleParamsExtensionScss ParseHandleParamsExtension = "scss" ParseHandleParamsExtensionLess ParseHandleParamsExtension = "less" ParseHandleParamsExtensionStyl ParseHandleParamsExtension = "styl" ParseHandleParamsExtensionSass ParseHandleParamsExtension = "sass" ParseHandleParamsExtensionSvg ParseHandleParamsExtension = "svg" ParseHandleParamsExtensionPdf ParseHandleParamsExtension = "pdf" ParseHandleParamsExtensionDocx ParseHandleParamsExtension = "docx" ParseHandleParamsExtensionDoc ParseHandleParamsExtension = "doc" ParseHandleParamsExtensionXlsx ParseHandleParamsExtension = "xlsx" ParseHandleParamsExtensionXlsm ParseHandleParamsExtension = "xlsm" ParseHandleParamsExtensionXlsb ParseHandleParamsExtension = "xlsb" ParseHandleParamsExtensionXltx ParseHandleParamsExtension = "xltx" ParseHandleParamsExtensionXltm ParseHandleParamsExtension = "xltm" ParseHandleParamsExtensionXls ParseHandleParamsExtension = "xls" ParseHandleParamsExtensionPptx ParseHandleParamsExtension = "pptx" ParseHandleParamsExtensionPptm ParseHandleParamsExtension = "pptm" ParseHandleParamsExtensionPpsx ParseHandleParamsExtension = "ppsx" ParseHandleParamsExtensionPpsm ParseHandleParamsExtension = "ppsm" ParseHandleParamsExtensionPotx ParseHandleParamsExtension = "potx" ParseHandleParamsExtensionPotm ParseHandleParamsExtension = "potm" ParseHandleParamsExtensionPpt ParseHandleParamsExtension = "ppt" ParseHandleParamsExtensionPps ParseHandleParamsExtension = "pps" ParseHandleParamsExtensionPot ParseHandleParamsExtension = "pot" ParseHandleParamsExtensionJpg ParseHandleParamsExtension = "jpg" ParseHandleParamsExtensionJpeg ParseHandleParamsExtension = "jpeg" ParseHandleParamsExtensionJpe ParseHandleParamsExtension = "jpe" ParseHandleParamsExtensionPng ParseHandleParamsExtension = "png" ParseHandleParamsExtensionGif ParseHandleParamsExtension = "gif" ParseHandleParamsExtensionBmp ParseHandleParamsExtension = "bmp" ParseHandleParamsExtensionTiff ParseHandleParamsExtension = "tiff" ParseHandleParamsExtensionTif ParseHandleParamsExtension = "tif" ParseHandleParamsExtensionWebp ParseHandleParamsExtension = "webp" ParseHandleParamsExtensionPpm ParseHandleParamsExtension = "ppm" ParseHandleParamsExtensionPbm ParseHandleParamsExtension = "pbm" ParseHandleParamsExtensionPgm ParseHandleParamsExtension = "pgm" ParseHandleParamsExtensionPnm ParseHandleParamsExtension = "pnm" )
type ParseHandleParamsPdf ¶ added in v2.4.0
type ParseHandleParamsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `query:"end,omitzero" json:"-"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `query:"start,omitzero" json:"-"`
// contains filtered or unexported fields
}
PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
func (ParseHandleParamsPdf) URLQuery ¶ added in v2.4.0
func (r ParseHandleParamsPdf) URLQuery() (v url.Values, err error)
URLQuery serializes ParseHandleParamsPdf's query parameters as `url.Values`.
type ParseHandleParamsZdr ¶ added in v2.5.0
type ParseHandleParamsZdr string
Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
const ( ParseHandleParamsZdrEnabled ParseHandleParamsZdr = "enabled" ParseHandleParamsZdrDisabled ParseHandleParamsZdr = "disabled" )
type ParseHandleResponse ¶ added in v2.3.0
type ParseHandleResponse struct {
// Input bytes converted to GitHub Flavored Markdown
Markdown string `json:"markdown" api:"required"`
// Indicates success
//
// Any of true.
Success bool `json:"success" api:"required"`
// Detected content type used for parsing
//
// Any of "html", "xml", "json", "jsonl", "text", "csv", "tsv", "markdown", "yaml",
// "python", "java", "javascript", "php", "shell", "ruby", "typescript", "rtf",
// "srt", "css", "scss", "less", "stylus", "sass", "svg", "pdf", "docx", "doc",
// "xlsx", "xls", "pptx", "ppt", "jpg", "png", "gif", "bmp", "tiff", "webp", "ppm",
// "pbm", "pgm", "pnm".
Type ParseHandleResponseType `json:"type" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata ParseHandleResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Markdown respjson.Field
Success respjson.Field
Type respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ParseHandleResponse) RawJSON ¶ added in v2.3.0
func (r ParseHandleResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ParseHandleResponse) UnmarshalJSON ¶ added in v2.3.0
func (r *ParseHandleResponse) UnmarshalJSON(data []byte) error
type ParseHandleResponseKeyMetadata ¶ added in v2.3.0
type ParseHandleResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (ParseHandleResponseKeyMetadata) RawJSON ¶ added in v2.3.0
func (r ParseHandleResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*ParseHandleResponseKeyMetadata) UnmarshalJSON ¶ added in v2.3.0
func (r *ParseHandleResponseKeyMetadata) UnmarshalJSON(data []byte) error
type ParseHandleResponseType ¶ added in v2.3.0
type ParseHandleResponseType string
Detected content type used for parsing
const ( ParseHandleResponseTypeHTML ParseHandleResponseType = "html" ParseHandleResponseTypeXml ParseHandleResponseType = "xml" ParseHandleResponseTypeJson ParseHandleResponseType = "json" ParseHandleResponseTypeJSONL ParseHandleResponseType = "jsonl" ParseHandleResponseTypeText ParseHandleResponseType = "text" ParseHandleResponseTypeCsv ParseHandleResponseType = "csv" ParseHandleResponseTypeTsv ParseHandleResponseType = "tsv" ParseHandleResponseTypeMarkdown ParseHandleResponseType = "markdown" ParseHandleResponseTypeYaml ParseHandleResponseType = "yaml" ParseHandleResponseTypePython ParseHandleResponseType = "python" ParseHandleResponseTypeJava ParseHandleResponseType = "java" ParseHandleResponseTypeJavascript ParseHandleResponseType = "javascript" ParseHandleResponseTypePhp ParseHandleResponseType = "php" ParseHandleResponseTypeShell ParseHandleResponseType = "shell" ParseHandleResponseTypeRuby ParseHandleResponseType = "ruby" ParseHandleResponseTypeTypescript ParseHandleResponseType = "typescript" ParseHandleResponseTypeRtf ParseHandleResponseType = "rtf" ParseHandleResponseTypeSrt ParseHandleResponseType = "srt" ParseHandleResponseTypeCss ParseHandleResponseType = "css" ParseHandleResponseTypeScss ParseHandleResponseType = "scss" ParseHandleResponseTypeLess ParseHandleResponseType = "less" ParseHandleResponseTypeStylus ParseHandleResponseType = "stylus" ParseHandleResponseTypeSass ParseHandleResponseType = "sass" ParseHandleResponseTypeSvg ParseHandleResponseType = "svg" ParseHandleResponseTypePdf ParseHandleResponseType = "pdf" ParseHandleResponseTypeDocx ParseHandleResponseType = "docx" ParseHandleResponseTypeDoc ParseHandleResponseType = "doc" ParseHandleResponseTypeXlsx ParseHandleResponseType = "xlsx" ParseHandleResponseTypeXls ParseHandleResponseType = "xls" ParseHandleResponseTypePptx ParseHandleResponseType = "pptx" ParseHandleResponseTypePpt ParseHandleResponseType = "ppt" ParseHandleResponseTypeJpg ParseHandleResponseType = "jpg" ParseHandleResponseTypePng ParseHandleResponseType = "png" ParseHandleResponseTypeGif ParseHandleResponseType = "gif" ParseHandleResponseTypeBmp ParseHandleResponseType = "bmp" ParseHandleResponseTypeTiff ParseHandleResponseType = "tiff" ParseHandleResponseTypeWebp ParseHandleResponseType = "webp" ParseHandleResponseTypePpm ParseHandleResponseType = "ppm" ParseHandleResponseTypePbm ParseHandleResponseType = "pbm" ParseHandleResponseTypePgm ParseHandleResponseType = "pgm" ParseHandleResponseTypePnm ParseHandleResponseType = "pnm" )
type ParseService ¶ added in v2.3.0
type ParseService struct {
// contains filtered or unexported fields
}
ParseService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewParseService method instead.
func NewParseService ¶ added in v2.3.0
func NewParseService(opts ...option.RequestOption) (r ParseService)
NewParseService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ParseService) Handle ¶ added in v2.3.0
func (r *ParseService) Handle(ctx context.Context, body io.Reader, params ParseHandleParams, opts ...option.RequestOption) (res *ParseHandleResponse, err error)
Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown.
type PersonEnrichParams ¶ added in v2.9.0
type PersonEnrichParams struct {
Email param.Opt[string] `json:"email,omitzero" format:"email"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
Company PersonEnrichParamsCompany `json:"company,omitzero"`
Education []PersonEnrichParamsEducation `json:"education,omitzero"`
Location PersonEnrichParamsLocation `json:"location,omitzero"`
Name PersonEnrichParamsName `json:"name,omitzero"`
SocialURLs []string `json:"social_urls,omitzero" format:"uri"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (PersonEnrichParams) MarshalJSON ¶ added in v2.9.0
func (r PersonEnrichParams) MarshalJSON() (data []byte, err error)
func (*PersonEnrichParams) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichParams) UnmarshalJSON(data []byte) error
type PersonEnrichParamsCompany ¶ added in v2.9.0
type PersonEnrichParamsCompany struct {
Domain param.Opt[string] `json:"domain,omitzero"`
Name param.Opt[string] `json:"name,omitzero"`
// contains filtered or unexported fields
}
func (PersonEnrichParamsCompany) MarshalJSON ¶ added in v2.9.0
func (r PersonEnrichParamsCompany) MarshalJSON() (data []byte, err error)
func (*PersonEnrichParamsCompany) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichParamsCompany) UnmarshalJSON(data []byte) error
type PersonEnrichParamsEducation ¶ added in v2.9.0
type PersonEnrichParamsEducation struct {
Degree param.Opt[string] `json:"degree,omitzero"`
FieldOfStudy param.Opt[string] `json:"field_of_study,omitzero"`
GraduationYear param.Opt[int64] `json:"graduation_year,omitzero"`
Institution PersonEnrichParamsEducationInstitution `json:"institution,omitzero"`
// contains filtered or unexported fields
}
func (PersonEnrichParamsEducation) MarshalJSON ¶ added in v2.9.0
func (r PersonEnrichParamsEducation) MarshalJSON() (data []byte, err error)
func (*PersonEnrichParamsEducation) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichParamsEducation) UnmarshalJSON(data []byte) error
type PersonEnrichParamsEducationInstitution ¶ added in v2.9.0
type PersonEnrichParamsEducationInstitution struct {
Domain param.Opt[string] `json:"domain,omitzero"`
Name param.Opt[string] `json:"name,omitzero"`
// contains filtered or unexported fields
}
func (PersonEnrichParamsEducationInstitution) MarshalJSON ¶ added in v2.9.0
func (r PersonEnrichParamsEducationInstitution) MarshalJSON() (data []byte, err error)
func (*PersonEnrichParamsEducationInstitution) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichParamsEducationInstitution) UnmarshalJSON(data []byte) error
type PersonEnrichParamsLocation ¶ added in v2.9.0
type PersonEnrichParamsLocation struct {
City param.Opt[string] `json:"city,omitzero"`
Country param.Opt[string] `json:"country,omitzero"`
Region param.Opt[string] `json:"region,omitzero"`
// contains filtered or unexported fields
}
func (PersonEnrichParamsLocation) MarshalJSON ¶ added in v2.9.0
func (r PersonEnrichParamsLocation) MarshalJSON() (data []byte, err error)
func (*PersonEnrichParamsLocation) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichParamsLocation) UnmarshalJSON(data []byte) error
type PersonEnrichParamsName ¶ added in v2.9.0
type PersonEnrichParamsName struct {
First param.Opt[string] `json:"first,omitzero"`
Last param.Opt[string] `json:"last,omitzero"`
// contains filtered or unexported fields
}
func (PersonEnrichParamsName) MarshalJSON ¶ added in v2.9.0
func (r PersonEnrichParamsName) MarshalJSON() (data []byte, err error)
func (*PersonEnrichParamsName) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichParamsName) UnmarshalJSON(data []byte) error
type PersonEnrichResponse ¶ added in v2.9.0
type PersonEnrichResponse struct {
// The highest-scoring person candidate.
Match PersonEnrichResponseMatchUnion `json:"match" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata PersonEnrichResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Match respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponse) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponse) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponse) UnmarshalJSON(data []byte) error
type PersonEnrichResponseKeyMetadata ¶ added in v2.9.0
type PersonEnrichResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (PersonEnrichResponseKeyMetadata) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseKeyMetadata) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseKeyMetadata) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidate ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidate struct {
Person PersonEnrichResponseMatchCandidatePerson `json:"person" api:"required"`
Score int64 `json:"score" api:"required"`
Status constant.Candidate `json:"status" default:"candidate"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Person respjson.Field
Score respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
The highest-scoring person candidate.
func (PersonEnrichResponseMatchCandidate) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidate) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidate) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidate) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePerson ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePerson struct {
// Whether the person's current role is known. `present` — current_role is
// populated. `none` — the work history explicitly shows every role has ended.
// `unknown` — our data sources could not confirm either way; treat a missing
// current_role as unverified rather than vacant.
//
// Any of "present", "none", "unknown".
CurrentRoleStatus string `json:"current_role_status" api:"required"`
Education []PersonEnrichResponseMatchCandidatePersonEducation `json:"education" api:"required"`
Experience []PersonEnrichResponseMatchCandidatePersonExperience `json:"experience" api:"required"`
Skills []string `json:"skills" api:"required"`
SocialURLs []string `json:"social_urls" api:"required" format:"uri"`
WebsiteURLs []string `json:"website_urls" api:"required" format:"uri"`
AvatarURL string `json:"avatar_url"`
Bio string `json:"bio"`
// When we last refreshed this profile from our data sources (ISO 8601).
CheckedAt string `json:"checked_at"`
CurrentRole PersonEnrichResponseMatchCandidatePersonCurrentRole `json:"current_role"`
Email string `json:"email" format:"email"`
// When the underlying profile data last changed in our data sources (ISO 8601).
// Omitted when unknown.
LastUpdated string `json:"last_updated"`
Location PersonEnrichResponseMatchCandidatePersonLocation `json:"location"`
Name PersonEnrichResponseMatchCandidatePersonName `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CurrentRoleStatus respjson.Field
Education respjson.Field
Experience respjson.Field
Skills respjson.Field
SocialURLs respjson.Field
WebsiteURLs respjson.Field
AvatarURL respjson.Field
Bio respjson.Field
CheckedAt respjson.Field
CurrentRole respjson.Field
Email respjson.Field
LastUpdated respjson.Field
Location respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePerson) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePerson) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePerson) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePerson) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonCurrentRole ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonCurrentRole struct {
Organization PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization `json:"organization" api:"required"`
Title string `json:"title" api:"required"`
Description string `json:"description"`
EndDate PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate `json:"end_date"`
IsCurrent bool `json:"is_current"`
Location string `json:"location"`
StartDate PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate `json:"start_date"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Organization respjson.Field
Title respjson.Field
Description respjson.Field
EndDate respjson.Field
IsCurrent respjson.Field
Location respjson.Field
StartDate respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonCurrentRole) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonCurrentRole) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonCurrentRole) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonCurrentRole) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate struct {
Year int64 `json:"year" api:"required"`
Day int64 `json:"day"`
Month int64 `json:"month"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Year respjson.Field
Day respjson.Field
Month respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonCurrentRoleEndDate) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization struct {
Name string `json:"name" api:"required"`
Domain string `json:"domain"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
Domain respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonCurrentRoleOrganization) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate struct {
Year int64 `json:"year" api:"required"`
Day int64 `json:"day"`
Month int64 `json:"month"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Year respjson.Field
Day respjson.Field
Month respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonCurrentRoleStartDate) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonEducation ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonEducation struct {
Institution PersonEnrichResponseMatchCandidatePersonEducationInstitution `json:"institution" api:"required"`
Degree string `json:"degree"`
Description string `json:"description"`
EndDate PersonEnrichResponseMatchCandidatePersonEducationEndDate `json:"end_date"`
FieldOfStudy string `json:"field_of_study"`
StartDate PersonEnrichResponseMatchCandidatePersonEducationStartDate `json:"start_date"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Institution respjson.Field
Degree respjson.Field
Description respjson.Field
EndDate respjson.Field
FieldOfStudy respjson.Field
StartDate respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonEducation) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonEducation) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonEducation) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonEducation) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonEducationEndDate ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonEducationEndDate struct {
Year int64 `json:"year" api:"required"`
Day int64 `json:"day"`
Month int64 `json:"month"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Year respjson.Field
Day respjson.Field
Month respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonEducationEndDate) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonEducationEndDate) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonEducationEndDate) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonEducationEndDate) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonEducationInstitution ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonEducationInstitution struct {
Name string `json:"name" api:"required"`
Domain string `json:"domain"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
Domain respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonEducationInstitution) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonEducationInstitution) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonEducationInstitution) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonEducationInstitution) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonEducationStartDate ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonEducationStartDate struct {
Year int64 `json:"year" api:"required"`
Day int64 `json:"day"`
Month int64 `json:"month"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Year respjson.Field
Day respjson.Field
Month respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonEducationStartDate) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonEducationStartDate) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonEducationStartDate) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonEducationStartDate) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonExperience ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonExperience struct {
Organization PersonEnrichResponseMatchCandidatePersonExperienceOrganization `json:"organization" api:"required"`
Title string `json:"title" api:"required"`
Description string `json:"description"`
EndDate PersonEnrichResponseMatchCandidatePersonExperienceEndDate `json:"end_date"`
IsCurrent bool `json:"is_current"`
Location string `json:"location"`
StartDate PersonEnrichResponseMatchCandidatePersonExperienceStartDate `json:"start_date"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Organization respjson.Field
Title respjson.Field
Description respjson.Field
EndDate respjson.Field
IsCurrent respjson.Field
Location respjson.Field
StartDate respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonExperience) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonExperience) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonExperience) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonExperience) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonExperienceEndDate ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonExperienceEndDate struct {
Year int64 `json:"year" api:"required"`
Day int64 `json:"day"`
Month int64 `json:"month"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Year respjson.Field
Day respjson.Field
Month respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonExperienceEndDate) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonExperienceEndDate) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonExperienceEndDate) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonExperienceEndDate) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonExperienceOrganization ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonExperienceOrganization struct {
Name string `json:"name" api:"required"`
Domain string `json:"domain"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Name respjson.Field
Domain respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonExperienceOrganization) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonExperienceOrganization) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonExperienceOrganization) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonExperienceOrganization) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonExperienceStartDate ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonExperienceStartDate struct {
Year int64 `json:"year" api:"required"`
Day int64 `json:"day"`
Month int64 `json:"month"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Year respjson.Field
Day respjson.Field
Month respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonExperienceStartDate) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonExperienceStartDate) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonExperienceStartDate) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonExperienceStartDate) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonLocation ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonLocation struct {
City string `json:"city"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Display string `json:"display"`
Region string `json:"region"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
City respjson.Field
Country respjson.Field
CountryCode respjson.Field
Display respjson.Field
Region respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonLocation) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonLocation) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonLocation) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchCandidatePersonName ¶ added in v2.9.0
type PersonEnrichResponseMatchCandidatePersonName struct {
First string `json:"first"`
Full string `json:"full"`
Last string `json:"last"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
First respjson.Field
Full respjson.Field
Last respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (PersonEnrichResponseMatchCandidatePersonName) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchCandidatePersonName) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchCandidatePersonName) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchCandidatePersonName) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchNotFound ¶ added in v2.9.0
type PersonEnrichResponseMatchNotFound struct {
Person any `json:"person" api:"required"`
Score any `json:"score" api:"required"`
Status constant.NotFound `json:"status" default:"not_found"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Person respjson.Field
Score respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
No usable person candidate was found.
func (PersonEnrichResponseMatchNotFound) RawJSON ¶ added in v2.9.0
func (r PersonEnrichResponseMatchNotFound) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchNotFound) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchNotFound) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchUnion ¶ added in v2.9.0
type PersonEnrichResponseMatchUnion struct {
// This field is a union of [PersonEnrichResponseMatchCandidatePerson], [any]
Person PersonEnrichResponseMatchUnionPerson `json:"person"`
// This field is a union of [int64], [any]
Score PersonEnrichResponseMatchUnionScore `json:"score"`
// Any of "candidate", "not_found".
Status string `json:"status"`
JSON struct {
Person respjson.Field
Score respjson.Field
Status respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
PersonEnrichResponseMatchUnion contains all possible properties and values from PersonEnrichResponseMatchCandidate, PersonEnrichResponseMatchNotFound.
Use the PersonEnrichResponseMatchUnion.AsAny method to switch on the variant.
Use the methods beginning with 'As' to cast the union to one of its variants.
func (PersonEnrichResponseMatchUnion) AsAny ¶ added in v2.9.0
func (u PersonEnrichResponseMatchUnion) AsAny() anyPersonEnrichResponseMatch
Use the following switch statement to find the correct variant
switch variant := PersonEnrichResponseMatchUnion.AsAny().(type) {
case contextdev.PersonEnrichResponseMatchCandidate:
case contextdev.PersonEnrichResponseMatchNotFound:
default:
fmt.Errorf("no variant present")
}
func (PersonEnrichResponseMatchUnion) AsCandidate ¶ added in v2.9.0
func (u PersonEnrichResponseMatchUnion) AsCandidate() (v PersonEnrichResponseMatchCandidate)
func (PersonEnrichResponseMatchUnion) AsNotFound ¶ added in v2.9.0
func (u PersonEnrichResponseMatchUnion) AsNotFound() (v PersonEnrichResponseMatchNotFound)
func (PersonEnrichResponseMatchUnion) RawJSON ¶ added in v2.9.0
func (u PersonEnrichResponseMatchUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*PersonEnrichResponseMatchUnion) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchUnion) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchUnionPerson ¶ added in v2.9.0
type PersonEnrichResponseMatchUnionPerson struct {
// This field will be present if the value is a [any] instead of an object.
OfPersonEnrichResponseMatchNotFoundPerson any `json:",inline"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
CurrentRoleStatus string `json:"current_role_status"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
Education []PersonEnrichResponseMatchCandidatePersonEducation `json:"education"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
Experience []PersonEnrichResponseMatchCandidatePersonExperience `json:"experience"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
Skills []string `json:"skills"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
SocialURLs []string `json:"social_urls"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
WebsiteURLs []string `json:"website_urls"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
AvatarURL string `json:"avatar_url"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
Bio string `json:"bio"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
CheckedAt string `json:"checked_at"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
CurrentRole PersonEnrichResponseMatchCandidatePersonCurrentRole `json:"current_role"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
Email string `json:"email"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
LastUpdated string `json:"last_updated"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
Location PersonEnrichResponseMatchCandidatePersonLocation `json:"location"`
// This field is from variant [PersonEnrichResponseMatchCandidatePerson].
Name PersonEnrichResponseMatchCandidatePersonName `json:"name"`
JSON struct {
OfPersonEnrichResponseMatchNotFoundPerson respjson.Field
CurrentRoleStatus respjson.Field
Education respjson.Field
Experience respjson.Field
Skills respjson.Field
SocialURLs respjson.Field
WebsiteURLs respjson.Field
AvatarURL respjson.Field
Bio respjson.Field
CheckedAt respjson.Field
CurrentRole respjson.Field
Email respjson.Field
LastUpdated respjson.Field
Location respjson.Field
Name respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
PersonEnrichResponseMatchUnionPerson is an implicit subunion of PersonEnrichResponseMatchUnion. PersonEnrichResponseMatchUnionPerson provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the PersonEnrichResponseMatchUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfPersonEnrichResponseMatchNotFoundPerson]
func (*PersonEnrichResponseMatchUnionPerson) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchUnionPerson) UnmarshalJSON(data []byte) error
type PersonEnrichResponseMatchUnionScore ¶ added in v2.9.0
type PersonEnrichResponseMatchUnionScore struct {
// This field will be present if the value is a [int64] instead of an object.
OfInt int64 `json:",inline"`
// This field will be present if the value is a [any] instead of an object.
OfPersonEnrichResponseMatchNotFoundScore any `json:",inline"`
JSON struct {
OfInt respjson.Field
OfPersonEnrichResponseMatchNotFoundScore respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
PersonEnrichResponseMatchUnionScore is an implicit subunion of PersonEnrichResponseMatchUnion. PersonEnrichResponseMatchUnionScore provides convenient access to the sub-properties of the union.
For type safety it is recommended to directly use a variant of the PersonEnrichResponseMatchUnion.
If the underlying value is not a json object, one of the following properties will be valid: OfInt OfPersonEnrichResponseMatchNotFoundScore]
func (*PersonEnrichResponseMatchUnionScore) UnmarshalJSON ¶ added in v2.9.0
func (r *PersonEnrichResponseMatchUnionScore) UnmarshalJSON(data []byte) error
type PersonService ¶ added in v2.9.0
type PersonService struct {
// contains filtered or unexported fields
}
PersonService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPersonService method instead.
func NewPersonService ¶ added in v2.9.0
func NewPersonService(opts ...option.RequestOption) (r PersonService)
NewPersonService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*PersonService) Enrich ¶ added in v2.9.0
func (r *PersonService) Enrich(ctx context.Context, body PersonEnrichParams, opts ...option.RequestOption) (res *PersonEnrichResponse, err error)
Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on all paid plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error.
type UtilityPrefetchParams ¶
type UtilityPrefetchParams struct {
// Identifier of the target to prefetch. Provide exactly one of domain or email.
Identifier UtilityPrefetchParamsIdentifierUnion `json:"identifier,omitzero" api:"required"`
// What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the
// styleguide cache.
//
// Any of "brand", "styleguide".
Type UtilityPrefetchParamsType `json:"type,omitzero" api:"required"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (UtilityPrefetchParams) MarshalJSON ¶
func (r UtilityPrefetchParams) MarshalJSON() (data []byte, err error)
func (*UtilityPrefetchParams) UnmarshalJSON ¶
func (r *UtilityPrefetchParams) UnmarshalJSON(data []byte) error
type UtilityPrefetchParamsIdentifierByDomain ¶
type UtilityPrefetchParamsIdentifierByDomain struct {
// Domain name to prefetch data for
Domain string `json:"domain" api:"required"`
// contains filtered or unexported fields
}
Prefetch by domain.
The property Domain is required.
func (UtilityPrefetchParamsIdentifierByDomain) MarshalJSON ¶
func (r UtilityPrefetchParamsIdentifierByDomain) MarshalJSON() (data []byte, err error)
func (*UtilityPrefetchParamsIdentifierByDomain) UnmarshalJSON ¶
func (r *UtilityPrefetchParamsIdentifierByDomain) UnmarshalJSON(data []byte) error
type UtilityPrefetchParamsIdentifierByEmail ¶
type UtilityPrefetchParamsIdentifierByEmail struct {
// Email address to prefetch data for. The domain will be extracted from the email.
// Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses
// are not allowed.
Email string `json:"email" api:"required" format:"email"`
// contains filtered or unexported fields
}
Prefetch by email. The domain will be extracted and validated.
The property Email is required.
func (UtilityPrefetchParamsIdentifierByEmail) MarshalJSON ¶
func (r UtilityPrefetchParamsIdentifierByEmail) MarshalJSON() (data []byte, err error)
func (*UtilityPrefetchParamsIdentifierByEmail) UnmarshalJSON ¶
func (r *UtilityPrefetchParamsIdentifierByEmail) UnmarshalJSON(data []byte) error
type UtilityPrefetchParamsIdentifierUnion ¶
type UtilityPrefetchParamsIdentifierUnion struct {
OfByDomain *UtilityPrefetchParamsIdentifierByDomain `json:",omitzero,inline"`
OfByEmail *UtilityPrefetchParamsIdentifierByEmail `json:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
func (UtilityPrefetchParamsIdentifierUnion) MarshalJSON ¶
func (u UtilityPrefetchParamsIdentifierUnion) MarshalJSON() ([]byte, error)
func (*UtilityPrefetchParamsIdentifierUnion) UnmarshalJSON ¶
func (u *UtilityPrefetchParamsIdentifierUnion) UnmarshalJSON(data []byte) error
type UtilityPrefetchParamsType ¶
type UtilityPrefetchParamsType string
What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache.
const ( UtilityPrefetchParamsTypeBrand UtilityPrefetchParamsType = "brand" UtilityPrefetchParamsTypeStyleguide UtilityPrefetchParamsType = "styleguide" )
type UtilityPrefetchResponse ¶
type UtilityPrefetchResponse struct {
// The domain that was queued for prefetching
Domain string `json:"domain"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata UtilityPrefetchResponseKeyMetadata `json:"key_metadata"`
// Success message
Message string `json:"message"`
// Status of the response, e.g., 'ok'
Status string `json:"status"`
// The type of prefetch that was queued, echoed from the request
//
// Any of "brand", "styleguide".
Type UtilityPrefetchResponseType `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Domain respjson.Field
KeyMetadata respjson.Field
Message respjson.Field
Status respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UtilityPrefetchResponse) RawJSON ¶
func (r UtilityPrefetchResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*UtilityPrefetchResponse) UnmarshalJSON ¶
func (r *UtilityPrefetchResponse) UnmarshalJSON(data []byte) error
type UtilityPrefetchResponseKeyMetadata ¶
type UtilityPrefetchResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (UtilityPrefetchResponseKeyMetadata) RawJSON ¶
func (r UtilityPrefetchResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*UtilityPrefetchResponseKeyMetadata) UnmarshalJSON ¶
func (r *UtilityPrefetchResponseKeyMetadata) UnmarshalJSON(data []byte) error
type UtilityPrefetchResponseType ¶
type UtilityPrefetchResponseType string
The type of prefetch that was queued, echoed from the request
const ( UtilityPrefetchResponseTypeBrand UtilityPrefetchResponseType = "brand" UtilityPrefetchResponseTypeStyleguide UtilityPrefetchResponseType = "styleguide" )
type UtilityService ¶
type UtilityService struct {
// contains filtered or unexported fields
}
UtilityService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUtilityService method instead.
func NewUtilityService ¶
func NewUtilityService(opts ...option.RequestOption) (r UtilityService)
NewUtilityService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*UtilityService) Prefetch ¶
func (r *UtilityService) Prefetch(ctx context.Context, body UtilityPrefetchParams, opts ...option.RequestOption) (res *UtilityPrefetchResponse, err error)
Signal that you may fetch data soon to improve latency. The type field selects what to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a styleguide extraction) and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed).
type WebExtractCompetitorsParams ¶
type WebExtractCompetitorsParams struct {
// Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted
// and normalized to their domain.
Domain string `query:"domain" api:"required" json:"-"`
// Exact number of direct competitors to return. Defaults to 5.
NumCompetitors param.Opt[int64] `query:"numCompetitors,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebExtractCompetitorsParams) URLQuery ¶
func (r WebExtractCompetitorsParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebExtractCompetitorsParams's query parameters as `url.Values`.
type WebExtractCompetitorsResponse ¶
type WebExtractCompetitorsResponse struct {
// Direct competitors ordered by relevance and confidence.
Competitors []WebExtractCompetitorsResponseCompetitor `json:"competitors" api:"required"`
// Normalized input domain.
Domain string `json:"domain" api:"required"`
// Status of the response.
//
// Any of "ok".
Status WebExtractCompetitorsResponseStatus `json:"status" api:"required"`
// Target company profile inferred from the landing page.
Target WebExtractCompetitorsResponseTarget `json:"target" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebExtractCompetitorsResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Competitors respjson.Field
Domain respjson.Field
Status respjson.Field
Target respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractCompetitorsResponse) RawJSON ¶
func (r WebExtractCompetitorsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractCompetitorsResponse) UnmarshalJSON ¶
func (r *WebExtractCompetitorsResponse) UnmarshalJSON(data []byte) error
type WebExtractCompetitorsResponseCompetitor ¶
type WebExtractCompetitorsResponseCompetitor struct {
// Confidence that this company is a direct competitor.
//
// Any of "high", "medium".
Confidence string `json:"confidence" api:"required"`
// Short description of the competitor.
Description string `json:"description" api:"required"`
// Competitor's normalized official domain.
Domain string `json:"domain" api:"required"`
// Competitor company or product name.
Name string `json:"name" api:"required"`
// Search result URLs used as evidence for this competitor.
SourceURLs []string `json:"sourceUrls" api:"required"`
// Competitor website URL.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Confidence respjson.Field
Description respjson.Field
Domain respjson.Field
Name respjson.Field
SourceURLs respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractCompetitorsResponseCompetitor) RawJSON ¶
func (r WebExtractCompetitorsResponseCompetitor) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractCompetitorsResponseCompetitor) UnmarshalJSON ¶
func (r *WebExtractCompetitorsResponseCompetitor) UnmarshalJSON(data []byte) error
type WebExtractCompetitorsResponseKeyMetadata ¶
type WebExtractCompetitorsResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebExtractCompetitorsResponseKeyMetadata) RawJSON ¶
func (r WebExtractCompetitorsResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractCompetitorsResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebExtractCompetitorsResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebExtractCompetitorsResponseStatus ¶
type WebExtractCompetitorsResponseStatus string
Status of the response.
const (
WebExtractCompetitorsResponseStatusOk WebExtractCompetitorsResponseStatus = "ok"
)
type WebExtractCompetitorsResponseTarget ¶
type WebExtractCompetitorsResponseTarget struct {
// Company or product name inferred from the landing page.
CompanyName string `json:"companyName" api:"required"`
// Specific operating field, product category, or market.
Field string `json:"field" api:"required"`
// One-sentence description of what the target company sells and who it serves.
FieldDescription string `json:"fieldDescription" api:"required"`
// Resolved URL used for the landing page analysis.
WebsiteURL string `json:"websiteUrl" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CompanyName respjson.Field
Field respjson.Field
FieldDescription respjson.Field
WebsiteURL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Target company profile inferred from the landing page.
func (WebExtractCompetitorsResponseTarget) RawJSON ¶
func (r WebExtractCompetitorsResponseTarget) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractCompetitorsResponseTarget) UnmarshalJSON ¶
func (r *WebExtractCompetitorsResponseTarget) UnmarshalJSON(data []byte) error
type WebExtractFontsParams ¶
type WebExtractFontsParams struct {
// Maximum age in milliseconds for cached brand data before the API performs a hard
// refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
// are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
// year.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// A specific URL to fetch fonts from directly, bypassing domain resolution (e.g.,
// 'https://example.com/design-system'). When provided, fonts are extracted from
// this exact URL. You must provide either 'domain' or 'directUrl', but not both.
DirectURL param.Opt[string] `query:"directUrl,omitzero" format:"uri" json:"-"`
// Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
// domain will be automatically normalized and validated. You must provide either
// 'domain' or 'directUrl', but not both.
Domain param.Opt[string] `query:"domain,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebExtractFontsParams) URLQuery ¶
func (r WebExtractFontsParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebExtractFontsParams's query parameters as `url.Values`.
type WebExtractFontsResponse ¶
type WebExtractFontsResponse struct {
// HTTP status code, e.g., 200
Code int64 `json:"code" api:"required"`
// The normalized domain that was processed
Domain string `json:"domain" api:"required"`
// Array of font usage information
Fonts []WebExtractFontsResponseFont `json:"fonts" api:"required"`
// Status of the response, e.g., 'ok'
Status string `json:"status" api:"required"`
// Font assets keyed by family name as it appears in the fonts array (non-generic
// names only). Clients match entries in fonts to pick a file URL from files.
// Omitted when no families resolve to Google or custom @font-face URLs.
FontLinks map[string]WebExtractFontsResponseFontLink `json:"fontLinks"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebExtractFontsResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Domain respjson.Field
Fonts respjson.Field
Status respjson.Field
FontLinks respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractFontsResponse) RawJSON ¶
func (r WebExtractFontsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractFontsResponse) UnmarshalJSON ¶
func (r *WebExtractFontsResponse) UnmarshalJSON(data []byte) error
type WebExtractFontsResponseFont ¶
type WebExtractFontsResponseFont struct {
// Array of fallback font families
Fallbacks []string `json:"fallbacks" api:"required"`
// Font family name
Font string `json:"font" api:"required"`
// Number of elements using this font
NumElements float64 `json:"num_elements" api:"required"`
// Number of words using this font
NumWords float64 `json:"num_words" api:"required"`
// Percentage of elements using this font
PercentElements float64 `json:"percent_elements" api:"required"`
// Percentage of words using this font
PercentWords float64 `json:"percent_words" api:"required"`
// Array of CSS selectors or element types where this font is used
Uses []string `json:"uses" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Fallbacks respjson.Field
Font respjson.Field
NumElements respjson.Field
NumWords respjson.Field
PercentElements respjson.Field
PercentWords respjson.Field
Uses respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractFontsResponseFont) RawJSON ¶
func (r WebExtractFontsResponseFont) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractFontsResponseFont) UnmarshalJSON ¶
func (r *WebExtractFontsResponseFont) UnmarshalJSON(data []byte) error
type WebExtractFontsResponseFontLink ¶
type WebExtractFontsResponseFontLink struct {
// Upright font files keyed by weight string (e.g. "400" for regular, "500",
// "700"). Values are absolute URLs.
Files map[string]string `json:"files" api:"required"`
// Any of "google", "custom".
Type string `json:"type" api:"required"`
// Google Fonts category when type is google (e.g. sans-serif, serif, monospace,
// display, handwriting). Omitted for custom fonts when unknown.
Category string `json:"category"`
// Present when type is custom: human-readable name derived from the fontLinks key
// (strip build/hash suffixes, split camelCase / PascalCase, normalize separators).
// Google entries omit this.
DisplayName string `json:"displayName"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Files respjson.Field
Type respjson.Field
Category respjson.Field
DisplayName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractFontsResponseFontLink) RawJSON ¶
func (r WebExtractFontsResponseFontLink) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractFontsResponseFontLink) UnmarshalJSON ¶
func (r *WebExtractFontsResponseFontLink) UnmarshalJSON(data []byte) error
type WebExtractFontsResponseKeyMetadata ¶
type WebExtractFontsResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebExtractFontsResponseKeyMetadata) RawJSON ¶
func (r WebExtractFontsResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractFontsResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebExtractFontsResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebExtractParams ¶
type WebExtractParams struct {
// JSON Schema for the returned data object. TypeScript Zod users can pass a JSON
// Schema generated from a Zod object; Python users can pass the equivalent JSON
// Schema object.
Schema map[string]any `json:"schema,omitzero" api:"required"`
// The starting website URL to crawl and extract from. Must include http:// or
// https://.
URL string `json:"url" api:"required" format:"uri"`
// When true, every returned value must be grounded in facts stated on the page;
// fields that cannot be supported by the page are returned as null/empty. When
// false (default), the model may make reasonable inferences and derivations from
// the page content (e.g. ideal customer, competitor analysis, recommendations)
// while keeping verifiable specifics (names, quotes, URLs, dates, metrics)
// faithful to the source.
FactCheck param.Opt[bool] `json:"factCheck,omitzero"`
// When true, follow links on subdomains of the starting URL's domain.
FollowSubdomains param.Opt[bool] `json:"followSubdomains,omitzero"`
// When true, iframe contents are included in Markdown before extraction.
IncludeFrames param.Opt[bool] `json:"includeFrames,omitzero"`
// Optional extraction guidance, such as which facts to prioritize or how to
// interpret fields in the schema.
Instructions param.Opt[string] `json:"instructions,omitzero"`
// Return cached scrape results if a prior scrape for the same parameters is
// younger than this many milliseconds. Defaults to 7 days (604800000 ms).
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Optional maximum link depth from the starting URL (0 = only the starting page).
// If omitted, there is no crawl depth limit.
MaxDepth param.Opt[int64] `json:"maxDepth,omitzero"`
// Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5.
MaxPages param.Opt[int64] `json:"maxPages,omitzero"`
// When true, waits briefly for CSS and transition animations to settle before
// extracting each crawled page. Defaults to false. This adds a bit of latency in
// exchange for more stable output on animated pages.
SettleAnimations param.Opt[bool] `json:"settleAnimations,omitzero"`
// Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000
// (110s). Default: 80000 (80s).
StopAfterMs param.Opt[int64] `json:"stopAfterMs,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Optional browser wait time in milliseconds after initial page load for each
// crawled page.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
Pdf WebExtractParamsPdf `json:"pdf,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (WebExtractParams) MarshalJSON ¶
func (r WebExtractParams) MarshalJSON() (data []byte, err error)
func (*WebExtractParams) UnmarshalJSON ¶
func (r *WebExtractParams) UnmarshalJSON(data []byte) error
type WebExtractParamsPdf ¶
type WebExtractParamsPdf struct {
// Last 1-based PDF page to parse. Must be greater than or equal to start when both
// are provided.
End param.Opt[int64] `json:"end,omitzero"`
// When true, PDF pages are fetched and parsed. When false, PDF pages are skipped.
ShouldParse param.Opt[bool] `json:"shouldParse,omitzero"`
// First 1-based PDF page to parse.
Start param.Opt[int64] `json:"start,omitzero"`
// contains filtered or unexported fields
}
func (WebExtractParamsPdf) MarshalJSON ¶
func (r WebExtractParamsPdf) MarshalJSON() (data []byte, err error)
func (*WebExtractParamsPdf) UnmarshalJSON ¶
func (r *WebExtractParamsPdf) UnmarshalJSON(data []byte) error
type WebExtractResponse ¶
type WebExtractResponse struct {
// Extracted data matching the request schema
Data map[string]any `json:"data" api:"required"`
Metadata WebExtractResponseMetadata `json:"metadata" api:"required"`
// Status of the response, e.g., 'ok'
Status string `json:"status" api:"required"`
// The starting URL that was analyzed
URL string `json:"url" api:"required"`
// List of URLs whose Markdown was used for extraction
URLsAnalyzed []string `json:"urls_analyzed" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebExtractResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Metadata respjson.Field
Status respjson.Field
URL respjson.Field
URLsAnalyzed respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractResponse) RawJSON ¶
func (r WebExtractResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractResponse) UnmarshalJSON ¶
func (r *WebExtractResponse) UnmarshalJSON(data []byte) error
type WebExtractResponseKeyMetadata ¶
type WebExtractResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebExtractResponseKeyMetadata) RawJSON ¶
func (r WebExtractResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebExtractResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebExtractResponseMetadata ¶
type WebExtractResponseMetadata struct {
MaxCrawlDepth int64 `json:"maxCrawlDepth" api:"required"`
// Number of crawled pages excluded because they were anti-bot challenges, error
// pages, or parked-domain placeholders.
NumBlocked int64 `json:"numBlocked" api:"required"`
NumFailed int64 `json:"numFailed" api:"required"`
NumSkipped int64 `json:"numSkipped" api:"required"`
NumSucceeded int64 `json:"numSucceeded" api:"required"`
NumURLs int64 `json:"numUrls" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MaxCrawlDepth respjson.Field
NumBlocked respjson.Field
NumFailed respjson.Field
NumSkipped respjson.Field
NumSucceeded respjson.Field
NumURLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractResponseMetadata) RawJSON ¶
func (r WebExtractResponseMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractResponseMetadata) UnmarshalJSON ¶
func (r *WebExtractResponseMetadata) UnmarshalJSON(data []byte) error
type WebExtractStyleguideParams ¶
type WebExtractStyleguideParams struct {
// Maximum age in milliseconds for cached brand data before the API performs a hard
// refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
// are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
// year.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// A specific URL to fetch the styleguide from directly, bypassing domain
// resolution (e.g., 'https://example.com/design-system'). When provided, the
// styleguide is extracted from this exact URL. You must provide either 'domain' or
// 'directUrl', but not both.
DirectURL param.Opt[string] `query:"directUrl,omitzero" format:"uri" json:"-"`
// Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
// domain will be automatically normalized and validated. You must provide either
// 'domain' or 'directUrl', but not both.
Domain param.Opt[string] `query:"domain,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional browser color scheme to emulate for websites that respond to
// prefers-color-scheme. This value is part of the styleguide cache key.
//
// Any of "light", "dark".
ColorScheme WebExtractStyleguideParamsColorScheme `query:"colorScheme,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebExtractStyleguideParams) URLQuery ¶
func (r WebExtractStyleguideParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebExtractStyleguideParams's query parameters as `url.Values`.
type WebExtractStyleguideParamsColorScheme ¶
type WebExtractStyleguideParamsColorScheme string
Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key.
const ( WebExtractStyleguideParamsColorSchemeLight WebExtractStyleguideParamsColorScheme = "light" WebExtractStyleguideParamsColorSchemeDark WebExtractStyleguideParamsColorScheme = "dark" )
type WebExtractStyleguideResponse ¶
type WebExtractStyleguideResponse struct {
// HTTP status code
Code int64 `json:"code"`
// The normalized domain that was processed
Domain string `json:"domain"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebExtractStyleguideResponseKeyMetadata `json:"key_metadata"`
// Status of the response, e.g., 'ok'
Status string `json:"status"`
// Comprehensive styleguide data extracted from the website
Styleguide WebExtractStyleguideResponseStyleguide `json:"styleguide"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Domain respjson.Field
KeyMetadata respjson.Field
Status respjson.Field
Styleguide respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponse) RawJSON ¶
func (r WebExtractStyleguideResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponse) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponse) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseKeyMetadata ¶
type WebExtractStyleguideResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebExtractStyleguideResponseKeyMetadata) RawJSON ¶
func (r WebExtractStyleguideResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguide ¶
type WebExtractStyleguideResponseStyleguide struct {
// Primary colors used on the website
Colors WebExtractStyleguideResponseStyleguideColors `json:"colors" api:"required"`
// UI component styles
Components WebExtractStyleguideResponseStyleguideComponents `json:"components" api:"required"`
// Spacing system used on the website
ElementSpacing WebExtractStyleguideResponseStyleguideElementSpacing `json:"elementSpacing" api:"required"`
// Font assets keyed by family name as it appears in fontFamily/fontFallbacks
// (non-generic names only). Clients match typography.fontFamily / fontWeight or
// button styles to pick a file URL from files.
FontLinks map[string]WebExtractStyleguideResponseStyleguideFontLink `json:"fontLinks" api:"required"`
// The primary color mode of the website design
//
// Any of "light", "dark".
Mode string `json:"mode" api:"required"`
// Shadow styles used on the website
Shadows WebExtractStyleguideResponseStyleguideShadows `json:"shadows" api:"required"`
// Typography styles used on the website
Typography WebExtractStyleguideResponseStyleguideTypography `json:"typography" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Colors respjson.Field
Components respjson.Field
ElementSpacing respjson.Field
FontLinks respjson.Field
Mode respjson.Field
Shadows respjson.Field
Typography respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Comprehensive styleguide data extracted from the website
func (WebExtractStyleguideResponseStyleguide) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguide) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguide) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguide) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideColors ¶
type WebExtractStyleguideResponseStyleguideColors struct {
// Accent color (hex format)
Accent string `json:"accent" api:"required"`
// Background color (hex format)
Background string `json:"background" api:"required"`
// Text color (hex format)
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Accent respjson.Field
Background respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Primary colors used on the website
func (WebExtractStyleguideResponseStyleguideColors) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideColors) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideColors) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideColors) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideComponents ¶
type WebExtractStyleguideResponseStyleguideComponents struct {
// Button component styles
Button WebExtractStyleguideResponseStyleguideComponentsButton `json:"button" api:"required"`
// Card component style
Card WebExtractStyleguideResponseStyleguideComponentsCard `json:"card"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Button respjson.Field
Card respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
UI component styles
func (WebExtractStyleguideResponseStyleguideComponents) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideComponents) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideComponents) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideComponents) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideComponentsButton ¶
type WebExtractStyleguideResponseStyleguideComponentsButton struct {
Link WebExtractStyleguideResponseStyleguideComponentsButtonLink `json:"link"`
Primary WebExtractStyleguideResponseStyleguideComponentsButtonPrimary `json:"primary"`
Secondary WebExtractStyleguideResponseStyleguideComponentsButtonSecondary `json:"secondary"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Link respjson.Field
Primary respjson.Field
Secondary respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Button component styles
func (WebExtractStyleguideResponseStyleguideComponentsButton) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideComponentsButton) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideComponentsButton) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideComponentsButton) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideComponentsButtonLink ¶
type WebExtractStyleguideResponseStyleguideComponentsButtonLink struct {
BackgroundColor string `json:"backgroundColor" api:"required"`
// Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has
// alpha)
BorderColor string `json:"borderColor" api:"required"`
BorderRadius string `json:"borderRadius" api:"required"`
BorderStyle string `json:"borderStyle" api:"required"`
BorderWidth string `json:"borderWidth" api:"required"`
// Computed box-shadow (comma-separated layers when present)
BoxShadow string `json:"boxShadow" api:"required"`
Color string `json:"color" api:"required"`
// Ready-to-use CSS declaration block for this component style
Css string `json:"css" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
// Sampled minimum height of the button box (typically px)
MinHeight string `json:"minHeight" api:"required"`
// Sampled minimum width of the button box (typically px)
MinWidth string `json:"minWidth" api:"required"`
Padding string `json:"padding" api:"required"`
TextDecoration string `json:"textDecoration" api:"required"`
// Full ordered font list from computed font-family
FontFallbacks []string `json:"fontFallbacks"`
// Primary button typeface (first in fontFallbacks)
FontFamily string `json:"fontFamily"`
// Hex color of the underline when it differs from the text color
TextDecorationColor string `json:"textDecorationColor"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BackgroundColor respjson.Field
BorderColor respjson.Field
BorderRadius respjson.Field
BorderStyle respjson.Field
BorderWidth respjson.Field
BoxShadow respjson.Field
Color respjson.Field
Css respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
MinHeight respjson.Field
MinWidth respjson.Field
Padding respjson.Field
TextDecoration respjson.Field
FontFallbacks respjson.Field
FontFamily respjson.Field
TextDecorationColor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideComponentsButtonLink) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideComponentsButtonLink) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideComponentsButtonLink) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideComponentsButtonLink) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideComponentsButtonPrimary ¶
type WebExtractStyleguideResponseStyleguideComponentsButtonPrimary struct {
BackgroundColor string `json:"backgroundColor" api:"required"`
// Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has
// alpha)
BorderColor string `json:"borderColor" api:"required"`
BorderRadius string `json:"borderRadius" api:"required"`
BorderStyle string `json:"borderStyle" api:"required"`
BorderWidth string `json:"borderWidth" api:"required"`
// Computed box-shadow (comma-separated layers when present)
BoxShadow string `json:"boxShadow" api:"required"`
Color string `json:"color" api:"required"`
// Ready-to-use CSS declaration block for this component style
Css string `json:"css" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
// Sampled minimum height of the button box (typically px)
MinHeight string `json:"minHeight" api:"required"`
// Sampled minimum width of the button box (typically px)
MinWidth string `json:"minWidth" api:"required"`
Padding string `json:"padding" api:"required"`
TextDecoration string `json:"textDecoration" api:"required"`
// Full ordered font list from computed font-family
FontFallbacks []string `json:"fontFallbacks"`
// Primary button typeface (first in fontFallbacks)
FontFamily string `json:"fontFamily"`
// Hex color of the underline when it differs from the text color
TextDecorationColor string `json:"textDecorationColor"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BackgroundColor respjson.Field
BorderColor respjson.Field
BorderRadius respjson.Field
BorderStyle respjson.Field
BorderWidth respjson.Field
BoxShadow respjson.Field
Color respjson.Field
Css respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
MinHeight respjson.Field
MinWidth respjson.Field
Padding respjson.Field
TextDecoration respjson.Field
FontFallbacks respjson.Field
FontFamily respjson.Field
TextDecorationColor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideComponentsButtonPrimary) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideComponentsButtonPrimary) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideComponentsButtonPrimary) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideComponentsButtonPrimary) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideComponentsButtonSecondary ¶
type WebExtractStyleguideResponseStyleguideComponentsButtonSecondary struct {
BackgroundColor string `json:"backgroundColor" api:"required"`
// Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has
// alpha)
BorderColor string `json:"borderColor" api:"required"`
BorderRadius string `json:"borderRadius" api:"required"`
BorderStyle string `json:"borderStyle" api:"required"`
BorderWidth string `json:"borderWidth" api:"required"`
// Computed box-shadow (comma-separated layers when present)
BoxShadow string `json:"boxShadow" api:"required"`
Color string `json:"color" api:"required"`
// Ready-to-use CSS declaration block for this component style
Css string `json:"css" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
// Sampled minimum height of the button box (typically px)
MinHeight string `json:"minHeight" api:"required"`
// Sampled minimum width of the button box (typically px)
MinWidth string `json:"minWidth" api:"required"`
Padding string `json:"padding" api:"required"`
TextDecoration string `json:"textDecoration" api:"required"`
// Full ordered font list from computed font-family
FontFallbacks []string `json:"fontFallbacks"`
// Primary button typeface (first in fontFallbacks)
FontFamily string `json:"fontFamily"`
// Hex color of the underline when it differs from the text color
TextDecorationColor string `json:"textDecorationColor"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BackgroundColor respjson.Field
BorderColor respjson.Field
BorderRadius respjson.Field
BorderStyle respjson.Field
BorderWidth respjson.Field
BoxShadow respjson.Field
Color respjson.Field
Css respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
MinHeight respjson.Field
MinWidth respjson.Field
Padding respjson.Field
TextDecoration respjson.Field
FontFallbacks respjson.Field
FontFamily respjson.Field
TextDecorationColor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideComponentsButtonSecondary) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideComponentsButtonSecondary) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideComponentsButtonSecondary) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideComponentsButtonSecondary) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideComponentsCard ¶
type WebExtractStyleguideResponseStyleguideComponentsCard struct {
BackgroundColor string `json:"backgroundColor" api:"required"`
// Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has
// alpha)
BorderColor string `json:"borderColor" api:"required"`
BorderRadius string `json:"borderRadius" api:"required"`
BorderStyle string `json:"borderStyle" api:"required"`
BorderWidth string `json:"borderWidth" api:"required"`
BoxShadow string `json:"boxShadow" api:"required"`
// Ready-to-use CSS declaration block for this component style
Css string `json:"css" api:"required"`
Padding string `json:"padding" api:"required"`
TextColor string `json:"textColor" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
BackgroundColor respjson.Field
BorderColor respjson.Field
BorderRadius respjson.Field
BorderStyle respjson.Field
BorderWidth respjson.Field
BoxShadow respjson.Field
Css respjson.Field
Padding respjson.Field
TextColor respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Card component style
func (WebExtractStyleguideResponseStyleguideComponentsCard) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideComponentsCard) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideComponentsCard) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideComponentsCard) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideElementSpacing ¶
type WebExtractStyleguideResponseStyleguideElementSpacing struct {
Lg string `json:"lg" api:"required"`
Md string `json:"md" api:"required"`
Sm string `json:"sm" api:"required"`
Xl string `json:"xl" api:"required"`
Xs string `json:"xs" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Lg respjson.Field
Md respjson.Field
Sm respjson.Field
Xl respjson.Field
Xs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Spacing system used on the website
func (WebExtractStyleguideResponseStyleguideElementSpacing) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideElementSpacing) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideElementSpacing) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideElementSpacing) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideFontLink ¶
type WebExtractStyleguideResponseStyleguideFontLink struct {
// Upright font files keyed by weight string (e.g. "400" for regular, "500",
// "700"). Values are absolute URLs.
Files map[string]string `json:"files" api:"required"`
// Any of "google", "custom".
Type string `json:"type" api:"required"`
// Google Fonts category when type is google (e.g. sans-serif, serif, monospace,
// display, handwriting). Omitted for custom fonts when unknown.
Category string `json:"category"`
// Present when type is custom: human-readable name derived from the fontLinks key
// (strip build/hash suffixes, split camelCase / PascalCase, normalize separators).
// Google entries omit this.
DisplayName string `json:"displayName"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Files respjson.Field
Type respjson.Field
Category respjson.Field
DisplayName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideFontLink) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideFontLink) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideFontLink) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideFontLink) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideShadows ¶
type WebExtractStyleguideResponseStyleguideShadows struct {
Inner string `json:"inner" api:"required"`
Lg string `json:"lg" api:"required"`
Md string `json:"md" api:"required"`
Sm string `json:"sm" api:"required"`
Xl string `json:"xl" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Inner respjson.Field
Lg respjson.Field
Md respjson.Field
Sm respjson.Field
Xl respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Shadow styles used on the website
func (WebExtractStyleguideResponseStyleguideShadows) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideShadows) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideShadows) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideShadows) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideTypography ¶
type WebExtractStyleguideResponseStyleguideTypography struct {
// Heading styles
Headings WebExtractStyleguideResponseStyleguideTypographyHeadings `json:"headings" api:"required"`
P WebExtractStyleguideResponseStyleguideTypographyP `json:"p"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Headings respjson.Field
P respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Typography styles used on the website
func (WebExtractStyleguideResponseStyleguideTypography) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideTypography) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideTypography) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideTypography) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideTypographyHeadings ¶
type WebExtractStyleguideResponseStyleguideTypographyHeadings struct {
H1 WebExtractStyleguideResponseStyleguideTypographyHeadingsH1 `json:"h1"`
H2 WebExtractStyleguideResponseStyleguideTypographyHeadingsH2 `json:"h2"`
H3 WebExtractStyleguideResponseStyleguideTypographyHeadingsH3 `json:"h3"`
H4 WebExtractStyleguideResponseStyleguideTypographyHeadingsH4 `json:"h4"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
H1 respjson.Field
H2 respjson.Field
H3 respjson.Field
H4 respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Heading styles
func (WebExtractStyleguideResponseStyleguideTypographyHeadings) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideTypographyHeadings) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideTypographyHeadings) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideTypographyHeadings) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH1 ¶
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH1 struct {
// Full ordered font list from resolved computed font-family
FontFallbacks []string `json:"fontFallbacks" api:"required"`
// Primary face (first family in the computed stack)
FontFamily string `json:"fontFamily" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
LetterSpacing string `json:"letterSpacing" api:"required"`
LineHeight string `json:"lineHeight" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FontFallbacks respjson.Field
FontFamily respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
LetterSpacing respjson.Field
LineHeight respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideTypographyHeadingsH1) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideTypographyHeadingsH1) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideTypographyHeadingsH1) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideTypographyHeadingsH1) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH2 ¶
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH2 struct {
// Full ordered font list from resolved computed font-family
FontFallbacks []string `json:"fontFallbacks" api:"required"`
// Primary face (first family in the computed stack)
FontFamily string `json:"fontFamily" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
LetterSpacing string `json:"letterSpacing" api:"required"`
LineHeight string `json:"lineHeight" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FontFallbacks respjson.Field
FontFamily respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
LetterSpacing respjson.Field
LineHeight respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideTypographyHeadingsH2) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideTypographyHeadingsH2) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideTypographyHeadingsH2) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideTypographyHeadingsH2) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH3 ¶
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH3 struct {
// Full ordered font list from resolved computed font-family
FontFallbacks []string `json:"fontFallbacks" api:"required"`
// Primary face (first family in the computed stack)
FontFamily string `json:"fontFamily" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
LetterSpacing string `json:"letterSpacing" api:"required"`
LineHeight string `json:"lineHeight" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FontFallbacks respjson.Field
FontFamily respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
LetterSpacing respjson.Field
LineHeight respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideTypographyHeadingsH3) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideTypographyHeadingsH3) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideTypographyHeadingsH3) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideTypographyHeadingsH3) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH4 ¶
type WebExtractStyleguideResponseStyleguideTypographyHeadingsH4 struct {
// Full ordered font list from resolved computed font-family
FontFallbacks []string `json:"fontFallbacks" api:"required"`
// Primary face (first family in the computed stack)
FontFamily string `json:"fontFamily" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
LetterSpacing string `json:"letterSpacing" api:"required"`
LineHeight string `json:"lineHeight" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FontFallbacks respjson.Field
FontFamily respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
LetterSpacing respjson.Field
LineHeight respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideTypographyHeadingsH4) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideTypographyHeadingsH4) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideTypographyHeadingsH4) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideTypographyHeadingsH4) UnmarshalJSON(data []byte) error
type WebExtractStyleguideResponseStyleguideTypographyP ¶
type WebExtractStyleguideResponseStyleguideTypographyP struct {
// Full ordered font list from resolved computed font-family
FontFallbacks []string `json:"fontFallbacks" api:"required"`
// Primary face (first family in the computed stack)
FontFamily string `json:"fontFamily" api:"required"`
FontSize string `json:"fontSize" api:"required"`
FontWeight float64 `json:"fontWeight" api:"required"`
LetterSpacing string `json:"letterSpacing" api:"required"`
LineHeight string `json:"lineHeight" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FontFallbacks respjson.Field
FontFamily respjson.Field
FontSize respjson.Field
FontWeight respjson.Field
LetterSpacing respjson.Field
LineHeight respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebExtractStyleguideResponseStyleguideTypographyP) RawJSON ¶
func (r WebExtractStyleguideResponseStyleguideTypographyP) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebExtractStyleguideResponseStyleguideTypographyP) UnmarshalJSON ¶
func (r *WebExtractStyleguideResponseStyleguideTypographyP) UnmarshalJSON(data []byte) error
type WebScreenshotParams ¶
type WebScreenshotParams struct {
// Return a cached screenshot if a prior screenshot for the same parameters exists
// and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// Optional vertical scroll offset in pixels for capturing a long page in
// viewport-sized chunks. When provided, the full page is captured once and the
// returned image is the viewport-sized slice that begins at this Y offset (e.g.
// request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page
// top to bottom). The final slice may be shorter than the viewport height. Takes
// precedence over fullScreenshot. Max: 100000.
ScrollOffset param.Opt[int64] `query:"scrollOffset,omitzero" json:"-"`
// Optional browser wait time in milliseconds after initial page load before taking
// the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when
// omitted.
WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// Optional parameter for comprehensive popup cleanup. If 'true', the browser
// dismisses detected cookie/consent UI and clears other detected obstructive
// popups and overlays before capture. If 'false' or not provided, this parameter
// requests no cleanup; handleCookiePopup can still request cookie/consent handling
// independently.
ClearPopups param.Opt[bool] `query:"clearPopups,omitzero" json:"-"`
// A specific URL to screenshot directly, bypassing domain resolution (e.g.,
// 'https://example.com/pricing'). When provided, the screenshot is taken of this
// exact URL. You must provide either 'domain' or 'directUrl', but not both.
DirectURL param.Opt[string] `query:"directUrl,omitzero" format:"uri" json:"-"`
// Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The
// domain will be automatically normalized and validated. You must provide either
// 'domain' or 'directUrl', but not both.
Domain param.Opt[string] `query:"domain,omitzero" json:"-"`
// Optional parameter to control cookie/consent popup handling. If 'true', we
// dismiss cookie banner before capture. If 'false' or not provided, captures the
// page without that step.
HandleCookiePopup param.Opt[bool] `query:"handleCookiePopup,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional parameter to choose the site's visual theme in the screenshot. Use
// 'light' or 'dark' when the site offers both appearances.
//
// Any of "light", "dark".
ColorScheme WebScreenshotParamsColorScheme `query:"colorScheme,omitzero" json:"-"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country WebScreenshotParamsCountry `query:"country,omitzero" json:"-"`
// Optional parameter to determine screenshot type. If 'true', takes a full page
// screenshot capturing all content. If 'false' or not provided, takes a viewport
// screenshot (standard browser view).
//
// Any of "true", "false".
FullScreenshot WebScreenshotParamsFullScreenshot `query:"fullScreenshot,omitzero" json:"-"`
// Optional parameter to specify which page type to screenshot. If provided, the
// system will scrape the domain's links and use heuristics to find the most
// appropriate URL for the specified page type (30 supported languages). If not
// provided, screenshots the main domain landing page. Only applicable when using
// 'domain', not 'directUrl'.
//
// Any of "login", "signup", "blog", "careers", "pricing", "terms", "privacy",
// "contact".
Page WebScreenshotParamsPage `query:"page,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
Viewport WebScreenshotParamsViewport `query:"viewport,omitzero" json:"-"`
// Set to enabled to bypass shared caches and omit request and response content
// from retained usage logs. Requires zero data retention to be enabled for your
// organization (contact support@context.dev), otherwise the request fails with
// ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
//
// Any of "enabled", "disabled".
Zdr WebScreenshotParamsZdr `query:"zdr,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebScreenshotParams) URLQuery ¶
func (r WebScreenshotParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebScreenshotParams's query parameters as `url.Values`.
type WebScreenshotParamsColorScheme ¶
type WebScreenshotParamsColorScheme string
Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances.
const ( WebScreenshotParamsColorSchemeLight WebScreenshotParamsColorScheme = "light" WebScreenshotParamsColorSchemeDark WebScreenshotParamsColorScheme = "dark" )
type WebScreenshotParamsCountry ¶
type WebScreenshotParamsCountry string
Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).
const ( WebScreenshotParamsCountryAd WebScreenshotParamsCountry = "ad" WebScreenshotParamsCountryAe WebScreenshotParamsCountry = "ae" WebScreenshotParamsCountryAf WebScreenshotParamsCountry = "af" WebScreenshotParamsCountryAg WebScreenshotParamsCountry = "ag" WebScreenshotParamsCountryAI WebScreenshotParamsCountry = "ai" WebScreenshotParamsCountryAl WebScreenshotParamsCountry = "al" WebScreenshotParamsCountryAm WebScreenshotParamsCountry = "am" WebScreenshotParamsCountryAo WebScreenshotParamsCountry = "ao" WebScreenshotParamsCountryAr WebScreenshotParamsCountry = "ar" WebScreenshotParamsCountryAt WebScreenshotParamsCountry = "at" WebScreenshotParamsCountryAu WebScreenshotParamsCountry = "au" WebScreenshotParamsCountryAw WebScreenshotParamsCountry = "aw" WebScreenshotParamsCountryAz WebScreenshotParamsCountry = "az" WebScreenshotParamsCountryBa WebScreenshotParamsCountry = "ba" WebScreenshotParamsCountryBb WebScreenshotParamsCountry = "bb" WebScreenshotParamsCountryBd WebScreenshotParamsCountry = "bd" WebScreenshotParamsCountryBe WebScreenshotParamsCountry = "be" WebScreenshotParamsCountryBf WebScreenshotParamsCountry = "bf" WebScreenshotParamsCountryBg WebScreenshotParamsCountry = "bg" WebScreenshotParamsCountryBh WebScreenshotParamsCountry = "bh" WebScreenshotParamsCountryBi WebScreenshotParamsCountry = "bi" WebScreenshotParamsCountryBj WebScreenshotParamsCountry = "bj" WebScreenshotParamsCountryBm WebScreenshotParamsCountry = "bm" WebScreenshotParamsCountryBn WebScreenshotParamsCountry = "bn" WebScreenshotParamsCountryBo WebScreenshotParamsCountry = "bo" WebScreenshotParamsCountryBq WebScreenshotParamsCountry = "bq" WebScreenshotParamsCountryBr WebScreenshotParamsCountry = "br" WebScreenshotParamsCountryBs WebScreenshotParamsCountry = "bs" WebScreenshotParamsCountryBw WebScreenshotParamsCountry = "bw" WebScreenshotParamsCountryBy WebScreenshotParamsCountry = "by" WebScreenshotParamsCountryBz WebScreenshotParamsCountry = "bz" WebScreenshotParamsCountryCa WebScreenshotParamsCountry = "ca" WebScreenshotParamsCountryCd WebScreenshotParamsCountry = "cd" WebScreenshotParamsCountryCf WebScreenshotParamsCountry = "cf" WebScreenshotParamsCountryCg WebScreenshotParamsCountry = "cg" WebScreenshotParamsCountryCh WebScreenshotParamsCountry = "ch" WebScreenshotParamsCountryCi WebScreenshotParamsCountry = "ci" WebScreenshotParamsCountryCl WebScreenshotParamsCountry = "cl" WebScreenshotParamsCountryCm WebScreenshotParamsCountry = "cm" WebScreenshotParamsCountryCn WebScreenshotParamsCountry = "cn" WebScreenshotParamsCountryCo WebScreenshotParamsCountry = "co" WebScreenshotParamsCountryCr WebScreenshotParamsCountry = "cr" WebScreenshotParamsCountryCv WebScreenshotParamsCountry = "cv" WebScreenshotParamsCountryCw WebScreenshotParamsCountry = "cw" WebScreenshotParamsCountryCy WebScreenshotParamsCountry = "cy" WebScreenshotParamsCountryCz WebScreenshotParamsCountry = "cz" WebScreenshotParamsCountryDe WebScreenshotParamsCountry = "de" WebScreenshotParamsCountryDj WebScreenshotParamsCountry = "dj" WebScreenshotParamsCountryDk WebScreenshotParamsCountry = "dk" WebScreenshotParamsCountryDm WebScreenshotParamsCountry = "dm" WebScreenshotParamsCountryDo WebScreenshotParamsCountry = "do" WebScreenshotParamsCountryDz WebScreenshotParamsCountry = "dz" WebScreenshotParamsCountryEc WebScreenshotParamsCountry = "ec" WebScreenshotParamsCountryEe WebScreenshotParamsCountry = "ee" WebScreenshotParamsCountryEg WebScreenshotParamsCountry = "eg" WebScreenshotParamsCountryEs WebScreenshotParamsCountry = "es" WebScreenshotParamsCountryEt WebScreenshotParamsCountry = "et" WebScreenshotParamsCountryFi WebScreenshotParamsCountry = "fi" WebScreenshotParamsCountryFj WebScreenshotParamsCountry = "fj" WebScreenshotParamsCountryFr WebScreenshotParamsCountry = "fr" WebScreenshotParamsCountryGa WebScreenshotParamsCountry = "ga" WebScreenshotParamsCountryGB WebScreenshotParamsCountry = "gb" WebScreenshotParamsCountryGd WebScreenshotParamsCountry = "gd" WebScreenshotParamsCountryGe WebScreenshotParamsCountry = "ge" WebScreenshotParamsCountryGf WebScreenshotParamsCountry = "gf" WebScreenshotParamsCountryGg WebScreenshotParamsCountry = "gg" WebScreenshotParamsCountryGh WebScreenshotParamsCountry = "gh" WebScreenshotParamsCountryGm WebScreenshotParamsCountry = "gm" WebScreenshotParamsCountryGn WebScreenshotParamsCountry = "gn" WebScreenshotParamsCountryGp WebScreenshotParamsCountry = "gp" WebScreenshotParamsCountryGq WebScreenshotParamsCountry = "gq" WebScreenshotParamsCountryGr WebScreenshotParamsCountry = "gr" WebScreenshotParamsCountryGt WebScreenshotParamsCountry = "gt" WebScreenshotParamsCountryGu WebScreenshotParamsCountry = "gu" WebScreenshotParamsCountryGw WebScreenshotParamsCountry = "gw" WebScreenshotParamsCountryGy WebScreenshotParamsCountry = "gy" WebScreenshotParamsCountryHk WebScreenshotParamsCountry = "hk" WebScreenshotParamsCountryHn WebScreenshotParamsCountry = "hn" WebScreenshotParamsCountryHr WebScreenshotParamsCountry = "hr" WebScreenshotParamsCountryHt WebScreenshotParamsCountry = "ht" WebScreenshotParamsCountryHu WebScreenshotParamsCountry = "hu" WebScreenshotParamsCountryID WebScreenshotParamsCountry = "id" WebScreenshotParamsCountryIe WebScreenshotParamsCountry = "ie" WebScreenshotParamsCountryIl WebScreenshotParamsCountry = "il" WebScreenshotParamsCountryIm WebScreenshotParamsCountry = "im" WebScreenshotParamsCountryIn WebScreenshotParamsCountry = "in" WebScreenshotParamsCountryIq WebScreenshotParamsCountry = "iq" WebScreenshotParamsCountryIr WebScreenshotParamsCountry = "ir" WebScreenshotParamsCountryIs WebScreenshotParamsCountry = "is" WebScreenshotParamsCountryIt WebScreenshotParamsCountry = "it" WebScreenshotParamsCountryJe WebScreenshotParamsCountry = "je" WebScreenshotParamsCountryJm WebScreenshotParamsCountry = "jm" WebScreenshotParamsCountryJo WebScreenshotParamsCountry = "jo" WebScreenshotParamsCountryJp WebScreenshotParamsCountry = "jp" WebScreenshotParamsCountryKe WebScreenshotParamsCountry = "ke" WebScreenshotParamsCountryKg WebScreenshotParamsCountry = "kg" WebScreenshotParamsCountryKh WebScreenshotParamsCountry = "kh" WebScreenshotParamsCountryKn WebScreenshotParamsCountry = "kn" WebScreenshotParamsCountryKr WebScreenshotParamsCountry = "kr" WebScreenshotParamsCountryKw WebScreenshotParamsCountry = "kw" WebScreenshotParamsCountryKy WebScreenshotParamsCountry = "ky" WebScreenshotParamsCountryKz WebScreenshotParamsCountry = "kz" WebScreenshotParamsCountryLa WebScreenshotParamsCountry = "la" WebScreenshotParamsCountryLb WebScreenshotParamsCountry = "lb" WebScreenshotParamsCountryLc WebScreenshotParamsCountry = "lc" WebScreenshotParamsCountryLk WebScreenshotParamsCountry = "lk" WebScreenshotParamsCountryLr WebScreenshotParamsCountry = "lr" WebScreenshotParamsCountryLs WebScreenshotParamsCountry = "ls" WebScreenshotParamsCountryLt WebScreenshotParamsCountry = "lt" WebScreenshotParamsCountryLu WebScreenshotParamsCountry = "lu" WebScreenshotParamsCountryLv WebScreenshotParamsCountry = "lv" WebScreenshotParamsCountryLy WebScreenshotParamsCountry = "ly" WebScreenshotParamsCountryMa WebScreenshotParamsCountry = "ma" WebScreenshotParamsCountryMc WebScreenshotParamsCountry = "mc" WebScreenshotParamsCountryMd WebScreenshotParamsCountry = "md" WebScreenshotParamsCountryMe WebScreenshotParamsCountry = "me" WebScreenshotParamsCountryMf WebScreenshotParamsCountry = "mf" WebScreenshotParamsCountryMg WebScreenshotParamsCountry = "mg" WebScreenshotParamsCountryMk WebScreenshotParamsCountry = "mk" WebScreenshotParamsCountryMl WebScreenshotParamsCountry = "ml" WebScreenshotParamsCountryMm WebScreenshotParamsCountry = "mm" WebScreenshotParamsCountryMn WebScreenshotParamsCountry = "mn" WebScreenshotParamsCountryMo WebScreenshotParamsCountry = "mo" WebScreenshotParamsCountryMq WebScreenshotParamsCountry = "mq" WebScreenshotParamsCountryMr WebScreenshotParamsCountry = "mr" WebScreenshotParamsCountryMt WebScreenshotParamsCountry = "mt" WebScreenshotParamsCountryMu WebScreenshotParamsCountry = "mu" WebScreenshotParamsCountryMv WebScreenshotParamsCountry = "mv" WebScreenshotParamsCountryMw WebScreenshotParamsCountry = "mw" WebScreenshotParamsCountryMx WebScreenshotParamsCountry = "mx" WebScreenshotParamsCountryMy WebScreenshotParamsCountry = "my" WebScreenshotParamsCountryMz WebScreenshotParamsCountry = "mz" WebScreenshotParamsCountryNa WebScreenshotParamsCountry = "na" WebScreenshotParamsCountryNc WebScreenshotParamsCountry = "nc" WebScreenshotParamsCountryNe WebScreenshotParamsCountry = "ne" WebScreenshotParamsCountryNg WebScreenshotParamsCountry = "ng" WebScreenshotParamsCountryNi WebScreenshotParamsCountry = "ni" WebScreenshotParamsCountryNl WebScreenshotParamsCountry = "nl" WebScreenshotParamsCountryNo WebScreenshotParamsCountry = "no" WebScreenshotParamsCountryNp WebScreenshotParamsCountry = "np" WebScreenshotParamsCountryNz WebScreenshotParamsCountry = "nz" WebScreenshotParamsCountryOm WebScreenshotParamsCountry = "om" WebScreenshotParamsCountryPa WebScreenshotParamsCountry = "pa" WebScreenshotParamsCountryPe WebScreenshotParamsCountry = "pe" WebScreenshotParamsCountryPf WebScreenshotParamsCountry = "pf" WebScreenshotParamsCountryPg WebScreenshotParamsCountry = "pg" WebScreenshotParamsCountryPh WebScreenshotParamsCountry = "ph" WebScreenshotParamsCountryPk WebScreenshotParamsCountry = "pk" WebScreenshotParamsCountryPl WebScreenshotParamsCountry = "pl" WebScreenshotParamsCountryPr WebScreenshotParamsCountry = "pr" WebScreenshotParamsCountryPs WebScreenshotParamsCountry = "ps" WebScreenshotParamsCountryPt WebScreenshotParamsCountry = "pt" WebScreenshotParamsCountryPy WebScreenshotParamsCountry = "py" WebScreenshotParamsCountryQa WebScreenshotParamsCountry = "qa" WebScreenshotParamsCountryRe WebScreenshotParamsCountry = "re" WebScreenshotParamsCountryRo WebScreenshotParamsCountry = "ro" WebScreenshotParamsCountryRs WebScreenshotParamsCountry = "rs" WebScreenshotParamsCountryRu WebScreenshotParamsCountry = "ru" WebScreenshotParamsCountryRw WebScreenshotParamsCountry = "rw" WebScreenshotParamsCountrySa WebScreenshotParamsCountry = "sa" WebScreenshotParamsCountrySc WebScreenshotParamsCountry = "sc" WebScreenshotParamsCountrySd WebScreenshotParamsCountry = "sd" WebScreenshotParamsCountrySe WebScreenshotParamsCountry = "se" WebScreenshotParamsCountrySg WebScreenshotParamsCountry = "sg" WebScreenshotParamsCountrySi WebScreenshotParamsCountry = "si" WebScreenshotParamsCountrySk WebScreenshotParamsCountry = "sk" WebScreenshotParamsCountrySl WebScreenshotParamsCountry = "sl" WebScreenshotParamsCountrySm WebScreenshotParamsCountry = "sm" WebScreenshotParamsCountrySn WebScreenshotParamsCountry = "sn" WebScreenshotParamsCountrySo WebScreenshotParamsCountry = "so" WebScreenshotParamsCountrySr WebScreenshotParamsCountry = "sr" WebScreenshotParamsCountrySS WebScreenshotParamsCountry = "ss" WebScreenshotParamsCountrySt WebScreenshotParamsCountry = "st" WebScreenshotParamsCountrySv WebScreenshotParamsCountry = "sv" WebScreenshotParamsCountrySx WebScreenshotParamsCountry = "sx" WebScreenshotParamsCountrySy WebScreenshotParamsCountry = "sy" WebScreenshotParamsCountrySz WebScreenshotParamsCountry = "sz" WebScreenshotParamsCountryTc WebScreenshotParamsCountry = "tc" WebScreenshotParamsCountryTd WebScreenshotParamsCountry = "td" WebScreenshotParamsCountryTg WebScreenshotParamsCountry = "tg" WebScreenshotParamsCountryTh WebScreenshotParamsCountry = "th" WebScreenshotParamsCountryTj WebScreenshotParamsCountry = "tj" WebScreenshotParamsCountryTl WebScreenshotParamsCountry = "tl" WebScreenshotParamsCountryTm WebScreenshotParamsCountry = "tm" WebScreenshotParamsCountryTn WebScreenshotParamsCountry = "tn" WebScreenshotParamsCountryTr WebScreenshotParamsCountry = "tr" WebScreenshotParamsCountryTt WebScreenshotParamsCountry = "tt" WebScreenshotParamsCountryTw WebScreenshotParamsCountry = "tw" WebScreenshotParamsCountryTz WebScreenshotParamsCountry = "tz" WebScreenshotParamsCountryUa WebScreenshotParamsCountry = "ua" WebScreenshotParamsCountryUg WebScreenshotParamsCountry = "ug" WebScreenshotParamsCountryUs WebScreenshotParamsCountry = "us" WebScreenshotParamsCountryUy WebScreenshotParamsCountry = "uy" WebScreenshotParamsCountryUz WebScreenshotParamsCountry = "uz" WebScreenshotParamsCountryVc WebScreenshotParamsCountry = "vc" WebScreenshotParamsCountryVe WebScreenshotParamsCountry = "ve" WebScreenshotParamsCountryVg WebScreenshotParamsCountry = "vg" WebScreenshotParamsCountryVi WebScreenshotParamsCountry = "vi" WebScreenshotParamsCountryVn WebScreenshotParamsCountry = "vn" WebScreenshotParamsCountryYe WebScreenshotParamsCountry = "ye" WebScreenshotParamsCountryYt WebScreenshotParamsCountry = "yt" WebScreenshotParamsCountryZa WebScreenshotParamsCountry = "za" WebScreenshotParamsCountryZm WebScreenshotParamsCountry = "zm" WebScreenshotParamsCountryZw WebScreenshotParamsCountry = "zw" )
type WebScreenshotParamsFullScreenshot ¶
type WebScreenshotParamsFullScreenshot string
Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view).
const ( WebScreenshotParamsFullScreenshotTrue WebScreenshotParamsFullScreenshot = "true" WebScreenshotParamsFullScreenshotFalse WebScreenshotParamsFullScreenshot = "false" )
type WebScreenshotParamsPage ¶
type WebScreenshotParamsPage string
Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'.
const ( WebScreenshotParamsPageLogin WebScreenshotParamsPage = "login" WebScreenshotParamsPageSignup WebScreenshotParamsPage = "signup" WebScreenshotParamsPageBlog WebScreenshotParamsPage = "blog" WebScreenshotParamsPageCareers WebScreenshotParamsPage = "careers" WebScreenshotParamsPagePricing WebScreenshotParamsPage = "pricing" WebScreenshotParamsPageTerms WebScreenshotParamsPage = "terms" WebScreenshotParamsPagePrivacy WebScreenshotParamsPage = "privacy" WebScreenshotParamsPageContact WebScreenshotParamsPage = "contact" )
type WebScreenshotParamsViewport ¶
type WebScreenshotParamsViewport struct {
// Viewport height in pixels.
Height param.Opt[int64] `query:"height,omitzero" json:"-"`
// Viewport width in pixels.
Width param.Opt[int64] `query:"width,omitzero" json:"-"`
// contains filtered or unexported fields
}
Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080.
func (WebScreenshotParamsViewport) URLQuery ¶
func (r WebScreenshotParamsViewport) URLQuery() (v url.Values, err error)
URLQuery serializes WebScreenshotParamsViewport's query parameters as `url.Values`.
type WebScreenshotParamsZdr ¶ added in v2.5.0
type WebScreenshotParamsZdr string
Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
const ( WebScreenshotParamsZdrEnabled WebScreenshotParamsZdr = "enabled" WebScreenshotParamsZdrDisabled WebScreenshotParamsZdr = "disabled" )
type WebScreenshotResponse ¶
type WebScreenshotResponse struct {
// HTTP status code
Code int64 `json:"code"`
// The normalized domain that was processed
Domain string `json:"domain"`
// Height in pixels of the returned screenshot image
Height int64 `json:"height"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebScreenshotResponseKeyMetadata `json:"key_metadata"`
// Public image URL for standard requests, or an in-memory data URL when ZDR is
// enabled.
Screenshot string `json:"screenshot"`
// Type of screenshot that was captured
//
// Any of "viewport", "fullPage".
ScreenshotType WebScreenshotResponseScreenshotType `json:"screenshotType"`
// Status of the response, e.g., 'ok'
Status string `json:"status"`
// Width in pixels of the returned screenshot image
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Domain respjson.Field
Height respjson.Field
KeyMetadata respjson.Field
Screenshot respjson.Field
ScreenshotType respjson.Field
Status respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebScreenshotResponse) RawJSON ¶
func (r WebScreenshotResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebScreenshotResponse) UnmarshalJSON ¶
func (r *WebScreenshotResponse) UnmarshalJSON(data []byte) error
type WebScreenshotResponseKeyMetadata ¶
type WebScreenshotResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebScreenshotResponseKeyMetadata) RawJSON ¶
func (r WebScreenshotResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebScreenshotResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebScreenshotResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebScreenshotResponseScreenshotType ¶
type WebScreenshotResponseScreenshotType string
Type of screenshot that was captured
const ( WebScreenshotResponseScreenshotTypeViewport WebScreenshotResponseScreenshotType = "viewport" WebScreenshotResponseScreenshotTypeFullPage WebScreenshotResponseScreenshotType = "fullPage" )
type WebSearchParams ¶
type WebSearchParams struct {
// Search query. Accepts natural language as well as Google-style search operators
// such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`.
Query string `json:"query" api:"required"`
// Number of results to request and return (10–100). Defaults to 10.
NumResults param.Opt[int64] `json:"numResults,omitzero"`
// Expand the query into multiple parallel variants for broader recall.
QueryFanout param.Opt[bool] `json:"queryFanout,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific
// country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
//
// Any of "af", "al", "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw",
// "au", "at", "az", "bs", "bh", "bd", "bb", "by", "be", "bz", "bj", "bm", "bt",
// "bo", "ba", "bw", "bv", "br", "io", "bn", "bg", "bf", "bi", "kh", "cm", "ca",
// "cv", "ky", "cf", "td", "cl", "cn", "cx", "cc", "co", "km", "cg", "cd", "ck",
// "cr", "ci", "hr", "cu", "cy", "cz", "dk", "dj", "dm", "do", "ec", "eg", "sv",
// "gq", "er", "ee", "et", "fk", "fo", "fj", "fi", "fr", "gf", "pf", "tf", "ga",
// "gm", "ge", "de", "gh", "gi", "gr", "gl", "gd", "gp", "gu", "gt", "gn", "gw",
// "gy", "ht", "hm", "va", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie",
// "il", "it", "jm", "jp", "jo", "kz", "ke", "ki", "kp", "kr", "kw", "kg", "la",
// "lv", "lb", "ls", "lr", "ly", "li", "lt", "lu", "mo", "mk", "mg", "mw", "my",
// "mv", "ml", "mt", "mh", "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn",
// "ms", "ma", "mz", "mm", "na", "nr", "np", "nl", "an", "nc", "nz", "ni", "ne",
// "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", "ps", "pa", "pg", "py", "pe",
// "ph", "pn", "pl", "pt", "pr", "qa", "re", "ro", "ru", "rw", "sh", "kn", "lc",
// "pm", "vc", "ws", "sm", "st", "sa", "sn", "rs", "sc", "sl", "sg", "sk", "si",
// "sb", "so", "za", "gs", "es", "lk", "sd", "sr", "sj", "sz", "se", "ch", "sy",
// "tw", "tj", "tz", "th", "tl", "tg", "tk", "to", "tt", "tn", "tr", "tm", "tc",
// "tv", "ug", "ua", "ae", "gb", "us", "um", "uy", "uz", "vu", "ve", "vn", "vg",
// "vi", "wf", "eh", "ye", "zm", "zw".
Country WebSearchParamsCountry `json:"country,omitzero"`
// Blocklist — drop results from these domains. Example: ["pinterest.com",
// "reddit.com"].
ExcludeDomains []string `json:"excludeDomains,omitzero"`
// Restrict results to content published within this window.
//
// Any of "last_24_hours", "last_week", "last_month", "last_year".
Freshness WebSearchParamsFreshness `json:"freshness,omitzero"`
// Allowlist — only return results from these domains. Example: ["arxiv.org",
// "github.com"].
IncludeDomains []string `json:"includeDomains,omitzero"`
// Inline Markdown scraping for each result. Set `enabled: true` to activate.
MarkdownOptions WebSearchParamsMarkdownOptions `json:"markdownOptions,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// contains filtered or unexported fields
}
func (WebSearchParams) MarshalJSON ¶
func (r WebSearchParams) MarshalJSON() (data []byte, err error)
func (*WebSearchParams) UnmarshalJSON ¶
func (r *WebSearchParams) UnmarshalJSON(data []byte) error
type WebSearchParamsCountry ¶
type WebSearchParamsCountry string
Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de".
const ( WebSearchParamsCountryAf WebSearchParamsCountry = "af" WebSearchParamsCountryAl WebSearchParamsCountry = "al" WebSearchParamsCountryDz WebSearchParamsCountry = "dz" WebSearchParamsCountryAs WebSearchParamsCountry = "as" WebSearchParamsCountryAd WebSearchParamsCountry = "ad" WebSearchParamsCountryAo WebSearchParamsCountry = "ao" WebSearchParamsCountryAI WebSearchParamsCountry = "ai" WebSearchParamsCountryAq WebSearchParamsCountry = "aq" WebSearchParamsCountryAg WebSearchParamsCountry = "ag" WebSearchParamsCountryAr WebSearchParamsCountry = "ar" WebSearchParamsCountryAm WebSearchParamsCountry = "am" WebSearchParamsCountryAw WebSearchParamsCountry = "aw" WebSearchParamsCountryAu WebSearchParamsCountry = "au" WebSearchParamsCountryAt WebSearchParamsCountry = "at" WebSearchParamsCountryAz WebSearchParamsCountry = "az" WebSearchParamsCountryBs WebSearchParamsCountry = "bs" WebSearchParamsCountryBh WebSearchParamsCountry = "bh" WebSearchParamsCountryBd WebSearchParamsCountry = "bd" WebSearchParamsCountryBb WebSearchParamsCountry = "bb" WebSearchParamsCountryBy WebSearchParamsCountry = "by" WebSearchParamsCountryBe WebSearchParamsCountry = "be" WebSearchParamsCountryBz WebSearchParamsCountry = "bz" WebSearchParamsCountryBj WebSearchParamsCountry = "bj" WebSearchParamsCountryBm WebSearchParamsCountry = "bm" WebSearchParamsCountryBt WebSearchParamsCountry = "bt" WebSearchParamsCountryBo WebSearchParamsCountry = "bo" WebSearchParamsCountryBa WebSearchParamsCountry = "ba" WebSearchParamsCountryBw WebSearchParamsCountry = "bw" WebSearchParamsCountryBv WebSearchParamsCountry = "bv" WebSearchParamsCountryBr WebSearchParamsCountry = "br" WebSearchParamsCountryIo WebSearchParamsCountry = "io" WebSearchParamsCountryBn WebSearchParamsCountry = "bn" WebSearchParamsCountryBg WebSearchParamsCountry = "bg" WebSearchParamsCountryBf WebSearchParamsCountry = "bf" WebSearchParamsCountryBi WebSearchParamsCountry = "bi" WebSearchParamsCountryKh WebSearchParamsCountry = "kh" WebSearchParamsCountryCm WebSearchParamsCountry = "cm" WebSearchParamsCountryCa WebSearchParamsCountry = "ca" WebSearchParamsCountryCv WebSearchParamsCountry = "cv" WebSearchParamsCountryKy WebSearchParamsCountry = "ky" WebSearchParamsCountryCf WebSearchParamsCountry = "cf" WebSearchParamsCountryTd WebSearchParamsCountry = "td" WebSearchParamsCountryCl WebSearchParamsCountry = "cl" WebSearchParamsCountryCn WebSearchParamsCountry = "cn" WebSearchParamsCountryCx WebSearchParamsCountry = "cx" WebSearchParamsCountryCc WebSearchParamsCountry = "cc" WebSearchParamsCountryCo WebSearchParamsCountry = "co" WebSearchParamsCountryKm WebSearchParamsCountry = "km" WebSearchParamsCountryCg WebSearchParamsCountry = "cg" WebSearchParamsCountryCd WebSearchParamsCountry = "cd" WebSearchParamsCountryCk WebSearchParamsCountry = "ck" WebSearchParamsCountryCr WebSearchParamsCountry = "cr" WebSearchParamsCountryCi WebSearchParamsCountry = "ci" WebSearchParamsCountryHr WebSearchParamsCountry = "hr" WebSearchParamsCountryCu WebSearchParamsCountry = "cu" WebSearchParamsCountryCy WebSearchParamsCountry = "cy" WebSearchParamsCountryCz WebSearchParamsCountry = "cz" WebSearchParamsCountryDk WebSearchParamsCountry = "dk" WebSearchParamsCountryDj WebSearchParamsCountry = "dj" WebSearchParamsCountryDm WebSearchParamsCountry = "dm" WebSearchParamsCountryDo WebSearchParamsCountry = "do" WebSearchParamsCountryEc WebSearchParamsCountry = "ec" WebSearchParamsCountryEg WebSearchParamsCountry = "eg" WebSearchParamsCountrySv WebSearchParamsCountry = "sv" WebSearchParamsCountryGq WebSearchParamsCountry = "gq" WebSearchParamsCountryEr WebSearchParamsCountry = "er" WebSearchParamsCountryEe WebSearchParamsCountry = "ee" WebSearchParamsCountryEt WebSearchParamsCountry = "et" WebSearchParamsCountryFk WebSearchParamsCountry = "fk" WebSearchParamsCountryFo WebSearchParamsCountry = "fo" WebSearchParamsCountryFj WebSearchParamsCountry = "fj" WebSearchParamsCountryFi WebSearchParamsCountry = "fi" WebSearchParamsCountryFr WebSearchParamsCountry = "fr" WebSearchParamsCountryGf WebSearchParamsCountry = "gf" WebSearchParamsCountryPf WebSearchParamsCountry = "pf" WebSearchParamsCountryTf WebSearchParamsCountry = "tf" WebSearchParamsCountryGa WebSearchParamsCountry = "ga" WebSearchParamsCountryGm WebSearchParamsCountry = "gm" WebSearchParamsCountryGe WebSearchParamsCountry = "ge" WebSearchParamsCountryDe WebSearchParamsCountry = "de" WebSearchParamsCountryGh WebSearchParamsCountry = "gh" WebSearchParamsCountryGi WebSearchParamsCountry = "gi" WebSearchParamsCountryGr WebSearchParamsCountry = "gr" WebSearchParamsCountryGl WebSearchParamsCountry = "gl" WebSearchParamsCountryGd WebSearchParamsCountry = "gd" WebSearchParamsCountryGp WebSearchParamsCountry = "gp" WebSearchParamsCountryGu WebSearchParamsCountry = "gu" WebSearchParamsCountryGt WebSearchParamsCountry = "gt" WebSearchParamsCountryGn WebSearchParamsCountry = "gn" WebSearchParamsCountryGw WebSearchParamsCountry = "gw" WebSearchParamsCountryGy WebSearchParamsCountry = "gy" WebSearchParamsCountryHt WebSearchParamsCountry = "ht" WebSearchParamsCountryHm WebSearchParamsCountry = "hm" WebSearchParamsCountryVa WebSearchParamsCountry = "va" WebSearchParamsCountryHn WebSearchParamsCountry = "hn" WebSearchParamsCountryHk WebSearchParamsCountry = "hk" WebSearchParamsCountryHu WebSearchParamsCountry = "hu" WebSearchParamsCountryIs WebSearchParamsCountry = "is" WebSearchParamsCountryIn WebSearchParamsCountry = "in" WebSearchParamsCountryID WebSearchParamsCountry = "id" WebSearchParamsCountryIr WebSearchParamsCountry = "ir" WebSearchParamsCountryIq WebSearchParamsCountry = "iq" WebSearchParamsCountryIe WebSearchParamsCountry = "ie" WebSearchParamsCountryIl WebSearchParamsCountry = "il" WebSearchParamsCountryIt WebSearchParamsCountry = "it" WebSearchParamsCountryJm WebSearchParamsCountry = "jm" WebSearchParamsCountryJp WebSearchParamsCountry = "jp" WebSearchParamsCountryJo WebSearchParamsCountry = "jo" WebSearchParamsCountryKz WebSearchParamsCountry = "kz" WebSearchParamsCountryKe WebSearchParamsCountry = "ke" WebSearchParamsCountryKi WebSearchParamsCountry = "ki" WebSearchParamsCountryKp WebSearchParamsCountry = "kp" WebSearchParamsCountryKr WebSearchParamsCountry = "kr" WebSearchParamsCountryKw WebSearchParamsCountry = "kw" WebSearchParamsCountryKg WebSearchParamsCountry = "kg" WebSearchParamsCountryLa WebSearchParamsCountry = "la" WebSearchParamsCountryLv WebSearchParamsCountry = "lv" WebSearchParamsCountryLb WebSearchParamsCountry = "lb" WebSearchParamsCountryLs WebSearchParamsCountry = "ls" WebSearchParamsCountryLr WebSearchParamsCountry = "lr" WebSearchParamsCountryLy WebSearchParamsCountry = "ly" WebSearchParamsCountryLi WebSearchParamsCountry = "li" WebSearchParamsCountryLt WebSearchParamsCountry = "lt" WebSearchParamsCountryLu WebSearchParamsCountry = "lu" WebSearchParamsCountryMo WebSearchParamsCountry = "mo" WebSearchParamsCountryMk WebSearchParamsCountry = "mk" WebSearchParamsCountryMg WebSearchParamsCountry = "mg" WebSearchParamsCountryMw WebSearchParamsCountry = "mw" WebSearchParamsCountryMy WebSearchParamsCountry = "my" WebSearchParamsCountryMv WebSearchParamsCountry = "mv" WebSearchParamsCountryMl WebSearchParamsCountry = "ml" WebSearchParamsCountryMt WebSearchParamsCountry = "mt" WebSearchParamsCountryMh WebSearchParamsCountry = "mh" WebSearchParamsCountryMq WebSearchParamsCountry = "mq" WebSearchParamsCountryMr WebSearchParamsCountry = "mr" WebSearchParamsCountryMu WebSearchParamsCountry = "mu" WebSearchParamsCountryYt WebSearchParamsCountry = "yt" WebSearchParamsCountryMx WebSearchParamsCountry = "mx" WebSearchParamsCountryFm WebSearchParamsCountry = "fm" WebSearchParamsCountryMd WebSearchParamsCountry = "md" WebSearchParamsCountryMc WebSearchParamsCountry = "mc" WebSearchParamsCountryMn WebSearchParamsCountry = "mn" WebSearchParamsCountryMs WebSearchParamsCountry = "ms" WebSearchParamsCountryMa WebSearchParamsCountry = "ma" WebSearchParamsCountryMz WebSearchParamsCountry = "mz" WebSearchParamsCountryMm WebSearchParamsCountry = "mm" WebSearchParamsCountryNa WebSearchParamsCountry = "na" WebSearchParamsCountryNr WebSearchParamsCountry = "nr" WebSearchParamsCountryNp WebSearchParamsCountry = "np" WebSearchParamsCountryNl WebSearchParamsCountry = "nl" WebSearchParamsCountryAn WebSearchParamsCountry = "an" WebSearchParamsCountryNc WebSearchParamsCountry = "nc" WebSearchParamsCountryNz WebSearchParamsCountry = "nz" WebSearchParamsCountryNi WebSearchParamsCountry = "ni" WebSearchParamsCountryNe WebSearchParamsCountry = "ne" WebSearchParamsCountryNg WebSearchParamsCountry = "ng" WebSearchParamsCountryNu WebSearchParamsCountry = "nu" WebSearchParamsCountryNf WebSearchParamsCountry = "nf" WebSearchParamsCountryMp WebSearchParamsCountry = "mp" WebSearchParamsCountryNo WebSearchParamsCountry = "no" WebSearchParamsCountryOm WebSearchParamsCountry = "om" WebSearchParamsCountryPk WebSearchParamsCountry = "pk" WebSearchParamsCountryPw WebSearchParamsCountry = "pw" WebSearchParamsCountryPs WebSearchParamsCountry = "ps" WebSearchParamsCountryPa WebSearchParamsCountry = "pa" WebSearchParamsCountryPg WebSearchParamsCountry = "pg" WebSearchParamsCountryPy WebSearchParamsCountry = "py" WebSearchParamsCountryPe WebSearchParamsCountry = "pe" WebSearchParamsCountryPh WebSearchParamsCountry = "ph" WebSearchParamsCountryPn WebSearchParamsCountry = "pn" WebSearchParamsCountryPl WebSearchParamsCountry = "pl" WebSearchParamsCountryPt WebSearchParamsCountry = "pt" WebSearchParamsCountryPr WebSearchParamsCountry = "pr" WebSearchParamsCountryQa WebSearchParamsCountry = "qa" WebSearchParamsCountryRe WebSearchParamsCountry = "re" WebSearchParamsCountryRo WebSearchParamsCountry = "ro" WebSearchParamsCountryRu WebSearchParamsCountry = "ru" WebSearchParamsCountryRw WebSearchParamsCountry = "rw" WebSearchParamsCountrySh WebSearchParamsCountry = "sh" WebSearchParamsCountryKn WebSearchParamsCountry = "kn" WebSearchParamsCountryLc WebSearchParamsCountry = "lc" WebSearchParamsCountryPm WebSearchParamsCountry = "pm" WebSearchParamsCountryVc WebSearchParamsCountry = "vc" WebSearchParamsCountryWs WebSearchParamsCountry = "ws" WebSearchParamsCountrySm WebSearchParamsCountry = "sm" WebSearchParamsCountrySt WebSearchParamsCountry = "st" WebSearchParamsCountrySa WebSearchParamsCountry = "sa" WebSearchParamsCountrySn WebSearchParamsCountry = "sn" WebSearchParamsCountryRs WebSearchParamsCountry = "rs" WebSearchParamsCountrySc WebSearchParamsCountry = "sc" WebSearchParamsCountrySl WebSearchParamsCountry = "sl" WebSearchParamsCountrySg WebSearchParamsCountry = "sg" WebSearchParamsCountrySk WebSearchParamsCountry = "sk" WebSearchParamsCountrySi WebSearchParamsCountry = "si" WebSearchParamsCountrySb WebSearchParamsCountry = "sb" WebSearchParamsCountrySo WebSearchParamsCountry = "so" WebSearchParamsCountryZa WebSearchParamsCountry = "za" WebSearchParamsCountryGs WebSearchParamsCountry = "gs" WebSearchParamsCountryEs WebSearchParamsCountry = "es" WebSearchParamsCountryLk WebSearchParamsCountry = "lk" WebSearchParamsCountrySd WebSearchParamsCountry = "sd" WebSearchParamsCountrySr WebSearchParamsCountry = "sr" WebSearchParamsCountrySj WebSearchParamsCountry = "sj" WebSearchParamsCountrySz WebSearchParamsCountry = "sz" WebSearchParamsCountrySe WebSearchParamsCountry = "se" WebSearchParamsCountryCh WebSearchParamsCountry = "ch" WebSearchParamsCountrySy WebSearchParamsCountry = "sy" WebSearchParamsCountryTw WebSearchParamsCountry = "tw" WebSearchParamsCountryTj WebSearchParamsCountry = "tj" WebSearchParamsCountryTz WebSearchParamsCountry = "tz" WebSearchParamsCountryTh WebSearchParamsCountry = "th" WebSearchParamsCountryTl WebSearchParamsCountry = "tl" WebSearchParamsCountryTg WebSearchParamsCountry = "tg" WebSearchParamsCountryTk WebSearchParamsCountry = "tk" WebSearchParamsCountryTo WebSearchParamsCountry = "to" WebSearchParamsCountryTt WebSearchParamsCountry = "tt" WebSearchParamsCountryTn WebSearchParamsCountry = "tn" WebSearchParamsCountryTr WebSearchParamsCountry = "tr" WebSearchParamsCountryTm WebSearchParamsCountry = "tm" WebSearchParamsCountryTc WebSearchParamsCountry = "tc" WebSearchParamsCountryTv WebSearchParamsCountry = "tv" WebSearchParamsCountryUg WebSearchParamsCountry = "ug" WebSearchParamsCountryUa WebSearchParamsCountry = "ua" WebSearchParamsCountryAe WebSearchParamsCountry = "ae" WebSearchParamsCountryGB WebSearchParamsCountry = "gb" WebSearchParamsCountryUs WebSearchParamsCountry = "us" WebSearchParamsCountryUm WebSearchParamsCountry = "um" WebSearchParamsCountryUy WebSearchParamsCountry = "uy" WebSearchParamsCountryUz WebSearchParamsCountry = "uz" WebSearchParamsCountryVu WebSearchParamsCountry = "vu" WebSearchParamsCountryVe WebSearchParamsCountry = "ve" WebSearchParamsCountryVn WebSearchParamsCountry = "vn" WebSearchParamsCountryVg WebSearchParamsCountry = "vg" WebSearchParamsCountryVi WebSearchParamsCountry = "vi" WebSearchParamsCountryWf WebSearchParamsCountry = "wf" WebSearchParamsCountryEh WebSearchParamsCountry = "eh" WebSearchParamsCountryYe WebSearchParamsCountry = "ye" WebSearchParamsCountryZm WebSearchParamsCountry = "zm" WebSearchParamsCountryZw WebSearchParamsCountry = "zw" )
type WebSearchParamsFreshness ¶
type WebSearchParamsFreshness string
Restrict results to content published within this window.
const ( WebSearchParamsFreshnessLast24Hours WebSearchParamsFreshness = "last_24_hours" WebSearchParamsFreshnessLastWeek WebSearchParamsFreshness = "last_week" WebSearchParamsFreshnessLastMonth WebSearchParamsFreshness = "last_month" WebSearchParamsFreshnessLastYear WebSearchParamsFreshness = "last_year" )
type WebSearchParamsMarkdownOptions ¶
type WebSearchParamsMarkdownOptions struct {
// Scrape each result to Markdown. Off by default to keep search cheap and fast.
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// Render iframe contents into the Markdown.
IncludeFrames param.Opt[bool] `json:"includeFrames,omitzero"`
// Emit image references in the Markdown.
IncludeImages param.Opt[bool] `json:"includeImages,omitzero"`
// Keep hyperlinks in the Markdown.
IncludeLinks param.Opt[bool] `json:"includeLinks,omitzero"`
// Cache TTL in ms for scraped Markdown keyed by URL + options. Default 1 day, max
// 30 days. Set to 0 to force a fresh scrape.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Truncate inline base64 image payloads to keep responses small.
ShortenBase64Images param.Opt[bool] `json:"shortenBase64Images,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Strip nav, header, footer, and sidebar — keep only the primary article content.
UseMainContentOnly param.Opt[bool] `json:"useMainContentOnly,omitzero"`
// Extra wait after page load before rendering, in ms (0–30000). Useful for
// JS-heavy pages.
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
// PDF handling. Use start/end to bound text extraction and OCR to a page range.
Pdf WebSearchParamsMarkdownOptionsPdf `json:"pdf,omitzero"`
// contains filtered or unexported fields
}
Inline Markdown scraping for each result. Set `enabled: true` to activate.
func (WebSearchParamsMarkdownOptions) MarshalJSON ¶
func (r WebSearchParamsMarkdownOptions) MarshalJSON() (data []byte, err error)
func (*WebSearchParamsMarkdownOptions) UnmarshalJSON ¶
func (r *WebSearchParamsMarkdownOptions) UnmarshalJSON(data []byte) error
type WebSearchParamsMarkdownOptionsPdf ¶
type WebSearchParamsMarkdownOptionsPdf struct {
// Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must
// be >= start.
End param.Opt[int64] `json:"end,omitzero"`
// Parse PDF URLs. When false, PDF results are skipped with WEBSITE_ACCESS_ERROR.
ShouldParse param.Opt[bool] `json:"shouldParse,omitzero"`
// First PDF page to parse (1-based, inclusive). Defaults to page 1.
Start param.Opt[int64] `json:"start,omitzero"`
// contains filtered or unexported fields
}
PDF handling. Use start/end to bound text extraction and OCR to a page range.
func (WebSearchParamsMarkdownOptionsPdf) MarshalJSON ¶
func (r WebSearchParamsMarkdownOptionsPdf) MarshalJSON() (data []byte, err error)
func (*WebSearchParamsMarkdownOptionsPdf) UnmarshalJSON ¶
func (r *WebSearchParamsMarkdownOptionsPdf) UnmarshalJSON(data []byte) error
type WebSearchResponse ¶
type WebSearchResponse struct {
// Echo of the original query (useful when fanout was enabled).
Query string `json:"query" api:"required"`
Results []WebSearchResponseResult `json:"results" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebSearchResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Query respjson.Field
Results respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebSearchResponse) RawJSON ¶
func (r WebSearchResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebSearchResponse) UnmarshalJSON ¶
func (r *WebSearchResponse) UnmarshalJSON(data []byte) error
type WebSearchResponseKeyMetadata ¶
type WebSearchResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebSearchResponseKeyMetadata) RawJSON ¶
func (r WebSearchResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebSearchResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebSearchResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebSearchResponseResult ¶
type WebSearchResponseResult struct {
// Snippet excerpt from the page.
Description string `json:"description" api:"required"`
// Markdown scrape status and content for this result.
Markdown WebSearchResponseResultMarkdown `json:"markdown" api:"required"`
// Relevance to the original query.
//
// Any of "high", "medium", "low".
Relevance string `json:"relevance" api:"required"`
// Page title.
Title string `json:"title" api:"required"`
// Canonical result URL.
URL string `json:"url" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
Markdown respjson.Field
Relevance respjson.Field
Title respjson.Field
URL respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebSearchResponseResult) RawJSON ¶
func (r WebSearchResponseResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebSearchResponseResult) UnmarshalJSON ¶
func (r *WebSearchResponseResult) UnmarshalJSON(data []byte) error
type WebSearchResponseResultMarkdown ¶
type WebSearchResponseResultMarkdown struct {
// Per-result scrape outcome. Inspect this before reading `markdown`.
//
// Any of "SUCCESS", "NOT_REQUESTED", "TIMEOUT", "CONTENT_TOO_LARGE",
// "WEBSITE_ACCESS_ERROR", "ERROR".
Code string `json:"code" api:"required"`
// GFM Markdown of the page. Null unless markdownOptions.enabled is true and
// scraping succeeded.
Markdown string `json:"markdown" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Markdown respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Markdown scrape status and content for this result.
func (WebSearchResponseResultMarkdown) RawJSON ¶
func (r WebSearchResponseResultMarkdown) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebSearchResponseResultMarkdown) UnmarshalJSON ¶
func (r *WebSearchResponseResultMarkdown) UnmarshalJSON(data []byte) error
type WebService ¶
type WebService struct {
// contains filtered or unexported fields
}
WebService contains methods and other services that help with interacting with the context.dev API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWebService method instead.
func NewWebService ¶
func NewWebService(opts ...option.RequestOption) (r WebService)
NewWebService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*WebService) Extract ¶
func (r *WebService) Extract(ctx context.Context, body WebExtractParams, opts ...option.RequestOption) (res *WebExtractResponse, err error)
Crawl a website, use the provided JSON Schema and instructions to prioritize relevant internal links, and extract structured data from the selected pages.
func (*WebService) ExtractCompetitors ¶
func (r *WebService) ExtractCompetitors(ctx context.Context, query WebExtractCompetitorsParams, opts ...option.RequestOption) (res *WebExtractCompetitorsResponse, err error)
Analyze a company's landing page and web search evidence to return direct competitors for the same product or market.
func (*WebService) ExtractFonts ¶
func (r *WebService) ExtractFonts(ctx context.Context, query WebExtractFontsParams, opts ...option.RequestOption) (res *WebExtractFontsResponse, err error)
Scrape font information from a website including font families, usage statistics, fallbacks, and element/word counts.
func (*WebService) ExtractStyleguide ¶
func (r *WebService) ExtractStyleguide(ctx context.Context, query WebExtractStyleguideParams, opts ...option.RequestOption) (res *WebExtractStyleguideResponse, err error)
Extract a comprehensive design system from a website including colors, typography, spacing, shadows, and UI components.
func (*WebService) Screenshot ¶
func (r *WebService) Screenshot(ctx context.Context, query WebScreenshotParams, opts ...option.RequestOption) (res *WebScreenshotResponse, err error)
Capture a screenshot of a website.
func (*WebService) Search ¶
func (r *WebService) Search(ctx context.Context, body WebSearchParams, opts ...option.RequestOption) (res *WebSearchResponse, err error)
Search the web and optionally scrape each result to Markdown in one round-trip.
func (*WebService) WebCrawlMd ¶
func (r *WebService) WebCrawlMd(ctx context.Context, body WebWebCrawlMdParams, opts ...option.RequestOption) (res *WebWebCrawlMdResponse, err error)
Performs a crawl starting from a given URL, extracts page content as Markdown, and returns results for all crawled pages.
func (*WebService) WebScrapeHTML ¶
func (r *WebService) WebScrapeHTML(ctx context.Context, query WebWebScrapeHTMLParams, opts ...option.RequestOption) (res *WebWebScrapeHTMLResponse, err error)
Scrapes the given URL and returns the raw HTML content of the page. The base request costs 1 credit; requests with browser actions cost 2 credits.
func (*WebService) WebScrapeImages ¶
func (r *WebService) WebScrapeImages(ctx context.Context, query WebWebScrapeImagesParams, opts ...option.RequestOption) (res *WebWebScrapeImagesResponse, err error)
Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit, or 2 credits with browser actions. When enrichment is enabled, the entire call costs 5 credits, including requests that also use actions.
func (*WebService) WebScrapeMd ¶
func (r *WebService) WebScrapeMd(ctx context.Context, query WebWebScrapeMdParams, opts ...option.RequestOption) (res *WebWebScrapeMdResponse, err error)
Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON responses from a recognized API key; use error_code to distinguish stable failure categories.
### YouTube
YouTube URLs return the video or channel itself rather than the surrounding player and navigation chrome. A URL addressing a single video (`/watch`, `youtu.be`, `/shorts`, `/embed`, `/live`) returns its title, channel, duration, view count, keywords, full description, and the transcript when the video has captions that can be retrieved; videos without captions return everything except the transcript. A channel URL (`/channel/UC…`, `/@handle`, `/c/…`, `/user/…`) returns its name, handle, subscriber count, video count, and full description. When `includeImages=true`, video responses also include the thumbnail and channel responses include the avatar. Costs the same as any other scrape.
### Billing & errors
| HTTP status | Billed? | Meaning | | ----------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds | | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | | 404 | No | Target page returned or fingerprinted as not found | | 408 | No | Request timed out | | 413 | No | Target content exceeds the maximum supported size (20 MB) | | 415 | No | Unsupported content type | | 429 | No | Per-minute rate limit exceeded; honor Retry-After | | 500 | No | Internal error |
func (*WebService) WebScrapeSitemap ¶
func (r *WebService) WebScrapeSitemap(ctx context.Context, query WebWebScrapeSitemapParams, opts ...option.RequestOption) (res *WebWebScrapeSitemapResponse, err error)
Crawl an entire website's sitemap and return all discovered page URLs. Pass `search` to have the crawled sitemap filtered down to the pages about a phrase (for example `pricing and plans` or `api authentication docs`), most relevant first — a searched crawl scans the whole sitemap and costs 2 credits instead of 1.
type WebWebCrawlMdParams ¶
type WebWebCrawlMdParams struct {
// The starting URL for the crawl (must include http:// or https:// protocol)
URL string `json:"url" api:"required" format:"uri"`
// When true, follow links on subdomains of the starting URL's domain (e.g.
// docs.example.com when starting from example.com). www and apex are always
// treated as equivalent.
FollowSubdomains param.Opt[bool] `json:"followSubdomains,omitzero"`
// When true, the contents of iframes are rendered to Markdown for each crawled
// page.
IncludeFrames param.Opt[bool] `json:"includeFrames,omitzero"`
// Include image references in the Markdown output
IncludeImages param.Opt[bool] `json:"includeImages,omitzero"`
// Preserve hyperlinks in the Markdown output
IncludeLinks param.Opt[bool] `json:"includeLinks,omitzero"`
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `json:"maxAgeMs,omitzero"`
// Maximum link depth from the starting URL (0 = only the starting page)
MaxDepth param.Opt[int64] `json:"maxDepth,omitzero"`
// Maximum number of pages to crawl. Hard cap: 500.
MaxPages param.Opt[int64] `json:"maxPages,omitzero"`
// When true, waits briefly for CSS and transition animations to settle before
// extracting each crawled page. Defaults to false. This adds a bit of latency in
// exchange for more stable output on animated pages.
SettleAnimations param.Opt[bool] `json:"settleAnimations,omitzero"`
// Truncate base64-encoded image data in the Markdown output
ShortenBase64Images param.Opt[bool] `json:"shortenBase64Images,omitzero"`
// Soft time budget for the crawl in milliseconds. After each scrape, the crawler
// checks the elapsed time and, if exceeded, returns the pages collected so far
// instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000
// (80s).
StopAfterMs param.Opt[int64] `json:"stopAfterMs,omitzero"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `json:"timeoutMS,omitzero"`
// Regex pattern. Only URLs matching this pattern will be followed and scraped.
URLRegex param.Opt[string] `json:"urlRegex,omitzero"`
// Extract only the main content, stripping headers, footers, sidebars, and
// navigation
UseMainContentOnly param.Opt[bool] `json:"useMainContentOnly,omitzero"`
// Optional browser wait time in milliseconds after initial page load for each
// crawled page. Min: 0. Max: 30000 (30 seconds).
WaitForMs param.Opt[int64] `json:"waitForMs,omitzero"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country WebWebCrawlMdParamsCountry `json:"country,omitzero"`
// CSS selectors to remove before each crawled page is converted to Markdown.
// Applied after includeSelectors. Exclusion takes precedence: an element matching
// both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".
ExcludeSelectors []string `json:"excludeSelectors,omitzero"`
// CSS selectors. When provided, only matching HTML subtrees (and their
// descendants) are kept before each crawled page is converted to Markdown. When
// omitted, the entire document is kept. Examples: "article.main", "#content",
// "[role=main]".
IncludeSelectors []string `json:"includeSelectors,omitzero"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebCrawlMdParamsPdf `json:"pdf,omitzero"`
// Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
Tags []string `json:"tags,omitzero"`
// Set to enabled to bypass shared caches and omit request and response content
// from retained usage logs. Requires zero data retention to be enabled for your
// organization (contact support@context.dev), otherwise the request fails with
// ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
//
// Any of "enabled", "disabled".
Zdr WebWebCrawlMdParamsZdr `json:"zdr,omitzero"`
// contains filtered or unexported fields
}
func (WebWebCrawlMdParams) MarshalJSON ¶
func (r WebWebCrawlMdParams) MarshalJSON() (data []byte, err error)
func (*WebWebCrawlMdParams) UnmarshalJSON ¶
func (r *WebWebCrawlMdParams) UnmarshalJSON(data []byte) error
type WebWebCrawlMdParamsCountry ¶
type WebWebCrawlMdParamsCountry string
Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).
const ( WebWebCrawlMdParamsCountryAd WebWebCrawlMdParamsCountry = "ad" WebWebCrawlMdParamsCountryAe WebWebCrawlMdParamsCountry = "ae" WebWebCrawlMdParamsCountryAf WebWebCrawlMdParamsCountry = "af" WebWebCrawlMdParamsCountryAg WebWebCrawlMdParamsCountry = "ag" WebWebCrawlMdParamsCountryAI WebWebCrawlMdParamsCountry = "ai" WebWebCrawlMdParamsCountryAl WebWebCrawlMdParamsCountry = "al" WebWebCrawlMdParamsCountryAm WebWebCrawlMdParamsCountry = "am" WebWebCrawlMdParamsCountryAo WebWebCrawlMdParamsCountry = "ao" WebWebCrawlMdParamsCountryAr WebWebCrawlMdParamsCountry = "ar" WebWebCrawlMdParamsCountryAt WebWebCrawlMdParamsCountry = "at" WebWebCrawlMdParamsCountryAu WebWebCrawlMdParamsCountry = "au" WebWebCrawlMdParamsCountryAw WebWebCrawlMdParamsCountry = "aw" WebWebCrawlMdParamsCountryAz WebWebCrawlMdParamsCountry = "az" WebWebCrawlMdParamsCountryBa WebWebCrawlMdParamsCountry = "ba" WebWebCrawlMdParamsCountryBb WebWebCrawlMdParamsCountry = "bb" WebWebCrawlMdParamsCountryBd WebWebCrawlMdParamsCountry = "bd" WebWebCrawlMdParamsCountryBe WebWebCrawlMdParamsCountry = "be" WebWebCrawlMdParamsCountryBf WebWebCrawlMdParamsCountry = "bf" WebWebCrawlMdParamsCountryBg WebWebCrawlMdParamsCountry = "bg" WebWebCrawlMdParamsCountryBh WebWebCrawlMdParamsCountry = "bh" WebWebCrawlMdParamsCountryBi WebWebCrawlMdParamsCountry = "bi" WebWebCrawlMdParamsCountryBj WebWebCrawlMdParamsCountry = "bj" WebWebCrawlMdParamsCountryBm WebWebCrawlMdParamsCountry = "bm" WebWebCrawlMdParamsCountryBn WebWebCrawlMdParamsCountry = "bn" WebWebCrawlMdParamsCountryBo WebWebCrawlMdParamsCountry = "bo" WebWebCrawlMdParamsCountryBq WebWebCrawlMdParamsCountry = "bq" WebWebCrawlMdParamsCountryBr WebWebCrawlMdParamsCountry = "br" WebWebCrawlMdParamsCountryBs WebWebCrawlMdParamsCountry = "bs" WebWebCrawlMdParamsCountryBw WebWebCrawlMdParamsCountry = "bw" WebWebCrawlMdParamsCountryBy WebWebCrawlMdParamsCountry = "by" WebWebCrawlMdParamsCountryBz WebWebCrawlMdParamsCountry = "bz" WebWebCrawlMdParamsCountryCa WebWebCrawlMdParamsCountry = "ca" WebWebCrawlMdParamsCountryCd WebWebCrawlMdParamsCountry = "cd" WebWebCrawlMdParamsCountryCf WebWebCrawlMdParamsCountry = "cf" WebWebCrawlMdParamsCountryCg WebWebCrawlMdParamsCountry = "cg" WebWebCrawlMdParamsCountryCh WebWebCrawlMdParamsCountry = "ch" WebWebCrawlMdParamsCountryCi WebWebCrawlMdParamsCountry = "ci" WebWebCrawlMdParamsCountryCl WebWebCrawlMdParamsCountry = "cl" WebWebCrawlMdParamsCountryCm WebWebCrawlMdParamsCountry = "cm" WebWebCrawlMdParamsCountryCn WebWebCrawlMdParamsCountry = "cn" WebWebCrawlMdParamsCountryCo WebWebCrawlMdParamsCountry = "co" WebWebCrawlMdParamsCountryCr WebWebCrawlMdParamsCountry = "cr" WebWebCrawlMdParamsCountryCv WebWebCrawlMdParamsCountry = "cv" WebWebCrawlMdParamsCountryCw WebWebCrawlMdParamsCountry = "cw" WebWebCrawlMdParamsCountryCy WebWebCrawlMdParamsCountry = "cy" WebWebCrawlMdParamsCountryCz WebWebCrawlMdParamsCountry = "cz" WebWebCrawlMdParamsCountryDe WebWebCrawlMdParamsCountry = "de" WebWebCrawlMdParamsCountryDj WebWebCrawlMdParamsCountry = "dj" WebWebCrawlMdParamsCountryDk WebWebCrawlMdParamsCountry = "dk" WebWebCrawlMdParamsCountryDm WebWebCrawlMdParamsCountry = "dm" WebWebCrawlMdParamsCountryDo WebWebCrawlMdParamsCountry = "do" WebWebCrawlMdParamsCountryDz WebWebCrawlMdParamsCountry = "dz" WebWebCrawlMdParamsCountryEc WebWebCrawlMdParamsCountry = "ec" WebWebCrawlMdParamsCountryEe WebWebCrawlMdParamsCountry = "ee" WebWebCrawlMdParamsCountryEg WebWebCrawlMdParamsCountry = "eg" WebWebCrawlMdParamsCountryEs WebWebCrawlMdParamsCountry = "es" WebWebCrawlMdParamsCountryEt WebWebCrawlMdParamsCountry = "et" WebWebCrawlMdParamsCountryFi WebWebCrawlMdParamsCountry = "fi" WebWebCrawlMdParamsCountryFj WebWebCrawlMdParamsCountry = "fj" WebWebCrawlMdParamsCountryFr WebWebCrawlMdParamsCountry = "fr" WebWebCrawlMdParamsCountryGa WebWebCrawlMdParamsCountry = "ga" WebWebCrawlMdParamsCountryGB WebWebCrawlMdParamsCountry = "gb" WebWebCrawlMdParamsCountryGd WebWebCrawlMdParamsCountry = "gd" WebWebCrawlMdParamsCountryGe WebWebCrawlMdParamsCountry = "ge" WebWebCrawlMdParamsCountryGf WebWebCrawlMdParamsCountry = "gf" WebWebCrawlMdParamsCountryGg WebWebCrawlMdParamsCountry = "gg" WebWebCrawlMdParamsCountryGh WebWebCrawlMdParamsCountry = "gh" WebWebCrawlMdParamsCountryGm WebWebCrawlMdParamsCountry = "gm" WebWebCrawlMdParamsCountryGn WebWebCrawlMdParamsCountry = "gn" WebWebCrawlMdParamsCountryGp WebWebCrawlMdParamsCountry = "gp" WebWebCrawlMdParamsCountryGq WebWebCrawlMdParamsCountry = "gq" WebWebCrawlMdParamsCountryGr WebWebCrawlMdParamsCountry = "gr" WebWebCrawlMdParamsCountryGt WebWebCrawlMdParamsCountry = "gt" WebWebCrawlMdParamsCountryGu WebWebCrawlMdParamsCountry = "gu" WebWebCrawlMdParamsCountryGw WebWebCrawlMdParamsCountry = "gw" WebWebCrawlMdParamsCountryGy WebWebCrawlMdParamsCountry = "gy" WebWebCrawlMdParamsCountryHk WebWebCrawlMdParamsCountry = "hk" WebWebCrawlMdParamsCountryHn WebWebCrawlMdParamsCountry = "hn" WebWebCrawlMdParamsCountryHr WebWebCrawlMdParamsCountry = "hr" WebWebCrawlMdParamsCountryHt WebWebCrawlMdParamsCountry = "ht" WebWebCrawlMdParamsCountryHu WebWebCrawlMdParamsCountry = "hu" WebWebCrawlMdParamsCountryID WebWebCrawlMdParamsCountry = "id" WebWebCrawlMdParamsCountryIe WebWebCrawlMdParamsCountry = "ie" WebWebCrawlMdParamsCountryIl WebWebCrawlMdParamsCountry = "il" WebWebCrawlMdParamsCountryIm WebWebCrawlMdParamsCountry = "im" WebWebCrawlMdParamsCountryIn WebWebCrawlMdParamsCountry = "in" WebWebCrawlMdParamsCountryIq WebWebCrawlMdParamsCountry = "iq" WebWebCrawlMdParamsCountryIr WebWebCrawlMdParamsCountry = "ir" WebWebCrawlMdParamsCountryIs WebWebCrawlMdParamsCountry = "is" WebWebCrawlMdParamsCountryIt WebWebCrawlMdParamsCountry = "it" WebWebCrawlMdParamsCountryJe WebWebCrawlMdParamsCountry = "je" WebWebCrawlMdParamsCountryJm WebWebCrawlMdParamsCountry = "jm" WebWebCrawlMdParamsCountryJo WebWebCrawlMdParamsCountry = "jo" WebWebCrawlMdParamsCountryJp WebWebCrawlMdParamsCountry = "jp" WebWebCrawlMdParamsCountryKe WebWebCrawlMdParamsCountry = "ke" WebWebCrawlMdParamsCountryKg WebWebCrawlMdParamsCountry = "kg" WebWebCrawlMdParamsCountryKh WebWebCrawlMdParamsCountry = "kh" WebWebCrawlMdParamsCountryKn WebWebCrawlMdParamsCountry = "kn" WebWebCrawlMdParamsCountryKr WebWebCrawlMdParamsCountry = "kr" WebWebCrawlMdParamsCountryKw WebWebCrawlMdParamsCountry = "kw" WebWebCrawlMdParamsCountryKy WebWebCrawlMdParamsCountry = "ky" WebWebCrawlMdParamsCountryKz WebWebCrawlMdParamsCountry = "kz" WebWebCrawlMdParamsCountryLa WebWebCrawlMdParamsCountry = "la" WebWebCrawlMdParamsCountryLb WebWebCrawlMdParamsCountry = "lb" WebWebCrawlMdParamsCountryLc WebWebCrawlMdParamsCountry = "lc" WebWebCrawlMdParamsCountryLk WebWebCrawlMdParamsCountry = "lk" WebWebCrawlMdParamsCountryLr WebWebCrawlMdParamsCountry = "lr" WebWebCrawlMdParamsCountryLs WebWebCrawlMdParamsCountry = "ls" WebWebCrawlMdParamsCountryLt WebWebCrawlMdParamsCountry = "lt" WebWebCrawlMdParamsCountryLu WebWebCrawlMdParamsCountry = "lu" WebWebCrawlMdParamsCountryLv WebWebCrawlMdParamsCountry = "lv" WebWebCrawlMdParamsCountryLy WebWebCrawlMdParamsCountry = "ly" WebWebCrawlMdParamsCountryMa WebWebCrawlMdParamsCountry = "ma" WebWebCrawlMdParamsCountryMc WebWebCrawlMdParamsCountry = "mc" WebWebCrawlMdParamsCountryMd WebWebCrawlMdParamsCountry = "md" WebWebCrawlMdParamsCountryMe WebWebCrawlMdParamsCountry = "me" WebWebCrawlMdParamsCountryMf WebWebCrawlMdParamsCountry = "mf" WebWebCrawlMdParamsCountryMg WebWebCrawlMdParamsCountry = "mg" WebWebCrawlMdParamsCountryMk WebWebCrawlMdParamsCountry = "mk" WebWebCrawlMdParamsCountryMl WebWebCrawlMdParamsCountry = "ml" WebWebCrawlMdParamsCountryMm WebWebCrawlMdParamsCountry = "mm" WebWebCrawlMdParamsCountryMn WebWebCrawlMdParamsCountry = "mn" WebWebCrawlMdParamsCountryMo WebWebCrawlMdParamsCountry = "mo" WebWebCrawlMdParamsCountryMq WebWebCrawlMdParamsCountry = "mq" WebWebCrawlMdParamsCountryMr WebWebCrawlMdParamsCountry = "mr" WebWebCrawlMdParamsCountryMt WebWebCrawlMdParamsCountry = "mt" WebWebCrawlMdParamsCountryMu WebWebCrawlMdParamsCountry = "mu" WebWebCrawlMdParamsCountryMv WebWebCrawlMdParamsCountry = "mv" WebWebCrawlMdParamsCountryMw WebWebCrawlMdParamsCountry = "mw" WebWebCrawlMdParamsCountryMx WebWebCrawlMdParamsCountry = "mx" WebWebCrawlMdParamsCountryMy WebWebCrawlMdParamsCountry = "my" WebWebCrawlMdParamsCountryMz WebWebCrawlMdParamsCountry = "mz" WebWebCrawlMdParamsCountryNa WebWebCrawlMdParamsCountry = "na" WebWebCrawlMdParamsCountryNc WebWebCrawlMdParamsCountry = "nc" WebWebCrawlMdParamsCountryNe WebWebCrawlMdParamsCountry = "ne" WebWebCrawlMdParamsCountryNg WebWebCrawlMdParamsCountry = "ng" WebWebCrawlMdParamsCountryNi WebWebCrawlMdParamsCountry = "ni" WebWebCrawlMdParamsCountryNl WebWebCrawlMdParamsCountry = "nl" WebWebCrawlMdParamsCountryNo WebWebCrawlMdParamsCountry = "no" WebWebCrawlMdParamsCountryNp WebWebCrawlMdParamsCountry = "np" WebWebCrawlMdParamsCountryNz WebWebCrawlMdParamsCountry = "nz" WebWebCrawlMdParamsCountryOm WebWebCrawlMdParamsCountry = "om" WebWebCrawlMdParamsCountryPa WebWebCrawlMdParamsCountry = "pa" WebWebCrawlMdParamsCountryPe WebWebCrawlMdParamsCountry = "pe" WebWebCrawlMdParamsCountryPf WebWebCrawlMdParamsCountry = "pf" WebWebCrawlMdParamsCountryPg WebWebCrawlMdParamsCountry = "pg" WebWebCrawlMdParamsCountryPh WebWebCrawlMdParamsCountry = "ph" WebWebCrawlMdParamsCountryPk WebWebCrawlMdParamsCountry = "pk" WebWebCrawlMdParamsCountryPl WebWebCrawlMdParamsCountry = "pl" WebWebCrawlMdParamsCountryPr WebWebCrawlMdParamsCountry = "pr" WebWebCrawlMdParamsCountryPs WebWebCrawlMdParamsCountry = "ps" WebWebCrawlMdParamsCountryPt WebWebCrawlMdParamsCountry = "pt" WebWebCrawlMdParamsCountryPy WebWebCrawlMdParamsCountry = "py" WebWebCrawlMdParamsCountryQa WebWebCrawlMdParamsCountry = "qa" WebWebCrawlMdParamsCountryRe WebWebCrawlMdParamsCountry = "re" WebWebCrawlMdParamsCountryRo WebWebCrawlMdParamsCountry = "ro" WebWebCrawlMdParamsCountryRs WebWebCrawlMdParamsCountry = "rs" WebWebCrawlMdParamsCountryRu WebWebCrawlMdParamsCountry = "ru" WebWebCrawlMdParamsCountryRw WebWebCrawlMdParamsCountry = "rw" WebWebCrawlMdParamsCountrySa WebWebCrawlMdParamsCountry = "sa" WebWebCrawlMdParamsCountrySc WebWebCrawlMdParamsCountry = "sc" WebWebCrawlMdParamsCountrySd WebWebCrawlMdParamsCountry = "sd" WebWebCrawlMdParamsCountrySe WebWebCrawlMdParamsCountry = "se" WebWebCrawlMdParamsCountrySg WebWebCrawlMdParamsCountry = "sg" WebWebCrawlMdParamsCountrySi WebWebCrawlMdParamsCountry = "si" WebWebCrawlMdParamsCountrySk WebWebCrawlMdParamsCountry = "sk" WebWebCrawlMdParamsCountrySl WebWebCrawlMdParamsCountry = "sl" WebWebCrawlMdParamsCountrySm WebWebCrawlMdParamsCountry = "sm" WebWebCrawlMdParamsCountrySn WebWebCrawlMdParamsCountry = "sn" WebWebCrawlMdParamsCountrySo WebWebCrawlMdParamsCountry = "so" WebWebCrawlMdParamsCountrySr WebWebCrawlMdParamsCountry = "sr" WebWebCrawlMdParamsCountrySS WebWebCrawlMdParamsCountry = "ss" WebWebCrawlMdParamsCountrySt WebWebCrawlMdParamsCountry = "st" WebWebCrawlMdParamsCountrySv WebWebCrawlMdParamsCountry = "sv" WebWebCrawlMdParamsCountrySx WebWebCrawlMdParamsCountry = "sx" WebWebCrawlMdParamsCountrySy WebWebCrawlMdParamsCountry = "sy" WebWebCrawlMdParamsCountrySz WebWebCrawlMdParamsCountry = "sz" WebWebCrawlMdParamsCountryTc WebWebCrawlMdParamsCountry = "tc" WebWebCrawlMdParamsCountryTd WebWebCrawlMdParamsCountry = "td" WebWebCrawlMdParamsCountryTg WebWebCrawlMdParamsCountry = "tg" WebWebCrawlMdParamsCountryTh WebWebCrawlMdParamsCountry = "th" WebWebCrawlMdParamsCountryTj WebWebCrawlMdParamsCountry = "tj" WebWebCrawlMdParamsCountryTl WebWebCrawlMdParamsCountry = "tl" WebWebCrawlMdParamsCountryTm WebWebCrawlMdParamsCountry = "tm" WebWebCrawlMdParamsCountryTn WebWebCrawlMdParamsCountry = "tn" WebWebCrawlMdParamsCountryTr WebWebCrawlMdParamsCountry = "tr" WebWebCrawlMdParamsCountryTt WebWebCrawlMdParamsCountry = "tt" WebWebCrawlMdParamsCountryTw WebWebCrawlMdParamsCountry = "tw" WebWebCrawlMdParamsCountryTz WebWebCrawlMdParamsCountry = "tz" WebWebCrawlMdParamsCountryUa WebWebCrawlMdParamsCountry = "ua" WebWebCrawlMdParamsCountryUg WebWebCrawlMdParamsCountry = "ug" WebWebCrawlMdParamsCountryUs WebWebCrawlMdParamsCountry = "us" WebWebCrawlMdParamsCountryUy WebWebCrawlMdParamsCountry = "uy" WebWebCrawlMdParamsCountryUz WebWebCrawlMdParamsCountry = "uz" WebWebCrawlMdParamsCountryVc WebWebCrawlMdParamsCountry = "vc" WebWebCrawlMdParamsCountryVe WebWebCrawlMdParamsCountry = "ve" WebWebCrawlMdParamsCountryVg WebWebCrawlMdParamsCountry = "vg" WebWebCrawlMdParamsCountryVi WebWebCrawlMdParamsCountry = "vi" WebWebCrawlMdParamsCountryVn WebWebCrawlMdParamsCountry = "vn" WebWebCrawlMdParamsCountryYe WebWebCrawlMdParamsCountry = "ye" WebWebCrawlMdParamsCountryYt WebWebCrawlMdParamsCountry = "yt" WebWebCrawlMdParamsCountryZa WebWebCrawlMdParamsCountry = "za" WebWebCrawlMdParamsCountryZm WebWebCrawlMdParamsCountry = "zm" WebWebCrawlMdParamsCountryZw WebWebCrawlMdParamsCountry = "zw" )
type WebWebCrawlMdParamsPdf ¶
type WebWebCrawlMdParamsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `json:"end,omitzero"`
// When true, OCR the selected PDF pages that have no usable text layer (scans),
// replacing each recovered page's text with the OCR result while pages with a real
// text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
// of the base request cost.
Ocr param.Opt[bool] `json:"ocr,omitzero"`
// When true, PDF pages are fetched and parsed. When false, PDF pages are skipped
// entirely (not included in results and not counted as failures).
ShouldParse param.Opt[bool] `json:"shouldParse,omitzero"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `json:"start,omitzero"`
// contains filtered or unexported fields
}
PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
func (WebWebCrawlMdParamsPdf) MarshalJSON ¶
func (r WebWebCrawlMdParamsPdf) MarshalJSON() (data []byte, err error)
func (*WebWebCrawlMdParamsPdf) UnmarshalJSON ¶
func (r *WebWebCrawlMdParamsPdf) UnmarshalJSON(data []byte) error
type WebWebCrawlMdParamsZdr ¶ added in v2.5.0
type WebWebCrawlMdParamsZdr string
Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
const ( WebWebCrawlMdParamsZdrEnabled WebWebCrawlMdParamsZdr = "enabled" WebWebCrawlMdParamsZdrDisabled WebWebCrawlMdParamsZdr = "disabled" )
type WebWebCrawlMdResponse ¶
type WebWebCrawlMdResponse struct {
Metadata WebWebCrawlMdResponseMetadata `json:"metadata" api:"required"`
Results []WebWebCrawlMdResponseResult `json:"results" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebWebCrawlMdResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Metadata respjson.Field
Results respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebCrawlMdResponse) RawJSON ¶
func (r WebWebCrawlMdResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponse) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponse) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseKeyMetadata ¶
type WebWebCrawlMdResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebWebCrawlMdResponseKeyMetadata) RawJSON ¶
func (r WebWebCrawlMdResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseMetadata ¶
type WebWebCrawlMdResponseMetadata struct {
// Maximum crawl depth reached during the crawl
MaxCrawlDepth int64 `json:"maxCrawlDepth" api:"required"`
// Number of pages that failed to crawl
NumFailed int64 `json:"numFailed" api:"required"`
// Number of URLs skipped (PDFs when pdf.shouldParse=false, or URLs not matching
// urlRegex)
NumSkipped int64 `json:"numSkipped" api:"required"`
// Number of pages successfully crawled
NumSucceeded int64 `json:"numSucceeded" api:"required"`
// Total number of URLs crawled
NumURLs int64 `json:"numUrls" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MaxCrawlDepth respjson.Field
NumFailed respjson.Field
NumSkipped respjson.Field
NumSucceeded respjson.Field
NumURLs respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebCrawlMdResponseMetadata) RawJSON ¶
func (r WebWebCrawlMdResponseMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseMetadata) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseMetadata) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseResult ¶
type WebWebCrawlMdResponseResult struct {
// Extracted page content as Markdown (empty string on failure)
Markdown string `json:"markdown" api:"required"`
Metadata WebWebCrawlMdResponseResultMetadata `json:"metadata" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Markdown respjson.Field
Metadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebCrawlMdResponseResult) RawJSON ¶
func (r WebWebCrawlMdResponseResult) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseResult) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseResult) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseResultMetadata ¶
type WebWebCrawlMdResponseResultMetadata struct {
// Depth relative to the start URL. 0 = start URL, 1 = one link away.
CrawlDepth int64 `json:"crawlDepth" api:"required"`
// Final URL scraped after redirects or scraper fallback, when known. Falls back to
// sourceUrl when unavailable.
FinalURL string `json:"finalUrl" api:"required"`
// Original URL requested by the caller.
SourceURL string `json:"sourceUrl" api:"required"`
// HTTP status code of the response
StatusCode int64 `json:"statusCode" api:"required"`
// true if the page was fetched and parsed successfully
Success bool `json:"success" api:"required"`
// Best page title extracted from the page (empty string if unavailable).
Title string `json:"title" api:"required"`
// The crawl URL fetched for this page.
URL string `json:"url" api:"required"`
// Additional non-social meta tags not promoted to top-level metadata fields.
AdditionalMeta map[string]WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion `json:"additionalMeta"`
// Resolved alternate links from link rel=alternate tags.
Alternates []WebWebCrawlMdResponseResultMetadataAlternate `json:"alternates"`
// Author metadata, when present.
Author string `json:"author"`
// Resolved canonical URL, when present.
CanonicalURL string `json:"canonicalUrl"`
// Best description extracted from standard, Open Graph, or Twitter metadata.
Description string `json:"description"`
// Resolved favicon URL, when present.
Favicon string `json:"favicon"`
// Page headings (h1–h6) in document order, extracted from the unfiltered document.
// Capped at the first 500 headings. Omitted when the page has none.
Headings []WebWebCrawlMdResponseResultMetadataHeading `json:"headings"`
// Primary resolved preview image from Open Graph, Twitter, or image metadata.
Image string `json:"image"`
// JSON-LD structured data blocks parsed from the page.
JsonLd []map[string]any `json:"jsonLd"`
// Keywords extracted from the page's keywords meta tag.
Keywords []string `json:"keywords"`
// Language extracted from html lang or language meta tags.
Language string `json:"language"`
// Modified timestamp/date from page metadata, when present.
ModifiedTime string `json:"modifiedTime"`
// Open Graph metadata with the og: prefix removed and keys camel-cased.
OpenGraph map[string]WebWebCrawlMdResponseResultMetadataOpenGraphUnion `json:"openGraph"`
// Published timestamp/date from page metadata, when present.
PublishedTime string `json:"publishedTime"`
// Robots meta directive, when present.
Robots string `json:"robots"`
// Site or application name from page metadata.
SiteName string `json:"siteName"`
// Twitter card metadata with the twitter: prefix removed and keys camel-cased.
Twitter map[string]WebWebCrawlMdResponseResultMetadataTwitterUnion `json:"twitter"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CrawlDepth respjson.Field
FinalURL respjson.Field
SourceURL respjson.Field
StatusCode respjson.Field
Success respjson.Field
Title respjson.Field
URL respjson.Field
AdditionalMeta respjson.Field
Alternates respjson.Field
Author respjson.Field
CanonicalURL respjson.Field
Description respjson.Field
Favicon respjson.Field
Headings respjson.Field
Image respjson.Field
JsonLd respjson.Field
Keywords respjson.Field
Language respjson.Field
ModifiedTime respjson.Field
OpenGraph respjson.Field
PublishedTime respjson.Field
Robots respjson.Field
SiteName respjson.Field
Twitter respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebCrawlMdResponseResultMetadata) RawJSON ¶
func (r WebWebCrawlMdResponseResultMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseResultMetadata) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseResultMetadata) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion ¶
type WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) AsString ¶
func (u WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) AsString() (v string)
func (WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) AsStringArray ¶
func (u WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) AsStringArray() (v []string)
func (WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) RawJSON ¶
func (u WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseResultMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseResultMetadataAlternate ¶
type WebWebCrawlMdResponseResultMetadataAlternate struct {
// Resolved alternate URL.
Href string `json:"href" api:"required"`
// Language or locale for the alternate URL, when present.
Hreflang string `json:"hreflang"`
// Alternate resource title, when present.
Title string `json:"title"`
// Alternate resource MIME type, when present.
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Href respjson.Field
Hreflang respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebCrawlMdResponseResultMetadataAlternate) RawJSON ¶
func (r WebWebCrawlMdResponseResultMetadataAlternate) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseResultMetadataAlternate) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseResultMetadataAlternate) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseResultMetadataHeading ¶ added in v2.10.0
type WebWebCrawlMdResponseResultMetadataHeading struct {
// Heading level, 1–6 (from h1–h6).
Level int64 `json:"level" api:"required"`
// Heading text with whitespace collapsed, truncated to 1000 characters.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Level respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebCrawlMdResponseResultMetadataHeading) RawJSON ¶ added in v2.10.0
func (r WebWebCrawlMdResponseResultMetadataHeading) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseResultMetadataHeading) UnmarshalJSON ¶ added in v2.10.0
func (r *WebWebCrawlMdResponseResultMetadataHeading) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseResultMetadataOpenGraphUnion ¶
type WebWebCrawlMdResponseResultMetadataOpenGraphUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebCrawlMdResponseResultMetadataOpenGraphUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebCrawlMdResponseResultMetadataOpenGraphUnion) AsString ¶
func (u WebWebCrawlMdResponseResultMetadataOpenGraphUnion) AsString() (v string)
func (WebWebCrawlMdResponseResultMetadataOpenGraphUnion) AsStringArray ¶
func (u WebWebCrawlMdResponseResultMetadataOpenGraphUnion) AsStringArray() (v []string)
func (WebWebCrawlMdResponseResultMetadataOpenGraphUnion) RawJSON ¶
func (u WebWebCrawlMdResponseResultMetadataOpenGraphUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseResultMetadataOpenGraphUnion) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseResultMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
type WebWebCrawlMdResponseResultMetadataTwitterUnion ¶
type WebWebCrawlMdResponseResultMetadataTwitterUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebCrawlMdResponseResultMetadataTwitterUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebCrawlMdResponseResultMetadataTwitterUnion) AsString ¶
func (u WebWebCrawlMdResponseResultMetadataTwitterUnion) AsString() (v string)
func (WebWebCrawlMdResponseResultMetadataTwitterUnion) AsStringArray ¶
func (u WebWebCrawlMdResponseResultMetadataTwitterUnion) AsStringArray() (v []string)
func (WebWebCrawlMdResponseResultMetadataTwitterUnion) RawJSON ¶
func (u WebWebCrawlMdResponseResultMetadataTwitterUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebCrawlMdResponseResultMetadataTwitterUnion) UnmarshalJSON ¶
func (r *WebWebCrawlMdResponseResultMetadataTwitterUnion) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLParams ¶
type WebWebScrapeHTMLParams struct {
// Full URL to scrape (must include http:// or https:// protocol)
URL string `query:"url" api:"required" format:"uri" json:"-"`
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// Optional browser wait time in milliseconds after initial page load. Min: 0. Max:
// 30000 (30 seconds).
WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// When true, iframes are rendered inline into the returned HTML.
IncludeFrames param.Opt[bool] `query:"includeFrames,omitzero" json:"-"`
// When true, waits briefly for CSS and transition animations to settle before
// extracting HTML. Defaults to false. This adds a bit of latency in exchange for
// more stable output on animated pages.
SettleAnimations param.Opt[bool] `query:"settleAnimations,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// When true, return only the page's main content in the HTML response, excluding
// headers, footers, sidebars, and navigation when detectable.
UseMainContentOnly param.Opt[bool] `query:"useMainContentOnly,omitzero" json:"-"`
// Optional browser actions executed in array order after the page loads and before
// content is captured. Requires a paid plan. Send a JSON array in the query
// parameter. Maximum: 5 actions.
Actions []WebWebScrapeHTMLParamsActionUnion `query:"actions,omitzero" json:"-"`
// CSS selectors to remove from the result. Applied after includeSelectors.
// Exclusion takes precedence: an element matching both is removed. Examples:
// "nav", "footer", ".ad-banner", "[aria-hidden=true]".
ExcludeSelectors []string `query:"excludeSelectors,omitzero" json:"-"`
// CSS selectors. When provided, only matching subtrees (and their descendants) are
// kept and everything else is dropped. When omitted, the entire document is kept.
// Examples: "article.main", "#content", "[role=main]".
IncludeSelectors []string `query:"includeSelectors,omitzero" json:"-"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country WebWebScrapeHTMLParamsCountry `query:"country,omitzero" json:"-"`
// Optional outbound HTTP headers forwarded only to the target URL, sent as
// deep-object query params such as headers[X-Custom]=value. When provided, caching
// is bypassed: the result is neither read from nor written to cache.
Headers map[string]string `query:"headers,omitzero" json:"-"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebScrapeHTMLParamsPdf `query:"pdf,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// Set to enabled to bypass shared caches and omit request and response content
// from retained usage logs. Requires zero data retention to be enabled for your
// organization (contact support@context.dev), otherwise the request fails with
// ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
//
// Any of "enabled", "disabled".
Zdr WebWebScrapeHTMLParamsZdr `query:"zdr,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebWebScrapeHTMLParams) URLQuery ¶
func (r WebWebScrapeHTMLParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeHTMLParams's query parameters as `url.Values`.
type WebWebScrapeHTMLParamsActionPerform ¶ added in v2.5.0
type WebWebScrapeHTMLParamsActionPerform struct {
Action string `query:"action" api:"required" json:"-"`
// This field can be elided, and will marshal its zero value as "perform".
Do constant.Perform `query:"do" json:"-" default:"perform"`
// contains filtered or unexported fields
}
Resolve and perform one natural-language browser action.
The properties Action, Do are required.
func (WebWebScrapeHTMLParamsActionPerform) URLQuery ¶ added in v2.5.0
func (r WebWebScrapeHTMLParamsActionPerform) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeHTMLParamsActionPerform's query parameters as `url.Values`.
type WebWebScrapeHTMLParamsActionUnion ¶ added in v2.5.0
type WebWebScrapeHTMLParamsActionUnion struct {
OfWait *WebWebScrapeHTMLParamsActionWait `query:",omitzero,inline"`
OfPerform *WebWebScrapeHTMLParamsActionPerform `query:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
type WebWebScrapeHTMLParamsActionWait ¶ added in v2.5.0
type WebWebScrapeHTMLParamsActionWait struct {
TimeMs int64 `query:"timeMs" api:"required" json:"-"`
// This field can be elided, and will marshal its zero value as "wait".
Do constant.Wait `query:"do" json:"-" default:"wait"`
// contains filtered or unexported fields
}
Pause for a fixed number of milliseconds before continuing to the next action.
The properties Do, TimeMs are required.
func (WebWebScrapeHTMLParamsActionWait) URLQuery ¶ added in v2.5.0
func (r WebWebScrapeHTMLParamsActionWait) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeHTMLParamsActionWait's query parameters as `url.Values`.
type WebWebScrapeHTMLParamsCountry ¶
type WebWebScrapeHTMLParamsCountry string
Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).
const ( WebWebScrapeHTMLParamsCountryAd WebWebScrapeHTMLParamsCountry = "ad" WebWebScrapeHTMLParamsCountryAe WebWebScrapeHTMLParamsCountry = "ae" WebWebScrapeHTMLParamsCountryAf WebWebScrapeHTMLParamsCountry = "af" WebWebScrapeHTMLParamsCountryAg WebWebScrapeHTMLParamsCountry = "ag" WebWebScrapeHTMLParamsCountryAI WebWebScrapeHTMLParamsCountry = "ai" WebWebScrapeHTMLParamsCountryAl WebWebScrapeHTMLParamsCountry = "al" WebWebScrapeHTMLParamsCountryAm WebWebScrapeHTMLParamsCountry = "am" WebWebScrapeHTMLParamsCountryAo WebWebScrapeHTMLParamsCountry = "ao" WebWebScrapeHTMLParamsCountryAr WebWebScrapeHTMLParamsCountry = "ar" WebWebScrapeHTMLParamsCountryAt WebWebScrapeHTMLParamsCountry = "at" WebWebScrapeHTMLParamsCountryAu WebWebScrapeHTMLParamsCountry = "au" WebWebScrapeHTMLParamsCountryAw WebWebScrapeHTMLParamsCountry = "aw" WebWebScrapeHTMLParamsCountryAz WebWebScrapeHTMLParamsCountry = "az" WebWebScrapeHTMLParamsCountryBa WebWebScrapeHTMLParamsCountry = "ba" WebWebScrapeHTMLParamsCountryBb WebWebScrapeHTMLParamsCountry = "bb" WebWebScrapeHTMLParamsCountryBd WebWebScrapeHTMLParamsCountry = "bd" WebWebScrapeHTMLParamsCountryBe WebWebScrapeHTMLParamsCountry = "be" WebWebScrapeHTMLParamsCountryBf WebWebScrapeHTMLParamsCountry = "bf" WebWebScrapeHTMLParamsCountryBg WebWebScrapeHTMLParamsCountry = "bg" WebWebScrapeHTMLParamsCountryBh WebWebScrapeHTMLParamsCountry = "bh" WebWebScrapeHTMLParamsCountryBi WebWebScrapeHTMLParamsCountry = "bi" WebWebScrapeHTMLParamsCountryBj WebWebScrapeHTMLParamsCountry = "bj" WebWebScrapeHTMLParamsCountryBm WebWebScrapeHTMLParamsCountry = "bm" WebWebScrapeHTMLParamsCountryBn WebWebScrapeHTMLParamsCountry = "bn" WebWebScrapeHTMLParamsCountryBo WebWebScrapeHTMLParamsCountry = "bo" WebWebScrapeHTMLParamsCountryBq WebWebScrapeHTMLParamsCountry = "bq" WebWebScrapeHTMLParamsCountryBr WebWebScrapeHTMLParamsCountry = "br" WebWebScrapeHTMLParamsCountryBs WebWebScrapeHTMLParamsCountry = "bs" WebWebScrapeHTMLParamsCountryBw WebWebScrapeHTMLParamsCountry = "bw" WebWebScrapeHTMLParamsCountryBy WebWebScrapeHTMLParamsCountry = "by" WebWebScrapeHTMLParamsCountryBz WebWebScrapeHTMLParamsCountry = "bz" WebWebScrapeHTMLParamsCountryCa WebWebScrapeHTMLParamsCountry = "ca" WebWebScrapeHTMLParamsCountryCd WebWebScrapeHTMLParamsCountry = "cd" WebWebScrapeHTMLParamsCountryCf WebWebScrapeHTMLParamsCountry = "cf" WebWebScrapeHTMLParamsCountryCg WebWebScrapeHTMLParamsCountry = "cg" WebWebScrapeHTMLParamsCountryCh WebWebScrapeHTMLParamsCountry = "ch" WebWebScrapeHTMLParamsCountryCi WebWebScrapeHTMLParamsCountry = "ci" WebWebScrapeHTMLParamsCountryCl WebWebScrapeHTMLParamsCountry = "cl" WebWebScrapeHTMLParamsCountryCm WebWebScrapeHTMLParamsCountry = "cm" WebWebScrapeHTMLParamsCountryCn WebWebScrapeHTMLParamsCountry = "cn" WebWebScrapeHTMLParamsCountryCo WebWebScrapeHTMLParamsCountry = "co" WebWebScrapeHTMLParamsCountryCr WebWebScrapeHTMLParamsCountry = "cr" WebWebScrapeHTMLParamsCountryCv WebWebScrapeHTMLParamsCountry = "cv" WebWebScrapeHTMLParamsCountryCw WebWebScrapeHTMLParamsCountry = "cw" WebWebScrapeHTMLParamsCountryCy WebWebScrapeHTMLParamsCountry = "cy" WebWebScrapeHTMLParamsCountryCz WebWebScrapeHTMLParamsCountry = "cz" WebWebScrapeHTMLParamsCountryDe WebWebScrapeHTMLParamsCountry = "de" WebWebScrapeHTMLParamsCountryDj WebWebScrapeHTMLParamsCountry = "dj" WebWebScrapeHTMLParamsCountryDk WebWebScrapeHTMLParamsCountry = "dk" WebWebScrapeHTMLParamsCountryDm WebWebScrapeHTMLParamsCountry = "dm" WebWebScrapeHTMLParamsCountryDo WebWebScrapeHTMLParamsCountry = "do" WebWebScrapeHTMLParamsCountryDz WebWebScrapeHTMLParamsCountry = "dz" WebWebScrapeHTMLParamsCountryEc WebWebScrapeHTMLParamsCountry = "ec" WebWebScrapeHTMLParamsCountryEe WebWebScrapeHTMLParamsCountry = "ee" WebWebScrapeHTMLParamsCountryEg WebWebScrapeHTMLParamsCountry = "eg" WebWebScrapeHTMLParamsCountryEs WebWebScrapeHTMLParamsCountry = "es" WebWebScrapeHTMLParamsCountryEt WebWebScrapeHTMLParamsCountry = "et" WebWebScrapeHTMLParamsCountryFi WebWebScrapeHTMLParamsCountry = "fi" WebWebScrapeHTMLParamsCountryFj WebWebScrapeHTMLParamsCountry = "fj" WebWebScrapeHTMLParamsCountryFr WebWebScrapeHTMLParamsCountry = "fr" WebWebScrapeHTMLParamsCountryGa WebWebScrapeHTMLParamsCountry = "ga" WebWebScrapeHTMLParamsCountryGB WebWebScrapeHTMLParamsCountry = "gb" WebWebScrapeHTMLParamsCountryGd WebWebScrapeHTMLParamsCountry = "gd" WebWebScrapeHTMLParamsCountryGe WebWebScrapeHTMLParamsCountry = "ge" WebWebScrapeHTMLParamsCountryGf WebWebScrapeHTMLParamsCountry = "gf" WebWebScrapeHTMLParamsCountryGg WebWebScrapeHTMLParamsCountry = "gg" WebWebScrapeHTMLParamsCountryGh WebWebScrapeHTMLParamsCountry = "gh" WebWebScrapeHTMLParamsCountryGm WebWebScrapeHTMLParamsCountry = "gm" WebWebScrapeHTMLParamsCountryGn WebWebScrapeHTMLParamsCountry = "gn" WebWebScrapeHTMLParamsCountryGp WebWebScrapeHTMLParamsCountry = "gp" WebWebScrapeHTMLParamsCountryGq WebWebScrapeHTMLParamsCountry = "gq" WebWebScrapeHTMLParamsCountryGr WebWebScrapeHTMLParamsCountry = "gr" WebWebScrapeHTMLParamsCountryGt WebWebScrapeHTMLParamsCountry = "gt" WebWebScrapeHTMLParamsCountryGu WebWebScrapeHTMLParamsCountry = "gu" WebWebScrapeHTMLParamsCountryGw WebWebScrapeHTMLParamsCountry = "gw" WebWebScrapeHTMLParamsCountryGy WebWebScrapeHTMLParamsCountry = "gy" WebWebScrapeHTMLParamsCountryHk WebWebScrapeHTMLParamsCountry = "hk" WebWebScrapeHTMLParamsCountryHn WebWebScrapeHTMLParamsCountry = "hn" WebWebScrapeHTMLParamsCountryHr WebWebScrapeHTMLParamsCountry = "hr" WebWebScrapeHTMLParamsCountryHt WebWebScrapeHTMLParamsCountry = "ht" WebWebScrapeHTMLParamsCountryHu WebWebScrapeHTMLParamsCountry = "hu" WebWebScrapeHTMLParamsCountryID WebWebScrapeHTMLParamsCountry = "id" WebWebScrapeHTMLParamsCountryIe WebWebScrapeHTMLParamsCountry = "ie" WebWebScrapeHTMLParamsCountryIl WebWebScrapeHTMLParamsCountry = "il" WebWebScrapeHTMLParamsCountryIm WebWebScrapeHTMLParamsCountry = "im" WebWebScrapeHTMLParamsCountryIn WebWebScrapeHTMLParamsCountry = "in" WebWebScrapeHTMLParamsCountryIq WebWebScrapeHTMLParamsCountry = "iq" WebWebScrapeHTMLParamsCountryIr WebWebScrapeHTMLParamsCountry = "ir" WebWebScrapeHTMLParamsCountryIs WebWebScrapeHTMLParamsCountry = "is" WebWebScrapeHTMLParamsCountryIt WebWebScrapeHTMLParamsCountry = "it" WebWebScrapeHTMLParamsCountryJe WebWebScrapeHTMLParamsCountry = "je" WebWebScrapeHTMLParamsCountryJm WebWebScrapeHTMLParamsCountry = "jm" WebWebScrapeHTMLParamsCountryJo WebWebScrapeHTMLParamsCountry = "jo" WebWebScrapeHTMLParamsCountryJp WebWebScrapeHTMLParamsCountry = "jp" WebWebScrapeHTMLParamsCountryKe WebWebScrapeHTMLParamsCountry = "ke" WebWebScrapeHTMLParamsCountryKg WebWebScrapeHTMLParamsCountry = "kg" WebWebScrapeHTMLParamsCountryKh WebWebScrapeHTMLParamsCountry = "kh" WebWebScrapeHTMLParamsCountryKn WebWebScrapeHTMLParamsCountry = "kn" WebWebScrapeHTMLParamsCountryKr WebWebScrapeHTMLParamsCountry = "kr" WebWebScrapeHTMLParamsCountryKw WebWebScrapeHTMLParamsCountry = "kw" WebWebScrapeHTMLParamsCountryKy WebWebScrapeHTMLParamsCountry = "ky" WebWebScrapeHTMLParamsCountryKz WebWebScrapeHTMLParamsCountry = "kz" WebWebScrapeHTMLParamsCountryLa WebWebScrapeHTMLParamsCountry = "la" WebWebScrapeHTMLParamsCountryLb WebWebScrapeHTMLParamsCountry = "lb" WebWebScrapeHTMLParamsCountryLc WebWebScrapeHTMLParamsCountry = "lc" WebWebScrapeHTMLParamsCountryLk WebWebScrapeHTMLParamsCountry = "lk" WebWebScrapeHTMLParamsCountryLr WebWebScrapeHTMLParamsCountry = "lr" WebWebScrapeHTMLParamsCountryLs WebWebScrapeHTMLParamsCountry = "ls" WebWebScrapeHTMLParamsCountryLt WebWebScrapeHTMLParamsCountry = "lt" WebWebScrapeHTMLParamsCountryLu WebWebScrapeHTMLParamsCountry = "lu" WebWebScrapeHTMLParamsCountryLv WebWebScrapeHTMLParamsCountry = "lv" WebWebScrapeHTMLParamsCountryLy WebWebScrapeHTMLParamsCountry = "ly" WebWebScrapeHTMLParamsCountryMa WebWebScrapeHTMLParamsCountry = "ma" WebWebScrapeHTMLParamsCountryMc WebWebScrapeHTMLParamsCountry = "mc" WebWebScrapeHTMLParamsCountryMd WebWebScrapeHTMLParamsCountry = "md" WebWebScrapeHTMLParamsCountryMe WebWebScrapeHTMLParamsCountry = "me" WebWebScrapeHTMLParamsCountryMf WebWebScrapeHTMLParamsCountry = "mf" WebWebScrapeHTMLParamsCountryMg WebWebScrapeHTMLParamsCountry = "mg" WebWebScrapeHTMLParamsCountryMk WebWebScrapeHTMLParamsCountry = "mk" WebWebScrapeHTMLParamsCountryMl WebWebScrapeHTMLParamsCountry = "ml" WebWebScrapeHTMLParamsCountryMm WebWebScrapeHTMLParamsCountry = "mm" WebWebScrapeHTMLParamsCountryMn WebWebScrapeHTMLParamsCountry = "mn" WebWebScrapeHTMLParamsCountryMo WebWebScrapeHTMLParamsCountry = "mo" WebWebScrapeHTMLParamsCountryMq WebWebScrapeHTMLParamsCountry = "mq" WebWebScrapeHTMLParamsCountryMr WebWebScrapeHTMLParamsCountry = "mr" WebWebScrapeHTMLParamsCountryMt WebWebScrapeHTMLParamsCountry = "mt" WebWebScrapeHTMLParamsCountryMu WebWebScrapeHTMLParamsCountry = "mu" WebWebScrapeHTMLParamsCountryMv WebWebScrapeHTMLParamsCountry = "mv" WebWebScrapeHTMLParamsCountryMw WebWebScrapeHTMLParamsCountry = "mw" WebWebScrapeHTMLParamsCountryMx WebWebScrapeHTMLParamsCountry = "mx" WebWebScrapeHTMLParamsCountryMy WebWebScrapeHTMLParamsCountry = "my" WebWebScrapeHTMLParamsCountryMz WebWebScrapeHTMLParamsCountry = "mz" WebWebScrapeHTMLParamsCountryNa WebWebScrapeHTMLParamsCountry = "na" WebWebScrapeHTMLParamsCountryNc WebWebScrapeHTMLParamsCountry = "nc" WebWebScrapeHTMLParamsCountryNe WebWebScrapeHTMLParamsCountry = "ne" WebWebScrapeHTMLParamsCountryNg WebWebScrapeHTMLParamsCountry = "ng" WebWebScrapeHTMLParamsCountryNi WebWebScrapeHTMLParamsCountry = "ni" WebWebScrapeHTMLParamsCountryNl WebWebScrapeHTMLParamsCountry = "nl" WebWebScrapeHTMLParamsCountryNo WebWebScrapeHTMLParamsCountry = "no" WebWebScrapeHTMLParamsCountryNp WebWebScrapeHTMLParamsCountry = "np" WebWebScrapeHTMLParamsCountryNz WebWebScrapeHTMLParamsCountry = "nz" WebWebScrapeHTMLParamsCountryOm WebWebScrapeHTMLParamsCountry = "om" WebWebScrapeHTMLParamsCountryPa WebWebScrapeHTMLParamsCountry = "pa" WebWebScrapeHTMLParamsCountryPe WebWebScrapeHTMLParamsCountry = "pe" WebWebScrapeHTMLParamsCountryPf WebWebScrapeHTMLParamsCountry = "pf" WebWebScrapeHTMLParamsCountryPg WebWebScrapeHTMLParamsCountry = "pg" WebWebScrapeHTMLParamsCountryPh WebWebScrapeHTMLParamsCountry = "ph" WebWebScrapeHTMLParamsCountryPk WebWebScrapeHTMLParamsCountry = "pk" WebWebScrapeHTMLParamsCountryPl WebWebScrapeHTMLParamsCountry = "pl" WebWebScrapeHTMLParamsCountryPr WebWebScrapeHTMLParamsCountry = "pr" WebWebScrapeHTMLParamsCountryPs WebWebScrapeHTMLParamsCountry = "ps" WebWebScrapeHTMLParamsCountryPt WebWebScrapeHTMLParamsCountry = "pt" WebWebScrapeHTMLParamsCountryPy WebWebScrapeHTMLParamsCountry = "py" WebWebScrapeHTMLParamsCountryQa WebWebScrapeHTMLParamsCountry = "qa" WebWebScrapeHTMLParamsCountryRe WebWebScrapeHTMLParamsCountry = "re" WebWebScrapeHTMLParamsCountryRo WebWebScrapeHTMLParamsCountry = "ro" WebWebScrapeHTMLParamsCountryRs WebWebScrapeHTMLParamsCountry = "rs" WebWebScrapeHTMLParamsCountryRu WebWebScrapeHTMLParamsCountry = "ru" WebWebScrapeHTMLParamsCountryRw WebWebScrapeHTMLParamsCountry = "rw" WebWebScrapeHTMLParamsCountrySa WebWebScrapeHTMLParamsCountry = "sa" WebWebScrapeHTMLParamsCountrySc WebWebScrapeHTMLParamsCountry = "sc" WebWebScrapeHTMLParamsCountrySd WebWebScrapeHTMLParamsCountry = "sd" WebWebScrapeHTMLParamsCountrySe WebWebScrapeHTMLParamsCountry = "se" WebWebScrapeHTMLParamsCountrySg WebWebScrapeHTMLParamsCountry = "sg" WebWebScrapeHTMLParamsCountrySi WebWebScrapeHTMLParamsCountry = "si" WebWebScrapeHTMLParamsCountrySk WebWebScrapeHTMLParamsCountry = "sk" WebWebScrapeHTMLParamsCountrySl WebWebScrapeHTMLParamsCountry = "sl" WebWebScrapeHTMLParamsCountrySm WebWebScrapeHTMLParamsCountry = "sm" WebWebScrapeHTMLParamsCountrySn WebWebScrapeHTMLParamsCountry = "sn" WebWebScrapeHTMLParamsCountrySo WebWebScrapeHTMLParamsCountry = "so" WebWebScrapeHTMLParamsCountrySr WebWebScrapeHTMLParamsCountry = "sr" WebWebScrapeHTMLParamsCountrySS WebWebScrapeHTMLParamsCountry = "ss" WebWebScrapeHTMLParamsCountrySt WebWebScrapeHTMLParamsCountry = "st" WebWebScrapeHTMLParamsCountrySv WebWebScrapeHTMLParamsCountry = "sv" WebWebScrapeHTMLParamsCountrySx WebWebScrapeHTMLParamsCountry = "sx" WebWebScrapeHTMLParamsCountrySy WebWebScrapeHTMLParamsCountry = "sy" WebWebScrapeHTMLParamsCountrySz WebWebScrapeHTMLParamsCountry = "sz" WebWebScrapeHTMLParamsCountryTc WebWebScrapeHTMLParamsCountry = "tc" WebWebScrapeHTMLParamsCountryTd WebWebScrapeHTMLParamsCountry = "td" WebWebScrapeHTMLParamsCountryTg WebWebScrapeHTMLParamsCountry = "tg" WebWebScrapeHTMLParamsCountryTh WebWebScrapeHTMLParamsCountry = "th" WebWebScrapeHTMLParamsCountryTj WebWebScrapeHTMLParamsCountry = "tj" WebWebScrapeHTMLParamsCountryTl WebWebScrapeHTMLParamsCountry = "tl" WebWebScrapeHTMLParamsCountryTm WebWebScrapeHTMLParamsCountry = "tm" WebWebScrapeHTMLParamsCountryTn WebWebScrapeHTMLParamsCountry = "tn" WebWebScrapeHTMLParamsCountryTr WebWebScrapeHTMLParamsCountry = "tr" WebWebScrapeHTMLParamsCountryTt WebWebScrapeHTMLParamsCountry = "tt" WebWebScrapeHTMLParamsCountryTw WebWebScrapeHTMLParamsCountry = "tw" WebWebScrapeHTMLParamsCountryTz WebWebScrapeHTMLParamsCountry = "tz" WebWebScrapeHTMLParamsCountryUa WebWebScrapeHTMLParamsCountry = "ua" WebWebScrapeHTMLParamsCountryUg WebWebScrapeHTMLParamsCountry = "ug" WebWebScrapeHTMLParamsCountryUs WebWebScrapeHTMLParamsCountry = "us" WebWebScrapeHTMLParamsCountryUy WebWebScrapeHTMLParamsCountry = "uy" WebWebScrapeHTMLParamsCountryUz WebWebScrapeHTMLParamsCountry = "uz" WebWebScrapeHTMLParamsCountryVc WebWebScrapeHTMLParamsCountry = "vc" WebWebScrapeHTMLParamsCountryVe WebWebScrapeHTMLParamsCountry = "ve" WebWebScrapeHTMLParamsCountryVg WebWebScrapeHTMLParamsCountry = "vg" WebWebScrapeHTMLParamsCountryVi WebWebScrapeHTMLParamsCountry = "vi" WebWebScrapeHTMLParamsCountryVn WebWebScrapeHTMLParamsCountry = "vn" WebWebScrapeHTMLParamsCountryYe WebWebScrapeHTMLParamsCountry = "ye" WebWebScrapeHTMLParamsCountryYt WebWebScrapeHTMLParamsCountry = "yt" WebWebScrapeHTMLParamsCountryZa WebWebScrapeHTMLParamsCountry = "za" WebWebScrapeHTMLParamsCountryZm WebWebScrapeHTMLParamsCountry = "zm" WebWebScrapeHTMLParamsCountryZw WebWebScrapeHTMLParamsCountry = "zw" )
type WebWebScrapeHTMLParamsPdf ¶
type WebWebScrapeHTMLParamsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `query:"end,omitzero" json:"-"`
// When true, OCR the selected PDF pages that have no usable text layer (scans),
// replacing each recovered page's text with the OCR result while pages with a real
// text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
// of the base request cost. When false, no OCR runs.
Ocr param.Opt[bool] `query:"ocr,omitzero" json:"-"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 PDF_SKIPPED is returned.
ShouldParse param.Opt[bool] `query:"shouldParse,omitzero" json:"-"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `query:"start,omitzero" json:"-"`
// contains filtered or unexported fields
}
PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
func (WebWebScrapeHTMLParamsPdf) URLQuery ¶
func (r WebWebScrapeHTMLParamsPdf) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeHTMLParamsPdf's query parameters as `url.Values`.
type WebWebScrapeHTMLParamsZdr ¶ added in v2.5.0
type WebWebScrapeHTMLParamsZdr string
Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
const ( WebWebScrapeHTMLParamsZdrEnabled WebWebScrapeHTMLParamsZdr = "enabled" WebWebScrapeHTMLParamsZdrDisabled WebWebScrapeHTMLParamsZdr = "disabled" )
type WebWebScrapeHTMLResponse ¶
type WebWebScrapeHTMLResponse struct {
// The scraped content of the page. For normal pages this is the raw HTML. When the
// page is a sitemap or feed served behind an XSL stylesheet (which browsers render
// into HTML), this is the underlying XML instead — see the `type` field.
HTML string `json:"html" api:"required"`
// Metadata extracted from the scraped page HTML.
Metadata WebWebScrapeHTMLResponseMetadata `json:"metadata" api:"required"`
// Indicates success
//
// Any of true.
Success bool `json:"success" api:"required"`
// Detected content type of the returned `html` field. Sitemaps and feeds are
// surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as
// `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations
// are surfaced as `pptx`/`ppt` with the extracted slides as HTML.
//
// Any of "html", "xml", "json", "text", "csv", "markdown", "svg", "pdf", "docx",
// "doc", "xlsx", "xls", "pptx", "ppt".
Type WebWebScrapeHTMLResponseType `json:"type" api:"required"`
// The URL that was scraped
URL string `json:"url" api:"required"`
// One verified outcome per requested browser action, in request order.
ActionsApplied []WebWebScrapeHTMLResponseActionsApplied `json:"actionsApplied"`
// True when an action was applied but the returned content could not be refreshed
// afterward.
ActionsHTMLStale bool `json:"actionsHtmlStale"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebWebScrapeHTMLResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
HTML respjson.Field
Metadata respjson.Field
Success respjson.Field
Type respjson.Field
URL respjson.Field
ActionsApplied respjson.Field
ActionsHTMLStale respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeHTMLResponse) RawJSON ¶
func (r WebWebScrapeHTMLResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponse) UnmarshalJSON ¶
func (r *WebWebScrapeHTMLResponse) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseActionsApplied ¶ added in v2.6.0
type WebWebScrapeHTMLResponseActionsApplied struct {
Instruction string `json:"instruction" api:"required"`
// Applied means the requested page state was visibly verified. Failed means it was
// not verified. Skipped means it was not attempted.
//
// Any of "applied", "failed", "skipped".
Status string `json:"status" api:"required"`
// Visible page evidence used to verify an applied action.
CompletionEvidence string `json:"completionEvidence"`
DurationMs float64 `json:"durationMs"`
Error string `json:"error"`
Method string `json:"method"`
TargetDescription string `json:"targetDescription"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Instruction respjson.Field
Status respjson.Field
CompletionEvidence respjson.Field
DurationMs respjson.Field
Error respjson.Field
Method respjson.Field
TargetDescription respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeHTMLResponseActionsApplied) RawJSON ¶ added in v2.6.0
func (r WebWebScrapeHTMLResponseActionsApplied) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseActionsApplied) UnmarshalJSON ¶ added in v2.6.0
func (r *WebWebScrapeHTMLResponseActionsApplied) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseKeyMetadata ¶
type WebWebScrapeHTMLResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebWebScrapeHTMLResponseKeyMetadata) RawJSON ¶
func (r WebWebScrapeHTMLResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebWebScrapeHTMLResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseMetadata ¶
type WebWebScrapeHTMLResponseMetadata struct {
// Final URL scraped after redirects or scraper fallback, when known. Falls back to
// sourceUrl when unavailable.
FinalURL string `json:"finalUrl" api:"required"`
// Original URL requested by the caller.
SourceURL string `json:"sourceUrl" api:"required"`
// Additional non-social meta tags not promoted to top-level metadata fields.
AdditionalMeta map[string]WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion `json:"additionalMeta"`
// Resolved alternate links from link rel=alternate tags.
Alternates []WebWebScrapeHTMLResponseMetadataAlternate `json:"alternates"`
// Author metadata, when present.
Author string `json:"author"`
// Resolved canonical URL, when present.
CanonicalURL string `json:"canonicalUrl"`
// Best description extracted from standard, Open Graph, or Twitter metadata.
Description string `json:"description"`
// Resolved favicon URL, when present.
Favicon string `json:"favicon"`
// Page headings (h1–h6) in document order, extracted from the unfiltered document.
// Capped at the first 500 headings. Omitted when the page has none.
Headings []WebWebScrapeHTMLResponseMetadataHeading `json:"headings"`
// Primary resolved preview image from Open Graph, Twitter, or image metadata.
Image string `json:"image"`
// JSON-LD structured data blocks parsed from the page.
JsonLd []map[string]any `json:"jsonLd"`
// Keywords extracted from the page's keywords meta tag.
Keywords []string `json:"keywords"`
// Language extracted from html lang or language meta tags.
Language string `json:"language"`
// Modified timestamp/date from page metadata, when present.
ModifiedTime string `json:"modifiedTime"`
// Open Graph metadata with the og: prefix removed and keys camel-cased.
OpenGraph map[string]WebWebScrapeHTMLResponseMetadataOpenGraphUnion `json:"openGraph"`
// Published timestamp/date from page metadata, when present.
PublishedTime string `json:"publishedTime"`
// Robots meta directive, when present.
Robots string `json:"robots"`
// Site or application name from page metadata.
SiteName string `json:"siteName"`
// Best title extracted from the page.
Title string `json:"title"`
// Twitter card metadata with the twitter: prefix removed and keys camel-cased.
Twitter map[string]WebWebScrapeHTMLResponseMetadataTwitterUnion `json:"twitter"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FinalURL respjson.Field
SourceURL respjson.Field
AdditionalMeta respjson.Field
Alternates respjson.Field
Author respjson.Field
CanonicalURL respjson.Field
Description respjson.Field
Favicon respjson.Field
Headings respjson.Field
Image respjson.Field
JsonLd respjson.Field
Keywords respjson.Field
Language respjson.Field
ModifiedTime respjson.Field
OpenGraph respjson.Field
PublishedTime respjson.Field
Robots respjson.Field
SiteName respjson.Field
Title respjson.Field
Twitter respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata extracted from the scraped page HTML.
func (WebWebScrapeHTMLResponseMetadata) RawJSON ¶
func (r WebWebScrapeHTMLResponseMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseMetadata) UnmarshalJSON ¶
func (r *WebWebScrapeHTMLResponseMetadata) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion ¶
type WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) AsString ¶
func (u WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) AsString() (v string)
func (WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) AsStringArray ¶
func (u WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) AsStringArray() (v []string)
func (WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) RawJSON ¶
func (u WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) UnmarshalJSON ¶
func (r *WebWebScrapeHTMLResponseMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseMetadataAlternate ¶
type WebWebScrapeHTMLResponseMetadataAlternate struct {
// Resolved alternate URL.
Href string `json:"href" api:"required"`
// Language or locale for the alternate URL, when present.
Hreflang string `json:"hreflang"`
// Alternate resource title, when present.
Title string `json:"title"`
// Alternate resource MIME type, when present.
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Href respjson.Field
Hreflang respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeHTMLResponseMetadataAlternate) RawJSON ¶
func (r WebWebScrapeHTMLResponseMetadataAlternate) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseMetadataAlternate) UnmarshalJSON ¶
func (r *WebWebScrapeHTMLResponseMetadataAlternate) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseMetadataHeading ¶ added in v2.10.0
type WebWebScrapeHTMLResponseMetadataHeading struct {
// Heading level, 1–6 (from h1–h6).
Level int64 `json:"level" api:"required"`
// Heading text with whitespace collapsed, truncated to 1000 characters.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Level respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeHTMLResponseMetadataHeading) RawJSON ¶ added in v2.10.0
func (r WebWebScrapeHTMLResponseMetadataHeading) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseMetadataHeading) UnmarshalJSON ¶ added in v2.10.0
func (r *WebWebScrapeHTMLResponseMetadataHeading) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseMetadataOpenGraphUnion ¶
type WebWebScrapeHTMLResponseMetadataOpenGraphUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebScrapeHTMLResponseMetadataOpenGraphUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebScrapeHTMLResponseMetadataOpenGraphUnion) AsString ¶
func (u WebWebScrapeHTMLResponseMetadataOpenGraphUnion) AsString() (v string)
func (WebWebScrapeHTMLResponseMetadataOpenGraphUnion) AsStringArray ¶
func (u WebWebScrapeHTMLResponseMetadataOpenGraphUnion) AsStringArray() (v []string)
func (WebWebScrapeHTMLResponseMetadataOpenGraphUnion) RawJSON ¶
func (u WebWebScrapeHTMLResponseMetadataOpenGraphUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseMetadataOpenGraphUnion) UnmarshalJSON ¶
func (r *WebWebScrapeHTMLResponseMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseMetadataTwitterUnion ¶
type WebWebScrapeHTMLResponseMetadataTwitterUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebScrapeHTMLResponseMetadataTwitterUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebScrapeHTMLResponseMetadataTwitterUnion) AsString ¶
func (u WebWebScrapeHTMLResponseMetadataTwitterUnion) AsString() (v string)
func (WebWebScrapeHTMLResponseMetadataTwitterUnion) AsStringArray ¶
func (u WebWebScrapeHTMLResponseMetadataTwitterUnion) AsStringArray() (v []string)
func (WebWebScrapeHTMLResponseMetadataTwitterUnion) RawJSON ¶
func (u WebWebScrapeHTMLResponseMetadataTwitterUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeHTMLResponseMetadataTwitterUnion) UnmarshalJSON ¶
func (r *WebWebScrapeHTMLResponseMetadataTwitterUnion) UnmarshalJSON(data []byte) error
type WebWebScrapeHTMLResponseType ¶
type WebWebScrapeHTMLResponseType string
Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations are surfaced as `pptx`/`ppt` with the extracted slides as HTML.
const ( WebWebScrapeHTMLResponseTypeHTML WebWebScrapeHTMLResponseType = "html" WebWebScrapeHTMLResponseTypeXml WebWebScrapeHTMLResponseType = "xml" WebWebScrapeHTMLResponseTypeJson WebWebScrapeHTMLResponseType = "json" WebWebScrapeHTMLResponseTypeText WebWebScrapeHTMLResponseType = "text" WebWebScrapeHTMLResponseTypeCsv WebWebScrapeHTMLResponseType = "csv" WebWebScrapeHTMLResponseTypeMarkdown WebWebScrapeHTMLResponseType = "markdown" WebWebScrapeHTMLResponseTypeSvg WebWebScrapeHTMLResponseType = "svg" WebWebScrapeHTMLResponseTypePdf WebWebScrapeHTMLResponseType = "pdf" WebWebScrapeHTMLResponseTypeDocx WebWebScrapeHTMLResponseType = "docx" WebWebScrapeHTMLResponseTypeDoc WebWebScrapeHTMLResponseType = "doc" WebWebScrapeHTMLResponseTypeXlsx WebWebScrapeHTMLResponseType = "xlsx" WebWebScrapeHTMLResponseTypeXls WebWebScrapeHTMLResponseType = "xls" WebWebScrapeHTMLResponseTypePptx WebWebScrapeHTMLResponseType = "pptx" WebWebScrapeHTMLResponseTypePpt WebWebScrapeHTMLResponseType = "ppt" )
type WebWebScrapeImagesParams ¶
type WebWebScrapeImagesParams struct {
// Page URL to inspect. Must include http:// or https://.
URL string `query:"url" api:"required" format:"uri" json:"-"`
// Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1
// day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days).
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// Optional browser wait time in milliseconds after initial page load before
// collecting images. Min: 0. Max: 30000 (30 seconds).
WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// When true, visually duplicate images are removed: every image is loaded and
// perceptually hashed, and only the highest-resolution copy of each duplicate
// group is kept. Images that cannot be downloaded or hashed are kept. Default:
// false.
Dedupe param.Opt[bool] `query:"dedupe,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional browser actions executed in array order after the page loads and before
// content is captured. Requires a paid plan. Send a JSON array in the query
// parameter. Maximum: 5 actions.
Actions []WebWebScrapeImagesParamsActionUnion `query:"actions,omitzero" json:"-"`
// Optional per-image processing, sent as deep-object query params such as
// enrichment[resolution]=true.
Enrichment WebWebScrapeImagesParamsEnrichment `query:"enrichment,omitzero" json:"-"`
// Optional outbound HTTP headers forwarded only to the target URL, sent as
// deep-object query params such as headers[X-Custom]=value. When provided, caching
// is bypassed: the result is neither read from nor written to cache.
Headers map[string]string `query:"headers,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebWebScrapeImagesParams) URLQuery ¶
func (r WebWebScrapeImagesParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeImagesParams's query parameters as `url.Values`.
type WebWebScrapeImagesParamsActionPerform ¶ added in v2.5.0
type WebWebScrapeImagesParamsActionPerform struct {
Action string `query:"action" api:"required" json:"-"`
// This field can be elided, and will marshal its zero value as "perform".
Do constant.Perform `query:"do" json:"-" default:"perform"`
// contains filtered or unexported fields
}
Resolve and perform one natural-language browser action.
The properties Action, Do are required.
func (WebWebScrapeImagesParamsActionPerform) URLQuery ¶ added in v2.5.0
func (r WebWebScrapeImagesParamsActionPerform) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeImagesParamsActionPerform's query parameters as `url.Values`.
type WebWebScrapeImagesParamsActionUnion ¶ added in v2.5.0
type WebWebScrapeImagesParamsActionUnion struct {
OfWait *WebWebScrapeImagesParamsActionWait `query:",omitzero,inline"`
OfPerform *WebWebScrapeImagesParamsActionPerform `query:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
type WebWebScrapeImagesParamsActionWait ¶ added in v2.5.0
type WebWebScrapeImagesParamsActionWait struct {
TimeMs int64 `query:"timeMs" api:"required" json:"-"`
// This field can be elided, and will marshal its zero value as "wait".
Do constant.Wait `query:"do" json:"-" default:"wait"`
// contains filtered or unexported fields
}
Pause for a fixed number of milliseconds before continuing to the next action.
The properties Do, TimeMs are required.
func (WebWebScrapeImagesParamsActionWait) URLQuery ¶ added in v2.5.0
func (r WebWebScrapeImagesParamsActionWait) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeImagesParamsActionWait's query parameters as `url.Values`.
type WebWebScrapeImagesParamsEnrichment ¶
type WebWebScrapeImagesParamsEnrichment struct {
// Classify each image by visual asset type.
Classification param.Opt[bool] `query:"classification,omitzero" json:"-"`
// Host materializable images on the Brand.dev CDN and return their URL and MIME
// type.
HostedURL param.Opt[bool] `query:"hostedUrl,omitzero" json:"-"`
// Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000.
MaxTimePerMs param.Opt[int64] `query:"maxTimePerMs,omitzero" json:"-"`
// Measure image width and height when possible.
Resolution param.Opt[bool] `query:"resolution,omitzero" json:"-"`
// contains filtered or unexported fields
}
Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true.
func (WebWebScrapeImagesParamsEnrichment) URLQuery ¶
func (r WebWebScrapeImagesParamsEnrichment) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeImagesParamsEnrichment's query parameters as `url.Values`.
type WebWebScrapeImagesResponse ¶
type WebWebScrapeImagesResponse struct {
// Images found on the page.
Images []WebWebScrapeImagesResponseImage `json:"images" api:"required"`
// Always true on success.
//
// Any of true.
Success bool `json:"success" api:"required"`
// Page URL that was scraped.
URL string `json:"url" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebWebScrapeImagesResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Images respjson.Field
Success respjson.Field
URL respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeImagesResponse) RawJSON ¶
func (r WebWebScrapeImagesResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeImagesResponse) UnmarshalJSON ¶
func (r *WebWebScrapeImagesResponse) UnmarshalJSON(data []byte) error
type WebWebScrapeImagesResponseImage ¶
type WebWebScrapeImagesResponseImage struct {
// Image alt text, or null when unavailable.
Alt string `json:"alt" api:"required"`
// Where the image was found.
//
// Any of "img", "svg", "link", "source", "video", "css", "object", "meta",
// "background".
Element string `json:"element" api:"required"`
// Original image value: URL, inline SVG or HTML, or base64 data URI.
Src string `json:"src" api:"required"`
// Format of src.
//
// Any of "url", "html", "base64".
Type string `json:"type" api:"required"`
// Requested metadata for images that could be processed.
Enrichment WebWebScrapeImagesResponseImageEnrichment `json:"enrichment"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Alt respjson.Field
Element respjson.Field
Src respjson.Field
Type respjson.Field
Enrichment respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeImagesResponseImage) RawJSON ¶
func (r WebWebScrapeImagesResponseImage) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeImagesResponseImage) UnmarshalJSON ¶
func (r *WebWebScrapeImagesResponseImage) UnmarshalJSON(data []byte) error
type WebWebScrapeImagesResponseImageEnrichment ¶
type WebWebScrapeImagesResponseImageEnrichment struct {
// Image height in pixels, when measured.
Height int64 `json:"height"`
// Detected MIME type, when hosted.
Mimetype string `json:"mimetype"`
// Visual asset category, when classified.
//
// Any of "photography", "illustration", "logo", "wordmark", "icon", "pattern",
// "graphic", "other".
Type string `json:"type"`
// Brand.dev CDN URL, when hosted.
URL string `json:"url" format:"uri"`
// Image width in pixels, when measured.
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Height respjson.Field
Mimetype respjson.Field
Type respjson.Field
URL respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Requested metadata for images that could be processed.
func (WebWebScrapeImagesResponseImageEnrichment) RawJSON ¶
func (r WebWebScrapeImagesResponseImageEnrichment) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeImagesResponseImageEnrichment) UnmarshalJSON ¶
func (r *WebWebScrapeImagesResponseImageEnrichment) UnmarshalJSON(data []byte) error
type WebWebScrapeImagesResponseKeyMetadata ¶
type WebWebScrapeImagesResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebWebScrapeImagesResponseKeyMetadata) RawJSON ¶
func (r WebWebScrapeImagesResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeImagesResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebWebScrapeImagesResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebWebScrapeMdParams ¶
type WebWebScrapeMdParams struct {
// Full URL to scrape into LLM usable Markdown (must include http:// or https://
// protocol)
URL string `query:"url" api:"required" format:"uri" json:"-"`
// Return a cached result if a prior scrape for the same parameters exists and is
// younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
// omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
MaxAgeMs param.Opt[int64] `query:"maxAgeMs,omitzero" json:"-"`
// Optional browser wait time in milliseconds after initial page load before
// converting the page to Markdown. Min: 0. Max: 30000 (30 seconds).
WaitForMs param.Opt[int64] `query:"waitForMs,omitzero" json:"-"`
// When true, the contents of iframes are rendered to Markdown.
IncludeFrames param.Opt[bool] `query:"includeFrames,omitzero" json:"-"`
// When true, the response also includes an `html` field with the page HTML the
// Markdown was converted from — the same body the Scrape HTML endpoint returns for
// the equivalent request.
IncludeHTML param.Opt[bool] `query:"includeHTML,omitzero" json:"-"`
// Include image references in Markdown output
IncludeImages param.Opt[bool] `query:"includeImages,omitzero" json:"-"`
// Preserve hyperlinks in Markdown output
IncludeLinks param.Opt[bool] `query:"includeLinks,omitzero" json:"-"`
// When true, waits briefly for CSS and transition animations to settle before
// converting to Markdown. Defaults to false. This adds a bit of latency in
// exchange for more stable output on animated pages.
SettleAnimations param.Opt[bool] `query:"settleAnimations,omitzero" json:"-"`
// Shorten base64-encoded image data in the Markdown output
ShortenBase64Images param.Opt[bool] `query:"shortenBase64Images,omitzero" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Extract only the main content of the page, excluding headers, footers, sidebars,
// and navigation
UseMainContentOnly param.Opt[bool] `query:"useMainContentOnly,omitzero" json:"-"`
// Optional browser actions executed in array order after the page loads and before
// content is captured. Requires a paid plan. Send a JSON array in the query
// parameter. Maximum: 5 actions.
Actions []WebWebScrapeMdParamsActionUnion `query:"actions,omitzero" json:"-"`
// CSS selectors to remove before conversion to Markdown. Applied after
// includeSelectors. Exclusion takes precedence: an element matching both is
// removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".
ExcludeSelectors []string `query:"excludeSelectors,omitzero" json:"-"`
// CSS selectors. When provided, only matching HTML subtrees (and their
// descendants) are kept before conversion to Markdown. When omitted, the entire
// document is kept. Examples: "article.main", "#content", "[role=main]".
IncludeSelectors []string `query:"includeSelectors,omitzero" json:"-"`
// Fetch the target page through a residential proxy in this country (ISO 3166-1
// alpha-2).
//
// Any of "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "ar", "at", "au", "aw",
// "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo",
// "bq", "br", "bs", "bw", "by", "bz", "ca", "cd", "cf", "cg", "ch", "ci", "cl",
// "cm", "cn", "co", "cr", "cv", "cw", "cy", "cz", "de", "dj", "dk", "dm", "do",
// "dz", "ec", "ee", "eg", "es", "et", "fi", "fj", "fr", "ga", "gb", "gd", "ge",
// "gf", "gg", "gh", "gm", "gn", "gp", "gq", "gr", "gt", "gu", "gw", "gy", "hk",
// "hn", "hr", "ht", "hu", "id", "ie", "il", "im", "in", "iq", "ir", "is", "it",
// "je", "jm", "jo", "jp", "ke", "kg", "kh", "kn", "kr", "kw", "ky", "kz", "la",
// "lb", "lc", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me",
// "mf", "mg", "mk", "ml", "mm", "mn", "mo", "mq", "mr", "mt", "mu", "mv", "mw",
// "mx", "my", "mz", "na", "nc", "ne", "ng", "ni", "nl", "no", "np", "nz", "om",
// "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pr", "ps", "pt", "py", "qa", "re",
// "ro", "rs", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm",
// "sn", "so", "sr", "ss", "st", "sv", "sx", "sy", "sz", "tc", "td", "tg", "th",
// "tj", "tl", "tm", "tn", "tr", "tt", "tw", "tz", "ua", "ug", "us", "uy", "uz",
// "vc", "ve", "vg", "vi", "vn", "ye", "yt", "za", "zm", "zw".
Country WebWebScrapeMdParamsCountry `query:"country,omitzero" json:"-"`
// Optional outbound HTTP headers forwarded only to the target URL, sent as
// deep-object query params such as headers[X-Custom]=value. When provided, caching
// is bypassed: the result is neither read from nor written to cache.
Headers map[string]string `query:"headers,omitzero" json:"-"`
// PDF parsing controls. Use start/end to limit text extraction and embedded-image
// detection/OCR to an inclusive 1-based page range.
Pdf WebWebScrapeMdParamsPdf `query:"pdf,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// Set to enabled to bypass shared caches and omit request and response content
// from retained usage logs. Requires zero data retention to be enabled for your
// organization (contact support@context.dev), otherwise the request fails with
// ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
//
// Any of "enabled", "disabled".
Zdr WebWebScrapeMdParamsZdr `query:"zdr,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebWebScrapeMdParams) URLQuery ¶
func (r WebWebScrapeMdParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeMdParams's query parameters as `url.Values`.
type WebWebScrapeMdParamsActionPerform ¶ added in v2.5.0
type WebWebScrapeMdParamsActionPerform struct {
Action string `query:"action" api:"required" json:"-"`
// This field can be elided, and will marshal its zero value as "perform".
Do constant.Perform `query:"do" json:"-" default:"perform"`
// contains filtered or unexported fields
}
Resolve and perform one natural-language browser action.
The properties Action, Do are required.
func (WebWebScrapeMdParamsActionPerform) URLQuery ¶ added in v2.5.0
func (r WebWebScrapeMdParamsActionPerform) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeMdParamsActionPerform's query parameters as `url.Values`.
type WebWebScrapeMdParamsActionUnion ¶ added in v2.5.0
type WebWebScrapeMdParamsActionUnion struct {
OfWait *WebWebScrapeMdParamsActionWait `query:",omitzero,inline"`
OfPerform *WebWebScrapeMdParamsActionPerform `query:",omitzero,inline"`
// contains filtered or unexported fields
}
Only one field can be non-zero.
Use param.IsOmitted to confirm if a field is set.
type WebWebScrapeMdParamsActionWait ¶ added in v2.5.0
type WebWebScrapeMdParamsActionWait struct {
TimeMs int64 `query:"timeMs" api:"required" json:"-"`
// This field can be elided, and will marshal its zero value as "wait".
Do constant.Wait `query:"do" json:"-" default:"wait"`
// contains filtered or unexported fields
}
Pause for a fixed number of milliseconds before continuing to the next action.
The properties Do, TimeMs are required.
func (WebWebScrapeMdParamsActionWait) URLQuery ¶ added in v2.5.0
func (r WebWebScrapeMdParamsActionWait) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeMdParamsActionWait's query parameters as `url.Values`.
type WebWebScrapeMdParamsCountry ¶
type WebWebScrapeMdParamsCountry string
Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2).
const ( WebWebScrapeMdParamsCountryAd WebWebScrapeMdParamsCountry = "ad" WebWebScrapeMdParamsCountryAe WebWebScrapeMdParamsCountry = "ae" WebWebScrapeMdParamsCountryAf WebWebScrapeMdParamsCountry = "af" WebWebScrapeMdParamsCountryAg WebWebScrapeMdParamsCountry = "ag" WebWebScrapeMdParamsCountryAI WebWebScrapeMdParamsCountry = "ai" WebWebScrapeMdParamsCountryAl WebWebScrapeMdParamsCountry = "al" WebWebScrapeMdParamsCountryAm WebWebScrapeMdParamsCountry = "am" WebWebScrapeMdParamsCountryAo WebWebScrapeMdParamsCountry = "ao" WebWebScrapeMdParamsCountryAr WebWebScrapeMdParamsCountry = "ar" WebWebScrapeMdParamsCountryAt WebWebScrapeMdParamsCountry = "at" WebWebScrapeMdParamsCountryAu WebWebScrapeMdParamsCountry = "au" WebWebScrapeMdParamsCountryAw WebWebScrapeMdParamsCountry = "aw" WebWebScrapeMdParamsCountryAz WebWebScrapeMdParamsCountry = "az" WebWebScrapeMdParamsCountryBa WebWebScrapeMdParamsCountry = "ba" WebWebScrapeMdParamsCountryBb WebWebScrapeMdParamsCountry = "bb" WebWebScrapeMdParamsCountryBd WebWebScrapeMdParamsCountry = "bd" WebWebScrapeMdParamsCountryBe WebWebScrapeMdParamsCountry = "be" WebWebScrapeMdParamsCountryBf WebWebScrapeMdParamsCountry = "bf" WebWebScrapeMdParamsCountryBg WebWebScrapeMdParamsCountry = "bg" WebWebScrapeMdParamsCountryBh WebWebScrapeMdParamsCountry = "bh" WebWebScrapeMdParamsCountryBi WebWebScrapeMdParamsCountry = "bi" WebWebScrapeMdParamsCountryBj WebWebScrapeMdParamsCountry = "bj" WebWebScrapeMdParamsCountryBm WebWebScrapeMdParamsCountry = "bm" WebWebScrapeMdParamsCountryBn WebWebScrapeMdParamsCountry = "bn" WebWebScrapeMdParamsCountryBo WebWebScrapeMdParamsCountry = "bo" WebWebScrapeMdParamsCountryBq WebWebScrapeMdParamsCountry = "bq" WebWebScrapeMdParamsCountryBr WebWebScrapeMdParamsCountry = "br" WebWebScrapeMdParamsCountryBs WebWebScrapeMdParamsCountry = "bs" WebWebScrapeMdParamsCountryBw WebWebScrapeMdParamsCountry = "bw" WebWebScrapeMdParamsCountryBy WebWebScrapeMdParamsCountry = "by" WebWebScrapeMdParamsCountryBz WebWebScrapeMdParamsCountry = "bz" WebWebScrapeMdParamsCountryCa WebWebScrapeMdParamsCountry = "ca" WebWebScrapeMdParamsCountryCd WebWebScrapeMdParamsCountry = "cd" WebWebScrapeMdParamsCountryCf WebWebScrapeMdParamsCountry = "cf" WebWebScrapeMdParamsCountryCg WebWebScrapeMdParamsCountry = "cg" WebWebScrapeMdParamsCountryCh WebWebScrapeMdParamsCountry = "ch" WebWebScrapeMdParamsCountryCi WebWebScrapeMdParamsCountry = "ci" WebWebScrapeMdParamsCountryCl WebWebScrapeMdParamsCountry = "cl" WebWebScrapeMdParamsCountryCm WebWebScrapeMdParamsCountry = "cm" WebWebScrapeMdParamsCountryCn WebWebScrapeMdParamsCountry = "cn" WebWebScrapeMdParamsCountryCo WebWebScrapeMdParamsCountry = "co" WebWebScrapeMdParamsCountryCr WebWebScrapeMdParamsCountry = "cr" WebWebScrapeMdParamsCountryCv WebWebScrapeMdParamsCountry = "cv" WebWebScrapeMdParamsCountryCw WebWebScrapeMdParamsCountry = "cw" WebWebScrapeMdParamsCountryCy WebWebScrapeMdParamsCountry = "cy" WebWebScrapeMdParamsCountryCz WebWebScrapeMdParamsCountry = "cz" WebWebScrapeMdParamsCountryDe WebWebScrapeMdParamsCountry = "de" WebWebScrapeMdParamsCountryDj WebWebScrapeMdParamsCountry = "dj" WebWebScrapeMdParamsCountryDk WebWebScrapeMdParamsCountry = "dk" WebWebScrapeMdParamsCountryDm WebWebScrapeMdParamsCountry = "dm" WebWebScrapeMdParamsCountryDo WebWebScrapeMdParamsCountry = "do" WebWebScrapeMdParamsCountryDz WebWebScrapeMdParamsCountry = "dz" WebWebScrapeMdParamsCountryEc WebWebScrapeMdParamsCountry = "ec" WebWebScrapeMdParamsCountryEe WebWebScrapeMdParamsCountry = "ee" WebWebScrapeMdParamsCountryEg WebWebScrapeMdParamsCountry = "eg" WebWebScrapeMdParamsCountryEs WebWebScrapeMdParamsCountry = "es" WebWebScrapeMdParamsCountryEt WebWebScrapeMdParamsCountry = "et" WebWebScrapeMdParamsCountryFi WebWebScrapeMdParamsCountry = "fi" WebWebScrapeMdParamsCountryFj WebWebScrapeMdParamsCountry = "fj" WebWebScrapeMdParamsCountryFr WebWebScrapeMdParamsCountry = "fr" WebWebScrapeMdParamsCountryGa WebWebScrapeMdParamsCountry = "ga" WebWebScrapeMdParamsCountryGB WebWebScrapeMdParamsCountry = "gb" WebWebScrapeMdParamsCountryGd WebWebScrapeMdParamsCountry = "gd" WebWebScrapeMdParamsCountryGe WebWebScrapeMdParamsCountry = "ge" WebWebScrapeMdParamsCountryGf WebWebScrapeMdParamsCountry = "gf" WebWebScrapeMdParamsCountryGg WebWebScrapeMdParamsCountry = "gg" WebWebScrapeMdParamsCountryGh WebWebScrapeMdParamsCountry = "gh" WebWebScrapeMdParamsCountryGm WebWebScrapeMdParamsCountry = "gm" WebWebScrapeMdParamsCountryGn WebWebScrapeMdParamsCountry = "gn" WebWebScrapeMdParamsCountryGp WebWebScrapeMdParamsCountry = "gp" WebWebScrapeMdParamsCountryGq WebWebScrapeMdParamsCountry = "gq" WebWebScrapeMdParamsCountryGr WebWebScrapeMdParamsCountry = "gr" WebWebScrapeMdParamsCountryGt WebWebScrapeMdParamsCountry = "gt" WebWebScrapeMdParamsCountryGu WebWebScrapeMdParamsCountry = "gu" WebWebScrapeMdParamsCountryGw WebWebScrapeMdParamsCountry = "gw" WebWebScrapeMdParamsCountryGy WebWebScrapeMdParamsCountry = "gy" WebWebScrapeMdParamsCountryHk WebWebScrapeMdParamsCountry = "hk" WebWebScrapeMdParamsCountryHn WebWebScrapeMdParamsCountry = "hn" WebWebScrapeMdParamsCountryHr WebWebScrapeMdParamsCountry = "hr" WebWebScrapeMdParamsCountryHt WebWebScrapeMdParamsCountry = "ht" WebWebScrapeMdParamsCountryHu WebWebScrapeMdParamsCountry = "hu" WebWebScrapeMdParamsCountryID WebWebScrapeMdParamsCountry = "id" WebWebScrapeMdParamsCountryIe WebWebScrapeMdParamsCountry = "ie" WebWebScrapeMdParamsCountryIl WebWebScrapeMdParamsCountry = "il" WebWebScrapeMdParamsCountryIm WebWebScrapeMdParamsCountry = "im" WebWebScrapeMdParamsCountryIn WebWebScrapeMdParamsCountry = "in" WebWebScrapeMdParamsCountryIq WebWebScrapeMdParamsCountry = "iq" WebWebScrapeMdParamsCountryIr WebWebScrapeMdParamsCountry = "ir" WebWebScrapeMdParamsCountryIs WebWebScrapeMdParamsCountry = "is" WebWebScrapeMdParamsCountryIt WebWebScrapeMdParamsCountry = "it" WebWebScrapeMdParamsCountryJe WebWebScrapeMdParamsCountry = "je" WebWebScrapeMdParamsCountryJm WebWebScrapeMdParamsCountry = "jm" WebWebScrapeMdParamsCountryJo WebWebScrapeMdParamsCountry = "jo" WebWebScrapeMdParamsCountryJp WebWebScrapeMdParamsCountry = "jp" WebWebScrapeMdParamsCountryKe WebWebScrapeMdParamsCountry = "ke" WebWebScrapeMdParamsCountryKg WebWebScrapeMdParamsCountry = "kg" WebWebScrapeMdParamsCountryKh WebWebScrapeMdParamsCountry = "kh" WebWebScrapeMdParamsCountryKn WebWebScrapeMdParamsCountry = "kn" WebWebScrapeMdParamsCountryKr WebWebScrapeMdParamsCountry = "kr" WebWebScrapeMdParamsCountryKw WebWebScrapeMdParamsCountry = "kw" WebWebScrapeMdParamsCountryKy WebWebScrapeMdParamsCountry = "ky" WebWebScrapeMdParamsCountryKz WebWebScrapeMdParamsCountry = "kz" WebWebScrapeMdParamsCountryLa WebWebScrapeMdParamsCountry = "la" WebWebScrapeMdParamsCountryLb WebWebScrapeMdParamsCountry = "lb" WebWebScrapeMdParamsCountryLc WebWebScrapeMdParamsCountry = "lc" WebWebScrapeMdParamsCountryLk WebWebScrapeMdParamsCountry = "lk" WebWebScrapeMdParamsCountryLr WebWebScrapeMdParamsCountry = "lr" WebWebScrapeMdParamsCountryLs WebWebScrapeMdParamsCountry = "ls" WebWebScrapeMdParamsCountryLt WebWebScrapeMdParamsCountry = "lt" WebWebScrapeMdParamsCountryLu WebWebScrapeMdParamsCountry = "lu" WebWebScrapeMdParamsCountryLv WebWebScrapeMdParamsCountry = "lv" WebWebScrapeMdParamsCountryLy WebWebScrapeMdParamsCountry = "ly" WebWebScrapeMdParamsCountryMa WebWebScrapeMdParamsCountry = "ma" WebWebScrapeMdParamsCountryMc WebWebScrapeMdParamsCountry = "mc" WebWebScrapeMdParamsCountryMd WebWebScrapeMdParamsCountry = "md" WebWebScrapeMdParamsCountryMe WebWebScrapeMdParamsCountry = "me" WebWebScrapeMdParamsCountryMf WebWebScrapeMdParamsCountry = "mf" WebWebScrapeMdParamsCountryMg WebWebScrapeMdParamsCountry = "mg" WebWebScrapeMdParamsCountryMk WebWebScrapeMdParamsCountry = "mk" WebWebScrapeMdParamsCountryMl WebWebScrapeMdParamsCountry = "ml" WebWebScrapeMdParamsCountryMm WebWebScrapeMdParamsCountry = "mm" WebWebScrapeMdParamsCountryMn WebWebScrapeMdParamsCountry = "mn" WebWebScrapeMdParamsCountryMo WebWebScrapeMdParamsCountry = "mo" WebWebScrapeMdParamsCountryMq WebWebScrapeMdParamsCountry = "mq" WebWebScrapeMdParamsCountryMr WebWebScrapeMdParamsCountry = "mr" WebWebScrapeMdParamsCountryMt WebWebScrapeMdParamsCountry = "mt" WebWebScrapeMdParamsCountryMu WebWebScrapeMdParamsCountry = "mu" WebWebScrapeMdParamsCountryMv WebWebScrapeMdParamsCountry = "mv" WebWebScrapeMdParamsCountryMw WebWebScrapeMdParamsCountry = "mw" WebWebScrapeMdParamsCountryMx WebWebScrapeMdParamsCountry = "mx" WebWebScrapeMdParamsCountryMy WebWebScrapeMdParamsCountry = "my" WebWebScrapeMdParamsCountryMz WebWebScrapeMdParamsCountry = "mz" WebWebScrapeMdParamsCountryNa WebWebScrapeMdParamsCountry = "na" WebWebScrapeMdParamsCountryNc WebWebScrapeMdParamsCountry = "nc" WebWebScrapeMdParamsCountryNe WebWebScrapeMdParamsCountry = "ne" WebWebScrapeMdParamsCountryNg WebWebScrapeMdParamsCountry = "ng" WebWebScrapeMdParamsCountryNi WebWebScrapeMdParamsCountry = "ni" WebWebScrapeMdParamsCountryNl WebWebScrapeMdParamsCountry = "nl" WebWebScrapeMdParamsCountryNo WebWebScrapeMdParamsCountry = "no" WebWebScrapeMdParamsCountryNp WebWebScrapeMdParamsCountry = "np" WebWebScrapeMdParamsCountryNz WebWebScrapeMdParamsCountry = "nz" WebWebScrapeMdParamsCountryOm WebWebScrapeMdParamsCountry = "om" WebWebScrapeMdParamsCountryPa WebWebScrapeMdParamsCountry = "pa" WebWebScrapeMdParamsCountryPe WebWebScrapeMdParamsCountry = "pe" WebWebScrapeMdParamsCountryPf WebWebScrapeMdParamsCountry = "pf" WebWebScrapeMdParamsCountryPg WebWebScrapeMdParamsCountry = "pg" WebWebScrapeMdParamsCountryPh WebWebScrapeMdParamsCountry = "ph" WebWebScrapeMdParamsCountryPk WebWebScrapeMdParamsCountry = "pk" WebWebScrapeMdParamsCountryPl WebWebScrapeMdParamsCountry = "pl" WebWebScrapeMdParamsCountryPr WebWebScrapeMdParamsCountry = "pr" WebWebScrapeMdParamsCountryPs WebWebScrapeMdParamsCountry = "ps" WebWebScrapeMdParamsCountryPt WebWebScrapeMdParamsCountry = "pt" WebWebScrapeMdParamsCountryPy WebWebScrapeMdParamsCountry = "py" WebWebScrapeMdParamsCountryQa WebWebScrapeMdParamsCountry = "qa" WebWebScrapeMdParamsCountryRe WebWebScrapeMdParamsCountry = "re" WebWebScrapeMdParamsCountryRo WebWebScrapeMdParamsCountry = "ro" WebWebScrapeMdParamsCountryRs WebWebScrapeMdParamsCountry = "rs" WebWebScrapeMdParamsCountryRu WebWebScrapeMdParamsCountry = "ru" WebWebScrapeMdParamsCountryRw WebWebScrapeMdParamsCountry = "rw" WebWebScrapeMdParamsCountrySa WebWebScrapeMdParamsCountry = "sa" WebWebScrapeMdParamsCountrySc WebWebScrapeMdParamsCountry = "sc" WebWebScrapeMdParamsCountrySd WebWebScrapeMdParamsCountry = "sd" WebWebScrapeMdParamsCountrySe WebWebScrapeMdParamsCountry = "se" WebWebScrapeMdParamsCountrySg WebWebScrapeMdParamsCountry = "sg" WebWebScrapeMdParamsCountrySi WebWebScrapeMdParamsCountry = "si" WebWebScrapeMdParamsCountrySk WebWebScrapeMdParamsCountry = "sk" WebWebScrapeMdParamsCountrySl WebWebScrapeMdParamsCountry = "sl" WebWebScrapeMdParamsCountrySm WebWebScrapeMdParamsCountry = "sm" WebWebScrapeMdParamsCountrySn WebWebScrapeMdParamsCountry = "sn" WebWebScrapeMdParamsCountrySo WebWebScrapeMdParamsCountry = "so" WebWebScrapeMdParamsCountrySr WebWebScrapeMdParamsCountry = "sr" WebWebScrapeMdParamsCountrySS WebWebScrapeMdParamsCountry = "ss" WebWebScrapeMdParamsCountrySt WebWebScrapeMdParamsCountry = "st" WebWebScrapeMdParamsCountrySv WebWebScrapeMdParamsCountry = "sv" WebWebScrapeMdParamsCountrySx WebWebScrapeMdParamsCountry = "sx" WebWebScrapeMdParamsCountrySy WebWebScrapeMdParamsCountry = "sy" WebWebScrapeMdParamsCountrySz WebWebScrapeMdParamsCountry = "sz" WebWebScrapeMdParamsCountryTc WebWebScrapeMdParamsCountry = "tc" WebWebScrapeMdParamsCountryTd WebWebScrapeMdParamsCountry = "td" WebWebScrapeMdParamsCountryTg WebWebScrapeMdParamsCountry = "tg" WebWebScrapeMdParamsCountryTh WebWebScrapeMdParamsCountry = "th" WebWebScrapeMdParamsCountryTj WebWebScrapeMdParamsCountry = "tj" WebWebScrapeMdParamsCountryTl WebWebScrapeMdParamsCountry = "tl" WebWebScrapeMdParamsCountryTm WebWebScrapeMdParamsCountry = "tm" WebWebScrapeMdParamsCountryTn WebWebScrapeMdParamsCountry = "tn" WebWebScrapeMdParamsCountryTr WebWebScrapeMdParamsCountry = "tr" WebWebScrapeMdParamsCountryTt WebWebScrapeMdParamsCountry = "tt" WebWebScrapeMdParamsCountryTw WebWebScrapeMdParamsCountry = "tw" WebWebScrapeMdParamsCountryTz WebWebScrapeMdParamsCountry = "tz" WebWebScrapeMdParamsCountryUa WebWebScrapeMdParamsCountry = "ua" WebWebScrapeMdParamsCountryUg WebWebScrapeMdParamsCountry = "ug" WebWebScrapeMdParamsCountryUs WebWebScrapeMdParamsCountry = "us" WebWebScrapeMdParamsCountryUy WebWebScrapeMdParamsCountry = "uy" WebWebScrapeMdParamsCountryUz WebWebScrapeMdParamsCountry = "uz" WebWebScrapeMdParamsCountryVc WebWebScrapeMdParamsCountry = "vc" WebWebScrapeMdParamsCountryVe WebWebScrapeMdParamsCountry = "ve" WebWebScrapeMdParamsCountryVg WebWebScrapeMdParamsCountry = "vg" WebWebScrapeMdParamsCountryVi WebWebScrapeMdParamsCountry = "vi" WebWebScrapeMdParamsCountryVn WebWebScrapeMdParamsCountry = "vn" WebWebScrapeMdParamsCountryYe WebWebScrapeMdParamsCountry = "ye" WebWebScrapeMdParamsCountryYt WebWebScrapeMdParamsCountry = "yt" WebWebScrapeMdParamsCountryZa WebWebScrapeMdParamsCountry = "za" WebWebScrapeMdParamsCountryZm WebWebScrapeMdParamsCountry = "zm" WebWebScrapeMdParamsCountryZw WebWebScrapeMdParamsCountry = "zw" )
type WebWebScrapeMdParamsPdf ¶
type WebWebScrapeMdParamsPdf struct {
// Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
// Must be greater than or equal to start when both are provided.
End param.Opt[int64] `query:"end,omitzero" json:"-"`
// When true, OCR the selected PDF pages that have no usable text layer (scans),
// replacing each recovered page's text with the OCR result while pages with a real
// text layer keep it. Billed at 1 credit per page OCR actually recovered, on top
// of the base request cost. When false, no OCR runs.
Ocr param.Opt[bool] `query:"ocr,omitzero" json:"-"`
// When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and
// a 400 PDF_SKIPPED is returned.
ShouldParse param.Opt[bool] `query:"shouldParse,omitzero" json:"-"`
// First 1-based PDF page to parse. When omitted, parsing starts at the first page.
Start param.Opt[int64] `query:"start,omitzero" json:"-"`
// contains filtered or unexported fields
}
PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.
func (WebWebScrapeMdParamsPdf) URLQuery ¶
func (r WebWebScrapeMdParamsPdf) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeMdParamsPdf's query parameters as `url.Values`.
type WebWebScrapeMdParamsZdr ¶ added in v2.5.0
type WebWebScrapeMdParamsZdr string
Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
const ( WebWebScrapeMdParamsZdrEnabled WebWebScrapeMdParamsZdr = "enabled" WebWebScrapeMdParamsZdrDisabled WebWebScrapeMdParamsZdr = "disabled" )
type WebWebScrapeMdResponse ¶
type WebWebScrapeMdResponse struct {
// UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result
// and compare small values against your workload's minimum useful-content
// threshold.
ContentLength int64 `json:"contentLength" api:"required"`
// Page content converted to GitHub Flavored Markdown
Markdown string `json:"markdown" api:"required"`
// Metadata extracted from the scraped page HTML.
Metadata WebWebScrapeMdResponseMetadata `json:"metadata" api:"required"`
// Indicates success
//
// Any of true.
Success bool `json:"success" api:"required"`
// The URL that was scraped
URL string `json:"url" api:"required"`
// One verified outcome per requested browser action, in request order.
ActionsApplied []WebWebScrapeMdResponseActionsApplied `json:"actionsApplied"`
// True when an action was applied but the returned content could not be refreshed
// afterward.
ActionsHTMLStale bool `json:"actionsHtmlStale"`
// Only present when includeHTML=true: the page HTML the Markdown was converted
// from — the same body the Scrape HTML endpoint returns for the equivalent
// request.
HTML string `json:"html"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebWebScrapeMdResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ContentLength respjson.Field
Markdown respjson.Field
Metadata respjson.Field
Success respjson.Field
URL respjson.Field
ActionsApplied respjson.Field
ActionsHTMLStale respjson.Field
HTML respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeMdResponse) RawJSON ¶
func (r WebWebScrapeMdResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponse) UnmarshalJSON ¶
func (r *WebWebScrapeMdResponse) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseActionsApplied ¶ added in v2.6.0
type WebWebScrapeMdResponseActionsApplied struct {
Instruction string `json:"instruction" api:"required"`
// Applied means the requested page state was visibly verified. Failed means it was
// not verified. Skipped means it was not attempted.
//
// Any of "applied", "failed", "skipped".
Status string `json:"status" api:"required"`
// Visible page evidence used to verify an applied action.
CompletionEvidence string `json:"completionEvidence"`
DurationMs float64 `json:"durationMs"`
Error string `json:"error"`
Method string `json:"method"`
TargetDescription string `json:"targetDescription"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Instruction respjson.Field
Status respjson.Field
CompletionEvidence respjson.Field
DurationMs respjson.Field
Error respjson.Field
Method respjson.Field
TargetDescription respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeMdResponseActionsApplied) RawJSON ¶ added in v2.6.0
func (r WebWebScrapeMdResponseActionsApplied) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseActionsApplied) UnmarshalJSON ¶ added in v2.6.0
func (r *WebWebScrapeMdResponseActionsApplied) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseKeyMetadata ¶
type WebWebScrapeMdResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebWebScrapeMdResponseKeyMetadata) RawJSON ¶
func (r WebWebScrapeMdResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebWebScrapeMdResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseMetadata ¶
type WebWebScrapeMdResponseMetadata struct {
// Final URL scraped after redirects or scraper fallback, when known. Falls back to
// sourceUrl when unavailable.
FinalURL string `json:"finalUrl" api:"required"`
// Original URL requested by the caller.
SourceURL string `json:"sourceUrl" api:"required"`
// Additional non-social meta tags not promoted to top-level metadata fields.
AdditionalMeta map[string]WebWebScrapeMdResponseMetadataAdditionalMetaUnion `json:"additionalMeta"`
// Resolved alternate links from link rel=alternate tags.
Alternates []WebWebScrapeMdResponseMetadataAlternate `json:"alternates"`
// Author metadata, when present.
Author string `json:"author"`
// Resolved canonical URL, when present.
CanonicalURL string `json:"canonicalUrl"`
// Best description extracted from standard, Open Graph, or Twitter metadata.
Description string `json:"description"`
// Resolved favicon URL, when present.
Favicon string `json:"favicon"`
// Page headings (h1–h6) in document order, extracted from the unfiltered document.
// Capped at the first 500 headings. Omitted when the page has none.
Headings []WebWebScrapeMdResponseMetadataHeading `json:"headings"`
// Primary resolved preview image from Open Graph, Twitter, or image metadata.
Image string `json:"image"`
// JSON-LD structured data blocks parsed from the page.
JsonLd []map[string]any `json:"jsonLd"`
// Keywords extracted from the page's keywords meta tag.
Keywords []string `json:"keywords"`
// Language extracted from html lang or language meta tags.
Language string `json:"language"`
// Modified timestamp/date from page metadata, when present.
ModifiedTime string `json:"modifiedTime"`
// Open Graph metadata with the og: prefix removed and keys camel-cased.
OpenGraph map[string]WebWebScrapeMdResponseMetadataOpenGraphUnion `json:"openGraph"`
// Published timestamp/date from page metadata, when present.
PublishedTime string `json:"publishedTime"`
// Robots meta directive, when present.
Robots string `json:"robots"`
// Site or application name from page metadata.
SiteName string `json:"siteName"`
// Best title extracted from the page.
Title string `json:"title"`
// Twitter card metadata with the twitter: prefix removed and keys camel-cased.
Twitter map[string]WebWebScrapeMdResponseMetadataTwitterUnion `json:"twitter"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
FinalURL respjson.Field
SourceURL respjson.Field
AdditionalMeta respjson.Field
Alternates respjson.Field
Author respjson.Field
CanonicalURL respjson.Field
Description respjson.Field
Favicon respjson.Field
Headings respjson.Field
Image respjson.Field
JsonLd respjson.Field
Keywords respjson.Field
Language respjson.Field
ModifiedTime respjson.Field
OpenGraph respjson.Field
PublishedTime respjson.Field
Robots respjson.Field
SiteName respjson.Field
Title respjson.Field
Twitter respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata extracted from the scraped page HTML.
func (WebWebScrapeMdResponseMetadata) RawJSON ¶
func (r WebWebScrapeMdResponseMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseMetadata) UnmarshalJSON ¶
func (r *WebWebScrapeMdResponseMetadata) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseMetadataAdditionalMetaUnion ¶
type WebWebScrapeMdResponseMetadataAdditionalMetaUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebScrapeMdResponseMetadataAdditionalMetaUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebScrapeMdResponseMetadataAdditionalMetaUnion) AsString ¶
func (u WebWebScrapeMdResponseMetadataAdditionalMetaUnion) AsString() (v string)
func (WebWebScrapeMdResponseMetadataAdditionalMetaUnion) AsStringArray ¶
func (u WebWebScrapeMdResponseMetadataAdditionalMetaUnion) AsStringArray() (v []string)
func (WebWebScrapeMdResponseMetadataAdditionalMetaUnion) RawJSON ¶
func (u WebWebScrapeMdResponseMetadataAdditionalMetaUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseMetadataAdditionalMetaUnion) UnmarshalJSON ¶
func (r *WebWebScrapeMdResponseMetadataAdditionalMetaUnion) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseMetadataAlternate ¶
type WebWebScrapeMdResponseMetadataAlternate struct {
// Resolved alternate URL.
Href string `json:"href" api:"required"`
// Language or locale for the alternate URL, when present.
Hreflang string `json:"hreflang"`
// Alternate resource title, when present.
Title string `json:"title"`
// Alternate resource MIME type, when present.
Type string `json:"type"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Href respjson.Field
Hreflang respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeMdResponseMetadataAlternate) RawJSON ¶
func (r WebWebScrapeMdResponseMetadataAlternate) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseMetadataAlternate) UnmarshalJSON ¶
func (r *WebWebScrapeMdResponseMetadataAlternate) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseMetadataHeading ¶ added in v2.10.0
type WebWebScrapeMdResponseMetadataHeading struct {
// Heading level, 1–6 (from h1–h6).
Level int64 `json:"level" api:"required"`
// Heading text with whitespace collapsed, truncated to 1000 characters.
Text string `json:"text" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Level respjson.Field
Text respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeMdResponseMetadataHeading) RawJSON ¶ added in v2.10.0
func (r WebWebScrapeMdResponseMetadataHeading) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseMetadataHeading) UnmarshalJSON ¶ added in v2.10.0
func (r *WebWebScrapeMdResponseMetadataHeading) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseMetadataOpenGraphUnion ¶
type WebWebScrapeMdResponseMetadataOpenGraphUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebScrapeMdResponseMetadataOpenGraphUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebScrapeMdResponseMetadataOpenGraphUnion) AsString ¶
func (u WebWebScrapeMdResponseMetadataOpenGraphUnion) AsString() (v string)
func (WebWebScrapeMdResponseMetadataOpenGraphUnion) AsStringArray ¶
func (u WebWebScrapeMdResponseMetadataOpenGraphUnion) AsStringArray() (v []string)
func (WebWebScrapeMdResponseMetadataOpenGraphUnion) RawJSON ¶
func (u WebWebScrapeMdResponseMetadataOpenGraphUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseMetadataOpenGraphUnion) UnmarshalJSON ¶
func (r *WebWebScrapeMdResponseMetadataOpenGraphUnion) UnmarshalJSON(data []byte) error
type WebWebScrapeMdResponseMetadataTwitterUnion ¶
type WebWebScrapeMdResponseMetadataTwitterUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a [[]string] instead of an object.
OfStringArray []string `json:",inline"`
JSON struct {
OfString respjson.Field
OfStringArray respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
WebWebScrapeMdResponseMetadataTwitterUnion contains all possible properties and values from [string], [[]string].
Use the methods beginning with 'As' to cast the union to one of its variants.
If the underlying value is not a json object, one of the following properties will be valid: OfString OfStringArray]
func (WebWebScrapeMdResponseMetadataTwitterUnion) AsString ¶
func (u WebWebScrapeMdResponseMetadataTwitterUnion) AsString() (v string)
func (WebWebScrapeMdResponseMetadataTwitterUnion) AsStringArray ¶
func (u WebWebScrapeMdResponseMetadataTwitterUnion) AsStringArray() (v []string)
func (WebWebScrapeMdResponseMetadataTwitterUnion) RawJSON ¶
func (u WebWebScrapeMdResponseMetadataTwitterUnion) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeMdResponseMetadataTwitterUnion) UnmarshalJSON ¶
func (r *WebWebScrapeMdResponseMetadataTwitterUnion) UnmarshalJSON(data []byte) error
type WebWebScrapeSitemapParams ¶
type WebWebScrapeSitemapParams struct {
// Domain to build a sitemap for
Domain string `query:"domain" api:"required" json:"-"`
// Maximum number of links to return from the sitemap crawl. Defaults to 10,000.
// Minimum is 1, maximum is 100,000.
MaxLinks param.Opt[int64] `query:"maxLinks,omitzero" json:"-"`
// Optional search phrase. When provided, the crawled sitemap is filtered to the
// pages whose URLs are about that phrase, most relevant first, and the request
// costs 2 credits instead of 1.
Search param.Opt[string] `query:"search,omitzero" json:"-"`
// Optional explicit sitemap URL. When provided, exactly this sitemap is crawled
// instead of discovering the domain's sitemaps.
SitemapURL param.Opt[string] `query:"sitemapUrl,omitzero" format:"uri" json:"-"`
// Optional timeout in milliseconds for the request. If the request takes longer
// than this value, it will be aborted with a 408 status code. Maximum allowed
// value is 300000ms (5 minutes).
TimeoutMs param.Opt[int64] `query:"timeoutMS,omitzero" json:"-"`
// Optional RE2-compatible regex pattern. Only URLs matching this pattern are
// returned and counted against maxLinks.
URLRegex param.Opt[string] `query:"urlRegex,omitzero" json:"-"`
// Optional outbound HTTP headers forwarded only to the target URL, sent as
// deep-object query params such as headers[X-Custom]=value. When provided, caching
// is bypassed: the result is neither read from nor written to cache.
Headers map[string]string `query:"headers,omitzero" json:"-"`
// Optional comma-separated caller-defined tags for tracking this request. Tags are
// recorded on the request's usage log and can be used to filter usage on the
// dashboard usage page. Up to 20 tags, each 1-50 characters.
Tags []string `query:"tags,omitzero" json:"-"`
// Set to enabled to bypass shared caches and omit request and response content
// from retained usage logs. Requires zero data retention to be enabled for your
// organization (contact support@context.dev), otherwise the request fails with
// ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
//
// Any of "enabled", "disabled".
Zdr WebWebScrapeSitemapParamsZdr `query:"zdr,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (WebWebScrapeSitemapParams) URLQuery ¶
func (r WebWebScrapeSitemapParams) URLQuery() (v url.Values, err error)
URLQuery serializes WebWebScrapeSitemapParams's query parameters as `url.Values`.
type WebWebScrapeSitemapParamsZdr ¶ added in v2.5.0
type WebWebScrapeSitemapParamsZdr string
Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
const ( WebWebScrapeSitemapParamsZdrEnabled WebWebScrapeSitemapParamsZdr = "enabled" WebWebScrapeSitemapParamsZdrDisabled WebWebScrapeSitemapParamsZdr = "disabled" )
type WebWebScrapeSitemapResponse ¶
type WebWebScrapeSitemapResponse struct {
// The normalized domain that was crawled
Domain string `json:"domain" api:"required"`
// Metadata about the sitemap crawl operation
Meta WebWebScrapeSitemapResponseMeta `json:"meta" api:"required"`
// Indicates success
//
// Any of true.
Success bool `json:"success" api:"required"`
// Discovered page URLs from the sitemap, up to `maxLinks`. When `search` is set
// these are only the matching pages, most relevant first.
URLs []string `json:"urls" api:"required"`
// Metadata about the API key used for the request. Included in every response
// whenever a valid API key is provided, even when the response status is not 200.
KeyMetadata WebWebScrapeSitemapResponseKeyMetadata `json:"key_metadata"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Domain respjson.Field
Meta respjson.Field
Success respjson.Field
URLs respjson.Field
KeyMetadata respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebWebScrapeSitemapResponse) RawJSON ¶
func (r WebWebScrapeSitemapResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeSitemapResponse) UnmarshalJSON ¶
func (r *WebWebScrapeSitemapResponse) UnmarshalJSON(data []byte) error
type WebWebScrapeSitemapResponseKeyMetadata ¶
type WebWebScrapeSitemapResponseKeyMetadata struct {
// The number of credits consumed by this request.
CreditsConsumed int64 `json:"credits_consumed" api:"required"`
// The number of credits remaining for your organization after this request.
CreditsRemaining int64 `json:"credits_remaining" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsConsumed respjson.Field
CreditsRemaining respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
func (WebWebScrapeSitemapResponseKeyMetadata) RawJSON ¶
func (r WebWebScrapeSitemapResponseKeyMetadata) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeSitemapResponseKeyMetadata) UnmarshalJSON ¶
func (r *WebWebScrapeSitemapResponseKeyMetadata) UnmarshalJSON(data []byte) error
type WebWebScrapeSitemapResponseMeta ¶
type WebWebScrapeSitemapResponseMeta struct {
// Number of errors encountered during crawling
Errors int64 `json:"errors" api:"required"`
// Total number of sitemap files discovered
SitemapsDiscovered int64 `json:"sitemapsDiscovered" api:"required"`
// Number of sitemap files successfully fetched and parsed
SitemapsFetched int64 `json:"sitemapsFetched" api:"required"`
// Number of sitemap files skipped (due to errors, timeouts, or limits)
SitemapsSkipped int64 `json:"sitemapsSkipped" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Errors respjson.Field
SitemapsDiscovered respjson.Field
SitemapsFetched respjson.Field
SitemapsSkipped respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Metadata about the sitemap crawl operation
func (WebWebScrapeSitemapResponseMeta) RawJSON ¶
func (r WebWebScrapeSitemapResponseMeta) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebWebScrapeSitemapResponseMeta) UnmarshalJSON ¶
func (r *WebWebScrapeSitemapResponseMeta) UnmarshalJSON(data []byte) error
type WebhookDelivery ¶ added in v2.3.0
type WebhookDelivery struct {
AttemptedAt time.Time `json:"attempted_at" api:"required" format:"date-time"`
Error WebhookDeliveryError `json:"error" api:"required"`
// The event this delivery carried. Deliveries recorded before event selection
// existed report change.detected.
//
// Any of "change.detected", "run.completed".
Event WebhookDeliveryEvent `json:"event" api:"required"`
// Identifier sent in the X-Context-Id header.
EventID string `json:"event_id" api:"required"`
// The endpoint's final HTTP response status, or null when no response was
// received.
HTTPStatus int64 `json:"http_status" api:"required"`
// Delivery outcome. delivered means any 2xx response; rejected means a non-2xx
// response; failed means no HTTP response was received; skipped_unsafe_url means
// the URL failed the public-endpoint safety check.
//
// Any of "delivered", "rejected", "failed", "skipped_unsafe_url".
Status WebhookDeliveryStatus `json:"status" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
AttemptedAt respjson.Field
Error respjson.Field
Event respjson.Field
EventID respjson.Field
HTTPStatus respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookDelivery) RawJSON ¶ added in v2.3.0
func (r WebhookDelivery) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookDelivery) UnmarshalJSON ¶ added in v2.3.0
func (r *WebhookDelivery) UnmarshalJSON(data []byte) error
type WebhookDeliveryError ¶ added in v2.3.0
type WebhookDeliveryError struct {
Code string `json:"code" api:"required"`
Message string `json:"message" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Code respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (WebhookDeliveryError) RawJSON ¶ added in v2.3.0
func (r WebhookDeliveryError) RawJSON() string
Returns the unmodified JSON received from the API
func (*WebhookDeliveryError) UnmarshalJSON ¶ added in v2.3.0
func (r *WebhookDeliveryError) UnmarshalJSON(data []byte) error
type WebhookDeliveryEvent ¶ added in v2.3.0
type WebhookDeliveryEvent string
The event this delivery carried. Deliveries recorded before event selection existed report change.detected.
const ( WebhookDeliveryEventChangeDetected WebhookDeliveryEvent = "change.detected" WebhookDeliveryEventRunCompleted WebhookDeliveryEvent = "run.completed" )
type WebhookDeliveryStatus ¶ added in v2.3.0
type WebhookDeliveryStatus string
Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check.
const ( WebhookDeliveryStatusDelivered WebhookDeliveryStatus = "delivered" WebhookDeliveryStatusRejected WebhookDeliveryStatus = "rejected" WebhookDeliveryStatusFailed WebhookDeliveryStatus = "failed" WebhookDeliveryStatusSkippedUnsafeURL WebhookDeliveryStatus = "skipped_unsafe_url" )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|