quicknode_sdk 0.1.0.pre.alpha.26 → 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,27 +0,0 @@
1
- module QuicknodeSdk
2
- class SDK
3
- def self.from_env
4
- new(Native::SDK.from_env)
5
- end
6
-
7
- def initialize(native)
8
- @native = native
9
- end
10
-
11
- def admin
12
- Admin.new(@native.admin)
13
- end
14
-
15
- def streams
16
- Streams.new(@native.streams)
17
- end
18
-
19
- def webhooks
20
- Webhooks.new(@native.webhooks)
21
- end
22
-
23
- def kvstore
24
- KvStore.new(@native.kvstore)
25
- end
26
- end
27
- 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,160 +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 initialize: (untyped native) -> void
31
- def admin: () -> Admin
32
- def streams: () -> Streams
33
- def webhooks: () -> Webhooks
34
- def kvstore: () -> KvStore
35
- end
36
-
37
- class DestinationAttributes
38
- def self.webhook: (url: String, ?max_retry: Integer, ?retry_interval_sec: Integer, ?post_timeout_sec: Integer, ?security_token: String, ?compression: String) -> DestinationAttributes
39
- 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
40
- 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
41
- 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
42
- 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
43
- end
44
-
45
- class Admin
46
- def initialize: (untyped native) -> void
47
-
48
- 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
49
- def create_endpoint: (?chain: String, ?network: String) -> untyped
50
- def show_endpoint: (id: String) -> untyped
51
- def update_endpoint: (id: String, ?label: String) -> void
52
- def archive_endpoint: (id: String) -> void
53
- def update_endpoint_status: (id: String, status: String) -> untyped
54
- def create_tag: (id: String, ?label: String) -> void
55
- def delete_tag: (id: String, tag_id: String) -> void
56
- def get_usage: (?start_time: Integer, ?end_time: Integer) -> untyped
57
- def get_usage_by_endpoint: (?start_time: Integer, ?end_time: Integer) -> untyped
58
- def get_usage_by_method: (?start_time: Integer, ?end_time: Integer) -> untyped
59
- def get_usage_by_chain: (?start_time: Integer, ?end_time: Integer) -> untyped
60
- def get_endpoint_logs: (id: String, from_time: String, to_time: String, ?include_details: bool, ?limit: Integer, ?next_at: String) -> untyped
61
- def get_log_details: (id: String, request_id: String) -> untyped
62
- def get_security_options: (id: String) -> untyped
63
- 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
64
- def create_token: (id: String) -> void
65
- def delete_token: (id: String, token_id: String) -> untyped
66
- def create_referrer: (id: String, ?referrer: String) -> void
67
- def delete_referrer: (id: String, referrer_id: String) -> untyped
68
- def create_ip: (id: String, ?ip: String) -> void
69
- def delete_ip: (id: String, ip_id: String) -> untyped
70
- def create_domain_mask: (id: String, ?domain_mask: String) -> void
71
- def delete_domain_mask: (id: String, domain_mask_id: String) -> untyped
72
- def create_jwt: (id: String, ?public_key: String, ?kid: String, ?name: String) -> void
73
- def delete_jwt: (id: String, jwt_id: String) -> void
74
- def create_request_filter: (id: String, ?methods: Array[String]) -> untyped
75
- def update_request_filter: (id: String, request_filter_id: String, ?methods: Array[String]) -> void
76
- def delete_request_filter: (id: String, request_filter_id: String) -> void
77
- def enable_multichain: (id: String) -> void
78
- def disable_multichain: (id: String) -> void
79
- def create_or_update_ip_custom_header: (id: String, header_name: String) -> untyped
80
- def delete_ip_custom_header: (id: String) -> untyped
81
- def get_method_rate_limits: (id: String) -> untyped
82
- def create_method_rate_limit: (id: String, interval: String, methods: Array[String], rate: Integer) -> untyped
83
- def update_method_rate_limit: (id: String, method_rate_limit_id: String, ?methods: Array[String], ?status: String, ?rate: Integer) -> untyped
84
- def delete_method_rate_limit: (id: String, method_rate_limit_id: String) -> void
85
- def update_rate_limits: (id: String, ?rps: Integer, ?rpm: Integer, ?rpd: Integer) -> void
86
- def get_rate_limits: (id: String) -> untyped
87
- def delete_rate_limit_override: (id: String, override_id: String) -> void
88
- def get_endpoint_urls: (id: String) -> untyped
89
- def get_endpoint_metrics: (id: String, period: String, metric: String) -> untyped
90
- def get_account_metrics: (period: String, metric: String, ?percentile: String) -> untyped
91
- def list_chains: () -> untyped
92
- def list_invoices: () -> untyped
93
- def list_payments: () -> untyped
94
- def list_teams: () -> untyped
95
- def create_team: (name: String) -> untyped
96
- def get_team: (id: Integer) -> untyped
97
- def delete_team: (id: Integer) -> untyped
98
- def list_team_endpoints: (id: Integer) -> untyped
99
- def update_team_endpoints: (id: Integer, endpoint_ids: Array[String]) -> untyped
100
- def invite_team_member: (id: Integer, email: String, ?full_name: String, ?role: String) -> untyped
101
- def remove_team_member: (id: Integer, user_id: Integer, ?destroy_user: bool) -> untyped
102
- def resend_team_invite: (id: Integer, user_id: Integer) -> untyped
103
- def bulk_update_endpoint_status: (ids: Array[String], status: String) -> untyped
104
- def bulk_add_tag: (ids: Array[String], label: String) -> untyped
105
- def bulk_remove_tag: (ids: Array[String], tag_id: Integer) -> untyped
106
- def list_tags: () -> untyped
107
- def rename_tag: (id: Integer, label: String) -> untyped
108
- def delete_account_tag: (id: Integer) -> untyped
109
- def get_usage_by_tag: (?start_time: Integer, ?end_time: Integer) -> untyped
110
- def get_endpoint_security: (id: String) -> untyped
111
- end
112
-
113
- class Streams
114
- def initialize: (untyped native) -> void
115
-
116
- 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
117
- def list_streams: (?stream_type: String, ?offset: Integer, ?limit: Integer, ?order_by: String, ?order_direction: String) -> untyped
118
- def delete_all_streams: () -> void
119
- def get_stream: (id: String) -> untyped
120
- 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
121
- def delete_stream: (id: String) -> void
122
- def activate_stream: (id: String) -> void
123
- def pause_stream: (id: String) -> void
124
- def test_filter: (network: String, dataset: String, block: String, filter_function: String, ?filter_language: String) -> untyped
125
- def get_enabled_count: (?stream_type: String) -> untyped
126
- end
127
-
128
- class Webhooks
129
- def initialize: (untyped native) -> void
130
-
131
- def list_webhooks: (?limit: Integer, ?offset: Integer) -> untyped
132
- def delete_all_webhooks: () -> void
133
- def get_webhook: (id: String) -> untyped
134
- def update_webhook: (id: String, ?name: String, ?notification_email: String, ?destination_attributes_json: String) -> untyped
135
- def delete_webhook: (id: String) -> void
136
- def pause_webhook: (id: String) -> void
137
- def activate_webhook: (id: String, start_from: String) -> void
138
- def get_enabled_count: () -> untyped
139
- def create_webhook_from_template: (name: String, network: String, destination_attributes_json: String, template_args_json: String, ?notification_email: String) -> untyped
140
- def update_webhook_template: (webhook_id: String, template_args_json: String, ?name: String, ?notification_email: String) -> untyped
141
- end
142
-
143
- class KvStore
144
- def initialize: (untyped native) -> void
145
-
146
- def create_set: (key: String, value: String) -> void
147
- def get_sets: (?limit: Integer, ?cursor: String) -> untyped
148
- def get_set: (key: String) -> untyped
149
- def bulk_sets: (?add_sets: Hash[String, String], ?delete_sets: Array[String]) -> void
150
- def delete_set: (key: String) -> void
151
- def create_list: (key: String, items: Array[String]) -> void
152
- def get_lists: (?limit: Integer, ?cursor: String) -> untyped
153
- def get_list: (key: String, ?limit: Integer, ?cursor: String) -> untyped
154
- def update_list: (key: String, ?add_items: Array[String], ?remove_items: Array[String]) -> void
155
- def add_list_item: (key: String, item: String) -> void
156
- def list_contains_item: (key: String, item: String) -> untyped
157
- def delete_list_item: (key: String, item: String) -> void
158
- def delete_list: (key: String) -> void
159
- end
160
- end