quicknode_sdk 0.1.0-aarch64-linux → 0.1.0.pre.alpha.11-aarch64-linux
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 +4 -4
- data/README.md +1537 -0
- data/lib/quicknode_sdk/clients/admin.rb +4 -0
- data/lib/quicknode_sdk/clients/kvstore.rb +4 -0
- data/lib/quicknode_sdk/clients/streams.rb +4 -0
- data/lib/quicknode_sdk/clients/webhooks.rb +4 -0
- data/lib/quicknode_sdk/native_delegator.rb +43 -0
- data/lib/{quicknode_sdk.so → quicknode_sdk/quicknode_sdk.so} +0 -0
- data/lib/quicknode_sdk/sdk.rb +27 -0
- data/lib/quicknode_sdk/wrap.rb +16 -0
- data/lib/quicknode_sdk.rb +8 -1
- data/sig/quicknode_sdk.rbs +162 -0
- metadata +29 -6
data/README.md
ADDED
|
@@ -0,0 +1,1537 @@
|
|
|
1
|
+
# quicknode_sdk (Ruby)
|
|
2
|
+
|
|
3
|
+
Ruby bindings for the Quicknode SDK.
|
|
4
|
+
|
|
5
|
+
This is one of four language bindings published from the same Rust core. See the [project README](https://github.com/quiknode-labs/sdk/blob/main/README.md) for the polyglot overview, development setup, and release process.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Quick Start](#quick-start)
|
|
11
|
+
- [Configuration](#configuration)
|
|
12
|
+
- [API Reference](#api-reference)
|
|
13
|
+
- [Admin Client](#admin-client)
|
|
14
|
+
- [Endpoints](#endpoints)
|
|
15
|
+
- [Endpoint Tags](#endpoint-tags)
|
|
16
|
+
- [Teams](#teams)
|
|
17
|
+
- [Usage](#usage)
|
|
18
|
+
- [Logs](#logs)
|
|
19
|
+
- [Endpoint Security](#endpoint-security)
|
|
20
|
+
- [Security Options](#security-options)
|
|
21
|
+
- [Tokens](#tokens)
|
|
22
|
+
- [Referrers](#referrers)
|
|
23
|
+
- [IPs](#ips)
|
|
24
|
+
- [Domain Masks](#domain-masks)
|
|
25
|
+
- [JWTs](#jwts)
|
|
26
|
+
- [Request Filters](#request-filters)
|
|
27
|
+
- [Multichain](#multichain)
|
|
28
|
+
- [IP Custom Headers](#ip-custom-headers)
|
|
29
|
+
- [Method Rate Limits](#method-rate-limits)
|
|
30
|
+
- [Endpoint Rate Limits](#endpoint-rate-limits)
|
|
31
|
+
- [Metrics](#metrics)
|
|
32
|
+
- [Chains](#chains)
|
|
33
|
+
- [Billing](#billing)
|
|
34
|
+
- [Bulk Operations](#bulk-operations)
|
|
35
|
+
- [Account Tags](#account-tags)
|
|
36
|
+
- [Streams Client](#streams-client)
|
|
37
|
+
- [Datasets, Regions, and Destinations](#datasets-regions-and-destinations)
|
|
38
|
+
- [Streams methods](#streams-methods)
|
|
39
|
+
- [Webhooks Client](#webhooks-client)
|
|
40
|
+
- [Templates and destination](#templates-and-destination)
|
|
41
|
+
- [Webhooks methods](#webhooks-methods)
|
|
42
|
+
- [KV Store Client](#kv-store-client)
|
|
43
|
+
- [Sets](#sets)
|
|
44
|
+
- [Lists](#lists)
|
|
45
|
+
- [Error Handling](#error-handling)
|
|
46
|
+
- [License](#license)
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
`gem install quicknode_sdk`
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
Construct the SDK once, then reach into the four sub-clients (`admin`, `streams`, `webhooks`, `kvstore`). Subsequent API Reference snippets assume you have a `qn` handle from one of these blocks.
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
# Ruby
|
|
58
|
+
require "quicknode_sdk"
|
|
59
|
+
|
|
60
|
+
qn = QuicknodeSdk::SDK.from_env
|
|
61
|
+
resp = qn.admin.get_endpoints
|
|
62
|
+
puts "#{resp[:data].length} endpoints"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
There are two ways to configure the SDK.
|
|
68
|
+
|
|
69
|
+
### Option A — Pass config directly
|
|
70
|
+
|
|
71
|
+
### Option B — Load from environment (`from_env()`)
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
# Ruby
|
|
75
|
+
qn = QuicknodeSdk::SDK.from_env
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Environment variables (prefix `QN_SDK__`, separator `__`):
|
|
79
|
+
|
|
80
|
+
| Variable | Required | Default | Description |
|
|
81
|
+
|----------|----------|---------|-------------|
|
|
82
|
+
| `QN_SDK__API_KEY` | yes | — | Your Quicknode API key |
|
|
83
|
+
| `QN_SDK__HTTP__TIMEOUT_SECS` | no | 30 | HTTP request timeout in seconds |
|
|
84
|
+
| `QN_SDK__HTTP__POOL_MAX_IDLE_PER_HOST` | no | — | Max idle HTTP connections per host |
|
|
85
|
+
| `QN_SDK__ADMIN__BASE_URL` | no | `https://api.quicknode.com/v0/` | Override admin API base URL (HTTPS, must end with `/`) |
|
|
86
|
+
| `QN_SDK__STREAMS__BASE_URL` | no | `https://api.quicknode.com/streams/rest/v1/` | Override streams base URL |
|
|
87
|
+
| `QN_SDK__WEBHOOKS__BASE_URL` | no | `https://api.quicknode.com/webhooks/rest/v1/` | Override webhooks base URL |
|
|
88
|
+
| `QN_SDK__KVSTORE__BASE_URL` | no | `https://api.quicknode.com/kv/rest/v1/` | Override KV store base URL |
|
|
89
|
+
|
|
90
|
+
## API Reference
|
|
91
|
+
|
|
92
|
+
Snippets assume `qn` was already constructed via the Quick Start. Optional parameters are skipped unless showing one is needed to illustrate usage.
|
|
93
|
+
|
|
94
|
+
### Language conventions
|
|
95
|
+
|
|
96
|
+
- Methods are **blocking** (not async). Parameters are a single Hash with symbol keys. Responses that carry data are returned as a `Hash` with indifferent access — `resp[:data]` and `resp["data"]` both work. Unknown parameter keys raise `ArgumentError`.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### Admin Client
|
|
101
|
+
|
|
102
|
+
Accessed as `qn.admin`. Manages endpoints, tags, teams, billing, usage, metrics, security, and rate limits. Backed by `https://api.quicknode.com/v0/`.
|
|
103
|
+
|
|
104
|
+
#### Endpoints
|
|
105
|
+
|
|
106
|
+
##### `get_endpoints` / `getEndpoints`
|
|
107
|
+
|
|
108
|
+
Returns a paginated list of endpoints on the account with optional search, filters (networks, statuses, labels, tags, dedicated, flat-rate), sorting, and pagination.
|
|
109
|
+
|
|
110
|
+
**Parameters** (all optional): `limit` (i32), `offset` (i32), `search` (string), `sort_by` (string), `sort_direction` (`"asc"` | `"desc"`), `networks` (string[]), `statuses` (string[]), `labels` (string[]), `dedicated` (bool), `is_flat_rate` (bool), `tag_ids` (i32[]), `tag_labels` (string[]).
|
|
111
|
+
|
|
112
|
+
**Returns**: `GetEndpointsResponse` — `{ data: Endpoint[], pagination?: Pagination }`.
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
# Ruby
|
|
116
|
+
resp = qn.admin.get_endpoints(limit: 20, sort_by: "created_at", sort_direction: "desc")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
##### `create_endpoint` / `createEndpoint`
|
|
120
|
+
|
|
121
|
+
Creates a new endpoint for the given blockchain and network.
|
|
122
|
+
|
|
123
|
+
**Parameters**: `chain` (string, optional), `network` (string, optional).
|
|
124
|
+
|
|
125
|
+
**Returns**: `CreateEndpointResponse` with `data: SingleEndpoint`.
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
# Ruby
|
|
129
|
+
resp = qn.admin.create_endpoint(chain: "ethereum", network: "mainnet")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
##### `show_endpoint` / `showEndpoint`
|
|
133
|
+
|
|
134
|
+
Fetches a single endpoint by id, including its full security configuration and rate limits.
|
|
135
|
+
|
|
136
|
+
**Parameters**: `id` (string, required).
|
|
137
|
+
|
|
138
|
+
**Returns**: `ShowEndpointResponse` with `data: SingleEndpoint`.
|
|
139
|
+
|
|
140
|
+
```ruby
|
|
141
|
+
# Ruby
|
|
142
|
+
resp = qn.admin.show_endpoint(id: "ep-123")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
##### `update_endpoint` / `updateEndpoint`
|
|
146
|
+
|
|
147
|
+
Updates editable fields on an endpoint. Currently supports `label`.
|
|
148
|
+
|
|
149
|
+
**Parameters**: `id` (string, required); body: `label` (string, optional).
|
|
150
|
+
|
|
151
|
+
**Returns**: nothing.
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
# Ruby
|
|
155
|
+
qn.admin.update_endpoint(id: "ep-123", label: "my label")
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
##### `archive_endpoint` / `archiveEndpoint`
|
|
159
|
+
|
|
160
|
+
Archives an endpoint. The HTTP verb is `DELETE` but the effect is archival, not permanent deletion.
|
|
161
|
+
|
|
162
|
+
**Parameters**: `id` (string, required).
|
|
163
|
+
|
|
164
|
+
**Returns**: nothing.
|
|
165
|
+
|
|
166
|
+
```ruby
|
|
167
|
+
# Ruby
|
|
168
|
+
qn.admin.archive_endpoint(id: "ep-123")
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
##### `update_endpoint_status` / `updateEndpointStatus`
|
|
172
|
+
|
|
173
|
+
Pauses or unpauses an endpoint.
|
|
174
|
+
|
|
175
|
+
**Parameters**: `id` (string, required); body: `status` (string, required — `"active"` or `"paused"`).
|
|
176
|
+
|
|
177
|
+
**Returns**: `UpdateEndpointStatusResponse`.
|
|
178
|
+
|
|
179
|
+
```ruby
|
|
180
|
+
# Ruby
|
|
181
|
+
qn.admin.update_endpoint_status(id: "ep-123", status: "paused")
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Endpoint Tags
|
|
185
|
+
|
|
186
|
+
Per-endpoint tag add/remove. For account-wide tag management see [Account Tags](#account-tags).
|
|
187
|
+
|
|
188
|
+
##### `create_tag` / `createTag`
|
|
189
|
+
|
|
190
|
+
Tags an endpoint with the given label. Creates the tag on the account if it does not exist.
|
|
191
|
+
|
|
192
|
+
**Parameters**: `id` (string, required); body: `label` (string, optional).
|
|
193
|
+
|
|
194
|
+
**Returns**: nothing.
|
|
195
|
+
|
|
196
|
+
```ruby
|
|
197
|
+
# Ruby
|
|
198
|
+
qn.admin.create_tag(id: "ep-123", label: "prod")
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
##### `delete_tag` / `deleteTag`
|
|
202
|
+
|
|
203
|
+
Removes a tag from a specific endpoint.
|
|
204
|
+
|
|
205
|
+
**Parameters**: `id` (endpoint id, string, required), `tag_id` (string, required).
|
|
206
|
+
|
|
207
|
+
**Returns**: nothing.
|
|
208
|
+
|
|
209
|
+
```ruby
|
|
210
|
+
# Ruby
|
|
211
|
+
qn.admin.delete_tag(id: "ep-123", tag_id: "42")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Teams
|
|
215
|
+
|
|
216
|
+
##### `list_teams` / `listTeams`
|
|
217
|
+
|
|
218
|
+
Lists all teams on the account.
|
|
219
|
+
|
|
220
|
+
**Parameters**: none.
|
|
221
|
+
|
|
222
|
+
**Returns**: `ListTeamsResponse` with `data: TeamSummary[]`.
|
|
223
|
+
|
|
224
|
+
```ruby
|
|
225
|
+
# Ruby
|
|
226
|
+
resp = qn.admin.list_teams
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
##### `create_team` / `createTeam`
|
|
230
|
+
|
|
231
|
+
Creates a new team.
|
|
232
|
+
|
|
233
|
+
**Parameters**: `name` (string, required).
|
|
234
|
+
|
|
235
|
+
**Returns**: `CreateTeamResponse` with `data: CreateTeamData`.
|
|
236
|
+
|
|
237
|
+
```ruby
|
|
238
|
+
# Ruby
|
|
239
|
+
resp = qn.admin.create_team(name: "Payments")
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
##### `get_team` / `getTeam`
|
|
243
|
+
|
|
244
|
+
Fetches team detail including pending invites.
|
|
245
|
+
|
|
246
|
+
**Parameters**: `id` (i64, required).
|
|
247
|
+
|
|
248
|
+
**Returns**: `GetTeamResponse` with `data: TeamDetail`.
|
|
249
|
+
|
|
250
|
+
```ruby
|
|
251
|
+
# Ruby
|
|
252
|
+
resp = qn.admin.get_team(id: 42)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
##### `delete_team` / `deleteTeam`
|
|
256
|
+
|
|
257
|
+
Deletes a team.
|
|
258
|
+
|
|
259
|
+
**Parameters**: `id` (i64, required).
|
|
260
|
+
|
|
261
|
+
**Returns**: `DeleteTeamResponse`.
|
|
262
|
+
|
|
263
|
+
```ruby
|
|
264
|
+
# Ruby
|
|
265
|
+
qn.admin.delete_team(id: 42)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
##### `list_team_endpoints` / `listTeamEndpoints`
|
|
269
|
+
|
|
270
|
+
Lists endpoints accessible to a team.
|
|
271
|
+
|
|
272
|
+
**Parameters**: `id` (i64, required).
|
|
273
|
+
|
|
274
|
+
**Returns**: `ListTeamEndpointsResponse` with `data: TeamEndpoint[]`.
|
|
275
|
+
|
|
276
|
+
```ruby
|
|
277
|
+
# Ruby
|
|
278
|
+
resp = qn.admin.list_team_endpoints(id: 42)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
##### `update_team_endpoints` / `updateTeamEndpoints`
|
|
282
|
+
|
|
283
|
+
Replaces the set of endpoints associated with a team. Pass an empty array to remove all.
|
|
284
|
+
|
|
285
|
+
**Parameters**: `id` (i64, required); body: `endpoint_ids` (string[], required).
|
|
286
|
+
|
|
287
|
+
**Returns**: `UpdateTeamEndpointsResponse`.
|
|
288
|
+
|
|
289
|
+
```ruby
|
|
290
|
+
# Ruby
|
|
291
|
+
qn.admin.update_team_endpoints(id: 42, endpoint_ids: ["ep-123", "ep-456"])
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
##### `invite_team_member` / `inviteTeamMember`
|
|
295
|
+
|
|
296
|
+
Invites a user to a team. Existing users only need `email`; new users require `full_name` and `role`.
|
|
297
|
+
|
|
298
|
+
**Parameters**: `id` (i64, required); body: `email` (string, required), `full_name` (string, optional), `role` (string, optional — `admin` | `viewer` | `billing`).
|
|
299
|
+
|
|
300
|
+
**Returns**: `InviteTeamMemberResponse`.
|
|
301
|
+
|
|
302
|
+
```ruby
|
|
303
|
+
# Ruby
|
|
304
|
+
qn.admin.invite_team_member(id: 42, email: "alice@example.com", role: "viewer")
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
##### `remove_team_member` / `removeTeamMember`
|
|
308
|
+
|
|
309
|
+
Removes a user from a team.
|
|
310
|
+
|
|
311
|
+
**Parameters**: `id` (team id, i64, required), `user_id` (i64, required).
|
|
312
|
+
|
|
313
|
+
**Returns**: `RemoveTeamMemberResponse`.
|
|
314
|
+
|
|
315
|
+
```ruby
|
|
316
|
+
# Ruby
|
|
317
|
+
qn.admin.remove_team_member(id: 42, user_id: 7)
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
##### `resend_team_invite` / `resendTeamInvite`
|
|
321
|
+
|
|
322
|
+
Re-sends a pending team invitation.
|
|
323
|
+
|
|
324
|
+
**Parameters**: `id` (team id, i64, required), `user_id` (i64, required).
|
|
325
|
+
|
|
326
|
+
**Returns**: `ResendTeamInviteResponse`.
|
|
327
|
+
|
|
328
|
+
```ruby
|
|
329
|
+
# Ruby
|
|
330
|
+
qn.admin.resend_team_invite(id: 42, user_id: 7)
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
#### Usage
|
|
334
|
+
|
|
335
|
+
All usage methods accept optional `start_time` and `end_time` Unix timestamps. Omit both for account-to-date totals.
|
|
336
|
+
|
|
337
|
+
##### `get_usage` / `getUsage`
|
|
338
|
+
|
|
339
|
+
Aggregate account usage for a time window.
|
|
340
|
+
|
|
341
|
+
**Returns**: `GetUsageResponse` with `data: UsageData` (`credits_used`, `credits_remaining`, `limit`, `overages`, `start_time`, `end_time`).
|
|
342
|
+
|
|
343
|
+
```ruby
|
|
344
|
+
# Ruby
|
|
345
|
+
resp = qn.admin.get_usage({})
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
##### `get_usage_by_endpoint` / `getUsageByEndpoint`
|
|
349
|
+
|
|
350
|
+
Per-endpoint usage breakdown.
|
|
351
|
+
|
|
352
|
+
**Returns**: `GetUsageByEndpointResponse` with `data.endpoints: EndpointUsage[]`.
|
|
353
|
+
|
|
354
|
+
```ruby
|
|
355
|
+
# Ruby
|
|
356
|
+
resp = qn.admin.get_usage_by_endpoint({})
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
##### `get_usage_by_method` / `getUsageByMethod`
|
|
360
|
+
|
|
361
|
+
Per-RPC-method usage breakdown.
|
|
362
|
+
|
|
363
|
+
**Returns**: `GetUsageByMethodResponse` with `data.methods: MethodUsage[]`.
|
|
364
|
+
|
|
365
|
+
```ruby
|
|
366
|
+
# Ruby
|
|
367
|
+
resp = qn.admin.get_usage_by_method({})
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
##### `get_usage_by_chain` / `getUsageByChain`
|
|
371
|
+
|
|
372
|
+
Per-chain usage breakdown.
|
|
373
|
+
|
|
374
|
+
**Returns**: `GetUsageByChainResponse` with `data.chains: ChainUsage[]`.
|
|
375
|
+
|
|
376
|
+
```ruby
|
|
377
|
+
# Ruby
|
|
378
|
+
resp = qn.admin.get_usage_by_chain({})
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
##### `get_usage_by_tag` / `getUsageByTag`
|
|
382
|
+
|
|
383
|
+
Per-tag usage breakdown.
|
|
384
|
+
|
|
385
|
+
**Returns**: `GetUsageByTagResponse` with `data.tags: TagUsage[]`.
|
|
386
|
+
|
|
387
|
+
```ruby
|
|
388
|
+
# Ruby
|
|
389
|
+
resp = qn.admin.get_usage_by_tag({})
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
#### Logs
|
|
393
|
+
|
|
394
|
+
##### `get_endpoint_logs` / `getEndpointLogs`
|
|
395
|
+
|
|
396
|
+
Fetches a page of request logs for an endpoint. Set `include_details=true` for full request/response payloads (truncated at 2 KB each).
|
|
397
|
+
|
|
398
|
+
**Parameters**: `id` (endpoint id, required); body: `from` (string timestamp, required), `to` (string timestamp, required), `include_details` (bool, optional), `limit` (i32, optional), `next_at` (string cursor, optional).
|
|
399
|
+
|
|
400
|
+
**Returns**: `GetEndpointLogsResponse` — `{ data: EndpointLog[], next_at?: string }`.
|
|
401
|
+
|
|
402
|
+
```ruby
|
|
403
|
+
# Ruby
|
|
404
|
+
resp = qn.admin.get_endpoint_logs(
|
|
405
|
+
id: "ep-123",
|
|
406
|
+
from_time: "2026-04-01T00:00:00Z",
|
|
407
|
+
to_time: "2026-04-02T00:00:00Z",
|
|
408
|
+
limit: 100
|
|
409
|
+
)
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
##### `get_log_details` / `getLogDetails`
|
|
413
|
+
|
|
414
|
+
Returns the full request/response payloads for a single log entry.
|
|
415
|
+
|
|
416
|
+
**Parameters**: `id` (endpoint id, required), `request_id` (log request uuid, required).
|
|
417
|
+
|
|
418
|
+
**Returns**: `GetLogDetailsResponse` with `data: LogDetails`.
|
|
419
|
+
|
|
420
|
+
```ruby
|
|
421
|
+
# Ruby
|
|
422
|
+
resp = qn.admin.get_log_details(id: "ep-123", request_id: "req-abc")
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
#### Endpoint Security
|
|
426
|
+
|
|
427
|
+
##### `get_endpoint_security` / `getEndpointSecurity`
|
|
428
|
+
|
|
429
|
+
Returns the full security configuration for an endpoint: tokens, JWTs, referrers, domain masks, IPs, request filters, and their per-feature toggles.
|
|
430
|
+
|
|
431
|
+
**Parameters**: `id` (string, required).
|
|
432
|
+
|
|
433
|
+
**Returns**: `GetEndpointSecurityResponse` with `data: EndpointSecurity`.
|
|
434
|
+
|
|
435
|
+
```ruby
|
|
436
|
+
# Ruby
|
|
437
|
+
resp = qn.admin.get_endpoint_security(id: "ep-123")
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
#### Security Options
|
|
441
|
+
|
|
442
|
+
##### `get_security_options` / `getSecurityOptions`
|
|
443
|
+
|
|
444
|
+
Returns the list of security features and their enabled state for an endpoint.
|
|
445
|
+
|
|
446
|
+
**Parameters**: `id` (string, required).
|
|
447
|
+
|
|
448
|
+
**Returns**: `GetSecurityOptionsResponse` with `data: SecurityOption[]`.
|
|
449
|
+
|
|
450
|
+
```ruby
|
|
451
|
+
# Ruby
|
|
452
|
+
resp = qn.admin.get_security_options(id: "ep-123")
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
##### `update_security_options` / `updateSecurityOptions`
|
|
456
|
+
|
|
457
|
+
Enables or disables individual security features. Each field accepts `"enabled"` or `"disabled"`.
|
|
458
|
+
|
|
459
|
+
**Parameters**: `id` (string, required); `options`: `SecurityOptionsUpdate` (`tokens`, `referrers`, `jwts`, `ips`, `domain_masks`, `hsts`, `cors`, `request_filters`, `ip_custom_header`).
|
|
460
|
+
|
|
461
|
+
**Returns**: `UpdateSecurityOptionsResponse` with updated `SecurityOption[]`.
|
|
462
|
+
|
|
463
|
+
```ruby
|
|
464
|
+
# Ruby
|
|
465
|
+
qn.admin.update_security_options(id: "ep-123", tokens: "enabled", jwts: "disabled")
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
#### Tokens
|
|
469
|
+
|
|
470
|
+
##### `create_token` / `createToken`
|
|
471
|
+
|
|
472
|
+
Generates a new auth token on an endpoint.
|
|
473
|
+
|
|
474
|
+
**Parameters**: `id` (endpoint id, required).
|
|
475
|
+
|
|
476
|
+
**Returns**: nothing.
|
|
477
|
+
|
|
478
|
+
```ruby
|
|
479
|
+
# Ruby
|
|
480
|
+
qn.admin.create_token(id: "ep-123")
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
##### `delete_token` / `deleteToken`
|
|
484
|
+
|
|
485
|
+
Revokes a token on an endpoint.
|
|
486
|
+
|
|
487
|
+
**Parameters**: `id` (endpoint id, required), `token_id` (string, required).
|
|
488
|
+
|
|
489
|
+
**Returns**: nothing.
|
|
490
|
+
|
|
491
|
+
```ruby
|
|
492
|
+
# Ruby
|
|
493
|
+
qn.admin.delete_token(id: "ep-123", token_id: "tok-1")
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
#### Referrers
|
|
497
|
+
|
|
498
|
+
##### `create_referrer` / `createReferrer`
|
|
499
|
+
|
|
500
|
+
Whitelists a referrer URL or domain on an endpoint.
|
|
501
|
+
|
|
502
|
+
**Parameters**: `id` (endpoint id, required); body: `referrer` (string, optional).
|
|
503
|
+
|
|
504
|
+
**Returns**: nothing.
|
|
505
|
+
|
|
506
|
+
```ruby
|
|
507
|
+
# Ruby
|
|
508
|
+
qn.admin.create_referrer(id: "ep-123", referrer: "example.com")
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
##### `delete_referrer` / `deleteReferrer`
|
|
512
|
+
|
|
513
|
+
Removes a referrer from the whitelist.
|
|
514
|
+
|
|
515
|
+
**Parameters**: `id` (endpoint id, required), `referrer_id` (string, required).
|
|
516
|
+
|
|
517
|
+
**Returns**: nothing.
|
|
518
|
+
|
|
519
|
+
```ruby
|
|
520
|
+
# Ruby
|
|
521
|
+
qn.admin.delete_referrer(id: "ep-123", referrer_id: "ref-1")
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
#### IPs
|
|
525
|
+
|
|
526
|
+
##### `create_ip` / `createIp`
|
|
527
|
+
|
|
528
|
+
Whitelists an IP address on an endpoint.
|
|
529
|
+
|
|
530
|
+
**Parameters**: `id` (endpoint id, required); body: `ip` (string, optional).
|
|
531
|
+
|
|
532
|
+
**Returns**: nothing.
|
|
533
|
+
|
|
534
|
+
```ruby
|
|
535
|
+
# Ruby
|
|
536
|
+
qn.admin.create_ip(id: "ep-123", ip: "198.51.100.7")
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
##### `delete_ip` / `deleteIp`
|
|
540
|
+
|
|
541
|
+
Removes an IP from the whitelist.
|
|
542
|
+
|
|
543
|
+
**Parameters**: `id` (endpoint id, required), `ip_id` (string, required).
|
|
544
|
+
|
|
545
|
+
**Returns**: `DeleteBoolResponse`.
|
|
546
|
+
|
|
547
|
+
```ruby
|
|
548
|
+
# Ruby
|
|
549
|
+
resp = qn.admin.delete_ip(id: "ep-123", ip_id: "ip-1")
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
#### Domain Masks
|
|
553
|
+
|
|
554
|
+
##### `create_domain_mask` / `createDomainMask`
|
|
555
|
+
|
|
556
|
+
Adds a custom domain mask to an endpoint.
|
|
557
|
+
|
|
558
|
+
**Parameters**: `id` (endpoint id, required); body: `domain_mask` (string, optional).
|
|
559
|
+
|
|
560
|
+
**Returns**: nothing.
|
|
561
|
+
|
|
562
|
+
```ruby
|
|
563
|
+
# Ruby
|
|
564
|
+
qn.admin.create_domain_mask(id: "ep-123", domain_mask: "rpc.example.com")
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
##### `delete_domain_mask` / `deleteDomainMask`
|
|
568
|
+
|
|
569
|
+
Removes a domain mask.
|
|
570
|
+
|
|
571
|
+
**Parameters**: `id` (endpoint id, required), `domain_mask_id` (string, required).
|
|
572
|
+
|
|
573
|
+
**Returns**: nothing.
|
|
574
|
+
|
|
575
|
+
```ruby
|
|
576
|
+
# Ruby
|
|
577
|
+
qn.admin.delete_domain_mask(id: "ep-123", domain_mask_id: "dm-1")
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
#### JWTs
|
|
581
|
+
|
|
582
|
+
##### `create_jwt` / `createJwt`
|
|
583
|
+
|
|
584
|
+
Configures JWT validation on an endpoint.
|
|
585
|
+
|
|
586
|
+
**Parameters**: `id` (endpoint id, required); body: `public_key` (string, optional), `kid` (string, optional), `name` (string, optional).
|
|
587
|
+
|
|
588
|
+
**Returns**: nothing.
|
|
589
|
+
|
|
590
|
+
```ruby
|
|
591
|
+
# Ruby
|
|
592
|
+
qn.admin.create_jwt(
|
|
593
|
+
id: "ep-123",
|
|
594
|
+
public_key: "-----BEGIN PUBLIC KEY-----\n...",
|
|
595
|
+
kid: "key-1",
|
|
596
|
+
name: "primary"
|
|
597
|
+
)
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
##### `delete_jwt` / `deleteJwt`
|
|
601
|
+
|
|
602
|
+
Removes a JWT configuration.
|
|
603
|
+
|
|
604
|
+
**Parameters**: `id` (endpoint id, required), `jwt_id` (string, required).
|
|
605
|
+
|
|
606
|
+
**Returns**: nothing.
|
|
607
|
+
|
|
608
|
+
```ruby
|
|
609
|
+
# Ruby
|
|
610
|
+
qn.admin.delete_jwt(id: "ep-123", jwt_id: "jwt-1")
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
#### Request Filters
|
|
614
|
+
|
|
615
|
+
Whitelist specific RPC methods on an endpoint. Requests for methods not on the list are blocked when the feature is enabled.
|
|
616
|
+
|
|
617
|
+
##### `create_request_filter` / `createRequestFilter`
|
|
618
|
+
|
|
619
|
+
**Parameters**: `id` (endpoint id, required); body: `method` (string[], optional). Ruby's Hash key is `methods` (plural).
|
|
620
|
+
|
|
621
|
+
**Returns**: `CreateRequestFilterResponse` with `data.id`.
|
|
622
|
+
|
|
623
|
+
```ruby
|
|
624
|
+
# Ruby
|
|
625
|
+
resp = qn.admin.create_request_filter(
|
|
626
|
+
id: "ep-123",
|
|
627
|
+
methods: ["eth_blockNumber", "eth_getBalance"]
|
|
628
|
+
)
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
##### `update_request_filter` / `updateRequestFilter`
|
|
632
|
+
|
|
633
|
+
**Parameters**: `id` (endpoint id, required), `request_filter_id` (string, required); body: `method` (string[], optional). Ruby's Hash keys are `request_filter_id` and `methods` (plural).
|
|
634
|
+
|
|
635
|
+
**Returns**: nothing.
|
|
636
|
+
|
|
637
|
+
```ruby
|
|
638
|
+
# Ruby
|
|
639
|
+
qn.admin.update_request_filter(id: "ep-123", request_filter_id: "f-1", methods: ["eth_call"])
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
##### `delete_request_filter` / `deleteRequestFilter`
|
|
643
|
+
|
|
644
|
+
**Parameters**: `id` (endpoint id, required), `request_filter_id` (string, required).
|
|
645
|
+
|
|
646
|
+
**Returns**: nothing.
|
|
647
|
+
|
|
648
|
+
```ruby
|
|
649
|
+
# Ruby
|
|
650
|
+
qn.admin.delete_request_filter(id: "ep-123", request_filter_id: "f-1")
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
#### Multichain
|
|
654
|
+
|
|
655
|
+
##### `enable_multichain` / `enableMultichain`
|
|
656
|
+
|
|
657
|
+
Enables multichain on an endpoint.
|
|
658
|
+
|
|
659
|
+
**Parameters**: `id` (endpoint id, required).
|
|
660
|
+
|
|
661
|
+
**Returns**: nothing.
|
|
662
|
+
|
|
663
|
+
```ruby
|
|
664
|
+
# Ruby
|
|
665
|
+
qn.admin.enable_multichain(id: "ep-123")
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
##### `disable_multichain` / `disableMultichain`
|
|
669
|
+
|
|
670
|
+
Disables multichain on an endpoint.
|
|
671
|
+
|
|
672
|
+
**Parameters**: `id` (endpoint id, required).
|
|
673
|
+
|
|
674
|
+
**Returns**: nothing.
|
|
675
|
+
|
|
676
|
+
```ruby
|
|
677
|
+
# Ruby
|
|
678
|
+
qn.admin.disable_multichain(id: "ep-123")
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
#### IP Custom Headers
|
|
682
|
+
|
|
683
|
+
##### `create_or_update_ip_custom_header` / `createOrUpdateIpCustomHeader`
|
|
684
|
+
|
|
685
|
+
Sets the custom header used to identify the client IP (e.g. when traffic is proxied).
|
|
686
|
+
|
|
687
|
+
**Parameters**: `id` (endpoint id, required); body: `header_name` (string, required).
|
|
688
|
+
|
|
689
|
+
**Returns**: `CreateOrUpdateIpCustomHeaderResponse` with `data.header_name`.
|
|
690
|
+
|
|
691
|
+
```ruby
|
|
692
|
+
# Ruby
|
|
693
|
+
qn.admin.create_or_update_ip_custom_header(
|
|
694
|
+
id: "ep-123",
|
|
695
|
+
header_name: "X-Forwarded-For"
|
|
696
|
+
)
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
##### `delete_ip_custom_header` / `deleteIpCustomHeader`
|
|
700
|
+
|
|
701
|
+
Removes the custom IP header configuration.
|
|
702
|
+
|
|
703
|
+
**Parameters**: `id` (endpoint id, required).
|
|
704
|
+
|
|
705
|
+
**Returns**: `DeleteBoolResponse`.
|
|
706
|
+
|
|
707
|
+
```ruby
|
|
708
|
+
# Ruby
|
|
709
|
+
qn.admin.delete_ip_custom_header(id: "ep-123")
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
#### Method Rate Limits
|
|
713
|
+
|
|
714
|
+
##### `get_method_rate_limits` / `getMethodRateLimits`
|
|
715
|
+
|
|
716
|
+
Lists method-level rate limiters configured on an endpoint.
|
|
717
|
+
|
|
718
|
+
**Parameters**: `id` (endpoint id, required).
|
|
719
|
+
|
|
720
|
+
**Returns**: `GetMethodRateLimitsResponse` with `data.rate_limiters: MethodRateLimiter[]`.
|
|
721
|
+
|
|
722
|
+
```ruby
|
|
723
|
+
# Ruby
|
|
724
|
+
resp = qn.admin.get_method_rate_limits(id: "ep-123")
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
##### `create_method_rate_limit` / `createMethodRateLimit`
|
|
728
|
+
|
|
729
|
+
Creates a new method-level rate limiter.
|
|
730
|
+
|
|
731
|
+
**Parameters**: `id` (endpoint id, required); body: `interval` (string, e.g. `"second"`), `methods` (string[]), `rate` (i32).
|
|
732
|
+
|
|
733
|
+
**Returns**: `CreateMethodRateLimitResponse` with `data: MethodRateLimiter`.
|
|
734
|
+
|
|
735
|
+
```ruby
|
|
736
|
+
# Ruby
|
|
737
|
+
resp = qn.admin.create_method_rate_limit(
|
|
738
|
+
id: "ep-123",
|
|
739
|
+
interval: "second",
|
|
740
|
+
methods: ["eth_call"],
|
|
741
|
+
rate: 10
|
|
742
|
+
)
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
##### `update_method_rate_limit` / `updateMethodRateLimit`
|
|
746
|
+
|
|
747
|
+
Updates an existing rate limiter. Only provided fields change.
|
|
748
|
+
|
|
749
|
+
**Parameters**: `id` (endpoint id, required), `method_rate_limit_id` (string, required); body: `methods` (string[], optional), `status` (`"enabled"` | `"disabled"`, optional), `rate` (i32, optional).
|
|
750
|
+
|
|
751
|
+
**Returns**: `UpdateMethodRateLimitResponse`.
|
|
752
|
+
|
|
753
|
+
```ruby
|
|
754
|
+
# Ruby
|
|
755
|
+
qn.admin.update_method_rate_limit(id: "ep-123", method_rate_limit_id: "rl-1", rate: 50)
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
##### `delete_method_rate_limit` / `deleteMethodRateLimit`
|
|
759
|
+
|
|
760
|
+
Deletes a rate limiter.
|
|
761
|
+
|
|
762
|
+
**Parameters**: `id` (endpoint id, required), `method_rate_limit_id` (string, required).
|
|
763
|
+
|
|
764
|
+
**Returns**: nothing.
|
|
765
|
+
|
|
766
|
+
```ruby
|
|
767
|
+
# Ruby
|
|
768
|
+
qn.admin.delete_method_rate_limit(id: "ep-123", method_rate_limit_id: "rl-1")
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
#### Endpoint Rate Limits
|
|
772
|
+
|
|
773
|
+
##### `update_rate_limits` / `updateRateLimits`
|
|
774
|
+
|
|
775
|
+
Updates the endpoint-level RPS / RPM / RPD caps.
|
|
776
|
+
|
|
777
|
+
**Parameters**: `id` (endpoint id, required); `rate_limits`: `RateLimitSettings` (`rps`, `rpm`, `rpd`, all optional).
|
|
778
|
+
|
|
779
|
+
**Returns**: nothing.
|
|
780
|
+
|
|
781
|
+
```ruby
|
|
782
|
+
# Ruby
|
|
783
|
+
qn.admin.update_rate_limits(id: "ep-123", rps: 100, rpm: 5000)
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
#### Metrics
|
|
787
|
+
|
|
788
|
+
##### `get_endpoint_metrics` / `getEndpointMetrics`
|
|
789
|
+
|
|
790
|
+
Returns metric series for an endpoint over a time period.
|
|
791
|
+
|
|
792
|
+
**Parameters**: `id` (endpoint id, required); body: `period` (`"hour"` | `"day"` | `"week"` | `"month"`), `metric` (e.g. `"method_calls_over_time"`, `"response_status_breakdown"`).
|
|
793
|
+
|
|
794
|
+
**Returns**: `GetEndpointMetricsResponse` with `data: EndpointMetric[]`.
|
|
795
|
+
|
|
796
|
+
```ruby
|
|
797
|
+
# Ruby
|
|
798
|
+
resp = qn.admin.get_endpoint_metrics(
|
|
799
|
+
id: "ep-123",
|
|
800
|
+
period: "day",
|
|
801
|
+
metric: "method_calls_over_time"
|
|
802
|
+
)
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
##### `get_account_metrics` / `getAccountMetrics`
|
|
806
|
+
|
|
807
|
+
Returns account-level metric series. Supports an optional `percentile` (e.g. `"p50"`, `"p95"`, `"p99"`) for latency metrics.
|
|
808
|
+
|
|
809
|
+
**Parameters**: `period` (required), `metric` (required), `percentile` (string, optional).
|
|
810
|
+
|
|
811
|
+
**Returns**: `GetAccountMetricsResponse` with `data: EndpointMetric[]`.
|
|
812
|
+
|
|
813
|
+
```ruby
|
|
814
|
+
# Ruby
|
|
815
|
+
resp = qn.admin.get_account_metrics(period: "day", metric: "credits_over_time")
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
#### Chains
|
|
819
|
+
|
|
820
|
+
##### `list_chains` / `listChains`
|
|
821
|
+
|
|
822
|
+
Lists the blockchains supported by Quicknode along with their networks.
|
|
823
|
+
|
|
824
|
+
**Parameters**: none.
|
|
825
|
+
|
|
826
|
+
**Returns**: `ListChainsResponse` with `data: Chain[]`.
|
|
827
|
+
|
|
828
|
+
```ruby
|
|
829
|
+
# Ruby
|
|
830
|
+
resp = qn.admin.list_chains
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
#### Billing
|
|
834
|
+
|
|
835
|
+
##### `list_invoices` / `listInvoices`
|
|
836
|
+
|
|
837
|
+
Lists invoices on the account.
|
|
838
|
+
|
|
839
|
+
**Parameters**: none.
|
|
840
|
+
|
|
841
|
+
**Returns**: `ListInvoicesResponse` with `data.invoices: Invoice[]`.
|
|
842
|
+
|
|
843
|
+
```ruby
|
|
844
|
+
# Ruby
|
|
845
|
+
resp = qn.admin.list_invoices
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
##### `list_payments` / `listPayments`
|
|
849
|
+
|
|
850
|
+
Lists payments on the account.
|
|
851
|
+
|
|
852
|
+
**Parameters**: none.
|
|
853
|
+
|
|
854
|
+
**Returns**: `ListPaymentsResponse` with `data.payments: Payment[]`.
|
|
855
|
+
|
|
856
|
+
```ruby
|
|
857
|
+
# Ruby
|
|
858
|
+
resp = qn.admin.list_payments
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
#### Bulk Operations
|
|
862
|
+
|
|
863
|
+
##### `bulk_update_endpoint_status` / `bulkUpdateEndpointStatus`
|
|
864
|
+
|
|
865
|
+
Activates or pauses many endpoints at once.
|
|
866
|
+
|
|
867
|
+
**Parameters**: `ids` (string[], required), `status` (`"active"` | `"paused"`, required).
|
|
868
|
+
|
|
869
|
+
**Returns**: `BulkUpdateEndpointStatusResponse` with per-endpoint `results`.
|
|
870
|
+
|
|
871
|
+
```ruby
|
|
872
|
+
# Ruby
|
|
873
|
+
resp = qn.admin.bulk_update_endpoint_status(ids: ["ep-1", "ep-2"], status: "paused")
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
##### `bulk_add_tag` / `bulkAddTag`
|
|
877
|
+
|
|
878
|
+
Applies a tag (created if missing) to many endpoints at once.
|
|
879
|
+
|
|
880
|
+
**Parameters**: `ids` (string[], required), `label` (string, required).
|
|
881
|
+
|
|
882
|
+
**Returns**: `BulkAddTagResponse`.
|
|
883
|
+
|
|
884
|
+
```ruby
|
|
885
|
+
# Ruby
|
|
886
|
+
resp = qn.admin.bulk_add_tag(ids: ["ep-1", "ep-2"], label: "prod")
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
##### `bulk_remove_tag` / `bulkRemoveTag`
|
|
890
|
+
|
|
891
|
+
Removes a tag from many endpoints at once.
|
|
892
|
+
|
|
893
|
+
**Parameters**: `ids` (string[], required), `tag_id` (i32, required).
|
|
894
|
+
|
|
895
|
+
**Returns**: `BulkRemoveTagResponse`.
|
|
896
|
+
|
|
897
|
+
```ruby
|
|
898
|
+
# Ruby
|
|
899
|
+
resp = qn.admin.bulk_remove_tag(ids: ["ep-1", "ep-2"], tag_id: 42)
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
#### Account Tags
|
|
903
|
+
|
|
904
|
+
##### `list_tags` / `listTags`
|
|
905
|
+
|
|
906
|
+
Lists every tag on the account along with usage counts.
|
|
907
|
+
|
|
908
|
+
**Parameters**: none.
|
|
909
|
+
|
|
910
|
+
**Returns**: `ListTagsResponse` with `data.tags: AccountTag[]`.
|
|
911
|
+
|
|
912
|
+
```ruby
|
|
913
|
+
# Ruby
|
|
914
|
+
resp = qn.admin.list_tags
|
|
915
|
+
```
|
|
916
|
+
|
|
917
|
+
##### `rename_tag` / `renameTag`
|
|
918
|
+
|
|
919
|
+
Renames an account-level tag.
|
|
920
|
+
|
|
921
|
+
**Parameters**: `tag_id` (i32, required); body: `label` (string, required).
|
|
922
|
+
|
|
923
|
+
**Returns**: `RenameTagResponse` with updated `AccountTag`.
|
|
924
|
+
|
|
925
|
+
```ruby
|
|
926
|
+
# Ruby
|
|
927
|
+
resp = qn.admin.rename_tag(tag_id: 42, label: "staging")
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
##### `delete_account_tag` / `deleteAccountTag`
|
|
931
|
+
|
|
932
|
+
Deletes a tag from the account. The tag must first be removed from any endpoints using it.
|
|
933
|
+
|
|
934
|
+
**Parameters**: `id` (i32, required).
|
|
935
|
+
|
|
936
|
+
**Returns**: `DeleteAccountTagResponse`.
|
|
937
|
+
|
|
938
|
+
```ruby
|
|
939
|
+
# Ruby
|
|
940
|
+
qn.admin.delete_account_tag(id: 42)
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
---
|
|
944
|
+
|
|
945
|
+
### Streams Client
|
|
946
|
+
|
|
947
|
+
Accessed as `qn.streams`. Creates and manages blockchain data streams that deliver filtered on-chain events to configured destinations. Backed by `https://api.quicknode.com/streams/rest/v1/`.
|
|
948
|
+
|
|
949
|
+
#### Datasets, Regions, and Destinations
|
|
950
|
+
|
|
951
|
+
Enums used across stream methods:
|
|
952
|
+
|
|
953
|
+
- **`StreamRegion`**: `UsaEast`, `EuropeCentral`, `AsiaEast` (wire values: `usa_east`, `europe_central`, `asia_east`).
|
|
954
|
+
- **`StreamDataset`**: `Block`, `BlockWithReceipts`, `Transactions`, `Logs`, `Receipts`, `TraceBlocks`, `DebugTraces`, `BlockWithReceiptsDebugTrace`, `BlockWithReceiptsTraceBlock`, `BlobSidecars`, `ProgramsWithLogs`, `Ledger`, `Events`, `Orders`, `Trades`, `BookUpdates`, `Twap`, `WriterActions`.
|
|
955
|
+
- **`StreamStatus`**: `Active`, `Paused`, `Terminated`, `Completed`, `Blocked`.
|
|
956
|
+
- **`FilterLanguage`**: `Javascript`, `Go`, `Wasm`.
|
|
957
|
+
- **`StreamMetadataLocation`**: `Body`, `Header`, `None`.
|
|
958
|
+
|
|
959
|
+
Destinations are expressed via `DestinationAttributes`. Each variant wraps an attribute struct:
|
|
960
|
+
|
|
961
|
+
| Variant | Struct | Key fields |
|
|
962
|
+
|---|---|---|
|
|
963
|
+
| `Webhook` | `WebhookAttributes` | `url`, `max_retry`, `retry_interval_sec`, `post_timeout_sec`, `compression`, `security_token?` |
|
|
964
|
+
| `S3` | `S3Attributes` | `endpoint`, `access_key`, `secret_key`, `bucket`, `object_prefix`, `compression`, `file_type`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
|
|
965
|
+
| `Azure` | `AzureAttributes` | `storage_account`, `sas_token`, `container`, `compression`, `file_type`, `max_retry`, `retry_interval_sec`, `blob_prefix?` |
|
|
966
|
+
| `Postgres` | `PostgresAttributes` | `host`, `port`, `username`, `password`, `database`, `schema`, `table`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
|
|
967
|
+
| `Mysql` | `MysqlAttributes` | `host`, `port`, `username`, `password`, `database`, `table`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
|
|
968
|
+
| `Mongo` | `MongoAttributes` | `connection_string`, `database`, `collection`, `max_retry`, `retry_interval_sec` |
|
|
969
|
+
| `Clickhouse` | `ClickhouseAttributes` | `host`, `port`, `username`, `password`, `database`, `table`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
|
|
970
|
+
| `Snowflake` | `SnowflakeAttributes` | `account`, `warehouse`, `database`, `schema`, `table`, `username`, `private_key`, `max_retry`, `retry_interval_sec` |
|
|
971
|
+
| `Kafka` | `KafkaAttributes` | `bootstrap_servers`, `topic`, `compression`, `max_retry`, `retry_interval_sec` |
|
|
972
|
+
| `Redis` | `RedisAttributes` | `host`, `port`, `username`, `password`, `key`, `max_retry`, `retry_interval_sec`, `use_ssl?` |
|
|
973
|
+
|
|
974
|
+
Wrapper naming per language:
|
|
975
|
+
|
|
976
|
+
- **Rust**: `DestinationAttributes::Webhook(WebhookAttributes { .. })` etc.
|
|
977
|
+
- **Python**: `StreamWebhookDestination(WebhookAttributes(...))`, `StreamS3Destination(S3Attributes(...))`, etc.
|
|
978
|
+
- **Node.js**: a discriminated object `{ destination: "webhook", attributes: { ... } }` using string discriminators.
|
|
979
|
+
- **Ruby**: factory methods on `QuicknodeSdk::DestinationAttributes`, e.g. `QuicknodeSdk::DestinationAttributes.webhook(url: ..., ...)`.
|
|
980
|
+
|
|
981
|
+
#### Streams methods
|
|
982
|
+
|
|
983
|
+
##### `create_stream` / `createStream`
|
|
984
|
+
|
|
985
|
+
Creates a new stream that delivers filtered data to the configured destination. Start from a specific block for backfills or from the tip for real-time streaming. Supports filters, reorg handling, distance-from-tip, elastic batching, notification emails, and extra destinations.
|
|
986
|
+
|
|
987
|
+
**Parameters**: `CreateStreamParams` — required: `name`, `region`, `network`, `dataset`, `start_range` (i64), `end_range` (i64, `-1` = follow tip), `destination_attributes`, `plan`, `threshold_fetch_buffer`. Common optional fields: `dataset_batch_size`, `include_stream_metadata`, `fix_block_reorgs`, `keep_distance_from_tip`, `elastic_batch_enabled`, `filter_function`, `filter_language`, `status`, `notification_email`, `extra_destinations`.
|
|
988
|
+
|
|
989
|
+
**Returns**: `Stream`.
|
|
990
|
+
|
|
991
|
+
```ruby
|
|
992
|
+
# Ruby
|
|
993
|
+
dest = QuicknodeSdk::DestinationAttributes.webhook(
|
|
994
|
+
url: "https://webhook.site/...",
|
|
995
|
+
max_retry: 3,
|
|
996
|
+
retry_interval_sec: 1,
|
|
997
|
+
post_timeout_sec: 10,
|
|
998
|
+
compression: "none"
|
|
999
|
+
)
|
|
1000
|
+
stream = qn.streams.create_stream(
|
|
1001
|
+
name: "My Stream",
|
|
1002
|
+
network: "ethereum-mainnet",
|
|
1003
|
+
dataset: "block",
|
|
1004
|
+
region: "usa_east",
|
|
1005
|
+
start_range: 24691804,
|
|
1006
|
+
end_range: 24691904,
|
|
1007
|
+
destination_attributes: dest,
|
|
1008
|
+
plan: "growth_plan",
|
|
1009
|
+
threshold_fetch_buffer: 1000,
|
|
1010
|
+
status: "active"
|
|
1011
|
+
)
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
##### `list_streams` / `listStreams`
|
|
1015
|
+
|
|
1016
|
+
Paginated list of streams on the account.
|
|
1017
|
+
|
|
1018
|
+
**Parameters** (all optional): `offset` (i64), `limit` (i64), `order_by` (string), `order_direction` (`"asc"` | `"desc"`), `stream_type` (string).
|
|
1019
|
+
|
|
1020
|
+
**Returns**: `ListStreamsResponse` with `data: Stream[]` and `page_info`.
|
|
1021
|
+
|
|
1022
|
+
```ruby
|
|
1023
|
+
# Ruby
|
|
1024
|
+
resp = qn.streams.list_streams({})
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
##### `get_stream` / `getStream`
|
|
1028
|
+
|
|
1029
|
+
Fetches one stream by id.
|
|
1030
|
+
|
|
1031
|
+
**Parameters**: `id` (string, required).
|
|
1032
|
+
|
|
1033
|
+
**Returns**: `Stream`.
|
|
1034
|
+
|
|
1035
|
+
```ruby
|
|
1036
|
+
# Ruby
|
|
1037
|
+
stream = qn.streams.get_stream(id: "stream-id")
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
##### `update_stream` / `updateStream`
|
|
1041
|
+
|
|
1042
|
+
Partially updates a stream. Omitted fields are left unchanged.
|
|
1043
|
+
|
|
1044
|
+
**Parameters**: `id` (string, required); body: any field from `CreateStreamParams` (all optional).
|
|
1045
|
+
|
|
1046
|
+
**Returns**: updated `Stream`.
|
|
1047
|
+
|
|
1048
|
+
```ruby
|
|
1049
|
+
# Ruby
|
|
1050
|
+
stream = qn.streams.update_stream(id: "stream-id", name: "Renamed")
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
##### `delete_stream` / `deleteStream`
|
|
1054
|
+
|
|
1055
|
+
Deletes one stream by id.
|
|
1056
|
+
|
|
1057
|
+
**Parameters**: `id` (string, required).
|
|
1058
|
+
|
|
1059
|
+
**Returns**: nothing.
|
|
1060
|
+
|
|
1061
|
+
```ruby
|
|
1062
|
+
# Ruby
|
|
1063
|
+
qn.streams.delete_stream(id: "stream-id")
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
##### `delete_all_streams` / `deleteAllStreams`
|
|
1067
|
+
|
|
1068
|
+
Deletes every stream on the account. Destructive and takes no arguments.
|
|
1069
|
+
|
|
1070
|
+
**Parameters**: none.
|
|
1071
|
+
|
|
1072
|
+
**Returns**: nothing.
|
|
1073
|
+
|
|
1074
|
+
```ruby
|
|
1075
|
+
# Ruby
|
|
1076
|
+
qn.streams.delete_all_streams
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
##### `activate_stream` / `activateStream`
|
|
1080
|
+
|
|
1081
|
+
Resumes delivery on a stream from its current position.
|
|
1082
|
+
|
|
1083
|
+
**Parameters**: `id` (string, required).
|
|
1084
|
+
|
|
1085
|
+
**Returns**: nothing.
|
|
1086
|
+
|
|
1087
|
+
```ruby
|
|
1088
|
+
# Ruby
|
|
1089
|
+
qn.streams.activate_stream(id: "stream-id")
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
##### `pause_stream` / `pauseStream`
|
|
1093
|
+
|
|
1094
|
+
Halts delivery on a stream.
|
|
1095
|
+
|
|
1096
|
+
**Parameters**: `id` (string, required).
|
|
1097
|
+
|
|
1098
|
+
**Returns**: nothing.
|
|
1099
|
+
|
|
1100
|
+
```ruby
|
|
1101
|
+
# Ruby
|
|
1102
|
+
qn.streams.pause_stream(id: "stream-id")
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
##### `test_filter` / `testFilter`
|
|
1106
|
+
|
|
1107
|
+
Runs a filter function against a block so it can be validated before being attached to a live stream.
|
|
1108
|
+
|
|
1109
|
+
**Parameters**: `network` (string, required), `dataset` (`StreamDataset`, required), `block` (string, required), `filter_function` (string, optional), `filter_language` (`FilterLanguage`, optional), `address_book_config` (optional).
|
|
1110
|
+
|
|
1111
|
+
**Returns**: `TestFilterResponse` with `result` and `logs`.
|
|
1112
|
+
|
|
1113
|
+
```ruby
|
|
1114
|
+
# Ruby
|
|
1115
|
+
resp = qn.streams.test_filter(
|
|
1116
|
+
network: "ethereum-mainnet",
|
|
1117
|
+
dataset: "block",
|
|
1118
|
+
block: "17811625"
|
|
1119
|
+
)
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
##### `get_enabled_count` / `getEnabledCount`
|
|
1123
|
+
|
|
1124
|
+
Counts currently enabled (active) streams, optionally filtered by type.
|
|
1125
|
+
|
|
1126
|
+
**Parameters**: `stream_type` (string, optional).
|
|
1127
|
+
|
|
1128
|
+
**Returns**: `EnabledCountResponse` with `total`.
|
|
1129
|
+
|
|
1130
|
+
```ruby
|
|
1131
|
+
# Ruby
|
|
1132
|
+
resp = qn.streams.get_enabled_count({})
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
---
|
|
1136
|
+
|
|
1137
|
+
### Webhooks Client
|
|
1138
|
+
|
|
1139
|
+
Accessed as `qn.webhooks`. Creates webhooks from filter templates and manages their lifecycle. Backed by `https://api.quicknode.com/webhooks/rest/v1/`.
|
|
1140
|
+
|
|
1141
|
+
#### Templates and destination
|
|
1142
|
+
|
|
1143
|
+
`WebhookTemplateId` identifies the filter template:
|
|
1144
|
+
|
|
1145
|
+
| Variant | Wire value |
|
|
1146
|
+
|---|---|
|
|
1147
|
+
| `EvmWalletFilter` | `evmWalletFilter` |
|
|
1148
|
+
| `EvmContractEvents` | `evmContractEvents` |
|
|
1149
|
+
| `EvmAbiFilter` | `evmAbiFilter` |
|
|
1150
|
+
| `SolanaWalletFilter` | `solanaWalletFilter` |
|
|
1151
|
+
| `BitcoinWalletFilter` | `bitcoinWalletFilter` |
|
|
1152
|
+
| `XrplWalletFilter` | `xrplWalletFilter` |
|
|
1153
|
+
| `HyperliquidWalletEventsFilter` | `hyperliquidWalletEventsFilter` |
|
|
1154
|
+
| `StellarWalletTransactionsSourceAccountFilter` | `stellarWalletTransactionsSourceAccountFilter` |
|
|
1155
|
+
|
|
1156
|
+
`TemplateArgs` carries the arguments; construct one per template via the factory methods:
|
|
1157
|
+
|
|
1158
|
+
| Factory | Argument struct | Fields |
|
|
1159
|
+
|---|---|---|
|
|
1160
|
+
| `evm_wallet_filter` | `EvmWalletFilterTemplate` | `wallets: string[]` |
|
|
1161
|
+
| `evm_contract_events` | `EvmContractEventsTemplate` | `contracts: string[]`, `event_hashes?: string[]` |
|
|
1162
|
+
| `evm_abi_filter` | `EvmAbiFilterTemplate` | `abi: string` (JSON), `contracts: string[]` |
|
|
1163
|
+
| `solana_wallet_filter` | `SolanaWalletFilterTemplate` | `accounts: string[]` |
|
|
1164
|
+
| `bitcoin_wallet_filter` | `BitcoinWalletFilterTemplate` | `wallets: string[]` |
|
|
1165
|
+
| `xrpl_wallet_filter` | `XrplWalletFilterTemplate` | `wallets: string[]` |
|
|
1166
|
+
| `hyperliquid_wallet_events_filter` | `HyperliquidWalletEventsFilterTemplate` | `wallets: string[]` |
|
|
1167
|
+
| `stellar_wallet_transactions_filter` | `StellarWalletTransactionsFilterTemplate` | `source_accounts: string[]` |
|
|
1168
|
+
|
|
1169
|
+
`WebhookDestinationAttributes`: `url` (required), `security_token` (optional — auto-generated if omitted), `compression` (optional — `"none"` | `"gzip"`).
|
|
1170
|
+
|
|
1171
|
+
`WebhookStartFrom`: `Last` (resume from last delivered block) or `Latest` (start from newest).
|
|
1172
|
+
|
|
1173
|
+
In Ruby, `template_args` is passed as a JSON string under the key `template_args_json`; destination is passed as a JSON string under `destination_attributes_json`.
|
|
1174
|
+
|
|
1175
|
+
#### Webhooks methods
|
|
1176
|
+
|
|
1177
|
+
##### `list_webhooks` / `listWebhooks`
|
|
1178
|
+
|
|
1179
|
+
Paginated list of webhooks.
|
|
1180
|
+
|
|
1181
|
+
**Parameters** (all optional): `limit` (i64), `offset` (i64).
|
|
1182
|
+
|
|
1183
|
+
**Returns**: `ListWebhooksResponse` with `data: Webhook[]` and `pageInfo: WebhookPageInfo { limit, offset, total }`.
|
|
1184
|
+
|
|
1185
|
+
```ruby
|
|
1186
|
+
# Ruby
|
|
1187
|
+
resp = qn.webhooks.list_webhooks({})
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
##### `get_webhook` / `getWebhook`
|
|
1191
|
+
|
|
1192
|
+
Fetches a webhook by id.
|
|
1193
|
+
|
|
1194
|
+
**Parameters**: `id` (string, required).
|
|
1195
|
+
|
|
1196
|
+
**Returns**: `Webhook`.
|
|
1197
|
+
|
|
1198
|
+
```ruby
|
|
1199
|
+
# Ruby
|
|
1200
|
+
webhook = qn.webhooks.get_webhook(id: "wh-1")
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
##### `create_webhook_from_template` / `createWebhookFromTemplate`
|
|
1204
|
+
|
|
1205
|
+
Creates a webhook from a predefined filter template.
|
|
1206
|
+
|
|
1207
|
+
**Parameters**: `name` (required), `network` (required), `destination_attributes` (`WebhookDestinationAttributes`, required), `template_args` (required — use the `TemplateArgs` enum variant for the chosen template), `notification_email` (optional).
|
|
1208
|
+
|
|
1209
|
+
**Returns**: `Webhook`.
|
|
1210
|
+
|
|
1211
|
+
```ruby
|
|
1212
|
+
# Ruby
|
|
1213
|
+
destination_attributes = JSON.generate({
|
|
1214
|
+
url: "https://webhook.site/...",
|
|
1215
|
+
compression: "none"
|
|
1216
|
+
})
|
|
1217
|
+
template_args = JSON.generate({
|
|
1218
|
+
templateId: "evmWalletFilter",
|
|
1219
|
+
templateArgs: { wallets: ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"] }
|
|
1220
|
+
})
|
|
1221
|
+
webhook = qn.webhooks.create_webhook_from_template(
|
|
1222
|
+
name: "Wallet Webhook",
|
|
1223
|
+
network: "ethereum-mainnet",
|
|
1224
|
+
destination_attributes_json: destination_attributes,
|
|
1225
|
+
template_args_json: template_args
|
|
1226
|
+
)
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
##### `update_webhook` / `updateWebhook`
|
|
1230
|
+
|
|
1231
|
+
Partially updates a webhook's name, notification email, and/or destination. If `destination_attributes` is supplied without `security_token`, a new token is generated automatically.
|
|
1232
|
+
|
|
1233
|
+
**Parameters**: `id` (required); body — all optional: `name`, `notification_email`, `destination_attributes`. In Ruby, `destination_attributes` is passed as a JSON string under the key `destination_attributes_json`.
|
|
1234
|
+
|
|
1235
|
+
**Returns**: updated `Webhook`.
|
|
1236
|
+
|
|
1237
|
+
```ruby
|
|
1238
|
+
# Ruby
|
|
1239
|
+
webhook = qn.webhooks.update_webhook(id: "wh-1", name: "Renamed Webhook")
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1242
|
+
##### `update_webhook_template` / `updateWebhookTemplate`
|
|
1243
|
+
|
|
1244
|
+
Updates the template args (and optionally name, email, destination) on an existing template-backed webhook.
|
|
1245
|
+
|
|
1246
|
+
**Parameters**: `webhook_id` (required), `template_args` (required); optional: `name`, `notification_email`, `destination_attributes`.
|
|
1247
|
+
|
|
1248
|
+
**Returns**: updated `Webhook`.
|
|
1249
|
+
|
|
1250
|
+
```ruby
|
|
1251
|
+
# Ruby
|
|
1252
|
+
template_args = JSON.generate({
|
|
1253
|
+
templateId: "evmWalletFilter",
|
|
1254
|
+
templateArgs: { wallets: ["0xnewwallet"] }
|
|
1255
|
+
})
|
|
1256
|
+
webhook = qn.webhooks.update_webhook_template(
|
|
1257
|
+
webhook_id: "wh-1",
|
|
1258
|
+
template_args_json: template_args
|
|
1259
|
+
)
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
##### `delete_webhook` / `deleteWebhook`
|
|
1263
|
+
|
|
1264
|
+
Deletes a webhook.
|
|
1265
|
+
|
|
1266
|
+
**Parameters**: `id` (required).
|
|
1267
|
+
|
|
1268
|
+
**Returns**: nothing.
|
|
1269
|
+
|
|
1270
|
+
```ruby
|
|
1271
|
+
# Ruby
|
|
1272
|
+
qn.webhooks.delete_webhook(id: "wh-1")
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
##### `delete_all_webhooks` / `deleteAllWebhooks`
|
|
1276
|
+
|
|
1277
|
+
Deletes every webhook on the account. Destructive and takes no arguments.
|
|
1278
|
+
|
|
1279
|
+
**Parameters**: none.
|
|
1280
|
+
|
|
1281
|
+
**Returns**: nothing.
|
|
1282
|
+
|
|
1283
|
+
```ruby
|
|
1284
|
+
# Ruby
|
|
1285
|
+
qn.webhooks.delete_all_webhooks
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1288
|
+
##### `pause_webhook` / `pauseWebhook`
|
|
1289
|
+
|
|
1290
|
+
Pauses a webhook so it stops delivering events.
|
|
1291
|
+
|
|
1292
|
+
**Parameters**: `id` (required).
|
|
1293
|
+
|
|
1294
|
+
**Returns**: nothing.
|
|
1295
|
+
|
|
1296
|
+
```ruby
|
|
1297
|
+
# Ruby
|
|
1298
|
+
qn.webhooks.pause_webhook(id: "wh-1")
|
|
1299
|
+
```
|
|
1300
|
+
|
|
1301
|
+
##### `activate_webhook` / `activateWebhook`
|
|
1302
|
+
|
|
1303
|
+
Activates a paused or new webhook so it resumes delivering events. `start_from` determines where processing resumes.
|
|
1304
|
+
|
|
1305
|
+
**Parameters**: `id` (required), `start_from` (`WebhookStartFrom`, required — `Last` or `Latest`).
|
|
1306
|
+
|
|
1307
|
+
**Returns**: nothing.
|
|
1308
|
+
|
|
1309
|
+
```ruby
|
|
1310
|
+
# Ruby
|
|
1311
|
+
qn.webhooks.activate_webhook(id: "wh-1", start_from: "latest")
|
|
1312
|
+
```
|
|
1313
|
+
|
|
1314
|
+
##### `get_enabled_count` / `getEnabledCount`
|
|
1315
|
+
|
|
1316
|
+
Counts currently enabled webhooks.
|
|
1317
|
+
|
|
1318
|
+
**Parameters**: none.
|
|
1319
|
+
|
|
1320
|
+
**Returns**: `WebhookEnabledCountResponse` with `total`.
|
|
1321
|
+
|
|
1322
|
+
```ruby
|
|
1323
|
+
# Ruby
|
|
1324
|
+
resp = qn.webhooks.get_enabled_count
|
|
1325
|
+
```
|
|
1326
|
+
|
|
1327
|
+
---
|
|
1328
|
+
|
|
1329
|
+
### KV Store Client
|
|
1330
|
+
|
|
1331
|
+
Accessed as `qn.kvstore`. Provides two primitives — **sets** (single string values under a key) and **lists** (ordered collections of strings under a key). Backed by `https://api.quicknode.com/kv/rest/v1/`.
|
|
1332
|
+
|
|
1333
|
+
#### Sets
|
|
1334
|
+
|
|
1335
|
+
##### `create_set` / `createSet`
|
|
1336
|
+
|
|
1337
|
+
Stores a single string value under a key.
|
|
1338
|
+
|
|
1339
|
+
**Parameters**: `key` (string, required), `value` (string, required).
|
|
1340
|
+
|
|
1341
|
+
**Returns**: nothing.
|
|
1342
|
+
|
|
1343
|
+
```ruby
|
|
1344
|
+
# Ruby
|
|
1345
|
+
qn.kvstore.create_set(key: "my-key", value: "hello")
|
|
1346
|
+
```
|
|
1347
|
+
|
|
1348
|
+
##### `get_sets` / `getSets`
|
|
1349
|
+
|
|
1350
|
+
Paginated page of key/value entries.
|
|
1351
|
+
|
|
1352
|
+
**Parameters** (all optional): `limit` (i64), `cursor` (string).
|
|
1353
|
+
|
|
1354
|
+
**Returns**: `GetSetsResponse` — `{ data: KvSetEntry[], cursor: string }`.
|
|
1355
|
+
|
|
1356
|
+
```ruby
|
|
1357
|
+
# Ruby
|
|
1358
|
+
resp = qn.kvstore.get_sets({})
|
|
1359
|
+
```
|
|
1360
|
+
|
|
1361
|
+
##### `get_set` / `getSet`
|
|
1362
|
+
|
|
1363
|
+
Returns the value stored under a key.
|
|
1364
|
+
|
|
1365
|
+
**Parameters**: `key` (string, required).
|
|
1366
|
+
|
|
1367
|
+
**Returns**: `GetSetResponse` with `value`.
|
|
1368
|
+
|
|
1369
|
+
```ruby
|
|
1370
|
+
# Ruby
|
|
1371
|
+
resp = qn.kvstore.get_set(key: "my-key")
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
##### `bulk_sets` / `bulkSets`
|
|
1375
|
+
|
|
1376
|
+
Adds and/or deletes multiple sets in a single request.
|
|
1377
|
+
|
|
1378
|
+
**Parameters** (at least one required): `add_sets` (map<string,string>, optional), `delete_sets` (string[], optional).
|
|
1379
|
+
|
|
1380
|
+
**Returns**: nothing.
|
|
1381
|
+
|
|
1382
|
+
```ruby
|
|
1383
|
+
# Ruby
|
|
1384
|
+
qn.kvstore.bulk_sets(add_sets: { "k1" => "v1" }, delete_sets: ["old-key"])
|
|
1385
|
+
```
|
|
1386
|
+
|
|
1387
|
+
##### `delete_set` / `deleteSet`
|
|
1388
|
+
|
|
1389
|
+
Deletes a single set.
|
|
1390
|
+
|
|
1391
|
+
**Parameters**: `key` (string, required).
|
|
1392
|
+
|
|
1393
|
+
**Returns**: nothing.
|
|
1394
|
+
|
|
1395
|
+
```ruby
|
|
1396
|
+
# Ruby
|
|
1397
|
+
qn.kvstore.delete_set(key: "my-key")
|
|
1398
|
+
```
|
|
1399
|
+
|
|
1400
|
+
#### Lists
|
|
1401
|
+
|
|
1402
|
+
##### `create_list` / `createList`
|
|
1403
|
+
|
|
1404
|
+
Creates a list under a key, seeded with the initial items.
|
|
1405
|
+
|
|
1406
|
+
**Parameters**: `key` (string, required), `items` (string[], required).
|
|
1407
|
+
|
|
1408
|
+
**Returns**: nothing.
|
|
1409
|
+
|
|
1410
|
+
```ruby
|
|
1411
|
+
# Ruby
|
|
1412
|
+
qn.kvstore.create_list(key: "my-list", items: ["0xabc", "0xdef"])
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
##### `get_lists` / `getLists`
|
|
1416
|
+
|
|
1417
|
+
Paginated page of list keys.
|
|
1418
|
+
|
|
1419
|
+
**Parameters** (all optional): `limit` (i64), `cursor` (string).
|
|
1420
|
+
|
|
1421
|
+
**Returns**: `GetListsResponse` — `{ data: { keys: string[] }, cursor: string }`.
|
|
1422
|
+
|
|
1423
|
+
```ruby
|
|
1424
|
+
# Ruby
|
|
1425
|
+
resp = qn.kvstore.get_lists({})
|
|
1426
|
+
```
|
|
1427
|
+
|
|
1428
|
+
##### `get_list` / `getList`
|
|
1429
|
+
|
|
1430
|
+
Paginated page of items for a specific list.
|
|
1431
|
+
|
|
1432
|
+
**Parameters**: `key` (string, required); optional `limit` (i64), `cursor` (string).
|
|
1433
|
+
|
|
1434
|
+
**Returns**: `GetListResponse` — `{ data: { items: string[] }, cursor: string }`.
|
|
1435
|
+
|
|
1436
|
+
```ruby
|
|
1437
|
+
# Ruby
|
|
1438
|
+
resp = qn.kvstore.get_list(key: "my-list")
|
|
1439
|
+
```
|
|
1440
|
+
|
|
1441
|
+
##### `update_list` / `updateList`
|
|
1442
|
+
|
|
1443
|
+
Adds and/or removes items in a single operation.
|
|
1444
|
+
|
|
1445
|
+
**Parameters**: `key` (string, required); optional: `add_items` (string[]), `remove_items` (string[]).
|
|
1446
|
+
|
|
1447
|
+
**Returns**: nothing.
|
|
1448
|
+
|
|
1449
|
+
```ruby
|
|
1450
|
+
# Ruby
|
|
1451
|
+
qn.kvstore.update_list(key: "my-list", add_items: ["0x456"], remove_items: ["0xabc"])
|
|
1452
|
+
```
|
|
1453
|
+
|
|
1454
|
+
##### `add_list_item` / `addListItem`
|
|
1455
|
+
|
|
1456
|
+
Appends a single item to a list.
|
|
1457
|
+
|
|
1458
|
+
**Parameters**: `key` (string, required), `item` (string, required).
|
|
1459
|
+
|
|
1460
|
+
**Returns**: nothing.
|
|
1461
|
+
|
|
1462
|
+
```ruby
|
|
1463
|
+
# Ruby
|
|
1464
|
+
qn.kvstore.add_list_item(key: "my-list", item: "0x123")
|
|
1465
|
+
```
|
|
1466
|
+
|
|
1467
|
+
##### `list_contains_item` / `listContainsItem`
|
|
1468
|
+
|
|
1469
|
+
Checks whether a list contains a specific item.
|
|
1470
|
+
|
|
1471
|
+
**Parameters**: `key` (string, required), `item` (string, required).
|
|
1472
|
+
|
|
1473
|
+
**Returns**: `ListContainsItemResponse` with `exists: bool`.
|
|
1474
|
+
|
|
1475
|
+
```ruby
|
|
1476
|
+
# Ruby
|
|
1477
|
+
resp = qn.kvstore.list_contains_item(key: "my-list", item: "0x123")
|
|
1478
|
+
```
|
|
1479
|
+
|
|
1480
|
+
##### `delete_list_item` / `deleteListItem`
|
|
1481
|
+
|
|
1482
|
+
Removes a single item from a list.
|
|
1483
|
+
|
|
1484
|
+
**Parameters**: `key` (string, required), `item` (string, required).
|
|
1485
|
+
|
|
1486
|
+
**Returns**: nothing.
|
|
1487
|
+
|
|
1488
|
+
```ruby
|
|
1489
|
+
# Ruby
|
|
1490
|
+
qn.kvstore.delete_list_item(key: "my-list", item: "0x123")
|
|
1491
|
+
```
|
|
1492
|
+
|
|
1493
|
+
##### `delete_list` / `deleteList`
|
|
1494
|
+
|
|
1495
|
+
Deletes a list and all of its items.
|
|
1496
|
+
|
|
1497
|
+
**Parameters**: `key` (string, required).
|
|
1498
|
+
|
|
1499
|
+
**Returns**: nothing.
|
|
1500
|
+
|
|
1501
|
+
```ruby
|
|
1502
|
+
# Ruby
|
|
1503
|
+
qn.kvstore.delete_list(key: "my-list")
|
|
1504
|
+
```
|
|
1505
|
+
|
|
1506
|
+
## Error Handling
|
|
1507
|
+
|
|
1508
|
+
Every binding exposes a typed exception hierarchy derived from the core `SdkError`
|
|
1509
|
+
enum (`crates/core/src/errors.rs`). Catch the base class (`QuicknodeSdk::Error`) for any SDK-originated failure, or a specific
|
|
1510
|
+
subclass to branch on transport vs. API semantics.
|
|
1511
|
+
|
|
1512
|
+
| Logical class | When it fires | Extra fields |
|
|
1513
|
+
|----------------------|-------------------------------------------------------------|----------------------|
|
|
1514
|
+
| `QuicknodeError` | base class; catches everything below | — |
|
|
1515
|
+
| `ConfigError` | invalid config or URL surfaced at construction time | — |
|
|
1516
|
+
| `HttpError` | transport failure that isn't a timeout/connect | — |
|
|
1517
|
+
| `TimeoutError` | request timed out (subclass of `HttpError`) | — |
|
|
1518
|
+
| `ConnectionError` | connection refused / DNS / TLS (subclass of `HttpError`) | — |
|
|
1519
|
+
| `ApiError` | non-2xx HTTP response | `status`, `body` |
|
|
1520
|
+
| `DecodeError` | 2xx response but JSON parse failed | `body` |
|
|
1521
|
+
|
|
1522
|
+
Class names: `QuicknodeSdk::Error`, `QuicknodeSdk::ConfigError`, `QuicknodeSdk::HttpError`, `QuicknodeSdk::TimeoutError`, `QuicknodeSdk::ConnectionError`, `QuicknodeSdk::ApiError`, `QuicknodeSdk::DecodeError`. All extend `StandardError`. Hash-key validation still raises `ArgumentError`.
|
|
1523
|
+
|
|
1524
|
+
```ruby
|
|
1525
|
+
# Ruby
|
|
1526
|
+
begin
|
|
1527
|
+
qn.admin.show_endpoint(id: "missing")
|
|
1528
|
+
rescue QuicknodeSdk::ApiError => e
|
|
1529
|
+
warn "api #{e.status}: #{e.body}" if e.status == 404
|
|
1530
|
+
rescue QuicknodeSdk::TimeoutError
|
|
1531
|
+
warn "timed out"
|
|
1532
|
+
end
|
|
1533
|
+
```
|
|
1534
|
+
|
|
1535
|
+
## License
|
|
1536
|
+
|
|
1537
|
+
MIT
|