Class: ContextDev::Resources::Batch
- Inherits:
-
Object
- Object
- ContextDev::Resources::Batch
- Defined in:
- lib/context_dev/resources/batch.rb,
sig/context_dev/resources/batch.rbs
Instance Method Summary collapse
-
#cancel(batch_id, request_options: {}) ⇒ ContextDev::Models::BatchCancelResponse
Stop a batch from starting new pages.
-
#get_results(batch_id, cursor: nil, limit: nil, request_options: {}) ⇒ ContextDev::Models::BatchGetResultsResponse
Some parameter documentations has been truncated, see Models::BatchGetResultsParams for more details.
-
#initialize(client:) ⇒ Batch
constructor
private
A new instance of Batch.
-
#list(cursor: nil, limit: nil, q: nil, search_type: nil, status: nil, tags: nil, request_options: {}) ⇒ ContextDev::Models::BatchListResponse
Some parameter documentations has been truncated, see Models::BatchListParams for more details.
-
#retrieve(batch_id, request_options: {}) ⇒ ContextDev::Models::BatchRetrieveResponse
Check progress, and get download links once the batch finishes.
-
#submit(identifiers:, tags: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::BatchSubmitResponse
Some parameter documentations has been truncated, see Models::BatchSubmitParams for more details.
Constructor Details
#initialize(client:) ⇒ Batch
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Batch.
147 148 149 |
# File 'lib/context_dev/resources/batch.rb', line 147 def initialize(client:) @client = client end |
Instance Method Details
#cancel(batch_id, request_options: {}) ⇒ ContextDev::Models::BatchCancelResponse
Stop a batch from starting new pages. In-progress pages finish, and unused credits are refunded.
75 76 77 78 79 80 81 82 |
# File 'lib/context_dev/resources/batch.rb', line 75 def cancel(batch_id, params = {}) @client.request( method: :post, path: ["batch/%1$s/cancel", batch_id], model: ContextDev::Models::BatchCancelResponse, options: params[:request_options] ) end |
#get_results(batch_id, cursor: nil, limit: nil, request_options: {}) ⇒ ContextDev::Models::BatchGetResultsResponse
Some parameter documentations has been truncated, see Models::BatchGetResultsParams for more details.
Page through a finished batch's results as JSON instead of downloading the NDJSON files.
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/context_dev/resources/batch.rb', line 103 def get_results(batch_id, params = {}) parsed, = ContextDev::BatchGetResultsParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["batch/%1$s/results", batch_id], query: query, model: ContextDev::Models::BatchGetResultsResponse, options: ) end |
#list(cursor: nil, limit: nil, q: nil, search_type: nil, status: nil, tags: nil, request_options: {}) ⇒ ContextDev::Models::BatchListResponse
Some parameter documentations has been truncated, see Models::BatchListParams for more details.
List your batches from newest to oldest. Filter by status or continue with a cursor.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/context_dev/resources/batch.rb', line 51 def list(params = {}) parsed, = ContextDev::BatchListParams.dump_request(params) query = ContextDev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "batch/list", query: query, model: ContextDev::Models::BatchListResponse, options: ) end |
#retrieve(batch_id, request_options: {}) ⇒ ContextDev::Models::BatchRetrieveResponse
Check progress, and get download links once the batch finishes.
17 18 19 20 21 22 23 24 |
# File 'lib/context_dev/resources/batch.rb', line 17 def retrieve(batch_id, params = {}) @client.request( method: :get, path: ["batch/%1$s", batch_id], model: ContextDev::Models::BatchRetrieveResponse, options: params[:request_options] ) end |
#submit(identifiers:, tags: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::BatchSubmitResponse
Some parameter documentations has been truncated, see Models::BatchSubmitParams for more details.
Retrieve and normalize a person profile from identifiers.
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/context_dev/resources/batch.rb', line 133 def submit(params) parsed, = ContextDev::BatchSubmitParams.dump_request(params) @client.request( method: :post, path: "people/retrieve", body: parsed, model: ContextDev::Models::BatchSubmitResponse, options: ) end |