perigon

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

README

Perigon Go API Library

Go Reference

The Perigon Go library provides convenient access to the Perigon REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/goperigon/perigon-go-sdk" // imported as perigon
)

Or to pin the version:

go get -u 'github.com/goperigon/[email protected]'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

For additional usage refer to our examples

package main

import (
	"context"
	"fmt"

	"github.com/goperigon/perigon-go-sdk"
	"github.com/goperigon/perigon-go-sdk/option"
)

func main() {
	client := perigon.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("PERIGON_API_KEY")
	)
	alls, err := client.All.List(context.TODO(), perigon.AllListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", alls.Articles)
}

Request fields

The perigon library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, perigon.String(string), perigon.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

params := perigon.ExampleParams{
	ID:   "id_xxx",              // required property
	Name: perigon.String("..."), // optional property

	Point: perigon.Point{
		X: 0,              // required field will serialize as 0
		Y: perigon.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: perigon.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.NullOpt[T](). To send null instead of a struct T, use param.NullObj[T]().

params.Description = param.NullOpt[string]() // explicit null string property
params.Point = param.NullObj[Point]()        // explicit null struct property

Request structs contain a .WithExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use WithExtraFields with trusted data.

To send a custom value instead of a struct, use param.OverrideObj[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [WithExtraFields]:
params.WithExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.OverrideObj[perigon.FooParams](12)

When available, use the .IsPresent() method to check if an optional parameter is not omitted or null. The param.IsOmitted(any) function can confirm the presence of any omitzero field.

Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        resp.Field
		Owner       resp.Field
		Age         resp.Field
		ExtraFields map[string]resp.Field
	} `json:"-"`
}

To handle optional data, use the IsPresent() method on the JSON field. If a field is null, not present, or invalid, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Use the IsPresent() method to handle optional fields
res.Owners                  // 1
res.JSON.Owners.IsPresent() // true
res.JSON.Owners.Raw()       // "1"

res.Age                  // 0
res.JSON.Age.IsPresent() // false
res.JSON.Age.Raw()       // ""

// Use the IsExplicitNull() method to differentiate null and omitted
res.Name                       // ""
res.JSON.Name.IsPresent()      // false
res.JSON.Name.Raw()            // "null"
res.JSON.Name.IsExplicitNull() // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...
	JSON struct {
		Owner resp.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := perigon.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.All.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *perigon.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.All.List(context.TODO(), perigon.AllListParams{})
if err != nil {
	var apierr *perigon.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/all": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.All.List(
	ctx,
	perigon.AllListParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper perigon.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := perigon.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.All.List(
	context.TODO(),
	perigon.AllListParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
alls, err := client.All.List(
	context.TODO(),
	perigon.AllListParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", alls)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: perigon.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := perigon.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (PERIGON_API_KEY, PERIGON_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AllEndpointSortBy

type AllEndpointSortBy string
const (
	AllEndpointSortByRelevance      AllEndpointSortBy = "relevance"
	AllEndpointSortByDate           AllEndpointSortBy = "date"
	AllEndpointSortByReverseDate    AllEndpointSortBy = "reverseDate"
	AllEndpointSortByReverseAddDate AllEndpointSortBy = "reverseAddDate"
	AllEndpointSortByAddDate        AllEndpointSortBy = "addDate"
	AllEndpointSortByPubDate        AllEndpointSortBy = "pubDate"
	AllEndpointSortByRefreshDate    AllEndpointSortBy = "refreshDate"
)

type AllListParams

type AllListParams struct {
	// 'addDateFrom' filter, will search articles added after the specified date, the
	// date could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T00:00:00
	AddDateFrom param.Opt[time.Time] `query:"addDateFrom,omitzero" format:"date-time" json:"-"`
	// 'addDateTo' filter, will search articles added before the specified date, the
	// date could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T23:59:59
	AddDateTo param.Opt[time.Time] `query:"addDateTo,omitzero" format:"date-time" json:"-"`
	// Search by company name.
	CompanyName param.Opt[string] `query:"companyName,omitzero" json:"-"`
	// Search query on the article's body of content field. Semantic similar to q
	// parameter.
	Content param.Opt[string] `query:"content,omitzero" json:"-"`
	// Search query on the description field. Semantic similar to q parameter.
	Desc param.Opt[string] `query:"desc,omitzero" json:"-"`
	// 'from' filter, will search articles published after the specified date, the date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2023-03-01T00:00:00
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Latitude of the center point to search places
	Lat param.Opt[float64] `query:"lat,omitzero" json:"-"`
	// Returns only articles that point to specified links (as determined by the
	// 'links' field in the article response).
	LinkTo param.Opt[string] `query:"linkTo,omitzero" json:"-"`
	// Longitude of the center point to search places
	Lon param.Opt[float64] `query:"lon,omitzero" json:"-"`
	// Maximum distance (in km) from starting point to search articles by tagged places
	MaxDistance param.Opt[float64] `query:"maxDistance,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating negative sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	NegativeSentimentFrom param.Opt[float64] `query:"negativeSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating negative sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	NegativeSentimentTo param.Opt[float64] `query:"negativeSentimentTo,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating neutral sentiment. Explanation of sentimental values can be
	// found in Docs under the Article Data section.
	NeutralSentimentFrom param.Opt[float64] `query:"neutralSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating neutral sentiment. See the Article Data section in Docs for an
	// explanation of scores.
	NeutralSentimentTo param.Opt[float64] `query:"neutralSentimentTo,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Filter to show only results where the source has a paywall (true) or does not
	// have a paywall (false).
	Paywall param.Opt[bool] `query:"paywall,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating positive sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	PositiveSentimentFrom param.Opt[float64] `query:"positiveSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating positive sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	PositiveSentimentTo param.Opt[float64] `query:"positiveSentimentTo,omitzero" json:"-"`
	// Filters by Google Content Categories. This field will filter by the category
	// prefix only. Example: prefixTaxonomy=/Finance
	PrefixTaxonomy param.Opt[string] `query:"prefixTaxonomy,omitzero" json:"-"`
	// Search query, each article will be scored and ranked against it. Articles are
	// searched on the title, description, and content fields.
	Q param.Opt[string] `query:"q,omitzero" json:"-"`
	// Will search articles that were refreshed after the specified date. The date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T00:00:00
	RefreshDateFrom param.Opt[time.Time] `query:"refreshDateFrom,omitzero" format:"date-time" json:"-"`
	// Will search articles that were refreshed before the specified date. The date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T23:59:59
	RefreshDateTo param.Opt[time.Time] `query:"refreshDateTo,omitzero" format:"date-time" json:"-"`
	// Shows all articles belonging to the same reprint group. A reprint group includes
	// one original article (the first one processed by the API) and all its known
	// reprints.
	ReprintGroupID param.Opt[string] `query:"reprintGroupId,omitzero" json:"-"`
	// Expand a query to search the translation, translatedTitle, and
	// translatedDescription fields for non-English articles.
	SearchTranslation param.Opt[bool] `query:"searchTranslation,omitzero" json:"-"`
	// Whether to show the total number of all matched articles. Default value is false
	// which makes queries a bit more efficient but also counts up to 10000 articles.
	ShowNumResults param.Opt[bool] `query:"showNumResults,omitzero" json:"-"`
	// Whether to return reprints in the response or not. Reprints are usually wired
	// articles from sources like AP or Reuters that are reprinted in multiple sources
	// at the same time. By default, this parameter is 'true'.
	ShowReprints param.Opt[bool] `query:"showReprints,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// Latitude of the center point to search articles created by local publications.
	SourceLat param.Opt[float64] `query:"sourceLat,omitzero" json:"-"`
	// Latitude of the center point to search articles created by local publications.
	SourceLon param.Opt[float64] `query:"sourceLon,omitzero" json:"-"`
	// Maximum distance from starting point to search articles created by local
	// publications.
	SourceMaxDistance param.Opt[float64] `query:"sourceMaxDistance,omitzero" json:"-"`
	// Search article headlines/title field. Semantic similar to q parameter.
	Title param.Opt[string] `query:"title,omitzero" json:"-"`
	// 'to' filter, will search articles published before the specified date, the date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T23:59:59
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Search query on the url field. Semantic similar to q parameter. E.g. could be
	// used for querying certain website sections, e.g. source=cnn.com&url=travel.
	URL param.Opt[string] `query:"url,omitzero" json:"-"`
	// Filters articles where a specified area, such as a neighborhood, borough, or
	// district, plays a central role in the content, beyond mere mentions, to ensure
	// the results are deeply relevant to the area in question. If multiple parameters
	// are passed, they will be applied as OR operations.
	Area []string `query:"area,omitzero" json:"-"`
	// Article ID will search for a news article by the ID of the article. If several
	// parameters are passed, all matched articles will be returned.
	ArticleID []string `query:"articleId,omitzero" json:"-"`
	// A list of author names to include. Only articles written by any of the specified
	// authors are returned. This is ideal when you wish to focus on content from
	// particular voices or experts.
	Author []string `query:"author,omitzero" json:"-"`
	// Author names to filter by. Article author bylines are used as a source field. If
	// multiple parameters are passed, they will be applied as OR operations.
	Byline []string `query:"byline,omitzero" json:"-"`
	// Filter by categories. Categories are general themes that the article is about.
	// Examples of categories: Tech, Politics, etc. If multiple parameters are passed,
	// they will be applied as OR operations. Use 'none' to search uncategorized
	// articles.
	Category []string `query:"category,omitzero" json:"-"`
	// Filters articles where a specified city plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the urban
	// area in question. If multiple parameters are passed, they will be applied as OR
	// operations.
	City []string `query:"city,omitzero" json:"-"`
	// Search for related content using a cluster ID. Passing a cluster ID will filter
	// results to only the content found within the cluster.
	ClusterID []string `query:"clusterId,omitzero" json:"-"`
	// Search by company domains for filtering. E.g. companyDomain=apple.com.
	CompanyDomain []string `query:"companyDomain,omitzero" json:"-"`
	// List of company IDs to filter by.
	CompanyID []string `query:"companyId,omitzero" json:"-"`
	// Search by company symbols.
	CompanySymbol []string `query:"companySymbol,omitzero" json:"-"`
	// Country code to filter by country. If multiple parameters are passed, they will
	// be applied as OR operations.
	Country []string `query:"country,omitzero" json:"-"`
	// A list of counties to include (or specify) in the search results. This field
	// filters the returned articles based on the county associated with the event or
	// news. Only articles tagged with one of these counties will be included.
	County []string `query:"county,omitzero" json:"-"`
	// A list of author names to exclude from the search results. Any article written
	// by an author whose name matches one in this list will be omitted, which helps to
	// avoid content from certain individuals.
	ExcludeAuthor []string `query:"excludeAuthor,omitzero" json:"-"`
	// A list of article categories to be omitted. If an article is tagged with any
	// category present in this list (such as “Polotics”, “Tech”, “Sports”, etc.), it
	// will not appear in the search results.
	ExcludeCategory []string `query:"excludeCategory,omitzero" json:"-"`
	// A list of cities to exclude from the results. Articles that are associated with
	// any of the specified cities will be filtered out.
	ExcludeCity []string `query:"excludeCity,omitzero" json:"-"`
	// A list of company domains to exclude. If an article is related to a company that
	// uses one of the specified domains (for instance, “example.com”), it will not be
	// returned in the results.
	ExcludeCompanyDomain []string `query:"excludeCompanyDomain,omitzero" json:"-"`
	// A list of company identifiers. Articles associated with companies that have any
	// of these unique IDs will be filtered out from the returned results, ensuring
	// that certain companies or corporate entities are not included.
	ExcludeCompanyID []string `query:"excludeCompanyId,omitzero" json:"-"`
	// A list of stock symbols (ticker symbols) that identify companies to be excluded.
	// Articles related to companies using any of these symbols will be omitted, which
	// is useful for targeting or avoiding specific public companies.
	ExcludeCompanySymbol []string `query:"excludeCompanySymbol,omitzero" json:"-"`
	// Excludes articles from specific counties or administrative divisions in the
	// vector search results. Accepts either a single county name or a list of county
	// names. County names should match the format used in article metadata (e.g., 'Los
	// Angeles County', 'Cook County'). This parameter allows for more granular
	// geographic filter
	ExcludeCounty []string `query:"excludeCounty,omitzero" json:"-"`
	// A list of journalist (or reporter) identifiers to exclude. If an article is
	// written by a journalist whose ID matches any in this list, it will not be part
	// of the result set.
	ExcludeJournalistID []string `query:"excludeJournalistId,omitzero" json:"-"`
	// Exclude results that include specific labels (Opinion, Non-news, Paid News,
	// etc.). You can filter multiple by repeating the parameter.
	ExcludeLabel []string `query:"excludeLabel,omitzero" json:"-"`
	// A list of languages to be excluded. Any article published in one of the
	// languages provided in this filter will not be returned. This is useful when you
	// are interested only in news published in specific languages.
	ExcludeLanguage []string `query:"excludeLanguage,omitzero" json:"-"`
	// Excludes articles where a specified country plays a central role in the content,
	// ensuring results are not deeply relevant to the country in question. If multiple
	// parameters are passed, they will be applied as AND operations, excluding
	// articles relevant to any of the specified countries.
	ExcludeLocationsCountry []string `query:"excludeLocationsCountry,omitzero" json:"-"`
	// A list of person names that, when associated with the content, cause the article
	// to be excluded. This filter removes articles related to any individuals whose
	// names match those on the list.
	ExcludePersonName []string `query:"excludePersonName,omitzero" json:"-"`
	// A list of Wikidata identifiers for individuals. Articles mentioning persons with
	// any of these Wikidata IDs will be filtered out. This is particularly helpful
	// when using a unique identifier to prevent ambiguity in names.
	ExcludePersonWikidataID []string `query:"excludePersonWikidataId,omitzero" json:"-"`
	// The domain of the website, which should be excluded from the search. Multiple
	// parameters could be provided. Wildcards (_ and ?) are suported (e.g. _.cnn.com).
	ExcludeSource []string `query:"excludeSource,omitzero" json:"-"`
	// A list of built-in source group names to exclude from the results. The Perigon
	// API categorizes sources into groups (for example, “top10” or “top100”) based on
	// type or popularity. Using this filter allows you to remove articles coming from
	// any source that belongs to one or more of the specified groups.
	ExcludeSourceGroup []string `query:"excludeSourceGroup,omitzero" json:"-"`
	// A list of states to exclude. Articles that include, or are associated with, any
	// of the states provided here will be filtered out. This is especially useful if
	// you want to ignore news tied to certain geographical areas (e.g., US states).
	ExcludeState []string `query:"excludeState,omitzero" json:"-"`
	// Filter by excluding topics. Each topic is some kind of entity that the article
	// is about. Examples of topics: Markets, Joe Biden, Green Energy, Climate Change,
	// Cryptocurrency, etc. If multiple parameters are passed, they will be applied as
	// OR operations.
	ExcludeTopic []string `query:"excludeTopic,omitzero" json:"-"`
	// Filter by journalist ID. Journalist IDs are unique journalist identifiers which
	// can be found through the Journalist API, or in the matchedAuthors field.
	JournalistID []string `query:"journalistId,omitzero" json:"-"`
	// Labels to filter by, could be 'Opinion', 'Paid-news', 'Non-news', etc. If
	// multiple parameters are passed, they will be applied as OR operations.
	Label []string `query:"label,omitzero" json:"-"`
	// Language code to filter by language. If multiple parameters are passed, they
	// will be applied as OR operations.
	Language []string `query:"language,omitzero" json:"-"`
	// Return all articles that have the specified location. Location attributes are
	// delimited by ':' between key and value, and '::' between attributes. Example:
	// 'city:New York::state:NY'.
	Location []string `query:"location,omitzero" json:"-"`
	// Filters articles where a specified country plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the country
	// in question. If multiple parameters are passed, they will be applied as OR
	// operations.
	LocationsCountry []string `query:"locationsCountry,omitzero" json:"-"`
	// Medium will filter out news articles medium, which could be 'Video' or
	// 'Article'. If several parameters are passed, all matched articles will be
	// returned.
	Medium []string `query:"medium,omitzero" json:"-"`
	// List of person names for exact matches. Boolean and complex logic is not
	// supported on this paramter.
	PersonName []string `query:"personName,omitzero" json:"-"`
	// List of person Wikidata IDs for filtering.
	PersonWikidataID []string `query:"personWikidataId,omitzero" json:"-"`
	// 'relevance' to sort by relevance to the query, 'date' to sort by the publication
	// date (desc), 'pubDate' is a synonym to 'date', 'addDate' to sort by 'addDate'
	// field (desc), 'refreshDate' to sort by 'refreshDate' field (desc). Defaults to
	// 'relevance'
	//
	// Any of "relevance", "date", "reverseDate", "reverseAddDate", "addDate",
	// "pubDate", "refreshDate".
	SortBy AllEndpointSortBy `query:"sortBy,omitzero" json:"-"`
	// Publisher's domain can include a subdomain. If multiple parameters are passed,
	// they will be applied as OR operations. Wildcards (_ and ?) are suported (e.g.
	// _.cnn.com).
	Source []string `query:"source,omitzero" json:"-"`
	// Find articles published by sources that are located within a given city.
	SourceCity []string `query:"sourceCity,omitzero" json:"-"`
	// Find articles published by sources that are located within a given country. Must
	// be 2 character country code (i.e. us, gb, etc).
	SourceCountry []string `query:"sourceCountry,omitzero" json:"-"`
	// Find articles published by sources that are located within a given county.
	SourceCounty []string `query:"sourceCounty,omitzero" json:"-"`
	// One of the supported source groups. Find Source Groups in the guided part of our
	// documentation...
	SourceGroup []string `query:"sourceGroup,omitzero" json:"-"`
	// Find articles published by sources that are located within a given state.
	SourceState []string `query:"sourceState,omitzero" json:"-"`
	// Filters articles where a specified state plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the state in
	// question. If multiple parameters are passed, they will be applied as OR
	// operations.
	State []string `query:"state,omitzero" json:"-"`
	// Filters by Google Content Categories. This field will accept 1 or more
	// categories, must pass the full name of the category. Example:
	// taxonomy=/Finance/Banking/Other, /Finance/Investing/Funds
	Taxonomy []string `query:"taxonomy,omitzero" json:"-"`
	// Filters results to include only articles with the specified topics. Topics are
	// more specific classifications than categories, with an article potentially
	// having multiple topics assigned. Perigon uses both human and machine curation to
	// maintain an evolving list of available topics. Common examples include
	// 'Markets', 'Crime', 'Cryptocurrency', 'Social Issues', 'College Sports', etc.
	// See the Topics page in Docs for a complete list of available topics.
	Topic []string `query:"topic,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AllListParams) IsPresent

func (f AllListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (AllListParams) URLQuery

func (r AllListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AllListParams's query parameters as `url.Values`.

type AllListResponse

type AllListResponse struct {
	Articles   []Article `json:"articles,nullable"`
	NumResults int64     `json:"numResults,nullable"`
	Status     int64     `json:"status,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Articles    resp.Field
		NumResults  resp.Field
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AllListResponse) RawJSON

func (r AllListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AllListResponse) UnmarshalJSON

func (r *AllListResponse) UnmarshalJSON(data []byte) error

type AllService

type AllService struct {
	Options []option.RequestOption
}

AllService contains methods and other services that help with interacting with the perigon 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 NewAllService method instead.

func NewAllService

func NewAllService(opts ...option.RequestOption) (r AllService)

NewAllService 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 (*AllService) List

func (r *AllService) List(ctx context.Context, query AllListParams, opts ...option.RequestOption) (res *AllListResponse, err error)

Search and filter all news articles available via the Perigon API. The result includes a list of individual articles that were matched to your specific criteria.

type Article

type Article struct {
	AddDate               string                 `json:"addDate,nullable"`
	ArticleID             string                 `json:"articleId,nullable"`
	AuthorsByline         string                 `json:"authorsByline,nullable"`
	Categories            []ArticleCategory      `json:"categories,nullable"`
	Claim                 string                 `json:"claim,nullable"`
	Cluster               NewsCluster            `json:"cluster"`
	ClusterID             string                 `json:"clusterId,nullable"`
	Companies             []ArticleCompany       `json:"companies,nullable"`
	Content               string                 `json:"content,nullable"`
	Country               string                 `json:"country,nullable"`
	Description           string                 `json:"description,nullable"`
	Entities              []ArticleEntity        `json:"entities,nullable"`
	EventTypes            []ArticleEventType     `json:"eventTypes,nullable"`
	Highlights            map[string][]string    `json:"highlights,nullable"`
	ImageURL              string                 `json:"imageUrl,nullable"`
	Journalists           []Journalist           `json:"journalists,nullable"`
	Keywords              []ArticleKeyword       `json:"keywords,nullable"`
	Labels                []ArticleLabel         `json:"labels,nullable"`
	Language              string                 `json:"language,nullable"`
	Links                 []string               `json:"links,nullable"`
	Locations             []ArticleLocation      `json:"locations,nullable"`
	MatchedAuthors        []ArticleMatchedAuthor `json:"matchedAuthors,nullable"`
	Medium                string                 `json:"medium,nullable"`
	People                []ArticlePerson        `json:"people,nullable"`
	Places                []ArticlePlace         `json:"places,nullable"`
	PubDate               string                 `json:"pubDate,nullable"`
	RefreshDate           string                 `json:"refreshDate,nullable"`
	Reprint               bool                   `json:"reprint,nullable"`
	ReprintGroupID        string                 `json:"reprintGroupId,nullable"`
	Score                 float64                `json:"score,nullable"`
	Sentiment             ArticleSentiment       `json:"sentiment"`
	ShortSummary          string                 `json:"shortSummary,nullable"`
	Source                ArticleSource          `json:"source"`
	Summary               string                 `json:"summary,nullable"`
	Taxonomies            []ArticleTaxonomy      `json:"taxonomies,nullable"`
	Title                 string                 `json:"title,nullable"`
	Topics                []ArticleTopic         `json:"topics,nullable"`
	TranslatedDescription string                 `json:"translatedDescription,nullable"`
	TranslatedSummary     string                 `json:"translatedSummary,nullable"`
	TranslatedTitle       string                 `json:"translatedTitle,nullable"`
	Translation           string                 `json:"translation,nullable"`
	URL                   string                 `json:"url,nullable"`
	Verdict               string                 `json:"verdict,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		AddDate               resp.Field
		ArticleID             resp.Field
		AuthorsByline         resp.Field
		Categories            resp.Field
		Claim                 resp.Field
		Cluster               resp.Field
		ClusterID             resp.Field
		Companies             resp.Field
		Content               resp.Field
		Country               resp.Field
		Description           resp.Field
		Entities              resp.Field
		EventTypes            resp.Field
		Highlights            resp.Field
		ImageURL              resp.Field
		Journalists           resp.Field
		Keywords              resp.Field
		Labels                resp.Field
		Language              resp.Field
		Links                 resp.Field
		Locations             resp.Field
		MatchedAuthors        resp.Field
		Medium                resp.Field
		People                resp.Field
		Places                resp.Field
		PubDate               resp.Field
		RefreshDate           resp.Field
		Reprint               resp.Field
		ReprintGroupID        resp.Field
		Score                 resp.Field
		Sentiment             resp.Field
		ShortSummary          resp.Field
		Source                resp.Field
		Summary               resp.Field
		Taxonomies            resp.Field
		Title                 resp.Field
		Topics                resp.Field
		TranslatedDescription resp.Field
		TranslatedSummary     resp.Field
		TranslatedTitle       resp.Field
		Translation           resp.Field
		URL                   resp.Field
		Verdict               resp.Field
		ExtraFields           map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Article) RawJSON

func (r Article) RawJSON() string

Returns the unmodified JSON received from the API

func (*Article) UnmarshalJSON

func (r *Article) UnmarshalJSON(data []byte) error

type ArticleCategory

type ArticleCategory struct {
	Name string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleCategory) RawJSON

func (r ArticleCategory) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleCategory) UnmarshalJSON

func (r *ArticleCategory) UnmarshalJSON(data []byte) error

type ArticleCompany

type ArticleCompany struct {
	ID      string   `json:"id,nullable"`
	Domains []string `json:"domains,nullable"`
	Name    string   `json:"name,nullable"`
	Symbols []string `json:"symbols,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID          resp.Field
		Domains     resp.Field
		Name        resp.Field
		Symbols     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleCompany) RawJSON

func (r ArticleCompany) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleCompany) UnmarshalJSON

func (r *ArticleCompany) UnmarshalJSON(data []byte) error

type ArticleEntity

type ArticleEntity struct {
	Data     string `json:"data,nullable"`
	Mentions int64  `json:"mentions,nullable"`
	Type     string `json:"type,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Data        resp.Field
		Mentions    resp.Field
		Type        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleEntity) RawJSON

func (r ArticleEntity) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleEntity) UnmarshalJSON

func (r *ArticleEntity) UnmarshalJSON(data []byte) error

type ArticleEventType

type ArticleEventType struct {
	Name string `json:"name,nullable"`
	Type string `json:"type,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		Type        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleEventType) RawJSON

func (r ArticleEventType) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleEventType) UnmarshalJSON

func (r *ArticleEventType) UnmarshalJSON(data []byte) error

type ArticleKeyword

type ArticleKeyword struct {
	Name   string  `json:"name,nullable"`
	Weight float64 `json:"weight,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		Weight      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleKeyword) RawJSON

func (r ArticleKeyword) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleKeyword) UnmarshalJSON

func (r *ArticleKeyword) UnmarshalJSON(data []byte) error

type ArticleLabel

type ArticleLabel struct {
	Name string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleLabel) RawJSON

func (r ArticleLabel) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleLabel) UnmarshalJSON

func (r *ArticleLabel) UnmarshalJSON(data []byte) error

type ArticleLocation

type ArticleLocation struct {
	Area    string `json:"area,nullable"`
	City    string `json:"city,nullable"`
	Country string `json:"country,nullable"`
	County  string `json:"county,nullable"`
	State   string `json:"state,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Area        resp.Field
		City        resp.Field
		Country     resp.Field
		County      resp.Field
		State       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleLocation) RawJSON

func (r ArticleLocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleLocation) UnmarshalJSON

func (r *ArticleLocation) UnmarshalJSON(data []byte) error

type ArticleMatchedAuthor

type ArticleMatchedAuthor struct {
	ID   string `json:"id,nullable"`
	Name string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID          resp.Field
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleMatchedAuthor) RawJSON

func (r ArticleMatchedAuthor) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleMatchedAuthor) UnmarshalJSON

func (r *ArticleMatchedAuthor) UnmarshalJSON(data []byte) error

type ArticlePerson

type ArticlePerson struct {
	Name       string `json:"name,nullable"`
	WikidataID string `json:"wikidataId,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		WikidataID  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticlePerson) RawJSON

func (r ArticlePerson) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticlePerson) UnmarshalJSON

func (r *ArticlePerson) UnmarshalJSON(data []byte) error

type ArticlePlace

type ArticlePlace struct {
	Amenity       string                  `json:"amenity,nullable"`
	City          string                  `json:"city,nullable"`
	Coordinates   ArticlePlaceCoordinates `json:"coordinates"`
	Country       string                  `json:"country,nullable"`
	CountryCode   string                  `json:"countryCode,nullable"`
	County        string                  `json:"county,nullable"`
	Neighbourhood string                  `json:"neighbourhood,nullable"`
	OsmID         string                  `json:"osmId,nullable"`
	Postcode      string                  `json:"postcode,nullable"`
	Quarter       string                  `json:"quarter,nullable"`
	Road          string                  `json:"road,nullable"`
	State         string                  `json:"state,nullable"`
	StateDistrict string                  `json:"stateDistrict,nullable"`
	Suburb        string                  `json:"suburb,nullable"`
	Town          string                  `json:"town,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Amenity       resp.Field
		City          resp.Field
		Coordinates   resp.Field
		Country       resp.Field
		CountryCode   resp.Field
		County        resp.Field
		Neighbourhood resp.Field
		OsmID         resp.Field
		Postcode      resp.Field
		Quarter       resp.Field
		Road          resp.Field
		State         resp.Field
		StateDistrict resp.Field
		Suburb        resp.Field
		Town          resp.Field
		ExtraFields   map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticlePlace) RawJSON

func (r ArticlePlace) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticlePlace) UnmarshalJSON

func (r *ArticlePlace) UnmarshalJSON(data []byte) error

type ArticlePlaceCoordinates

type ArticlePlaceCoordinates struct {
	Lat float64 `json:"lat,nullable"`
	Lon float64 `json:"lon,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Lat         resp.Field
		Lon         resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticlePlaceCoordinates) RawJSON

func (r ArticlePlaceCoordinates) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticlePlaceCoordinates) UnmarshalJSON

func (r *ArticlePlaceCoordinates) UnmarshalJSON(data []byte) error

type ArticleSearchFilterCoordinatesParam

type ArticleSearchFilterCoordinatesParam struct {
	Lat    param.Opt[float64] `json:"lat,omitzero"`
	Lon    param.Opt[float64] `json:"lon,omitzero"`
	Radius param.Opt[float64] `json:"radius,omitzero"`
	// contains filtered or unexported fields
}

Filter using sources that are located on specific coordinates using Lat, lon and radius.

func (ArticleSearchFilterCoordinatesParam) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (ArticleSearchFilterCoordinatesParam) MarshalJSON

func (r ArticleSearchFilterCoordinatesParam) MarshalJSON() (data []byte, err error)

type ArticleSearchFilterParam

type ArticleSearchFilterParam struct {
	// Adds additional AND filter objects. These objects must be of the same type as
	// the original filter object and will be combined with the existing filter using
	// the AND logical operator.
	And []ArticleSearchFilterParam `json:"AND,omitzero"`
	// Filter by specific article(s). Array of article IDs. For convenience, a single
	// string ID is also accepted.
	ArticleID []string `json:"articleId,omitzero"`
	// Filter by categories. Categories are general themes that the article is about.
	// Examples of categories: Tech, Politics, etc. If multiple parameters are passed,
	// they will be applied as OR operations. Use 'none' to search uncategorized
	// articles.
	Category []string `json:"category,omitzero"`
	// Filters articles where a specified city plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the urban
	// area in question. If multiple parameters are passed, they will be applied as OR
	// operations.
	City []string `json:"city,omitzero"`
	// Filter by specific cluster(s). Accepts either a single string or an array of
	// strings.
	ClusterID []string `json:"clusterId,omitzero"`
	// Search by company domains for filtering. E.g. companyDomain=apple.com.
	CompanyDomain []string `json:"companyDomain,omitzero"`
	// List of company IDs to filter by.
	CompanyID []string `json:"companyId,omitzero"`
	// Search by company name.
	CompanyName []string `json:"companyName,omitzero"`
	// Search by company symbols.
	CompanySymbol []string `json:"companySymbol,omitzero"`
	// Country code to filter by country. If multiple parameters are passed, they will
	// be applied as OR operations. Only accepts country ISO codes.
	Country []string `json:"country,omitzero"`
	// Filters articles where a specified state plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the state in
	// question. If multiple parameters are passed, they will be applied as OR
	// operations.
	County []string `json:"county,omitzero"`
	// A list of cities to exclude from the results. Articles that are associated with
	// any of the specified cities will be filtered out.
	ExcludeCity []string `json:"excludeCity,omitzero"`
	// A list of company domains to exclude. If an article is related to a company that
	// uses one of the specified domains (for instance, "example.com"), it will not be
	// returned in the results.
	ExcludeCompanyDomain []string `json:"excludeCompanyDomain,omitzero"`
	// A list of company identifiers. Articles associated with companies that have any
	// of these unique IDs will be filtered out from the returned results, ensuring
	// that certain companies or corporate entities are not included.
	ExcludeCompanyID []string `json:"excludeCompanyId,omitzero"`
	// A list of stock symbols (ticker symbols) that identify companies to be excluded.
	// Articles related to companies using any of these symbols will be omitted, which
	// is useful for targeting or avoiding specific public companies.
	ExcludeCompanySymbol []string `json:"excludeCompanySymbol,omitzero"`
	// Excludes articles from specific countries in the vector search results. Accepts
	// a list of country codes (e.g., 'US', 'UK', 'CA'). Use this parameter to filter
	// out articles published in countries you don't want to include in your search
	// results. See the Country and Language Support section in the documentation for a
	// full list of supported country codes.
	ExcludeCountry []string `json:"excludeCountry,omitzero"`
	// Excludes articles from specific counties or administrative divisions in the
	// vector search results. Accepts either a single county name or a list of county
	// names. County names should match the format used in article metadata (e.g., 'Los
	// Angeles County', 'Cook County'). This parameter allows for more granular
	// geographic filter
	ExcludeCounty []string `json:"excludeCounty,omitzero"`
	// Exclude results that include specific labels (Opinion, Non-news, Paid News,
	// etc.). You can filter multiple by repeating the parameter.
	ExcludeLabel []string `json:"excludeLabel,omitzero"`
	// A list of languages to be excluded. Any article published in one of the
	// languages provided in this filter will not be returned. This is useful when you
	// are interested only in news published in specific languages.
	ExcludeLanguage []string `json:"excludeLanguage,omitzero"`
	// Excludes articles where a specified country plays a central role in the content,
	// ensuring results are not deeply relevant to the country in question. If multiple
	// parameters are passed, they will be applied as AND operations, excluding
	// articles relevant to any of the specified countries.
	ExcludeLocationsCountry []string `json:"excludeLocationsCountry,omitzero"`
	// A list of person names that, when associated with the content, cause the article
	// to be excluded. This filter removes articles related to any individuals whose
	// names match those on the list.
	ExcludePersonName []string `json:"excludePersonName,omitzero"`
	// A list of Wikidata identifiers for individuals. Articles mentioning persons with
	// any of these Wikidata IDs will be filtered out. This is particularly helpful
	// when using a unique identifier to prevent ambiguity in names.
	ExcludePersonWikidataID []string `json:"excludePersonWikidataId,omitzero"`
	// The domain of the website, which should be excluded from the search. Multiple
	// parameters could be provided. Wildcards (_ and ?) are suported (e.g. _.cnn.com).
	ExcludeSource []string `json:"excludeSource,omitzero"`
	// A list of states to exclude. Articles that include, or are associated with, any
	// of the states provided here will be filtered out. This is especially useful if
	// you want to ignore news tied to certain geographical areas (e.g., US states).
	ExcludeState []string `json:"excludeState,omitzero"`
	// Filter by excluding topics. Each topic is some kind of entity that the article
	// is about. Examples of topics: Markets, Joe Biden, Green Energy, Climate Change,
	// Cryptocurrency, etc. If multiple parameters are passed, they will be applied as
	// OR operations.
	ExcludeTopic []string `json:"excludeTopic,omitzero"`
	// Labels to filter by, could be 'Opinion', 'Paid-news', 'Non-news', etc. If
	// multiple parameters are passed, they will be applied as OR operations.
	Label []string `json:"label,omitzero"`
	// Language code to filter by language. If an array parameters are passed, they
	// will be applied as OR operations. For example: ['en', 'es']. Language ISO codes
	// must be provided.
	Language []string `json:"language,omitzero"`
	// Filters articles where a specified country plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the country
	// in question. If multiple parameters are passed, they will be applied as OR
	// operations. Only accepts country ISO codes.
	LocationsCountry []string `json:"locationsCountry,omitzero"`
	// A filter object for logical NOT operations
	Not []ArticleSearchFilterParam `json:"NOT,omitzero"`
	// Adds additional OR filter objects. These objects must be of the same type as the
	// original filter object and will be combined with the existing filter using the
	// OR logical operator.
	Or []ArticleSearchFilterParam `json:"OR,omitzero"`
	// List of person names for exact matches. Boolean and complex logic is not
	// supported on this filter.
	PersonName []string `json:"personName,omitzero"`
	// List of person Wikidata IDs for filtering.
	PersonWikidataID []string `json:"personWikidataId,omitzero"`
	// Filter by specific source(s). Accepts either a single string or an array of
	// strings.
	Source []string `json:"source,omitzero"`
	// Find articles published by sources that are located within a given city.
	SourceCity []string `json:"sourceCity,omitzero"`
	// Find articles published by sources that are located within a given country. Must
	// be 2 character country code (i.e. us, gb, etc).
	SourceCountry []string `json:"sourceCountry,omitzero"`
	// Find articles published by sources that are located within a given county.
	SourceCounty []string `json:"sourceCounty,omitzero"`
	// Filter by specific source group, for example: 'top100'. Accepts either a single
	// string or an array of strings.
	SourceGroup []string `json:"sourceGroup,omitzero"`
	// Find articles published by sources that are located within a given state.
	SourceState []string `json:"sourceState,omitzero"`
	// Filters articles where a specified state plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the state in
	// question. If multiple parameters are passed, they will be applied as OR
	// operations. Only accepts state ISO codes.
	State []string `json:"state,omitzero"`
	// Filters by Google Content Categories. This field will accept 1 or more
	// categories, must pass the full name of the category. Example:
	// taxonomy=/Finance/Banking/Other, /Finance/Investing/Funds
	Taxonomy []string `json:"taxonomy,omitzero"`
	// Filter by topics. Each topic is some kind of entity that the article is about.
	// Examples of topics: Markets, Joe Biden, Green Energy, Climate Change,
	// Cryptocurrency, etc. If multiple parameters are passed, they will be applied as
	// OR operations.
	Topic []string `json:"topic,omitzero"`
	// Filter using sources that are located on specific coordinates using Lat, lon and
	// radius.
	Coordinates ArticleSearchFilterCoordinatesParam `json:"coordinates,omitzero"`
	// Filter using sources that are located on specific coordinates using Lat, lon and
	// radius.
	SourceCoordinates ArticleSearchFilterSourceCoordinatesParam `json:"sourceCoordinates,omitzero"`
	// contains filtered or unexported fields
}

A versatile filter object to refine search results based on articles, clusters, sources, languages, categories, locations, companies, and people. Supports logical operators (AND, OR, NOT) for complex queries. Accepts single values or arrays, with arrays applied as OR operations.

func (ArticleSearchFilterParam) IsPresent

func (f ArticleSearchFilterParam) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (ArticleSearchFilterParam) MarshalJSON

func (r ArticleSearchFilterParam) MarshalJSON() (data []byte, err error)

type ArticleSearchFilterSourceCoordinatesParam

type ArticleSearchFilterSourceCoordinatesParam struct {
	Lat    param.Opt[float64] `json:"lat,omitzero"`
	Lon    param.Opt[float64] `json:"lon,omitzero"`
	Radius param.Opt[float64] `json:"radius,omitzero"`
	// contains filtered or unexported fields
}

Filter using sources that are located on specific coordinates using Lat, lon and radius.

func (ArticleSearchFilterSourceCoordinatesParam) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (ArticleSearchFilterSourceCoordinatesParam) MarshalJSON

func (r ArticleSearchFilterSourceCoordinatesParam) MarshalJSON() (data []byte, err error)

type ArticleSentiment

type ArticleSentiment struct {
	Negative float64 `json:"negative,nullable"`
	Neutral  float64 `json:"neutral,nullable"`
	Positive float64 `json:"positive,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Negative    resp.Field
		Neutral     resp.Field
		Positive    resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleSentiment) RawJSON

func (r ArticleSentiment) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleSentiment) UnmarshalJSON

func (r *ArticleSentiment) UnmarshalJSON(data []byte) error

type ArticleSource

type ArticleSource struct {
	Domain   string                `json:"domain,nullable"`
	Location ArticleSourceLocation `json:"location"`
	Paywall  bool                  `json:"paywall,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Domain      resp.Field
		Location    resp.Field
		Paywall     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleSource) RawJSON

func (r ArticleSource) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleSource) UnmarshalJSON

func (r *ArticleSource) UnmarshalJSON(data []byte) error

type ArticleSourceLocation

type ArticleSourceLocation struct {
	City        string                           `json:"city,nullable"`
	Coordinates ArticleSourceLocationCoordinates `json:"coordinates"`
	Country     string                           `json:"country,nullable"`
	County      string                           `json:"county,nullable"`
	State       string                           `json:"state,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		City        resp.Field
		Coordinates resp.Field
		Country     resp.Field
		County      resp.Field
		State       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleSourceLocation) RawJSON

func (r ArticleSourceLocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleSourceLocation) UnmarshalJSON

func (r *ArticleSourceLocation) UnmarshalJSON(data []byte) error

type ArticleSourceLocationCoordinates

type ArticleSourceLocationCoordinates struct {
	Lat float64 `json:"lat,nullable"`
	Lon float64 `json:"lon,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Lat         resp.Field
		Lon         resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleSourceLocationCoordinates) RawJSON

Returns the unmodified JSON received from the API

func (*ArticleSourceLocationCoordinates) UnmarshalJSON

func (r *ArticleSourceLocationCoordinates) UnmarshalJSON(data []byte) error

type ArticleTaxonomy

type ArticleTaxonomy struct {
	Name  string  `json:"name,nullable"`
	Score float64 `json:"score,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		Score       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleTaxonomy) RawJSON

func (r ArticleTaxonomy) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleTaxonomy) UnmarshalJSON

func (r *ArticleTaxonomy) UnmarshalJSON(data []byte) error

type ArticleTopic

type ArticleTopic struct {
	Name string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ArticleTopic) RawJSON

func (r ArticleTopic) RawJSON() string

Returns the unmodified JSON received from the API

func (*ArticleTopic) UnmarshalJSON

func (r *ArticleTopic) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Options     []option.RequestOption
	All         AllService
	Companies   CompanyService
	Journalists JournalistService
	People      PersonService
	Sources     SourceService
	Stories     StoryService
	Summarize   SummarizeService
	Topics      TopicService
	Vector      VectorService
}

Client creates a struct with services and top level methods that help with interacting with the perigon 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 (PERIGON_API_KEY, PERIGON_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.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CompanyListParams

type CompanyListParams struct {
	// Search by industry. Boolean operators and logic are supported.
	Industry param.Opt[string] `query:"industry,omitzero" json:"-"`
	// Starting IPO date.
	IpoFrom param.Opt[time.Time] `query:"ipoFrom,omitzero" format:"date-time" json:"-"`
	// Ending IPO date.
	IpoTo param.Opt[time.Time] `query:"ipoTo,omitzero" format:"date-time" json:"-"`
	// Search by company name. Boolean operators and logic are supported.
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// Minimum number of employees.
	NumEmployeesFrom param.Opt[int64] `query:"numEmployeesFrom,omitzero" json:"-"`
	// Maximum number of employees.
	NumEmployeesTo param.Opt[int64] `query:"numEmployeesTo,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Search companies over 'name', 'altNames', 'domains' and 'symbols.symbol' fields.
	// Boolean operators and logic are supported.
	Q param.Opt[string] `query:"q,omitzero" json:"-"`
	// Search by sector. Boolean operators and logic are supported.
	Sector param.Opt[string] `query:"sector,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// Search by company id.
	ID []string `query:"id,omitzero" json:"-"`
	// Search by company country.
	Country []string `query:"country,omitzero" json:"-"`
	// Search by company domain.
	Domain []string `query:"domain,omitzero" json:"-"`
	// Search by exchange name.
	Exchange []string `query:"exchange,omitzero" json:"-"`
	// Search by ticker symbol.
	Symbol []string `query:"symbol,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CompanyListParams) IsPresent

func (f CompanyListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (CompanyListParams) URLQuery

func (r CompanyListParams) URLQuery() (v url.Values, err error)

URLQuery serializes CompanyListParams's query parameters as `url.Values`.

type CompanyListResponse

type CompanyListResponse struct {
	NumResults int64                       `json:"numResults,nullable"`
	Results    []CompanyListResponseResult `json:"results,nullable"`
	Status     int64                       `json:"status,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		NumResults  resp.Field
		Results     resp.Field
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Company search result

func (CompanyListResponse) RawJSON

func (r CompanyListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompanyListResponse) UnmarshalJSON

func (r *CompanyListResponse) UnmarshalJSON(data []byte) error

type CompanyListResponseResult

type CompanyListResponseResult struct {
	ID                string                                `json:"id,nullable"`
	Address           string                                `json:"address,nullable"`
	AltNames          []string                              `json:"altNames,nullable"`
	Ceo               string                                `json:"ceo,nullable"`
	City              string                                `json:"city,nullable"`
	Country           string                                `json:"country,nullable"`
	Description       string                                `json:"description,nullable"`
	Domains           []string                              `json:"domains,nullable"`
	Favicon           string                                `json:"favicon,nullable"`
	FullTimeEmployees int64                                 `json:"fullTimeEmployees,nullable"`
	GlobalRank        int64                                 `json:"globalRank,nullable"`
	Industry          string                                `json:"industry,nullable"`
	IsActivelyTrading bool                                  `json:"isActivelyTrading,nullable"`
	IsAdr             bool                                  `json:"isAdr,nullable"`
	IsEtf             bool                                  `json:"isEtf,nullable"`
	IsFund            bool                                  `json:"isFund,nullable"`
	MonthlyVisits     int64                                 `json:"monthlyVisits,nullable"`
	Naics             string                                `json:"naics,nullable"`
	Name              string                                `json:"name,nullable"`
	PrimaryRecordID   string                                `json:"primaryRecordId,nullable"`
	Revenue           string                                `json:"revenue,nullable"`
	Sector            string                                `json:"sector,nullable"`
	Sic               string                                `json:"sic,nullable"`
	State             string                                `json:"state,nullable"`
	Symbols           []CompanyListResponseResultSymbol     `json:"symbols,nullable"`
	UpdatedAt         string                                `json:"updatedAt,nullable"`
	WebResources      CompanyListResponseResultWebResources `json:"webResources"`
	YearFounded       int64                                 `json:"yearFounded,nullable"`
	Zip               string                                `json:"zip,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID                resp.Field
		Address           resp.Field
		AltNames          resp.Field
		Ceo               resp.Field
		City              resp.Field
		Country           resp.Field
		Description       resp.Field
		Domains           resp.Field
		Favicon           resp.Field
		FullTimeEmployees resp.Field
		GlobalRank        resp.Field
		Industry          resp.Field
		IsActivelyTrading resp.Field
		IsAdr             resp.Field
		IsEtf             resp.Field
		IsFund            resp.Field
		Logo              resp.Field
		MonthlyVisits     resp.Field
		Naics             resp.Field
		Name              resp.Field
		PrimaryRecordID   resp.Field
		Revenue           resp.Field
		Sector            resp.Field
		Sic               resp.Field
		State             resp.Field
		Symbols           resp.Field
		UpdatedAt         resp.Field
		WebResources      resp.Field
		YearFounded       resp.Field
		Zip               resp.Field
		ExtraFields       map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompanyListResponseResult) RawJSON

func (r CompanyListResponseResult) RawJSON() string

Returns the unmodified JSON received from the API

func (*CompanyListResponseResult) UnmarshalJSON

func (r *CompanyListResponseResult) UnmarshalJSON(data []byte) error

type CompanyListResponseResultSymbol

type CompanyListResponseResultSymbol struct {
	Exchange          string `json:"exchange,nullable"`
	ExchangeShortName string `json:"exchangeShortName,nullable"`
	IpoDate           string `json:"ipoDate,nullable"`
	Symbol            string `json:"symbol,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Exchange          resp.Field
		ExchangeShortName resp.Field
		IpoDate           resp.Field
		Symbol            resp.Field
		ExtraFields       map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompanyListResponseResultSymbol) RawJSON

Returns the unmodified JSON received from the API

func (*CompanyListResponseResultSymbol) UnmarshalJSON

func (r *CompanyListResponseResultSymbol) UnmarshalJSON(data []byte) error

type CompanyListResponseResultWebResources

type CompanyListResponseResultWebResources struct {
	About     string `json:"about,nullable"`
	Blog      string `json:"blog,nullable"`
	Careers   string `json:"careers,nullable"`
	Events    string `json:"events,nullable"`
	Facebook  string `json:"facebook,nullable"`
	Instagram string `json:"instagram,nullable"`
	Linkedin  string `json:"linkedin,nullable"`
	Medium    string `json:"medium,nullable"`
	Reddit    string `json:"reddit,nullable"`
	Sitemap   string `json:"sitemap,nullable"`
	Threads   string `json:"threads,nullable"`
	Tiktok    string `json:"tiktok,nullable"`
	Updates   string `json:"updates,nullable"`
	Wellfound string `json:"wellfound,nullable"`
	Wikipedia string `json:"wikipedia,nullable"`
	X         string `json:"x,nullable"`
	Youtube   string `json:"youtube,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		About       resp.Field
		Blog        resp.Field
		Careers     resp.Field
		Events      resp.Field
		Facebook    resp.Field
		Instagram   resp.Field
		Linkedin    resp.Field
		Medium      resp.Field
		Reddit      resp.Field
		Sitemap     resp.Field
		Threads     resp.Field
		Tiktok      resp.Field
		Updates     resp.Field
		Wellfound   resp.Field
		Wikipedia   resp.Field
		X           resp.Field
		Youtube     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CompanyListResponseResultWebResources) RawJSON

Returns the unmodified JSON received from the API

func (*CompanyListResponseResultWebResources) UnmarshalJSON

func (r *CompanyListResponseResultWebResources) UnmarshalJSON(data []byte) error

type CompanyService

type CompanyService struct {
	Options []option.RequestOption
}

CompanyService contains methods and other services that help with interacting with the perigon 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 NewCompanyService method instead.

func NewCompanyService

func NewCompanyService(opts ...option.RequestOption) (r CompanyService)

NewCompanyService 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 (*CompanyService) List

Browse or search for companies Perigon tracks using name, domain, ticker symbol, industry, and more. Supports Boolean search logic and filtering by metadata such as country, exchange, employee count, and IPO date.

type Error

type Error = apierror.Error

type ImageHolder

type ImageHolder struct {
	URL string `json:"url,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		URL         resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ImageHolder) RawJSON

func (r ImageHolder) RawJSON() string

Returns the unmodified JSON received from the API

func (*ImageHolder) UnmarshalJSON

func (r *ImageHolder) UnmarshalJSON(data []byte) error

type Journalist

type Journalist struct {
	ID                  string               `json:"id,nullable"`
	AvgMonthlyPosts     int64                `json:"avgMonthlyPosts,nullable"`
	BlogURL             string               `json:"blogUrl,nullable"`
	Description         string               `json:"description,nullable"`
	FacebookURL         string               `json:"facebookUrl,nullable"`
	FullName            string               `json:"fullName,nullable"`
	Headline            string               `json:"headline,nullable"`
	ImageURL            string               `json:"imageUrl,nullable"`
	InstagramURL        string               `json:"instagramUrl,nullable"`
	LinkedinConnections int64                `json:"linkedinConnections,nullable"`
	LinkedinFollowers   int64                `json:"linkedinFollowers,nullable"`
	LinkedinURL         string               `json:"linkedinUrl,nullable"`
	Locations           []JournalistLocation `json:"locations,nullable"`
	Name                string               `json:"name,nullable"`
	Title               string               `json:"title,nullable"`
	TopCategories       []NameCount          `json:"topCategories,nullable"`
	TopCountries        []NameCount          `json:"topCountries,nullable"`
	TopLabels           []NameCount          `json:"topLabels,nullable"`
	TopSources          []NameCount          `json:"topSources,nullable"`
	TopTopics           []NameCount          `json:"topTopics,nullable"`
	TumblrURL           string               `json:"tumblrUrl,nullable"`
	TwitterBio          string               `json:"twitterBio,nullable"`
	TwitterHandle       string               `json:"twitterHandle,nullable"`
	UpdatedAt           string               `json:"updatedAt,nullable"`
	WebsiteURL          string               `json:"websiteUrl,nullable"`
	YoutubeURL          string               `json:"youtubeUrl,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID                  resp.Field
		AvgMonthlyPosts     resp.Field
		BlogURL             resp.Field
		Description         resp.Field
		FacebookURL         resp.Field
		FullName            resp.Field
		Headline            resp.Field
		ImageURL            resp.Field
		InstagramURL        resp.Field
		LinkedinConnections resp.Field
		LinkedinFollowers   resp.Field
		LinkedinURL         resp.Field
		Locations           resp.Field
		Name                resp.Field
		Title               resp.Field
		TopCategories       resp.Field
		TopCountries        resp.Field
		TopLabels           resp.Field
		TopSources          resp.Field
		TopTopics           resp.Field
		TumblrURL           resp.Field
		TwitterBio          resp.Field
		TwitterHandle       resp.Field
		UpdatedAt           resp.Field
		WebsiteURL          resp.Field
		YoutubeURL          resp.Field
		ExtraFields         map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Journalist) RawJSON

func (r Journalist) RawJSON() string

Returns the unmodified JSON received from the API

func (*Journalist) UnmarshalJSON

func (r *Journalist) UnmarshalJSON(data []byte) error

type JournalistListParams

type JournalistListParams struct {
	// Returns the journalist with the maximum indicated number of average monthly
	// posts.
	MaxMonthlyPosts param.Opt[int64] `query:"maxMonthlyPosts,omitzero" json:"-"`
	// Returns the journalists with the minimum indicated number of average monthly
	// posts.
	MinMonthlyPosts param.Opt[int64] `query:"minMonthlyPosts,omitzero" json:"-"`
	// Searches through journalist names, scores and ranks them, returns results sorted
	// by relevance.
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Searches through name, title, twitterBio fields with priority given to the name,
	// then to the title, then to the twitter bio. Returns results sorted by relevance.
	Q param.Opt[string] `query:"q,omitzero" json:"-"`
	// If 'true', shows accurate number of results matched by the query. By default,
	// the counter is accurate only up to 10,000 results due performance reasons.
	ShowNumResults param.Opt[bool] `query:"showNumResults,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// Searches for journalists by (exact match) twitter handle.
	Twitter param.Opt[string] `query:"twitter,omitzero" json:"-"`
	// Starting date when the record was last updated.
	UpdatedAtFrom param.Opt[time.Time] `query:"updatedAtFrom,omitzero" format:"date-time" json:"-"`
	// Ending date when the record was last updated.
	UpdatedAtTo param.Opt[time.Time] `query:"updatedAtTo,omitzero" format:"date-time" json:"-"`
	// Filter by journalist ID. Journalist IDs are unique journalist identifiers which
	// can be found through the Journalist API, or in the matchedAuthors field.
	ID []string `query:"id,omitzero" json:"-"`
	// Filter by categories. Categories are general themes that the article is about.
	// Examples of categories: Tech, Politics, etc. If multiple parameters are passed,
	// they will be applied as OR operations.
	Category []string `query:"category,omitzero" json:"-"`
	// Country code to filter by country. If multiple parameters are passed, they will
	// be applied as OR operations.
	Country []string `query:"country,omitzero" json:"-"`
	// Filter journalists by label. For example, searching 'Opinion' will return the
	// journalists where 'Opinion'-type articles is one of the top labels for the
	// articles they publish.
	Label []string `query:"label,omitzero" json:"-"`
	// Search for journalist by the publisher's domain can include a subdomain. If
	// multiple parameters are passed, they will be applied as OR operations. Wildcards
	// (_ and ?) are suported (e.g. _.cnn.com).
	Source []string `query:"source,omitzero" json:"-"`
	// Searches for journalists by topic.
	Topic []string `query:"topic,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (JournalistListParams) IsPresent

func (f JournalistListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (JournalistListParams) URLQuery

func (r JournalistListParams) URLQuery() (v url.Values, err error)

URLQuery serializes JournalistListParams's query parameters as `url.Values`.

type JournalistListResponse

type JournalistListResponse struct {
	NumResults int64        `json:"numResults,nullable"`
	Results    []Journalist `json:"results,nullable"`
	Status     int64        `json:"status,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		NumResults  resp.Field
		Results     resp.Field
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Journalist search result

func (JournalistListResponse) RawJSON

func (r JournalistListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*JournalistListResponse) UnmarshalJSON

func (r *JournalistListResponse) UnmarshalJSON(data []byte) error

type JournalistLocation

type JournalistLocation struct {
	Area    string `json:"area,nullable"`
	City    string `json:"city,nullable"`
	Country string `json:"country,nullable"`
	County  string `json:"county,nullable"`
	State   string `json:"state,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Area        resp.Field
		City        resp.Field
		Country     resp.Field
		County      resp.Field
		State       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (JournalistLocation) RawJSON

func (r JournalistLocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*JournalistLocation) UnmarshalJSON

func (r *JournalistLocation) UnmarshalJSON(data []byte) error

type JournalistService

type JournalistService struct {
	Options []option.RequestOption
}

JournalistService contains methods and other services that help with interacting with the perigon 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 NewJournalistService method instead.

func NewJournalistService

func NewJournalistService(opts ...option.RequestOption) (r JournalistService)

NewJournalistService 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 (*JournalistService) Get

func (r *JournalistService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Journalist, err error)

Find additional details on a journalist by using the journalist ID found in an article response object.

func (*JournalistService) List

Search journalists using broad search attributes. Our database contains over 230,000 journalists from around the world and is refreshed frequently.

type NameCount

type NameCount struct {
	Count int64  `json:"count,nullable"`
	Name  string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Count       resp.Field
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NameCount) RawJSON

func (r NameCount) RawJSON() string

Returns the unmodified JSON received from the API

func (*NameCount) UnmarshalJSON

func (r *NameCount) UnmarshalJSON(data []byte) error

type NewsCluster

type NewsCluster struct {
	ID                string                   `json:"id,nullable"`
	Categories        []NewsClusterCategory    `json:"categories,nullable"`
	Companies         []NewsClusterCompany     `json:"companies,nullable"`
	Countries         []NewsClusterCountry     `json:"countries,nullable"`
	CreatedAt         string                   `json:"createdAt,nullable"`
	DuplicateOf       string                   `json:"duplicateOf,nullable"`
	Highlights        map[string][]string      `json:"highlights,nullable"`
	ImageSource       NewsClusterImageSource   `json:"imageSource"`
	ImageURL          string                   `json:"imageUrl,nullable"`
	InitializedAt     string                   `json:"initializedAt,nullable"`
	KeyPoints         []NewsClusterKeyPoint    `json:"keyPoints,nullable"`
	Locations         []NewsClusterLocation    `json:"locations,nullable"`
	Name              string                   `json:"name,nullable"`
	People            []NewsClusterPerson      `json:"people,nullable"`
	Questions         []NewsClusterQuestion    `json:"questions,nullable"`
	ReprintCount      int64                    `json:"reprintCount,nullable"`
	SelectedArticles  []Article                `json:"selectedArticles,nullable"`
	Sentiment         NewsClusterSentiment     `json:"sentiment"`
	ShortSummary      string                   `json:"shortSummary,nullable"`
	Slug              string                   `json:"slug,nullable"`
	Summary           string                   `json:"summary,nullable"`
	SummaryReferences []string                 `json:"summaryReferences,nullable"`
	Taxonomies        []NewsClusterTaxonomy    `json:"taxonomies,nullable"`
	TopCategories     []NewsClusterTopCategory `json:"topCategories,nullable"`
	TopCompanies      []NewsClusterTopCompany  `json:"topCompanies,nullable"`
	TopCountries      []string                 `json:"topCountries,nullable"`
	Topics            []NewsClusterTopic       `json:"topics,nullable"`
	TopLocations      []NewsClusterTopLocation `json:"topLocations,nullable"`
	TopPeople         []NewsClusterTopPerson   `json:"topPeople,nullable"`
	TopTaxonomies     []NewsClusterTopTaxonomy `json:"topTaxonomies,nullable"`
	TopTopics         []NewsClusterTopTopic    `json:"topTopics,nullable"`
	TotalCount        int64                    `json:"totalCount,nullable"`
	UniqueCount       int64                    `json:"uniqueCount,nullable"`
	UniqueSources     []string                 `json:"uniqueSources,nullable"`
	UpdatedAt         string                   `json:"updatedAt,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID                resp.Field
		Categories        resp.Field
		Companies         resp.Field
		Countries         resp.Field
		CreatedAt         resp.Field
		DuplicateOf       resp.Field
		Highlights        resp.Field
		ImageSource       resp.Field
		ImageURL          resp.Field
		InitializedAt     resp.Field
		KeyPoints         resp.Field
		Locations         resp.Field
		Name              resp.Field
		People            resp.Field
		Questions         resp.Field
		ReprintCount      resp.Field
		SelectedArticles  resp.Field
		Sentiment         resp.Field
		ShortSummary      resp.Field
		Slug              resp.Field
		Summary           resp.Field
		SummaryReferences resp.Field
		Taxonomies        resp.Field
		TopCategories     resp.Field
		TopCompanies      resp.Field
		TopCountries      resp.Field
		Topics            resp.Field
		TopLocations      resp.Field
		TopPeople         resp.Field
		TopTaxonomies     resp.Field
		TopTopics         resp.Field
		TotalCount        resp.Field
		UniqueCount       resp.Field
		UniqueSources     resp.Field
		UpdatedAt         resp.Field
		ExtraFields       map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsCluster) RawJSON

func (r NewsCluster) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsCluster) UnmarshalJSON

func (r *NewsCluster) UnmarshalJSON(data []byte) error

type NewsClusterCategory

type NewsClusterCategory struct {
	Count int64  `json:"count,nullable"`
	Name  string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Count       resp.Field
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterCategory) RawJSON

func (r NewsClusterCategory) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterCategory) UnmarshalJSON

func (r *NewsClusterCategory) UnmarshalJSON(data []byte) error

type NewsClusterCompany

type NewsClusterCompany struct {
	ID      string   `json:"id,nullable"`
	Count   int64    `json:"count,nullable"`
	Domains []string `json:"domains,nullable"`
	Name    string   `json:"name,nullable"`
	Symbols []string `json:"symbols,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID          resp.Field
		Count       resp.Field
		Domains     resp.Field
		Name        resp.Field
		Symbols     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterCompany) RawJSON

func (r NewsClusterCompany) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterCompany) UnmarshalJSON

func (r *NewsClusterCompany) UnmarshalJSON(data []byte) error

type NewsClusterCountry

type NewsClusterCountry struct {
	Count int64  `json:"count,nullable"`
	Name  string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Count       resp.Field
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterCountry) RawJSON

func (r NewsClusterCountry) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterCountry) UnmarshalJSON

func (r *NewsClusterCountry) UnmarshalJSON(data []byte) error

type NewsClusterImageSource

type NewsClusterImageSource struct {
	Domain   string                         `json:"domain,nullable"`
	Location NewsClusterImageSourceLocation `json:"location"`
	Paywall  bool                           `json:"paywall,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Domain      resp.Field
		Location    resp.Field
		Paywall     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterImageSource) RawJSON

func (r NewsClusterImageSource) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterImageSource) UnmarshalJSON

func (r *NewsClusterImageSource) UnmarshalJSON(data []byte) error

type NewsClusterImageSourceLocation

type NewsClusterImageSourceLocation struct {
	City        string                                    `json:"city,nullable"`
	Coordinates NewsClusterImageSourceLocationCoordinates `json:"coordinates"`
	Country     string                                    `json:"country,nullable"`
	County      string                                    `json:"county,nullable"`
	State       string                                    `json:"state,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		City        resp.Field
		Coordinates resp.Field
		Country     resp.Field
		County      resp.Field
		State       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterImageSourceLocation) RawJSON

Returns the unmodified JSON received from the API

func (*NewsClusterImageSourceLocation) UnmarshalJSON

func (r *NewsClusterImageSourceLocation) UnmarshalJSON(data []byte) error

type NewsClusterImageSourceLocationCoordinates

type NewsClusterImageSourceLocationCoordinates struct {
	Lat float64 `json:"lat,nullable"`
	Lon float64 `json:"lon,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Lat         resp.Field
		Lon         resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterImageSourceLocationCoordinates) RawJSON

Returns the unmodified JSON received from the API

func (*NewsClusterImageSourceLocationCoordinates) UnmarshalJSON

func (r *NewsClusterImageSourceLocationCoordinates) UnmarshalJSON(data []byte) error

type NewsClusterKeyPoint

type NewsClusterKeyPoint struct {
	Point      string   `json:"point,nullable"`
	References []string `json:"references,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Point       resp.Field
		References  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterKeyPoint) RawJSON

func (r NewsClusterKeyPoint) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterKeyPoint) UnmarshalJSON

func (r *NewsClusterKeyPoint) UnmarshalJSON(data []byte) error

type NewsClusterLocation

type NewsClusterLocation struct {
	Area   string `json:"area,nullable"`
	City   string `json:"city,nullable"`
	Count  int64  `json:"count,nullable"`
	County string `json:"county,nullable"`
	State  string `json:"state,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Area        resp.Field
		City        resp.Field
		Count       resp.Field
		County      resp.Field
		State       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterLocation) RawJSON

func (r NewsClusterLocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterLocation) UnmarshalJSON

func (r *NewsClusterLocation) UnmarshalJSON(data []byte) error

type NewsClusterPerson

type NewsClusterPerson struct {
	Count      int64  `json:"count,nullable"`
	Name       string `json:"name,nullable"`
	WikidataID string `json:"wikidataId,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Count       resp.Field
		Name        resp.Field
		WikidataID  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterPerson) RawJSON

func (r NewsClusterPerson) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterPerson) UnmarshalJSON

func (r *NewsClusterPerson) UnmarshalJSON(data []byte) error

type NewsClusterQuestion

type NewsClusterQuestion struct {
	Answer     string   `json:"answer,nullable"`
	Question   string   `json:"question,nullable"`
	References []string `json:"references,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Answer      resp.Field
		Question    resp.Field
		References  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterQuestion) RawJSON

func (r NewsClusterQuestion) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterQuestion) UnmarshalJSON

func (r *NewsClusterQuestion) UnmarshalJSON(data []byte) error

type NewsClusterSentiment

type NewsClusterSentiment struct {
	Negative float64 `json:"negative,nullable"`
	Neutral  float64 `json:"neutral,nullable"`
	Positive float64 `json:"positive,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Negative    resp.Field
		Neutral     resp.Field
		Positive    resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterSentiment) RawJSON

func (r NewsClusterSentiment) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterSentiment) UnmarshalJSON

func (r *NewsClusterSentiment) UnmarshalJSON(data []byte) error

type NewsClusterTaxonomy

type NewsClusterTaxonomy struct {
	Count int64  `json:"count,nullable"`
	Name  string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Count       resp.Field
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTaxonomy) RawJSON

func (r NewsClusterTaxonomy) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTaxonomy) UnmarshalJSON

func (r *NewsClusterTaxonomy) UnmarshalJSON(data []byte) error

type NewsClusterTopCategory

type NewsClusterTopCategory struct {
	Name string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTopCategory) RawJSON

func (r NewsClusterTopCategory) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTopCategory) UnmarshalJSON

func (r *NewsClusterTopCategory) UnmarshalJSON(data []byte) error

type NewsClusterTopCompany

type NewsClusterTopCompany struct {
	ID      string   `json:"id,nullable"`
	Domains []string `json:"domains,nullable"`
	Name    string   `json:"name,nullable"`
	Symbols []string `json:"symbols,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID          resp.Field
		Domains     resp.Field
		Name        resp.Field
		Symbols     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTopCompany) RawJSON

func (r NewsClusterTopCompany) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTopCompany) UnmarshalJSON

func (r *NewsClusterTopCompany) UnmarshalJSON(data []byte) error

type NewsClusterTopLocation

type NewsClusterTopLocation struct {
	Area    string `json:"area,nullable"`
	City    string `json:"city,nullable"`
	Country string `json:"country,nullable"`
	County  string `json:"county,nullable"`
	State   string `json:"state,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Area        resp.Field
		City        resp.Field
		Country     resp.Field
		County      resp.Field
		State       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTopLocation) RawJSON

func (r NewsClusterTopLocation) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTopLocation) UnmarshalJSON

func (r *NewsClusterTopLocation) UnmarshalJSON(data []byte) error

type NewsClusterTopPerson

type NewsClusterTopPerson struct {
	Name       string `json:"name,nullable"`
	WikidataID string `json:"wikidataId,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		WikidataID  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTopPerson) RawJSON

func (r NewsClusterTopPerson) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTopPerson) UnmarshalJSON

func (r *NewsClusterTopPerson) UnmarshalJSON(data []byte) error

type NewsClusterTopTaxonomy

type NewsClusterTopTaxonomy struct {
	Name string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTopTaxonomy) RawJSON

func (r NewsClusterTopTaxonomy) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTopTaxonomy) UnmarshalJSON

func (r *NewsClusterTopTaxonomy) UnmarshalJSON(data []byte) error

type NewsClusterTopTopic

type NewsClusterTopTopic struct {
	Name string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTopTopic) RawJSON

func (r NewsClusterTopTopic) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTopTopic) UnmarshalJSON

func (r *NewsClusterTopTopic) UnmarshalJSON(data []byte) error

type NewsClusterTopic

type NewsClusterTopic struct {
	Count int64  `json:"count,nullable"`
	Name  string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Count       resp.Field
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NewsClusterTopic) RawJSON

func (r NewsClusterTopic) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsClusterTopic) UnmarshalJSON

func (r *NewsClusterTopic) UnmarshalJSON(data []byte) error

type PersonListParams

type PersonListParams struct {
	// Search by name of the person. Supports exact matching with quotes ("") and
	// Boolean operators (AND, OR, NOT).
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// Search by occupation name. Supports exact matching with quotes ("") and Boolean
	// operators (AND, OR, NOT).
	OccupationLabel param.Opt[string] `query:"occupationLabel,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// Filter by Wikidata occupation ID(s). Use this to find people with specific
	// occupations.
	OccupationID []string `query:"occupationId,omitzero" json:"-"`
	// Filter by Wikidata entity ID(s). Use this to find specific people by their
	// Wikidata identifiers.
	WikidataID []string `query:"wikidataId,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PersonListParams) IsPresent

func (f PersonListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (PersonListParams) URLQuery

func (r PersonListParams) URLQuery() (v url.Values, err error)

URLQuery serializes PersonListParams's query parameters as `url.Values`.

type PersonListResponse

type PersonListResponse struct {
	NumResults int64                      `json:"numResults,nullable"`
	Results    []PersonListResponseResult `json:"results,nullable"`
	Status     int64                      `json:"status,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		NumResults  resp.Field
		Results     resp.Field
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Person search result

func (PersonListResponse) RawJSON

func (r PersonListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PersonListResponse) UnmarshalJSON

func (r *PersonListResponse) UnmarshalJSON(data []byte) error

type PersonListResponseResult

type PersonListResponseResult struct {
	Abstract       string                                   `json:"abstract,nullable"`
	Aliases        []string                                 `json:"aliases,nullable"`
	CreatedAt      string                                   `json:"createdAt,nullable"`
	DateOfBirth    WikidataDateHolder                       `json:"dateOfBirth"`
	DateOfDeath    WikidataDateHolder                       `json:"dateOfDeath"`
	Description    string                                   `json:"description,nullable"`
	Gender         WikidataLabelHolder                      `json:"gender"`
	Image          ImageHolder                              `json:"image"`
	Name           string                                   `json:"name,nullable"`
	Occupation     []WikidataLabelHolder                    `json:"occupation,nullable"`
	PoliticalParty []PersonListResponseResultPoliticalParty `json:"politicalParty,nullable"`
	Position       []PersonListResponseResultPosition       `json:"position,nullable"`
	UpdatedAt      string                                   `json:"updatedAt,nullable"`
	WikidataID     string                                   `json:"wikidataId,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Abstract       resp.Field
		Aliases        resp.Field
		CreatedAt      resp.Field
		DateOfBirth    resp.Field
		DateOfDeath    resp.Field
		Description    resp.Field
		Gender         resp.Field
		Image          resp.Field
		Name           resp.Field
		Occupation     resp.Field
		PoliticalParty resp.Field
		Position       resp.Field
		UpdatedAt      resp.Field
		WikidataID     resp.Field
		ExtraFields    map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PersonListResponseResult) RawJSON

func (r PersonListResponseResult) RawJSON() string

Returns the unmodified JSON received from the API

func (*PersonListResponseResult) UnmarshalJSON

func (r *PersonListResponseResult) UnmarshalJSON(data []byte) error

type PersonListResponseResultPoliticalParty

type PersonListResponseResultPoliticalParty struct {
	EndTime    WikidataDateHolder `json:"endTime"`
	Label      string             `json:"label,nullable"`
	StartTime  WikidataDateHolder `json:"startTime"`
	WikidataID string             `json:"wikidataId,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		EndTime     resp.Field
		Label       resp.Field
		StartTime   resp.Field
		WikidataID  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PersonListResponseResultPoliticalParty) RawJSON

Returns the unmodified JSON received from the API

func (*PersonListResponseResultPoliticalParty) UnmarshalJSON

func (r *PersonListResponseResultPoliticalParty) UnmarshalJSON(data []byte) error

type PersonListResponseResultPosition

type PersonListResponseResultPosition struct {
	Employer   WikidataLabelHolder `json:"employer"`
	EndTime    WikidataDateHolder  `json:"endTime"`
	Label      string              `json:"label,nullable"`
	StartTime  WikidataDateHolder  `json:"startTime"`
	WikidataID string              `json:"wikidataId,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Employer    resp.Field
		EndTime     resp.Field
		Label       resp.Field
		StartTime   resp.Field
		WikidataID  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PersonListResponseResultPosition) RawJSON

Returns the unmodified JSON received from the API

func (*PersonListResponseResultPosition) UnmarshalJSON

func (r *PersonListResponseResultPosition) UnmarshalJSON(data []byte) error

type PersonService

type PersonService struct {
	Options []option.RequestOption
}

PersonService contains methods and other services that help with interacting with the perigon 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

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) List

func (r *PersonService) List(ctx context.Context, query PersonListParams, opts ...option.RequestOption) (res *PersonListResponse, err error)

Search and retrieve additional information on known persons that exist within Perigon's entity database and as referenced in any article response object. Our database contains over 650,000 people from around the world and is refreshed frequently. People data is derived from Wikidata and includes a wikidataId field that can be used to lookup even more information on Wikidata's website.

type SortBy

type SortBy string
const (
	SortByCreatedAt  SortBy = "createdAt"
	SortByUpdatedAt  SortBy = "updatedAt"
	SortByRelevance  SortBy = "relevance"
	SortByCount      SortBy = "count"
	SortByTotalCount SortBy = "totalCount"
)

type SourceListParams

type SourceListParams struct {
	// Returns the sources that have at most this number of average monthly posts.
	MaxMonthlyPosts param.Opt[int64] `query:"maxMonthlyPosts,omitzero" json:"-"`
	// Enter a maximum number of monthly visits that the source must have in order to
	// match your query.
	MaxMonthlyVisits param.Opt[int64] `query:"maxMonthlyVisits,omitzero" json:"-"`
	// Returns the sources that have at least this number of average monthly posts.
	MinMonthlyPosts param.Opt[int64] `query:"minMonthlyPosts,omitzero" json:"-"`
	// Filter by popularity. Enter a minimum number of monthly visits that the source
	// must have in order to match your query.
	MinMonthlyVisits param.Opt[int64] `query:"minMonthlyVisits,omitzero" json:"-"`
	// Search by name of source. This parameter supports complex boolean search
	// operators, and also searches the altNames field for alternative names of the
	// source.
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Use 'true' to find only sources known to have a paywall, or use 'false' to
	// filter for only sources that do not have a paywall.
	Paywall param.Opt[bool] `query:"paywall,omitzero" json:"-"`
	// If 'true', shows accurate number of results matched by the query. By default,
	// the counter is accurate only up to 10,000 results due performance reasons.
	ShowNumResults param.Opt[bool] `query:"showNumResults,omitzero" json:"-"`
	// Controls whether subdomains are included in the response. When set to true
	// (default), all relevant subdomains of media sources will be returned as separate
	// results. Set to false to consolidate results to parent domains only.
	ShowSubdomains param.Opt[bool] `query:"showSubdomains,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// Find all sources within a sourceGroup. Find Source Groups in the guided part of
	// our documentation...
	SourceGroup param.Opt[string] `query:"sourceGroup,omitzero" json:"-"`
	// Latitude of the center point to search local publications.
	SourceLat param.Opt[float64] `query:"sourceLat,omitzero" json:"-"`
	// Longitude of the center point to search local publications.
	SourceLon param.Opt[float64] `query:"sourceLon,omitzero" json:"-"`
	// Maximum distance from starting point to search local publications.
	SourceMaxDistance param.Opt[float64] `query:"sourceMaxDistance,omitzero" json:"-"`
	// Filter by categories. Categories are general themes that the article is about.
	// Examples of categories: Tech, Politics, etc. If multiple parameters are passed,
	// they will be applied as OR operations.
	Category []string `query:"category,omitzero" json:"-"`
	// Country code to filter sources by the countries in which they most commonly
	// cover. If multiple parameters are passed, they will be applied as OR operations.
	Country []string `query:"country,omitzero" json:"-"`
	// Domain name for the media source to lookup. This parameter supports wildcard
	// queries, ie. "\*.cnn.com" will match all subdomains for cnn.com.
	Domain []string `query:"domain,omitzero" json:"-"`
	// Filter sources by label. For example, searching 'Opinion' will return the
	// sources where 'Opinion'-type articles is one of the top labels for the articles
	// they publish.
	Label []string `query:"label,omitzero" json:"-"`
	// Use 'relevance' to sort by relevance to the query, 'globalRank' for top ranked
	// sources based on popularity, 'monthlyVisits' for sources with the largest
	// audience, 'avgMonthlyPosts' for sources with the highest publishing frequency.
	// Defaults to 'relevance'.
	//
	// Any of "createdAt", "updatedAt", "relevance", "count", "totalCount".
	SortBy SortBy `query:"sortBy,omitzero" json:"-"`
	// Find all local publications that are located within a given city.
	SourceCity []string `query:"sourceCity,omitzero" json:"-"`
	// Find all local publications that are located within a given country.
	SourceCountry []string `query:"sourceCountry,omitzero" json:"-"`
	// Find all local publications that are located within a given county.
	SourceCounty []string `query:"sourceCounty,omitzero" json:"-"`
	// Find all local publications that are located within a given state.
	SourceState []string `query:"sourceState,omitzero" json:"-"`
	// Find sources by topic. For example, searching 'Markets' will return the sources
	// where 'Markets' is one of the top 10 topics that they cover.
	Topic []string `query:"topic,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SourceListParams) IsPresent

func (f SourceListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (SourceListParams) URLQuery

func (r SourceListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SourceListParams's query parameters as `url.Values`.

type SourceListResponse

type SourceListResponse struct {
	NumResults int64                      `json:"numResults,nullable"`
	Results    []SourceListResponseResult `json:"results,nullable"`
	Status     int64                      `json:"status,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		NumResults  resp.Field
		Results     resp.Field
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Source search result

func (SourceListResponse) RawJSON

func (r SourceListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SourceListResponse) UnmarshalJSON

func (r *SourceListResponse) UnmarshalJSON(data []byte) error

type SourceListResponseResult

type SourceListResponseResult struct {
	ID                 string                           `json:"id,nullable"`
	AdFontesBiasRating string                           `json:"adFontesBiasRating,nullable"`
	AllSidesBiasRating string                           `json:"allSidesBiasRating,nullable"`
	AltNames           []string                         `json:"altNames,nullable"`
	AvgBiasRating      string                           `json:"avgBiasRating,nullable"`
	AvgMonthlyPosts    int64                            `json:"avgMonthlyPosts,nullable"`
	Description        string                           `json:"description,nullable"`
	Domain             string                           `json:"domain,nullable"`
	GlobalRank         int64                            `json:"globalRank,nullable"`
	Location           SourceListResponseResultLocation `json:"location"`
	LogoFavIcon        ImageHolder                      `json:"logoFavIcon"`
	LogoLarge          ImageHolder                      `json:"logoLarge"`
	LogoSquare         ImageHolder                      `json:"logoSquare"`
	MbfcBiasRating     string                           `json:"mbfcBiasRating,nullable"`
	MonthlyVisits      int64                            `json:"monthlyVisits,nullable"`
	Name               string                           `json:"name,nullable"`
	Paywall            bool                             `json:"paywall,nullable"`
	PrimaryRecordID    string                           `json:"primaryRecordId,nullable"`
	TopCategories      []SourceTopStatHolder            `json:"topCategories,nullable"`
	TopCountries       []SourceTopStatHolder            `json:"topCountries,nullable"`
	TopLabels          []SourceTopStatHolder            `json:"topLabels,nullable"`
	TopTopics          []SourceTopStatHolder            `json:"topTopics,nullable"`
	UpdatedAt          string                           `json:"updatedAt,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID                 resp.Field
		AdFontesBiasRating resp.Field
		AllSidesBiasRating resp.Field
		AltNames           resp.Field
		AvgBiasRating      resp.Field
		AvgMonthlyPosts    resp.Field
		Description        resp.Field
		Domain             resp.Field
		GlobalRank         resp.Field
		Location           resp.Field
		LogoFavIcon        resp.Field
		LogoLarge          resp.Field
		LogoSquare         resp.Field
		MbfcBiasRating     resp.Field
		MonthlyVisits      resp.Field
		Name               resp.Field
		Paywall            resp.Field
		PrimaryRecordID    resp.Field
		TopCategories      resp.Field
		TopCountries       resp.Field
		TopLabels          resp.Field
		TopTopics          resp.Field
		UpdatedAt          resp.Field
		ExtraFields        map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SourceListResponseResult) RawJSON

func (r SourceListResponseResult) RawJSON() string

Returns the unmodified JSON received from the API

func (*SourceListResponseResult) UnmarshalJSON

func (r *SourceListResponseResult) UnmarshalJSON(data []byte) error

type SourceListResponseResultLocation

type SourceListResponseResultLocation struct {
	City        string                                      `json:"city,nullable"`
	Coordinates SourceListResponseResultLocationCoordinates `json:"coordinates"`
	Country     string                                      `json:"country,nullable"`
	County      string                                      `json:"county,nullable"`
	State       string                                      `json:"state,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		City        resp.Field
		Coordinates resp.Field
		Country     resp.Field
		County      resp.Field
		State       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SourceListResponseResultLocation) RawJSON

Returns the unmodified JSON received from the API

func (*SourceListResponseResultLocation) UnmarshalJSON

func (r *SourceListResponseResultLocation) UnmarshalJSON(data []byte) error

type SourceListResponseResultLocationCoordinates

type SourceListResponseResultLocationCoordinates struct {
	Lat float64 `json:"lat,nullable"`
	Lon float64 `json:"lon,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Lat         resp.Field
		Lon         resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SourceListResponseResultLocationCoordinates) RawJSON

Returns the unmodified JSON received from the API

func (*SourceListResponseResultLocationCoordinates) UnmarshalJSON

func (r *SourceListResponseResultLocationCoordinates) UnmarshalJSON(data []byte) error

type SourceService

type SourceService struct {
	Options []option.RequestOption
}

SourceService contains methods and other services that help with interacting with the perigon 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 NewSourceService method instead.

func NewSourceService

func NewSourceService(opts ...option.RequestOption) (r SourceService)

NewSourceService 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 (*SourceService) List

func (r *SourceService) List(ctx context.Context, query SourceListParams, opts ...option.RequestOption) (res *SourceListResponse, err error)

Search and filter the 142,000+ media sources available via the Perigon API. The result includes a list of individual media sources that were matched to your specific criteria.

type SourceTopStatHolder

type SourceTopStatHolder struct {
	Count int64  `json:"count,nullable"`
	Name  string `json:"name,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Count       resp.Field
		Name        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SourceTopStatHolder) RawJSON

func (r SourceTopStatHolder) RawJSON() string

Returns the unmodified JSON received from the API

func (*SourceTopStatHolder) UnmarshalJSON

func (r *SourceTopStatHolder) UnmarshalJSON(data []byte) error

type StoryListParams

type StoryListParams struct {
	// List of company names for filtering. Filtering is applied on topCompanies field.
	CompanyName param.Opt[string] `query:"companyName,omitzero" json:"-"`
	// 'from' filter, will search stories created after the specified date, the date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2023-03-01T00:00:00
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// 'initializedFrom' filter, will search stories that became available after
	// provided date
	InitializedFrom param.Opt[time.Time] `query:"initializedFrom,omitzero" format:"date-time" json:"-"`
	// 'initializedTo' filter, will search stories that became available before
	// provided date
	InitializedTo param.Opt[time.Time] `query:"initializedTo,omitzero" format:"date-time" json:"-"`
	// Filter by maximum cluster size. Maximum cluster size filter applies to number of
	// unique articles in the cluster.
	MaxClusterSize param.Opt[int64] `query:"maxClusterSize,omitzero" json:"-"`
	// Filter by minimum cluster size. Minimum cluster size filter applies to number of
	// unique articles.
	MinClusterSize param.Opt[int64] `query:"minClusterSize,omitzero" json:"-"`
	// Specifies the minimum number of unique sources required for a story to appear in
	// results. Higher values return more significant stories covered by multiple
	// publications. Default is 3.
	MinUniqueSources param.Opt[int64] `query:"minUniqueSources,omitzero" json:"-"`
	// Search story by name. Supports complex query syntax, same way as q parameter
	// from /all endpoint.
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// Returns stories with name assigned. Defaults to true.
	NameExists param.Opt[bool] `query:"nameExists,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating negative sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	NegativeSentimentFrom param.Opt[float64] `query:"negativeSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating negative sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	NegativeSentimentTo param.Opt[float64] `query:"negativeSentimentTo,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating neutral sentiment. Explanation of sentimental values can be
	// found in Docs under the Article Data section.
	NeutralSentimentFrom param.Opt[float64] `query:"neutralSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating neutral sentiment. See the Article Data section in Docs for an
	// explanation of scores.
	NeutralSentimentTo param.Opt[float64] `query:"neutralSentimentTo,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// List of people names. Filtering is applied on topPeople field.
	PersonName param.Opt[string] `query:"personName,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating positive sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	PositiveSentimentFrom param.Opt[float64] `query:"positiveSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating positive sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	PositiveSentimentTo param.Opt[float64] `query:"positiveSentimentTo,omitzero" json:"-"`
	// Search story by name, summary and key points. Preference is given to the name
	// field. Supports complex query syntax, same way as q parameter from /all
	// endpoint.
	Q param.Opt[string] `query:"q,omitzero" json:"-"`
	// Stories are deduplicated by default. If a story is deduplicated, all future
	// articles are merged into the original story. duplicateOf field contains the
	// original cluster Id. When showDuplicates=true, all stories are shown.
	ShowDuplicates param.Opt[bool] `query:"showDuplicates,omitzero" json:"-"`
	// Show total number of results. By default set to false, will cap result count
	// at 10000.
	ShowNumResults    param.Opt[bool] `query:"showNumResults,omitzero" json:"-"`
	ShowStoryPageInfo param.Opt[bool] `query:"showStoryPageInfo,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// 'to' filter, will search stories created before the specified date, the date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2023-03-01T23:59:59
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Will return stories with 'updatedAt' >= 'updatedFrom'.
	UpdatedFrom param.Opt[time.Time] `query:"updatedFrom,omitzero" format:"date-time" json:"-"`
	// Will return stories with 'updatedAt' <= 'updatedTo'.
	UpdatedTo param.Opt[time.Time] `query:"updatedTo,omitzero" format:"date-time" json:"-"`
	// Filter local news by area. Applies only to local news, when this param is passed
	// non-local news will not be returned. If multiple parameters are passed, they
	// will be applied as OR operations.
	Area []string `query:"area,omitzero" json:"-"`
	// Filter by categories. Categories are general themes that the article is about.
	// Examples of categories: Tech, Politics, etc. If multiple parameters are passed,
	// they will be applied as OR operations. Use 'none' to search uncategorized
	// articles. More ➜
	Category []string `query:"category,omitzero" json:"-"`
	// Filter local news by city. Applies only to local news, when this param is passed
	// non-local news will not be returned. If multiple parameters are passed, they
	// will be applied as OR operations.
	City []string `query:"city,omitzero" json:"-"`
	// Filter to specific story. Passing a cluster ID will filter results to only the
	// content found within the cluster. Multiple params could be passed.
	ClusterID []string `query:"clusterId,omitzero" json:"-"`
	// List of company domains for filtering. Filtering is applied on topCompanies
	// field.
	CompanyDomain []string `query:"companyDomain,omitzero" json:"-"`
	// List of company IDs for filtering. Filtering is applied to topCompanies field.
	CompanyID []string `query:"companyId,omitzero" json:"-"`
	// List of company tickers for filtering. Filtering is applied on topCompanies
	// field.
	CompanySymbol []string `query:"companySymbol,omitzero" json:"-"`
	// Country code to filter by country. If multiple parameters are passed, they will
	// be applied as OR operations.
	Country []string `query:"country,omitzero" json:"-"`
	// Excludes specific stories from the results by their unique identifiers. Use this
	// parameter to filter out unwanted or previously seen stories.
	ExcludeClusterID []string `query:"excludeClusterId,omitzero" json:"-"`
	// List of person Wikidata IDs for filtering. Filter is applied on topPeople field.
	PersonWikidataID []string `query:"personWikidataId,omitzero" json:"-"`
	// Sort stories by count ('count'), total count ('totalCount'), creation date
	// ('createdAt'), last updated date ('updatedAt'), or relevance ('relevance'). By
	// default is sorted by 'createdAt'
	//
	// Any of "createdAt", "updatedAt", "relevance", "count", "totalCount".
	SortBy SortBy `query:"sortBy,omitzero" json:"-"`
	// Filter stories by sources that wrote articles belonging to this story. At least
	// 1 article is required for story to match. Multiple parameters could be passed.
	Source []string `query:"source,omitzero" json:"-"`
	// Filter stories by sources that wrote articles belonging to this story. Source
	// groups are expanded into a list of sources. At least 1 article by the source is
	// required for story to match. Multiple params could be passed.
	SourceGroup []string `query:"sourceGroup,omitzero" json:"-"`
	// Filter local news by state. Applies only to local news, when this param is
	// passed non-local news will not be returned. If multiple parameters are passed,
	// they will be applied as OR operations.
	State []string `query:"state,omitzero" json:"-"`
	// Filters by Google Content Categories. This field will accept 1 or more
	// categories, must pass the full name of the category. Example:
	// taxonomy=/Finance/Banking/Other, /Finance/Investing/Funds
	Taxonomy []string `query:"taxonomy,omitzero" json:"-"`
	// Filter by topics. Each topic is some kind of entity that the article is about.
	// Examples of topics: Markets, Joe Biden, Green Energy, Climate Change,
	// Cryptocurrency, etc. If multiple parameters are passed, they will be applied as
	// OR operations.
	Topic []string `query:"topic,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (StoryListParams) IsPresent

func (f StoryListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (StoryListParams) URLQuery

func (r StoryListParams) URLQuery() (v url.Values, err error)

URLQuery serializes StoryListParams's query parameters as `url.Values`.

type StoryListResponse

type StoryListResponse struct {
	NumResults int64         `json:"numResults,nullable"`
	Results    []NewsCluster `json:"results,nullable"`
	Status     int64         `json:"status,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		NumResults  resp.Field
		Results     resp.Field
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Story search result

func (StoryListResponse) RawJSON

func (r StoryListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*StoryListResponse) UnmarshalJSON

func (r *StoryListResponse) UnmarshalJSON(data []byte) error

type StoryService

type StoryService struct {
	Options []option.RequestOption
}

StoryService contains methods and other services that help with interacting with the perigon 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 NewStoryService method instead.

func NewStoryService

func NewStoryService(opts ...option.RequestOption) (r StoryService)

NewStoryService 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 (*StoryService) List

func (r *StoryService) List(ctx context.Context, query StoryListParams, opts ...option.RequestOption) (res *StoryListResponse, err error)

Search and filter all news stories available via the Perigon API. Each story aggregates key information across related articles, including AI-generated names, summaries, and key points.

type SummarizeNewParams

type SummarizeNewParams struct {
	// The maximum number of articles to factor into the summary.
	MaxArticleCount param.Opt[int64] `json:"maxArticleCount,omitzero"`
	// Maximum number of tokens to generate in the summary.
	MaxTokens param.Opt[int64] `json:"maxTokens,omitzero"`
	// Instructions guiding how the summary should be written. Maximum length: 2 048
	// characters.
	Prompt param.Opt[string] `json:"prompt,omitzero"`
	// The maximum number of articles that should be returned in the response. This can
	// be used to return fewer than maxArticleCount results.
	ReturnedArticleCount param.Opt[int64] `json:"returnedArticleCount,omitzero"`
	// Sampling temperature for the LLM (0.0 = deterministic to 2.0 = very creative).
	Temperature param.Opt[float64] `json:"temperature,omitzero"`
	// Nucleus sampling (top-p) for the LLM (0.0 to 1.0).
	TopP param.Opt[float64] `json:"topP,omitzero"`
	// 'addDateFrom' filter, will search articles added after the specified date, the
	// date could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T00:00:00
	AddDateFrom param.Opt[time.Time] `query:"addDateFrom,omitzero" format:"date-time" json:"-"`
	// 'addDateTo' filter, will search articles added before the specified date, the
	// date could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T23:59:59
	AddDateTo param.Opt[time.Time] `query:"addDateTo,omitzero" format:"date-time" json:"-"`
	// Search by company name.
	CompanyName param.Opt[string] `query:"companyName,omitzero" json:"-"`
	// Search query on the article's body of content field. Semantic similar to q
	// parameter.
	Content param.Opt[string] `query:"content,omitzero" json:"-"`
	// Search query on the description field. Semantic similar to q parameter.
	Desc param.Opt[string] `query:"desc,omitzero" json:"-"`
	// 'from' filter, will search articles published after the specified date, the date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2023-03-01T00:00:00
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Latitude of the center point to search places
	Lat param.Opt[float64] `query:"lat,omitzero" json:"-"`
	// Returns only articles that point to specified links (as determined by the
	// 'links' field in the article response).
	LinkTo param.Opt[string] `query:"linkTo,omitzero" json:"-"`
	// Longitude of the center point to search places
	Lon param.Opt[float64] `query:"lon,omitzero" json:"-"`
	// Maximum distance (in km) from starting point to search articles by tagged places
	MaxDistance param.Opt[float64] `query:"maxDistance,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating negative sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	NegativeSentimentFrom param.Opt[float64] `query:"negativeSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating negative sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	NegativeSentimentTo param.Opt[float64] `query:"negativeSentimentTo,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating neutral sentiment. Explanation of sentimental values can be
	// found in Docs under the Article Data section.
	NeutralSentimentFrom param.Opt[float64] `query:"neutralSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating neutral sentiment. See the Article Data section in Docs for an
	// explanation of scores.
	NeutralSentimentTo param.Opt[float64] `query:"neutralSentimentTo,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Filter to show only results where the source has a paywall (true) or does not
	// have a paywall (false).
	Paywall param.Opt[bool] `query:"paywall,omitzero" json:"-"`
	// Filters results with a sentiment score greater than or equal to the specified
	// value, indicating positive sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	PositiveSentimentFrom param.Opt[float64] `query:"positiveSentimentFrom,omitzero" json:"-"`
	// Filters results with a sentiment score less than or equal to the specified
	// value, indicating positive sentiment. See the Article Data section in Docs for
	// an explanation of scores.
	PositiveSentimentTo param.Opt[float64] `query:"positiveSentimentTo,omitzero" json:"-"`
	// Filters by Google Content Categories. This field will filter by the category
	// prefix only. Example: prefixTaxonomy=/Finance
	PrefixTaxonomy param.Opt[string] `query:"prefixTaxonomy,omitzero" json:"-"`
	// Search query, each article will be scored and ranked against it. Articles are
	// searched on the title, description, and content fields.
	Q param.Opt[string] `query:"q,omitzero" json:"-"`
	// Will search articles that were refreshed after the specified date. The date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T00:00:00
	RefreshDateFrom param.Opt[time.Time] `query:"refreshDateFrom,omitzero" format:"date-time" json:"-"`
	// Will search articles that were refreshed before the specified date. The date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T23:59:59
	RefreshDateTo param.Opt[time.Time] `query:"refreshDateTo,omitzero" format:"date-time" json:"-"`
	// Shows all articles belonging to the same reprint group. A reprint group includes
	// one original article (the first one processed by the API) and all its known
	// reprints.
	ReprintGroupID param.Opt[string] `query:"reprintGroupId,omitzero" json:"-"`
	// Expand a query to search the translation, translatedTitle, and
	// translatedDescription fields for non-English articles.
	SearchTranslation param.Opt[bool] `query:"searchTranslation,omitzero" json:"-"`
	// Whether to show the total number of all matched articles. Default value is false
	// which makes queries a bit more efficient but also counts up to 10000 articles.
	ShowNumResults param.Opt[bool] `query:"showNumResults,omitzero" json:"-"`
	// Whether to return reprints in the response or not. Reprints are usually wired
	// articles from sources like AP or Reuters that are reprinted in multiple sources
	// at the same time. By default, this parameter is 'true'.
	ShowReprints param.Opt[bool] `query:"showReprints,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// Latitude of the center point to search articles created by local publications.
	SourceLat param.Opt[float64] `query:"sourceLat,omitzero" json:"-"`
	// Latitude of the center point to search articles created by local publications.
	SourceLon param.Opt[float64] `query:"sourceLon,omitzero" json:"-"`
	// Maximum distance from starting point to search articles created by local
	// publications.
	SourceMaxDistance param.Opt[float64] `query:"sourceMaxDistance,omitzero" json:"-"`
	// Search article headlines/title field. Semantic similar to q parameter.
	Title param.Opt[string] `query:"title,omitzero" json:"-"`
	// 'to' filter, will search articles published before the specified date, the date
	// could be passed as ISO or 'yyyy-mm-dd'. Add time in ISO format, ie.
	// 2022-02-01T23:59:59
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Search query on the url field. Semantic similar to q parameter. E.g. could be
	// used for querying certain website sections, e.g. source=cnn.com&url=travel.
	URL param.Opt[string] `query:"url,omitzero" json:"-"`
	// Method for selecting articles: ARTICLES (include all matches) or CLUSTERS (one
	// per cluster).
	//
	// Any of "ARTICLES", "CLUSTERS".
	Method SummarizeNewParamsMethod `json:"method,omitzero"`
	// The underlying LLM model to use for generation.
	//
	// Any of "gpt-4o", "gpt-4o-mini", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano",
	// "llama-3.3-70b-versatile", "deepseek-r1-distill-llama-70b".
	Model SummarizeNewParamsModel `json:"model,omitzero"`
	// Which article fields to include when generating the summary. Up to three values
	// from TITLE, CONTENT, SUMMARY.
	//
	// Any of "TITLE", "CONTENT", "SUMMARY".
	SummarizeFields SummarizeNewParamsSummarizeFields `json:"summarizeFields,omitzero"`
	// Filters articles where a specified area, such as a neighborhood, borough, or
	// district, plays a central role in the content, beyond mere mentions, to ensure
	// the results are deeply relevant to the area in question. If multiple parameters
	// are passed, they will be applied as OR operations.
	Area []string `query:"area,omitzero" json:"-"`
	// Article ID will search for a news article by the ID of the article. If several
	// parameters are passed, all matched articles will be returned.
	ArticleID []string `query:"articleId,omitzero" json:"-"`
	// A list of author names to include. Only articles written by any of the specified
	// authors are returned. This is ideal when you wish to focus on content from
	// particular voices or experts.
	Author []string `query:"author,omitzero" json:"-"`
	// Author names to filter by. Article author bylines are used as a source field. If
	// multiple parameters are passed, they will be applied as OR operations.
	Byline []string `query:"byline,omitzero" json:"-"`
	// Filter by categories. Categories are general themes that the article is about.
	// Examples of categories: Tech, Politics, etc. If multiple parameters are passed,
	// they will be applied as OR operations. Use 'none' to search uncategorized
	// articles.
	Category []string `query:"category,omitzero" json:"-"`
	// Filters articles where a specified city plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the urban
	// area in question. If multiple parameters are passed, they will be applied as OR
	// operations.
	City []string `query:"city,omitzero" json:"-"`
	// Search for related content using a cluster ID. Passing a cluster ID will filter
	// results to only the content found within the cluster.
	ClusterID []string `query:"clusterId,omitzero" json:"-"`
	// Search by company domains for filtering. E.g. companyDomain=apple.com.
	CompanyDomain []string `query:"companyDomain,omitzero" json:"-"`
	// List of company IDs to filter by.
	CompanyID []string `query:"companyId,omitzero" json:"-"`
	// Search by company symbols.
	CompanySymbol []string `query:"companySymbol,omitzero" json:"-"`
	// Country code to filter by country. If multiple parameters are passed, they will
	// be applied as OR operations.
	Country []string `query:"country,omitzero" json:"-"`
	// A list of counties to include (or specify) in the search results. This field
	// filters the returned articles based on the county associated with the event or
	// news. Only articles tagged with one of these counties will be included.
	County []string `query:"county,omitzero" json:"-"`
	// A list of author names to exclude from the search results. Any article written
	// by an author whose name matches one in this list will be omitted, which helps to
	// avoid content from certain individuals.
	ExcludeAuthor []string `query:"excludeAuthor,omitzero" json:"-"`
	// A list of article categories to be omitted. If an article is tagged with any
	// category present in this list (such as “Polotics”, “Tech”, “Sports”, etc.), it
	// will not appear in the search results.
	ExcludeCategory []string `query:"excludeCategory,omitzero" json:"-"`
	// A list of cities to exclude from the results. Articles that are associated with
	// any of the specified cities will be filtered out.
	ExcludeCity []string `query:"excludeCity,omitzero" json:"-"`
	// A list of company domains to exclude. If an article is related to a company that
	// uses one of the specified domains (for instance, “example.com”), it will not be
	// returned in the results.
	ExcludeCompanyDomain []string `query:"excludeCompanyDomain,omitzero" json:"-"`
	// A list of company identifiers. Articles associated with companies that have any
	// of these unique IDs will be filtered out from the returned results, ensuring
	// that certain companies or corporate entities are not included.
	ExcludeCompanyID []string `query:"excludeCompanyId,omitzero" json:"-"`
	// A list of stock symbols (ticker symbols) that identify companies to be excluded.
	// Articles related to companies using any of these symbols will be omitted, which
	// is useful for targeting or avoiding specific public companies.
	ExcludeCompanySymbol []string `query:"excludeCompanySymbol,omitzero" json:"-"`
	// Excludes articles from specific counties or administrative divisions in the
	// vector search results. Accepts either a single county name or a list of county
	// names. County names should match the format used in article metadata (e.g., 'Los
	// Angeles County', 'Cook County'). This parameter allows for more granular
	// geographic filter
	ExcludeCounty []string `query:"excludeCounty,omitzero" json:"-"`
	// A list of journalist (or reporter) identifiers to exclude. If an article is
	// written by a journalist whose ID matches any in this list, it will not be part
	// of the result set.
	ExcludeJournalistID []string `query:"excludeJournalistId,omitzero" json:"-"`
	// Exclude results that include specific labels (Opinion, Non-news, Paid News,
	// etc.). You can filter multiple by repeating the parameter.
	ExcludeLabel []string `query:"excludeLabel,omitzero" json:"-"`
	// A list of languages to be excluded. Any article published in one of the
	// languages provided in this filter will not be returned. This is useful when you
	// are interested only in news published in specific languages.
	ExcludeLanguage []string `query:"excludeLanguage,omitzero" json:"-"`
	// Excludes articles where a specified country plays a central role in the content,
	// ensuring results are not deeply relevant to the country in question. If multiple
	// parameters are passed, they will be applied as AND operations, excluding
	// articles relevant to any of the specified countries.
	ExcludeLocationsCountry []string `query:"excludeLocationsCountry,omitzero" json:"-"`
	// A list of person names that, when associated with the content, cause the article
	// to be excluded. This filter removes articles related to any individuals whose
	// names match those on the list.
	ExcludePersonName []string `query:"excludePersonName,omitzero" json:"-"`
	// A list of Wikidata identifiers for individuals. Articles mentioning persons with
	// any of these Wikidata IDs will be filtered out. This is particularly helpful
	// when using a unique identifier to prevent ambiguity in names.
	ExcludePersonWikidataID []string `query:"excludePersonWikidataId,omitzero" json:"-"`
	// The domain of the website, which should be excluded from the search. Multiple
	// parameters could be provided. Wildcards (_ and ?) are suported (e.g. _.cnn.com).
	ExcludeSource []string `query:"excludeSource,omitzero" json:"-"`
	// A list of built-in source group names to exclude from the results. The Perigon
	// API categorizes sources into groups (for example, “top10” or “top100”) based on
	// type or popularity. Using this filter allows you to remove articles coming from
	// any source that belongs to one or more of the specified groups.
	ExcludeSourceGroup []string `query:"excludeSourceGroup,omitzero" json:"-"`
	// A list of states to exclude. Articles that include, or are associated with, any
	// of the states provided here will be filtered out. This is especially useful if
	// you want to ignore news tied to certain geographical areas (e.g., US states).
	ExcludeState []string `query:"excludeState,omitzero" json:"-"`
	// Filter by excluding topics. Each topic is some kind of entity that the article
	// is about. Examples of topics: Markets, Joe Biden, Green Energy, Climate Change,
	// Cryptocurrency, etc. If multiple parameters are passed, they will be applied as
	// OR operations.
	ExcludeTopic []string `query:"excludeTopic,omitzero" json:"-"`
	// Filter by journalist ID. Journalist IDs are unique journalist identifiers which
	// can be found through the Journalist API, or in the matchedAuthors field.
	JournalistID []string `query:"journalistId,omitzero" json:"-"`
	// Labels to filter by, could be 'Opinion', 'Paid-news', 'Non-news', etc. If
	// multiple parameters are passed, they will be applied as OR operations.
	Label []string `query:"label,omitzero" json:"-"`
	// Language code to filter by language. If multiple parameters are passed, they
	// will be applied as OR operations.
	Language []string `query:"language,omitzero" json:"-"`
	// Return all articles that have the specified location. Location attributes are
	// delimited by ':' between key and value, and '::' between attributes. Example:
	// 'city:New York::state:NY'.
	Location []string `query:"location,omitzero" json:"-"`
	// Filters articles where a specified country plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the country
	// in question. If multiple parameters are passed, they will be applied as OR
	// operations.
	LocationsCountry []string `query:"locationsCountry,omitzero" json:"-"`
	// Medium will filter out news articles medium, which could be 'Video' or
	// 'Article'. If several parameters are passed, all matched articles will be
	// returned.
	Medium []string `query:"medium,omitzero" json:"-"`
	// List of person names for exact matches. Boolean and complex logic is not
	// supported on this paramter.
	PersonName []string `query:"personName,omitzero" json:"-"`
	// List of person Wikidata IDs for filtering.
	PersonWikidataID []string `query:"personWikidataId,omitzero" json:"-"`
	// 'relevance' to sort by relevance to the query, 'date' to sort by the publication
	// date (desc), 'pubDate' is a synonym to 'date', 'addDate' to sort by 'addDate'
	// field (desc), 'refreshDate' to sort by 'refreshDate' field (desc). Defaults to
	// 'relevance'
	//
	// Any of "relevance", "date", "reverseDate", "reverseAddDate", "addDate",
	// "pubDate", "refreshDate".
	SortBy AllEndpointSortBy `query:"sortBy,omitzero" json:"-"`
	// Publisher's domain can include a subdomain. If multiple parameters are passed,
	// they will be applied as OR operations. Wildcards (_ and ?) are suported (e.g.
	// _.cnn.com).
	Source []string `query:"source,omitzero" json:"-"`
	// Find articles published by sources that are located within a given city.
	SourceCity []string `query:"sourceCity,omitzero" json:"-"`
	// Find articles published by sources that are located within a given country. Must
	// be 2 character country code (i.e. us, gb, etc).
	SourceCountry []string `query:"sourceCountry,omitzero" json:"-"`
	// Find articles published by sources that are located within a given county.
	SourceCounty []string `query:"sourceCounty,omitzero" json:"-"`
	// One of the supported source groups. Find Source Groups in the guided part of our
	// documentation...
	SourceGroup []string `query:"sourceGroup,omitzero" json:"-"`
	// Find articles published by sources that are located within a given state.
	SourceState []string `query:"sourceState,omitzero" json:"-"`
	// Filters articles where a specified state plays a central role in the content,
	// beyond mere mentions, to ensure the results are deeply relevant to the state in
	// question. If multiple parameters are passed, they will be applied as OR
	// operations.
	State []string `query:"state,omitzero" json:"-"`
	// Filters by Google Content Categories. This field will accept 1 or more
	// categories, must pass the full name of the category. Example:
	// taxonomy=/Finance/Banking/Other, /Finance/Investing/Funds
	Taxonomy []string `query:"taxonomy,omitzero" json:"-"`
	// Filters results to include only articles with the specified topics. Topics are
	// more specific classifications than categories, with an article potentially
	// having multiple topics assigned. Perigon uses both human and machine curation to
	// maintain an evolving list of available topics. Common examples include
	// 'Markets', 'Crime', 'Cryptocurrency', 'Social Issues', 'College Sports', etc.
	// See the Topics page in Docs for a complete list of available topics.
	Topic []string `query:"topic,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SummarizeNewParams) IsPresent

func (f SummarizeNewParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (SummarizeNewParams) MarshalJSON

func (r SummarizeNewParams) MarshalJSON() (data []byte, err error)

func (SummarizeNewParams) URLQuery

func (r SummarizeNewParams) URLQuery() (v url.Values, err error)

URLQuery serializes SummarizeNewParams's query parameters as `url.Values`.

type SummarizeNewParamsMethod

type SummarizeNewParamsMethod string

Method for selecting articles: ARTICLES (include all matches) or CLUSTERS (one per cluster).

const (
	SummarizeNewParamsMethodArticles SummarizeNewParamsMethod = "ARTICLES"
	SummarizeNewParamsMethodClusters SummarizeNewParamsMethod = "CLUSTERS"
)

type SummarizeNewParamsModel

type SummarizeNewParamsModel string

The underlying LLM model to use for generation.

const (
	SummarizeNewParamsModelGpt4o                     SummarizeNewParamsModel = "gpt-4o"
	SummarizeNewParamsModelGpt4oMini                 SummarizeNewParamsModel = "gpt-4o-mini"
	SummarizeNewParamsModelGpt4_1                    SummarizeNewParamsModel = "gpt-4.1"
	SummarizeNewParamsModelGpt4_1Mini                SummarizeNewParamsModel = "gpt-4.1-mini"
	SummarizeNewParamsModelGpt4_1Nano                SummarizeNewParamsModel = "gpt-4.1-nano"
	SummarizeNewParamsModelLlama3_3_70bVersatile     SummarizeNewParamsModel = "llama-3.3-70b-versatile"
	SummarizeNewParamsModelDeepseekR1DistillLlama70b SummarizeNewParamsModel = "deepseek-r1-distill-llama-70b"
)

type SummarizeNewParamsSummarizeFields

type SummarizeNewParamsSummarizeFields string

Which article fields to include when generating the summary. Up to three values from TITLE, CONTENT, SUMMARY.

const (
	SummarizeNewParamsSummarizeFieldsTitle   SummarizeNewParamsSummarizeFields = "TITLE"
	SummarizeNewParamsSummarizeFieldsContent SummarizeNewParamsSummarizeFields = "CONTENT"
	SummarizeNewParamsSummarizeFieldsSummary SummarizeNewParamsSummarizeFields = "SUMMARY"
)

type SummarizeNewResponse

type SummarizeNewResponse struct {
	NumResults int64     `json:"numResults,nullable"`
	Results    []Article `json:"results,nullable"`
	Status     int64     `json:"status,nullable"`
	Summary    string    `json:"summary,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		NumResults  resp.Field
		Results     resp.Field
		Status      resp.Field
		Summary     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SummarizeNewResponse) RawJSON

func (r SummarizeNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SummarizeNewResponse) UnmarshalJSON

func (r *SummarizeNewResponse) UnmarshalJSON(data []byte) error

type SummarizeService

type SummarizeService struct {
	Options []option.RequestOption
}

SummarizeService contains methods and other services that help with interacting with the perigon 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 NewSummarizeService method instead.

func NewSummarizeService

func NewSummarizeService(opts ...option.RequestOption) (r SummarizeService)

NewSummarizeService 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 (*SummarizeService) New

Produce a single, concise summary over the full corpus of articles matching your filters, using your prompt to guide which insights to highlight.

type TopicListParams

type TopicListParams struct {
	// Search by category.
	Category param.Opt[string] `query:"category,omitzero" json:"-"`
	// Search by name.
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// The page number to retrieve.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// The number of items per page.
	Size param.Opt[int64] `query:"size,omitzero" json:"-"`
	// Search by subcategory.
	Subcategory param.Opt[string] `query:"subcategory,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TopicListParams) IsPresent

func (f TopicListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (TopicListParams) URLQuery

func (r TopicListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TopicListParams's query parameters as `url.Values`.

type TopicListResponse

type TopicListResponse struct {
	Data  []TopicListResponseData `json:"data,nullable"`
	Total int64                   `json:"total,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Data        resp.Field
		Total       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Topic search result

func (TopicListResponse) RawJSON

func (r TopicListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*TopicListResponse) UnmarshalJSON

func (r *TopicListResponse) UnmarshalJSON(data []byte) error

type TopicListResponseData

type TopicListResponseData struct {
	ID        int64                       `json:"id,nullable"`
	CreatedAt time.Time                   `json:"createdAt,nullable" format:"date-time"`
	Labels    TopicListResponseDataLabels `json:"labels"`
	Name      string                      `json:"name,nullable"`
	UpdatedAt time.Time                   `json:"updatedAt,nullable" format:"date-time"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID          resp.Field
		CreatedAt   resp.Field
		Labels      resp.Field
		Name        resp.Field
		UpdatedAt   resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TopicListResponseData) RawJSON

func (r TopicListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*TopicListResponseData) UnmarshalJSON

func (r *TopicListResponseData) UnmarshalJSON(data []byte) error

type TopicListResponseDataLabels

type TopicListResponseDataLabels struct {
	Category    string `json:"category,nullable"`
	Subcategory string `json:"subcategory,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Category    resp.Field
		Subcategory resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TopicListResponseDataLabels) RawJSON

func (r TopicListResponseDataLabels) RawJSON() string

Returns the unmodified JSON received from the API

func (*TopicListResponseDataLabels) UnmarshalJSON

func (r *TopicListResponseDataLabels) UnmarshalJSON(data []byte) error

type TopicService

type TopicService struct {
	Options []option.RequestOption
}

TopicService contains methods and other services that help with interacting with the perigon 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 NewTopicService method instead.

func NewTopicService

func NewTopicService(opts ...option.RequestOption) (r TopicService)

NewTopicService 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 (*TopicService) List

func (r *TopicService) List(ctx context.Context, query TopicListParams, opts ...option.RequestOption) (res *TopicListResponse, err error)

Search through all available Topics that exist within the Perigon Database.

type VectorNewsSearchParams

type VectorNewsSearchParams struct {
	// Natural language query to search the news articles database
	Prompt      string               `json:"prompt,required"`
	AddDateFrom param.Opt[time.Time] `json:"addDateFrom,omitzero" format:"date-time"`
	AddDateTo   param.Opt[time.Time] `json:"addDateTo,omitzero" format:"date-time"`
	// The page number to retrieve.
	Page param.Opt[int64] `json:"page,omitzero"`
	// 'pubDateFrom' filter, will search articles published after the specified date,
	// the date could be passed as ISO or 'yyyy-mm-dd'. Date time in ISO format, ie.
	// 2024-01-01T00:00:00 - Default: Only articles with a pubDate within the last 30
	// days of the request
	PubDateFrom param.Opt[time.Time] `json:"pubDateFrom,omitzero" format:"date-time"`
	// 'pubDateFrom' filter, will search articles published before the specified date,
	// the date could be passed as ISO or 'yyyy-mm-dd'. Date time in ISO format, ie.
	// 2024-01-01T00:00:00
	PubDateTo      param.Opt[time.Time] `json:"pubDateTo,omitzero" format:"date-time"`
	ScoreThreshold param.Opt[float64]   `json:"scoreThreshold,omitzero"`
	// Whether to return reprints in the response or not. Reprints are usually wired
	// articles from sources like AP or Reuters that are reprinted in multiple sources
	// at the same time. By default, this parameter is 'true'.
	ShowReprints param.Opt[bool] `json:"showReprints,omitzero"`
	// The number of items per page.
	Size param.Opt[int64] `json:"size,omitzero"`
	// A versatile filter object to refine search results based on articles, clusters,
	// sources, languages, categories, locations, companies, and people. Supports
	// logical operators (AND, OR, NOT) for complex queries. Accepts single values or
	// arrays, with arrays applied as OR operations.
	Filter ArticleSearchFilterParam `json:"filter,omitzero"`
	// contains filtered or unexported fields
}

func (VectorNewsSearchParams) IsPresent

func (f VectorNewsSearchParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (VectorNewsSearchParams) MarshalJSON

func (r VectorNewsSearchParams) MarshalJSON() (data []byte, err error)

type VectorNewsSearchResponse

type VectorNewsSearchResponse struct {
	Results []VectorNewsSearchResponseResult `json:"results,nullable"`
	Status  int64                            `json:"status,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Results     resp.Field
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Vector search result

func (VectorNewsSearchResponse) RawJSON

func (r VectorNewsSearchResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VectorNewsSearchResponse) UnmarshalJSON

func (r *VectorNewsSearchResponse) UnmarshalJSON(data []byte) error

type VectorNewsSearchResponseResult

type VectorNewsSearchResponseResult struct {
	Data  Article `json:"data"`
	Score float64 `json:"score,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Data        resp.Field
		Score       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VectorNewsSearchResponseResult) RawJSON

Returns the unmodified JSON received from the API

func (*VectorNewsSearchResponseResult) UnmarshalJSON

func (r *VectorNewsSearchResponseResult) UnmarshalJSON(data []byte) error

type VectorNewsService

type VectorNewsService struct {
	Options []option.RequestOption
}

VectorNewsService contains methods and other services that help with interacting with the perigon 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 NewVectorNewsService method instead.

func NewVectorNewsService

func NewVectorNewsService(opts ...option.RequestOption) (r VectorNewsService)

NewVectorNewsService 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 (*VectorNewsService) Search

Perform a natural language search over news articles from the past 6 months using semantic relevance. The result includes a list of articles most closely matched to your query intent.

type VectorService

type VectorService struct {
	Options []option.RequestOption
	News    VectorNewsService
}

VectorService contains methods and other services that help with interacting with the perigon 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 NewVectorService method instead.

func NewVectorService

func NewVectorService(opts ...option.RequestOption) (r VectorService)

NewVectorService 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.

type WikidataDateHolder

type WikidataDateHolder struct {
	Precision string `json:"precision,nullable"`
	Time      string `json:"time,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Precision   resp.Field
		Time        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WikidataDateHolder) RawJSON

func (r WikidataDateHolder) RawJSON() string

Returns the unmodified JSON received from the API

func (*WikidataDateHolder) UnmarshalJSON

func (r *WikidataDateHolder) UnmarshalJSON(data []byte) error

type WikidataLabelHolder

type WikidataLabelHolder struct {
	Label      string `json:"label,nullable"`
	WikidataID string `json:"wikidataId,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Label       resp.Field
		WikidataID  resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WikidataLabelHolder) RawJSON

func (r WikidataLabelHolder) RawJSON() string

Returns the unmodified JSON received from the API

func (*WikidataLabelHolder) UnmarshalJSON

func (r *WikidataLabelHolder) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
examples
all command
stories command
vector command
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.21, 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.21, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

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