Class: Rafflesia::QueryExports

Inherits:
Object
  • Object
show all
Defined in:
lib/rafflesia/query_exports.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ QueryExports

Returns a new instance of QueryExports.



9
10
11
# File 'lib/rafflesia/query_exports.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#cancel(export_id:, request_options: {}) ⇒ Rafflesia::EnvelopeQueryExportData

POST /v1/query_exports/export_id/cancel

Parameters:

  • export_id (String)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/rafflesia/query_exports.rb', line 97

def cancel(
  export_id:,
  request_options: {}
)
  response = @client.request(
    method: :post,
    path: "/v1/query_exports/#{Rafflesia::Util.encode_path(export_id)}/cancel",
    auth: true,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeQueryExportData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#create(query:, format: nil, max_rows: nil, retention_days: nil, request_options: {}) ⇒ Rafflesia::EnvelopeQueryExportData

POST /v1/query_exports

Parameters:

  • format (String, nil) (defaults to: nil)
  • max_rows (Integer, nil) (defaults to: nil)

    Hard maximum complete-result row count. The export fails rather than truncating.

  • query (Rafflesia::QueryRequest)
  • retention_days (Integer, nil) (defaults to: nil)

    Retention window before the export becomes eligible for reachability-aware garbage collection; defaults to 30 days.

  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/rafflesia/query_exports.rb', line 49

def create(
  query:,
  format: nil,
  max_rows: nil,
  retention_days: nil,
  request_options: {}
)
  body = {
    'format' => format,
    'max_rows' => max_rows,
    'query' => query,
    'retention_days' => retention_days
  }.compact
  response = @client.request(
    method: :post,
    path: '/v1/query_exports',
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeQueryExportData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#download(export_id:, request_options: {}) ⇒ String

Download immutable query-export Parquet bytes with a verified checksum.

Parameters:

  • export_id (String)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:

  • (String)


116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/rafflesia/query_exports.rb', line 116

def download(
  export_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/v1/query_exports/#{Rafflesia::Util.encode_path(export_id)}/download",
    auth: true,
    request_options: request_options
  )
  response.body
end

#get(export_id:, request_options: {}) ⇒ Rafflesia::EnvelopeQueryExportData

GET /v1/query_exports/export_id

Parameters:

  • export_id (String)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/rafflesia/query_exports.rb', line 78

def get(
  export_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/v1/query_exports/#{Rafflesia::Util.encode_path(export_id)}",
    auth: true,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeQueryExportData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#list(limit: nil, starting_after: nil, status: nil, request_options: {}) ⇒ Rafflesia::EnvelopeQueryExportListData

GET /v1/query_exports

Parameters:

  • limit (Integer, nil) (defaults to: nil)
  • starting_after (String, nil) (defaults to: nil)
  • status (Rafflesia::Types::QueryExportsStatus, nil) (defaults to: nil)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rafflesia/query_exports.rb', line 19

def list(
  limit: nil,
  starting_after: nil,
  status: nil,
  request_options: {}
)
  params = {
    'limit' => limit,
    'starting_after' => starting_after,
    'status' => status
  }.compact
  response = @client.request(
    method: :get,
    path: '/v1/query_exports',
    auth: true,
    params: params,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeQueryExportListData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end

#retry(export_id:, request_options: {}) ⇒ Rafflesia::EnvelopeQueryExportData

POST /v1/query_exports/export_id/retry

Parameters:

  • export_id (String)
  • request_options (Hash) (defaults to: {})

    (see Rafflesia::Types::RequestOptions)

Returns:



133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/rafflesia/query_exports.rb', line 133

def retry(
  export_id:,
  request_options: {}
)
  response = @client.request(
    method: :post,
    path: "/v1/query_exports/#{Rafflesia::Util.encode_path(export_id)}/retry",
    auth: true,
    request_options: request_options
  )
  result = Rafflesia::EnvelopeQueryExportData.new(response.body)
  result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
  result
end