quicknode_sdk 0.1.0.pre.alpha.30 → 0.1.0

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.
@@ -1,4 +0,0 @@
1
- module QuicknodeSdk
2
- class Admin < NativeDelegator
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module QuicknodeSdk
2
- class KvStore < NativeDelegator
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module QuicknodeSdk
2
- class Streams < NativeDelegator
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module QuicknodeSdk
2
- class Webhooks < NativeDelegator
3
- end
4
- end
@@ -1,43 +0,0 @@
1
- module QuicknodeSdk
2
- # Shared base class for the user-facing client wrappers (Admin, Streams,
3
- # Webhooks, KvStore). Each Magnus-bound native client is held in @native and
4
- # all method calls are forwarded through method_missing.
5
- #
6
- # The native side exposes two kinds of methods: arity-0 (e.g. list_chains)
7
- # and arity-1 taking a single positional Hash of options (e.g.
8
- # get_endpoints). To support all three Ruby call styles documented in the
9
- # README and examples — bare (qn.admin.get_endpoints), kwargs
10
- # (qn.admin.get_endpoints(limit: 5)), and positional hash
11
- # (qn.streams.list_streams({})) — we coerce whatever the caller passed into
12
- # a single options hash, then dispatch on the native arity. Arity-0 methods
13
- # reject any argument (Magnus enforces this), so we must call them with no
14
- # args; arity-1 methods always need a Hash passed POSITIONALLY (Magnus's
15
- # RHash is a positional arg, and Ruby 3 treats `**{}` as zero arguments —
16
- # so we must not splat the options).
17
- class NativeDelegator
18
- def initialize(native)
19
- @native = native
20
- end
21
-
22
- def method_missing(name, *args, **kwargs)
23
- return super unless @native.respond_to?(name)
24
- opts = if !kwargs.empty?
25
- kwargs
26
- elsif args.length == 1 && args[0].is_a?(Hash)
27
- args[0]
28
- else
29
- {}
30
- end
31
- result = if @native.method(name).arity == 0
32
- @native.public_send(name)
33
- else
34
- @native.public_send(name, opts)
35
- end
36
- QuicknodeSdk.wrap(result)
37
- end
38
-
39
- def respond_to_missing?(name, include_private = false)
40
- @native.respond_to?(name, include_private) || super
41
- end
42
- end
43
- end
@@ -1,38 +0,0 @@
1
- module QuicknodeSdk
2
- class SDK
3
- def self.from_env
4
- new(Native::SDK.from_env)
5
- end
6
-
7
- # Build an SDK from an explicit config hash. Supports custom headers,
8
- # timeouts, and base URLs without relying on env vars.
9
- #
10
- # QuicknodeSdk::SDK.from_config(
11
- # api_key: "...",
12
- # http: { headers: { "X-Correlation-Id" => "abc" } }
13
- # )
14
- def self.from_config(opts)
15
- new(Native::SDK.from_config(opts))
16
- end
17
-
18
- def initialize(native)
19
- @native = native
20
- end
21
-
22
- def admin
23
- Admin.new(@native.admin)
24
- end
25
-
26
- def streams
27
- Streams.new(@native.streams)
28
- end
29
-
30
- def webhooks
31
- Webhooks.new(@native.webhooks)
32
- end
33
-
34
- def kvstore
35
- KvStore.new(@native.kvstore)
36
- end
37
- end
38
- end
@@ -1,16 +0,0 @@
1
- require "hashie"
2
-
3
- module QuicknodeSdk
4
- class IndifferentHash < Hash
5
- include Hashie::Extensions::MergeInitializer
6
- include Hashie::Extensions::IndifferentAccess
7
- end
8
-
9
- def self.wrap(v)
10
- case v
11
- when Hash then IndifferentHash.new(v).tap { |h| h.each { |k, val| h[k] = wrap(val) } }
12
- when Array then v.map { |x| wrap(x) }
13
- else v
14
- end
15
- end
16
- end
@@ -1,161 +0,0 @@
1
- module QuicknodeSdk
2
- def self.wrap: (untyped v) -> untyped
3
-
4
- class Error < StandardError
5
- end
6
-
7
- class ConfigError < Error
8
- end
9
-
10
- class HttpError < Error
11
- end
12
-
13
- class TimeoutError < HttpError
14
- end
15
-
16
- class ConnectionError < HttpError
17
- end
18
-
19
- class ApiError < Error
20
- attr_reader status: Integer
21
- attr_reader body: String
22
- end
23
-
24
- class DecodeError < Error
25
- attr_reader body: String
26
- end
27
-
28
- class SDK
29
- def self.from_env: () -> SDK
30
- def self.from_config: (Hash[Symbol | String, untyped] opts) -> SDK
31
- def initialize: (untyped native) -> void
32
- def admin: () -> Admin
33
- def streams: () -> Streams
34
- def webhooks: () -> Webhooks
35
- def kvstore: () -> KvStore
36
- end
37
-
38
- class DestinationAttributes
39
- def self.webhook: (url: String, ?max_retry: Integer, ?retry_interval_sec: Integer, ?post_timeout_sec: Integer, ?security_token: String, ?compression: String) -> DestinationAttributes
40
- def self.s3: (endpoint: String, access_key: String, secret_key: String, bucket: String, object_prefix: String, compression: String, file_type: String, ?max_retry: Integer, ?retry_interval_sec: Integer, ?use_ssl: bool) -> DestinationAttributes
41
- def self.azure: (storage_account: String, sas_token: String, container: String, compression: String, file_type: String, ?max_retry: Integer, ?retry_interval_sec: Integer, ?blob_prefix: String) -> DestinationAttributes
42
- def self.postgres: (host: String, ?port: Integer, database: String, username: String, password: String, table_name: String, sslmode: String, ?max_retry: Integer, ?retry_interval_sec: Integer) -> DestinationAttributes
43
- def self.kafka: (bootstrap_servers: String, topic_name: String, compression_type: String, ?batch_size: Integer, ?linger_ms: Integer, ?max_message_bytes: Integer, ?timeout_sec: Integer, ?max_retry: Integer, ?retry_interval_sec: Integer, ?username: String, ?password: String, ?protocol: String, ?mechanisms: String) -> DestinationAttributes
44
- end
45
-
46
- class Admin
47
- def initialize: (untyped native) -> void
48
-
49
- def get_endpoints: (?limit: Integer, ?offset: Integer, ?search: String, ?sort_by: String, ?sort_direction: String, ?networks: Array[String], ?statuses: Array[String], ?labels: Array[String], ?dedicated: bool, ?is_flat_rate: bool, ?tag_ids: Array[Integer], ?tag_labels: Array[String]) -> untyped
50
- def create_endpoint: (?chain: String, ?network: String) -> untyped
51
- def show_endpoint: (id: String) -> untyped
52
- def update_endpoint: (id: String, ?label: String) -> void
53
- def archive_endpoint: (id: String) -> void
54
- def update_endpoint_status: (id: String, status: String) -> untyped
55
- def create_tag: (id: String, ?label: String) -> void
56
- def delete_tag: (id: String, tag_id: String) -> void
57
- def get_usage: (?start_time: Integer, ?end_time: Integer) -> untyped
58
- def get_usage_by_endpoint: (?start_time: Integer, ?end_time: Integer) -> untyped
59
- def get_usage_by_method: (?start_time: Integer, ?end_time: Integer) -> untyped
60
- def get_usage_by_chain: (?start_time: Integer, ?end_time: Integer) -> untyped
61
- def get_endpoint_logs: (id: String, from_time: String, to_time: String, ?include_details: bool, ?limit: Integer, ?next_at: String) -> untyped
62
- def get_log_details: (id: String, request_id: String) -> untyped
63
- def get_security_options: (id: String) -> untyped
64
- def update_security_options: (id: String, ?tokens: String, ?referrers: String, ?jwts: String, ?ips: String, ?domain_masks: String, ?hsts: String, ?cors: String, ?request_filters: String, ?ip_custom_header: String) -> untyped
65
- def create_token: (id: String) -> void
66
- def delete_token: (id: String, token_id: String) -> untyped
67
- def create_referrer: (id: String, ?referrer: String) -> void
68
- def delete_referrer: (id: String, referrer_id: String) -> untyped
69
- def create_ip: (id: String, ?ip: String) -> void
70
- def delete_ip: (id: String, ip_id: String) -> untyped
71
- def create_domain_mask: (id: String, ?domain_mask: String) -> void
72
- def delete_domain_mask: (id: String, domain_mask_id: String) -> untyped
73
- def create_jwt: (id: String, ?public_key: String, ?kid: String, ?name: String) -> void
74
- def delete_jwt: (id: String, jwt_id: String) -> void
75
- def create_request_filter: (id: String, ?methods: Array[String]) -> untyped
76
- def update_request_filter: (id: String, request_filter_id: String, ?methods: Array[String]) -> void
77
- def delete_request_filter: (id: String, request_filter_id: String) -> void
78
- def enable_multichain: (id: String) -> void
79
- def disable_multichain: (id: String) -> void
80
- def create_or_update_ip_custom_header: (id: String, header_name: String) -> untyped
81
- def delete_ip_custom_header: (id: String) -> untyped
82
- def get_method_rate_limits: (id: String) -> untyped
83
- def create_method_rate_limit: (id: String, interval: String, methods: Array[String], rate: Integer) -> untyped
84
- def update_method_rate_limit: (id: String, method_rate_limit_id: String, ?methods: Array[String], ?status: String, ?rate: Integer) -> untyped
85
- def delete_method_rate_limit: (id: String, method_rate_limit_id: String) -> void
86
- def update_rate_limits: (id: String, ?rps: Integer, ?rpm: Integer, ?rpd: Integer) -> void
87
- def get_rate_limits: (id: String) -> untyped
88
- def delete_rate_limit_override: (id: String, override_id: String) -> void
89
- def get_endpoint_urls: (id: String) -> untyped
90
- def get_endpoint_metrics: (id: String, period: String, metric: String) -> untyped
91
- def get_account_metrics: (period: String, metric: String, ?percentile: String) -> untyped
92
- def list_chains: () -> untyped
93
- def list_invoices: () -> untyped
94
- def list_payments: () -> untyped
95
- def list_teams: () -> untyped
96
- def create_team: (name: String) -> untyped
97
- def get_team: (id: Integer) -> untyped
98
- def delete_team: (id: Integer) -> untyped
99
- def list_team_endpoints: (id: Integer) -> untyped
100
- def update_team_endpoints: (id: Integer, endpoint_ids: Array[String]) -> untyped
101
- def invite_team_member: (id: Integer, email: String, ?full_name: String, ?role: String) -> untyped
102
- def remove_team_member: (id: Integer, user_id: Integer, ?destroy_user: bool) -> untyped
103
- def resend_team_invite: (id: Integer, user_id: Integer) -> untyped
104
- def bulk_update_endpoint_status: (ids: Array[String], status: String) -> untyped
105
- def bulk_add_tag: (ids: Array[String], label: String) -> untyped
106
- def bulk_remove_tag: (ids: Array[String], tag_id: Integer) -> untyped
107
- def list_tags: () -> untyped
108
- def rename_tag: (id: Integer, label: String) -> untyped
109
- def delete_account_tag: (id: Integer) -> untyped
110
- def get_usage_by_tag: (?start_time: Integer, ?end_time: Integer) -> untyped
111
- def get_endpoint_security: (id: String) -> untyped
112
- end
113
-
114
- class Streams
115
- def initialize: (untyped native) -> void
116
-
117
- def create_stream: (name: String, network: String, dataset: String, region: String, start_range: Integer, end_range: Integer, destination_attributes: DestinationAttributes, dataset_batch_size: Integer, elastic_batch_enabled: bool, ?plan: String, ?threshold_fetch_buffer: Integer, ?max_batch_size: Integer, ?max_buffer_range_size: Integer, ?max_buffer_processing_workers: Integer, ?keep_distance_from_tip: Integer, ?filter_function: String, ?filter_language: String, ?include_stream_metadata: String, ?product_type: String, ?status: String, ?notification_email: String, ?charge_min_cap: Integer, ?fix_block_reorgs: Integer, ?extra_destinations: Array[DestinationAttributes]) -> untyped
118
- def list_streams: (?stream_type: String, ?offset: Integer, ?limit: Integer, ?order_by: String, ?order_direction: String) -> untyped
119
- def delete_all_streams: () -> void
120
- def get_stream: (id: String) -> untyped
121
- def update_stream: (id: String, ?name: String, ?network: String, ?dataset: String, ?region: String, ?start_range: Integer, ?end_range: Integer, ?destination_attributes: DestinationAttributes, ?plan: String, ?threshold_fetch_buffer: Integer, ?dataset_batch_size: Integer, ?max_batch_size: Integer, ?max_buffer_range_size: Integer, ?max_buffer_processing_workers: Integer, ?keep_distance_from_tip: Integer, ?filter_function: String, ?filter_language: String, ?include_stream_metadata: String, ?notification_email: String, ?charge_min_cap: Integer, ?fix_block_reorgs: Integer, ?elastic_batch_enabled: bool, ?status: String, ?memo: String, ?extra_destinations: Array[DestinationAttributes]) -> untyped
122
- def delete_stream: (id: String) -> void
123
- def activate_stream: (id: String) -> void
124
- def pause_stream: (id: String) -> void
125
- def test_filter: (network: String, dataset: String, block: String, filter_function: String, ?filter_language: String) -> untyped
126
- def get_enabled_count: (?stream_type: String) -> untyped
127
- end
128
-
129
- class Webhooks
130
- def initialize: (untyped native) -> void
131
-
132
- def list_webhooks: (?limit: Integer, ?offset: Integer) -> untyped
133
- def delete_all_webhooks: () -> void
134
- def get_webhook: (id: String) -> untyped
135
- def update_webhook: (id: String, ?name: String, ?notification_email: String, ?destination_attributes_json: String) -> untyped
136
- def delete_webhook: (id: String) -> void
137
- def pause_webhook: (id: String) -> void
138
- def activate_webhook: (id: String, start_from: String) -> void
139
- def get_enabled_count: () -> untyped
140
- def create_webhook_from_template: (name: String, network: String, destination_attributes_json: String, template_args_json: String, ?notification_email: String) -> untyped
141
- def update_webhook_template: (webhook_id: String, template_args_json: String, ?name: String, ?notification_email: String) -> untyped
142
- end
143
-
144
- class KvStore
145
- def initialize: (untyped native) -> void
146
-
147
- def create_set: (key: String, value: String) -> void
148
- def get_sets: (?limit: Integer, ?cursor: String) -> untyped
149
- def get_set: (key: String) -> untyped
150
- def bulk_sets: (?add_sets: Hash[String, String], ?delete_sets: Array[String]) -> void
151
- def delete_set: (key: String) -> void
152
- def create_list: (key: String, items: Array[String]) -> void
153
- def get_lists: (?limit: Integer, ?cursor: String) -> untyped
154
- def get_list: (key: String, ?limit: Integer, ?cursor: String) -> untyped
155
- def update_list: (key: String, ?add_items: Array[String], ?remove_items: Array[String]) -> void
156
- def add_list_item: (key: String, item: String) -> void
157
- def list_contains_item: (key: String, item: String) -> untyped
158
- def delete_list_item: (key: String, item: String) -> void
159
- def delete_list: (key: String) -> void
160
- end
161
- end