Class: Peddler::APIs::DataKiosk20231115

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/data_kiosk_2023_11_15.rb,
lib/peddler/apis/data_kiosk_2023_11_15/error.rb,
lib/peddler/apis/data_kiosk_2023_11_15/query.rb,
lib/peddler/apis/data_kiosk_2023_11_15/error_list.rb,
lib/peddler/apis/data_kiosk_2023_11_15/query_list.rb,
lib/peddler/apis/data_kiosk_2023_11_15/get_queries_response.rb,
lib/peddler/apis/data_kiosk_2023_11_15/create_query_response.rb,
lib/peddler/apis/data_kiosk_2023_11_15/get_document_response.rb,
lib/peddler/apis/data_kiosk_2023_11_15/create_query_specification.rb

Overview

Selling Partner API for Data Kiosk

The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.

Defined Under Namespace

Classes: QueryList

Constant Summary collapse

Error =

Error response returned when the request is unsuccessful.

Structure.new do
  # @return [String] An error code that identifies the type of error that occurred.
  attribute(:code, String)

  # @return [String] A message that describes the error condition.
  attribute(:message, String)

  # @return [String] Additional details that can help the caller understand or fix the issue.
  attribute?(:details, String)
end
Query =

Detailed information about the query.

Structure.new do
  # @return [Time] The date and time when the query was created, in ISO 8601 date time format.
  attribute(:created_time, Time, from: "createdTime")

  # @return [String] The processing status of the query.
  attribute(:processing_status, String, from: "processingStatus")

  # @return [String] The submitted query.
  attribute(:query, String)

  # @return [String] The query identifier. This identifier is unique only in combination with a selling partner
  # account ID.
  attribute(:query_id, String, from: "queryId")

  # @return [String] The data document identifier. This identifier is only present when there is data available as
  # a result of the query. This identifier is unique only in combination with a selling partner account ID. Pass
  # this identifier into the `getDocument` operation to get the information required to retrieve the data
  # document's contents.
  attribute?(:data_document_id, String, from: "dataDocumentId")

  # @return [String] The error document identifier. This identifier is only present when an error occurs during
  # query processing. This identifier is unique only in combination with a selling partner account ID. Pass this
  # identifier into the `getDocument` operation to get the information required to retrieve the error document's
  # contents.
  attribute?(:error_document_id, String, from: "errorDocumentId")

  # @return [Hash] When a query produces results that are not included in the data document, pagination occurs.
  # This means the results are divided into pages. To retrieve the next page, you must pass a
  # `CreateQuerySpecification` object with `paginationToken` set to this object's `nextToken` and with `query` set
  # to this object's `query` in the subsequent `createQuery` request. When there are no more pages to fetch, the
  # `nextToken` field will be absent.
  attribute?(:pagination, Hash)

  # @return [Time] The date and time when the query processing completed, in ISO 8601 date time format.
  attribute?(:processing_end_time, Time, from: "processingEndTime")

  # @return [Time] The date and time when the query processing started, in ISO 8601 date time format.
  attribute?(:processing_start_time, Time, from: "processingStartTime")
end
ErrorList =

A list of error responses returned when a request is unsuccessful.

Structure.new do
  # @return [Array<Error>] Error response returned when the request is unsuccessful.
  attribute(:errors, [Error])
end
GetQueriesResponse =

The response for the getQueries operation.

Structure.new do
  # @return [Array<Query>] The Data Kiosk queries.
  attribute(:queries, [Query])

  # @return [Hash] When a request has results that are not included in this response, pagination occurs. This
  # means the results are divided into pages. To retrieve the next page, you must pass the `nextToken` as the
  # `paginationToken` query parameter in the subsequent `getQueries` request. All other parameters must be
  # provided with the same values that were provided with the request that generated this token, with the
  # exception of `pageSize` which can be modified between calls to `getQueries`. When there are no more pages to
  # fetch, the `nextToken` field will be absent.
  attribute?(:pagination, Hash)
end
CreateQueryResponse =

The response for the createQuery operation.

Structure.new do
  # @return [String] The identifier for the query. This identifier is unique only in combination with a selling
  # partner account ID.
  attribute(:query_id, String, from: "queryId")
end
GetDocumentResponse =

The response for the getDocument operation.

Structure.new do
  # @return [String] The identifier for the Data Kiosk document. This identifier is unique only in combination
  # with a selling partner account ID.
  attribute(:document_id, String, from: "documentId")

  # @return [String] A presigned URL that can be used to retrieve the Data Kiosk document. This URL expires after
  # 5 minutes. If the Data Kiosk document is compressed, the `Content-Encoding` header will indicate the
  # compression algorithm.
  #
  # **Note:** Most HTTP clients are capable of automatically decompressing downloaded files based on the
  # `Content-Encoding` header.
  attribute(:document_url, String, from: "documentUrl")
end
CreateQuerySpecification =

Information required to create the query.

Structure.new do
  # @return [String] The GraphQL query to submit. A query must be at most 8000 characters after unnecessary
  # whitespace is removed.
  attribute(:query, String)

  # @return [String] A token to fetch a certain page of query results when there are multiple pages of query
  # results available. The value of this token must be fetched from the `pagination.nextToken` field of the
  # `Query` object, and the `query` field for this object must also be set to the `query` field of the same
  # `Query` object. A `Query` object can be retrieved from either the `getQueries` or `getQuery` operation. In the
  # absence of this token value, the first page of query results will be requested.
  attribute?(:pagination_token, String, from: "paginationToken")
end

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#cancel_query(query_id, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Cancels the query specified by the queryId parameter. Only queries with a non-terminal processingStatus (IN_QUEUE, IN_PROGRESS) can be cancelled. Cancelling a query that already has a processingStatus of CANCELLED will no-op. Cancelled queries are returned in subsequent calls to the getQuery and getQueries operations.

selling partner account ID.

Parameters:

  • query_id (String)

    The identifier for the query. This identifier is unique only in combination with a

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



72
73
74
75
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 72

def cancel_query(query_id, rate_limit: 0.0222)
  path = "/dataKiosk/2023-11-15/queries/#{percent_encode(query_id)}"
  meter(rate_limit).delete(path)
end

#create_query(body, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates a Data Kiosk query request.

Note: The retention of a query varies based on the fields requested. Each field within a schema is annotated with a @resultRetention directive that defines how long a query containing that field will be retained. When a query contains multiple fields with different retentions, the shortest (minimum) retention is applied. The retention of a query's resulting documents always matches the retention of the query.

Parameters:

  • body (Hash)

    The body of the request.

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

Returns:



56
57
58
59
60
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 56

def create_query(body, rate_limit: 0.0167)
  path = "/dataKiosk/2023-11-15/queries"
  parser = -> { CreateQueryResponse }
  meter(rate_limit).post(path, body:, parser:)
end

#get_document(document_id, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the information required for retrieving a Data Kiosk document's contents. See the createQuery operation for details about document retention.

Parameters:

  • document_id (String)

    The identifier for the Data Kiosk document.

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

Returns:



97
98
99
100
101
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 97

def get_document(document_id, rate_limit: 0.0167)
  path = "/dataKiosk/2023-11-15/documents/#{percent_encode(document_id)}"
  parser = -> { GetDocumentResponse }
  meter(rate_limit).get(path, parser:)
end

#get_queries(processing_statuses: nil, page_size: 10, created_since: nil, created_until: nil, pagination_token: nil, rate_limit: 0.0222) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns details for the Data Kiosk queries that match the specified filters. See the createQuery operation for details about query retention.

in ISO 8601 date time format. The default is 90 days ago. ISO 8601 date time format. The default is the time of the getQueries request. results available. The value of this token is fetched from the pagination.nextToken field returned in the GetQueriesResponse object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of pageSize which can be modified between calls to getQueries. In the absence of this token value, getQueries returns the first page of results.

Parameters:

  • processing_statuses (Array<String>) (defaults to: nil)

    A list of processing statuses used to filter queries.

  • page_size (Integer) (defaults to: 10)

    The maximum number of queries to return in a single call.

  • created_since (String) (defaults to: nil)

    The earliest query creation date and time for queries to include in the response,

  • created_until (String) (defaults to: nil)

    The latest query creation date and time for queries to include in the response, in

  • pagination_token (String) (defaults to: nil)

    A token to fetch a certain page of results when there are multiple pages of

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 31

def get_queries(processing_statuses: nil, page_size: 10, created_since: nil, created_until: nil,
  pagination_token: nil, rate_limit: 0.0222)
  path = "/dataKiosk/2023-11-15/queries"
  params = {
    "processingStatuses" => stringify_array(processing_statuses),
    "pageSize" => page_size,
    "createdSince" => created_since,
    "createdUntil" => created_until,
    "paginationToken" => pagination_token,
  }.compact
  parser = -> { GetQueriesResponse }
  meter(rate_limit).get(path, params:, parser:)
end

#get_query(query_id, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns query details for the query specified by the queryId parameter. See the createQuery operation for details about query retention.

Parameters:

  • query_id (String)

    The query identifier.

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

Returns:



84
85
86
87
88
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 84

def get_query(query_id, rate_limit: 2.0)
  path = "/dataKiosk/2023-11-15/queries/#{percent_encode(query_id)}"
  parser = -> { Query }
  meter(rate_limit).get(path, parser:)
end