Documentation
¶
Overview ¶
Package datasets provides a client for interacting with Tilebox Datasets.
Documentation: https://docs.tilebox.com/datasets
Index ¶
- func As[T proto.Message](seq iter.Seq2[[]byte, error]) iter.Seq2[T, error]
- func Collect[K any](seq iter.Seq2[K, error]) ([]K, error)
- func CollectAs[T proto.Message](seq iter.Seq2[[]byte, error]) ([]T, error)
- type Client
- type ClientOption
- type Collection
- type CollectionClient
- type CollectionService
- type DataAccessService
- type DataIngestionService
- type DatapointClient
- type Dataset
- type DatasetClient
- type DatasetService
- type IngestResponse
- type QueryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { Datasets DatasetClient Collections CollectionClient Datapoints DatapointClient }
Client is a Tilebox Datasets client.
func NewClient ¶
func NewClient(options ...ClientOption) *Client
NewClient creates a new Tilebox Datasets client.
By default, the returned Client is configured with:
- "https://api.tilebox.com" as the URL
- environment variable TILEBOX_API_KEY as the API key
- a grpc.RetryHTTPClient HTTP client
- the global tracer provider
The passed options are used to override these default values and configure the returned Client appropriately.
type ClientOption ¶
type ClientOption func(*clientConfig)
ClientOption is an interface for configuring a client. Using such options helpers is a quite common pattern in Go, as it allows for optional parameters in constructors. This concrete implementation here is inspired by how libraries such as axiom-go and connect do their configuration.
func WithAPIKey ¶
func WithAPIKey(apiKey string) ClientOption
WithAPIKey sets the API key to use for the client.
Defaults to no API key.
func WithConnectClientOptions ¶
func WithConnectClientOptions(options ...connect.ClientOption) ClientOption
WithConnectClientOptions sets additional options for the connect.HTTPClient.
func WithDisableTracing ¶
func WithDisableTracing() ClientOption
WithDisableTracing disables OpenTelemetry tracing for the client.
func WithHTTPClient ¶
func WithHTTPClient(httpClient connect.HTTPClient) ClientOption
WithHTTPClient sets the connect.HTTPClient to use for the client.
Defaults to grpc.RetryHTTPClient.
func WithURL ¶
func WithURL(url string) ClientOption
WithURL sets the URL of the Tilebox Datasets service.
Defaults to "https://api.tilebox.com".
type Collection ¶
type Collection struct { // ID is the unique identifier of the collection. ID uuid.UUID // Name is the name of the collection. Name string // Availability is the time interval for which data is available. Availability *query.TimeInterval // Count is the number of datapoints in the collection. Count uint64 }
Collection represents a Tilebox Dataset collection.
Documentation: https://docs.tilebox.com/datasets/concepts/collections
func (Collection) String ¶
func (c Collection) String() string
type CollectionClient ¶
type CollectionClient interface { Create(ctx context.Context, datasetID uuid.UUID, name string) (*Collection, error) Get(ctx context.Context, datasetID uuid.UUID, name string) (*Collection, error) GetOrCreate(ctx context.Context, datasetID uuid.UUID, name string) (*Collection, error) List(ctx context.Context, datasetID uuid.UUID) ([]*Collection, error) }
type CollectionService ¶
type CollectionService interface { CreateCollection(ctx context.Context, datasetID uuid.UUID, collectionName string) (*datasetsv1.CollectionInfo, error) GetCollectionByName(ctx context.Context, datasetID uuid.UUID, collectionName string) (*datasetsv1.CollectionInfo, error) ListCollections(ctx context.Context, datasetID uuid.UUID) (*datasetsv1.CollectionInfos, error) }
type DataAccessService ¶
type DataAccessService interface { Query(ctx context.Context, collectionIDs []uuid.UUID, filters *datasetsv1.QueryFilters, page *datasetsv1.Pagination, skipData bool) (*datasetsv1.QueryResultPage, error) QueryByID(ctx context.Context, collectionIDs []uuid.UUID, datapointID uuid.UUID, skipData bool) (*datasetsv1.Any, error) }
type DataIngestionService ¶
type DataIngestionService interface { Ingest(ctx context.Context, collectionID uuid.UUID, datapoints [][]byte, allowExisting bool) (*datasetsv1.IngestResponse, error) Delete(ctx context.Context, collectionID uuid.UUID, datapointIDs []uuid.UUID) (*datasetsv1.DeleteResponse, error) }
type DatapointClient ¶
type DatapointClient interface { GetInto(ctx context.Context, collectionIDs []uuid.UUID, datapointID uuid.UUID, datapoint proto.Message, options ...QueryOption) error Query(ctx context.Context, collectionIDs []uuid.UUID, options ...QueryOption) iter.Seq2[[]byte, error] QueryInto(ctx context.Context, collectionIDs []uuid.UUID, datapoints any, options ...QueryOption) error Ingest(ctx context.Context, collectionID uuid.UUID, datapoints any, allowExisting bool) (*IngestResponse, error) Delete(ctx context.Context, collectionID uuid.UUID, datapoints any) (int64, error) DeleteIDs(ctx context.Context, collectionID uuid.UUID, datapointIDs []uuid.UUID) (int64, error) }
type Dataset ¶
type Dataset struct { // ID is the unique identifier of the dataset. ID uuid.UUID // Type is the type of the dataset. Type *datasetsv1.AnnotatedType // Name is the name of the dataset. Name string // Description is a short description of the dataset. Description string // Slug is the unique slug of the dataset. Slug string }
Dataset represents a Tilebox Dataset.
Documentation: https://docs.tilebox.com/datasets/concepts/datasets
type DatasetClient ¶
type DatasetService ¶
type DatasetService interface { GetDataset(ctx context.Context, slug string) (*datasetsv1.Dataset, error) ListDatasets(ctx context.Context) (*datasetsv1.ListDatasetsResponse, error) }
type IngestResponse ¶
type IngestResponse struct { // NumCreated is the number of datapoints that were created. NumCreated int64 // NumExisting is the number of datapoints that were ignored because they already existed. NumExisting int64 // DatapointIDs is the list of all the datapoints IDs in the same order as the datapoints in the request. DatapointIDs []uuid.UUID }
IngestResponse contains the response from the Ingest method.
type QueryOption ¶
type QueryOption func(*queryOptions)
QueryOption is an interface for configuring a Query request.
func WithSkipData ¶
func WithSkipData() QueryOption
WithSkipData skips the data when querying datapoints. It is an optional flag for omitting the actual datapoint data from the response. If set, only the required datapoint fields will be returned.
Defaults to false.
func WithSpatialExtent ¶
func WithSpatialExtent(spatialExtent orb.Geometry) QueryOption
WithSpatialExtent specifies the geographical extent in which to query data. Optional, if not specified the query will return all results found globally.
func WithTemporalExtent ¶
func WithTemporalExtent(temporalExtent query.TemporalExtent) QueryOption
WithTemporalExtent specifies the time interval for which data should be queried. Right now, a temporal extent is required for every query.