bitfab 0.51.3 → 0.51.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 571e505294f7f5abe3b1d4c8521c4427cf30c105e03eb87509e70dd929559f43
4
- data.tar.gz: 2a39fa504e22027f19a845efb156fb6a7c38d4a1187b7df64dad1623b5cccb4b
3
+ metadata.gz: b739123699ec796d304175df24d0ff07ffa098b95c31d878370a07c7b9cb34c6
4
+ data.tar.gz: 6895704bbaf7f045b704a2ac71a7502a5f5b205792abd80af1b9d4fa124879d7
5
5
  SHA512:
6
- metadata.gz: e4146889a3a1f02b3bca7a104810067d59ec1e138cd099dc4822d241bcf34a6cb1514535d0bb902628e18a990bb31b5b1c79074cb946bdae7416bad3121a877c
7
- data.tar.gz: ab9ab7427fb6065d4a6c1748b780a60d12b70302971b474927741653da400f60deb8a739addb5eb60ef79e7e9c791922538c86cbe53f163a1eb69c4dd175b87b
6
+ metadata.gz: c4b895369cabdcec196d957e92bc2cf13dfe972efa3342ffbb0bc705f7670050cf60a7f85c4132dd92b394c59c338acc41c7bbb5597cb1a8aa160f501a5d3895
7
+ data.tar.gz: 810b845093e98709f56162422a9e87e1de46180e91224a0a60c67abc2f04f39ef1a3add5ac8f31e374c656920dc95c2aec79f6731c8160e0af98884791cf5450
@@ -25,10 +25,19 @@ module Bitfab
25
25
  end
26
26
 
27
27
  # List datasets, scoped to one trace function when given and
28
- # organization-wide otherwise.
28
+ # organization-wide otherwise. Fetches all pages automatically.
29
29
  def list(trace_function_key: nil)
30
- query = trace_function_key.nil? ? "" : "?#{URI.encode_www_form("traceFunctionKey" => trace_function_key)}"
31
- @http_client.get("/api/sdk/datasets#{query}")["datasets"]
30
+ query = {"limit" => "100"}
31
+ query["traceFunctionKey"] = trace_function_key unless trace_function_key.nil?
32
+ datasets = []
33
+ loop do
34
+ result = @http_client.get("/api/sdk/datasets?#{URI.encode_www_form(query)}")
35
+ datasets.concat(result["datasets"])
36
+ cursor = result["nextCursor"]
37
+ return datasets if cursor.nil?
38
+
39
+ query["cursor"] = cursor
40
+ end
32
41
  end
33
42
 
34
43
  # Fetch one dataset by id. A dataset outside this organization raises
@@ -38,9 +47,18 @@ module Bitfab
38
47
  end
39
48
 
40
49
  # The ids of every trace in the dataset, the same membership a replay with
41
- # dataset_id: selects.
50
+ # dataset_id: selects. Fetches all pages automatically.
42
51
  def list_traces(dataset_id)
43
- @http_client.get(dataset_path(dataset_id, "/traces"))
52
+ trace_ids = []
53
+ query = {"limit" => "100"}
54
+ loop do
55
+ page = @http_client.get("#{dataset_path(dataset_id, "/traces")}?#{URI.encode_www_form(query)}")
56
+ trace_ids.concat(page["traceIds"])
57
+ cursor = page["nextCursor"]
58
+ return {"datasetId" => page["datasetId"], "traceIds" => trace_ids} if cursor.nil?
59
+
60
+ query["cursor"] = cursor
61
+ end
44
62
  end
45
63
 
46
64
  # Add traces to the dataset (1 to 100 ids per call). Traces outside the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.51.3"
4
+ VERSION = "0.51.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.51.3
4
+ version: 0.51.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team