Class: Peddler::APIs::DataKiosk20231115

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/data_kiosk_2023_11_15.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.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #parser, #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.

Parameters:

  • query_id (String)

    The identifier for the query. This identifier is unique only in combination with a selling partner account ID.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



75
76
77
78
79
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 75

def cancel_query(query_id, rate_limit: 0.0222)
  path = "/dataKiosk/2023-11-15/queries/#{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:



59
60
61
62
63
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 59

def create_query(body, rate_limit: 0.0167)
  path = "/dataKiosk/2023-11-15/queries"

  meter(rate_limit).post(path, body:)
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:



101
102
103
104
105
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 101

def get_document(document_id, rate_limit: 0.0167)
  path = "/dataKiosk/2023-11-15/documents/#{document_id}"

  meter(rate_limit).get(path)
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.

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, in ISO 8601 date time format. The default is 90 days ago.

  • created_until (String) (defaults to: nil)

    The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the ‘getQueries` request.

  • pagination_token (String) (defaults to: nil)

    A token to fetch a certain page of results when there are multiple pages of 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.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 35

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" => processing_statuses,
    "pageSize" => page_size,
    "createdSince" => created_since,
    "createdUntil" => created_until,
    "paginationToken" => pagination_token,
  }.compact

  meter(rate_limit).get(path, params:)
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:



88
89
90
91
92
# File 'lib/peddler/apis/data_kiosk_2023_11_15.rb', line 88

def get_query(query_id, rate_limit: 2.0)
  path = "/dataKiosk/2023-11-15/queries/#{query_id}"

  meter(rate_limit).get(path)
end