Class: Privy::Resources::Intents
- Inherits:
-
Object
- Object
- Privy::Resources::Intents
- Defined in:
- lib/privy/resources/intents.rb
Instance Method Summary collapse
-
#create_policy_rule(policy_id, action:, conditions:, method_:, name:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RuleIntentResponse
Some parameter documentations has been truncated, see Models::IntentCreatePolicyRuleParams for more details.
-
#delete_policy_rule(rule_id, policy_id:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RuleIntentResponse
Some parameter documentations has been truncated, see Models::IntentDeletePolicyRuleParams for more details.
-
#get(intent_id, request_options: {}) ⇒ Privy::Models::RpcIntentResponse, ...
Retrieve an intent by ID.
-
#initialize(client:) ⇒ Intents
constructor
private
A new instance of Intents.
-
#list(created_by_id: nil, current_user_has_signed: nil, cursor: nil, intent_type: nil, limit: nil, pending_member_id: nil, resource_id: nil, sort_by: nil, status: nil, request_options: {}) ⇒ Privy::Internal::Cursor<Privy::Models::RpcIntentResponse, Privy::Models::TransferIntentResponse, Privy::Models::WalletIntentResponse, Privy::Models::PolicyIntentResponse, Privy::Models::RuleIntentResponse, Privy::Models::KeyQuorumIntentResponse>
List intents for an app.
-
#rpc(wallet_id, wallet_rpc_request_body:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RpcIntentResponse
Some parameter documentations has been truncated, see Models::IntentRpcParams for more details.
-
#transfer(wallet_id, destination:, source:, amount_type: nil, fee_configuration: nil, slippage_bps: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::TransferIntentResponse
Some parameter documentations has been truncated, see Models::IntentTransferParams for more details.
-
#update_key_quorum(key_quorum_id, authorization_threshold: nil, display_name: nil, key_quorum_ids: nil, public_keys: nil, user_ids: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::KeyQuorumIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdateKeyQuorumParams for more details.
-
#update_policy(policy_id, name: nil, owner: nil, owner_id: nil, rules: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::PolicyIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdatePolicyParams for more details.
-
#update_policy_rule(rule_id, policy_id:, action:, conditions:, method_:, name:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RuleIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdatePolicyRuleParams for more details.
-
#update_wallet(wallet_id, additional_signers: nil, display_name: nil, owner: nil, owner_id: nil, policy_ids: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::WalletIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdateWalletParams for more details.
Constructor Details
#initialize(client:) ⇒ Intents
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Intents.
376 377 378 |
# File 'lib/privy/resources/intents.rb', line 376 def initialize(client:) @client = client end |
Instance Method Details
#create_policy_rule(policy_id, action:, conditions:, method_:, name:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RuleIntentResponse
Some parameter documentations has been truncated, see Models::IntentCreatePolicyRuleParams for more details.
Create an intent to add a rule to a policy. The intent must be authorized by the policy owner before it can be executed.
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/privy/resources/intents.rb', line 72 def create_policy_rule(policy_id, params) parsed, = Privy::IntentCreatePolicyRuleParams.dump_request(params) header_params = {privy_request_expiry: "privy-request-expiry"} @client.request( method: :post, path: ["v1/intents/policies/%1$s/rules", policy_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::RuleIntentResponse, options: ) end |
#delete_policy_rule(rule_id, policy_id:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RuleIntentResponse
Some parameter documentations has been truncated, see Models::IntentDeletePolicyRuleParams for more details.
Create an intent to delete a rule from a policy. The intent must be authorized by the policy owner before it can be executed.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/privy/resources/intents.rb', line 104 def delete_policy_rule(rule_id, params) parsed, = Privy::IntentDeletePolicyRuleParams.dump_request(params) policy_id = parsed.delete(:policy_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["v1/intents/policies/%1$s/rules/%2$s", policy_id, rule_id], headers: parsed.transform_keys(privy_request_expiry: "privy-request-expiry"), model: Privy::RuleIntentResponse, options: ) end |
#get(intent_id, request_options: {}) ⇒ Privy::Models::RpcIntentResponse, ...
Retrieve an intent by ID. Returns the intent details including its current status, authorization details, and execution result if applicable.
131 132 133 134 135 136 137 138 |
# File 'lib/privy/resources/intents.rb', line 131 def get(intent_id, params = {}) @client.request( method: :get, path: ["v1/intents/%1$s", intent_id], model: Privy::IntentResponse, options: params[:request_options] ) end |
#list(created_by_id: nil, current_user_has_signed: nil, cursor: nil, intent_type: nil, limit: nil, pending_member_id: nil, resource_id: nil, sort_by: nil, status: nil, request_options: {}) ⇒ Privy::Internal::Cursor<Privy::Models::RpcIntentResponse, Privy::Models::TransferIntentResponse, Privy::Models::WalletIntentResponse, Privy::Models::PolicyIntentResponse, Privy::Models::RuleIntentResponse, Privy::Models::KeyQuorumIntentResponse>
List intents for an app. Returns a paginated list of intents with their current status and details.
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/privy/resources/intents.rb', line 34 def list(params = {}) parsed, = Privy::IntentListParams.dump_request(params) query = Privy::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/intents", query: query, page: Privy::Internal::Cursor, model: Privy::IntentResponse, options: ) end |
#rpc(wallet_id, wallet_rpc_request_body:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RpcIntentResponse
Some parameter documentations has been truncated, see Models::IntentRpcParams for more details.
Create an intent to execute an RPC method on a wallet. The intent must be authorized by either the wallet owner or signers before it can be executed.
159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/privy/resources/intents.rb', line 159 def rpc(wallet_id, params) parsed, = Privy::IntentRpcParams.dump_request(params) @client.request( method: :post, path: ["v1/intents/wallets/%1$s/rpc", wallet_id], headers: parsed.except(:wallet_rpc_request_body).transform_keys(privy_request_expiry: "privy-request-expiry"), body: parsed[:wallet_rpc_request_body], model: Privy::RpcIntentResponse, options: ) end |
#transfer(wallet_id, destination:, source:, amount_type: nil, fee_configuration: nil, slippage_bps: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::TransferIntentResponse
Some parameter documentations has been truncated, see Models::IntentTransferParams for more details.
Create an intent to execute a token transfer via a wallet. The intent must be authorized by either the wallet owner or signers before it can be executed.
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/privy/resources/intents.rb', line 198 def transfer(wallet_id, params) parsed, = Privy::IntentTransferParams.dump_request(params) header_params = {privy_request_expiry: "privy-request-expiry"} @client.request( method: :post, path: ["v1/intents/wallets/%1$s/transfer", wallet_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::TransferIntentResponse, options: ) end |
#update_key_quorum(key_quorum_id, authorization_threshold: nil, display_name: nil, key_quorum_ids: nil, public_keys: nil, user_ids: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::KeyQuorumIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdateKeyQuorumParams for more details.
Create an intent to update a key quorum. The intent must be authorized by the key quorum members before it can be executed.
238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/privy/resources/intents.rb', line 238 def update_key_quorum(key_quorum_id, params = {}) parsed, = Privy::IntentUpdateKeyQuorumParams.dump_request(params) header_params = {privy_request_expiry: "privy-request-expiry"} @client.request( method: :patch, path: ["v1/intents/key_quorums/%1$s", key_quorum_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::KeyQuorumIntentResponse, options: ) end |
#update_policy(policy_id, name: nil, owner: nil, owner_id: nil, rules: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::PolicyIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdatePolicyParams for more details.
Create an intent to update a policy. The intent must be authorized by the policy owner before it can be executed.
276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/privy/resources/intents.rb', line 276 def update_policy(policy_id, params = {}) parsed, = Privy::IntentUpdatePolicyParams.dump_request(params) header_params = {privy_request_expiry: "privy-request-expiry"} @client.request( method: :patch, path: ["v1/intents/policies/%1$s", policy_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::PolicyIntentResponse, options: ) end |
#update_policy_rule(rule_id, policy_id:, action:, conditions:, method_:, name:, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::RuleIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdatePolicyRuleParams for more details.
Create an intent to update a rule on a policy. The intent must be authorized by the policy owner before it can be executed.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/privy/resources/intents.rb', line 316 def update_policy_rule(rule_id, params) parsed, = Privy::IntentUpdatePolicyRuleParams.dump_request(params) policy_id = parsed.delete(:policy_id) do raise ArgumentError.new("missing required path argument #{_1}") end header_params = {privy_request_expiry: "privy-request-expiry"} @client.request( method: :patch, path: ["v1/intents/policies/%1$s/rules/%2$s", policy_id, rule_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::RuleIntentResponse, options: ) end |
#update_wallet(wallet_id, additional_signers: nil, display_name: nil, owner: nil, owner_id: nil, policy_ids: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::WalletIntentResponse
Some parameter documentations has been truncated, see Models::IntentUpdateWalletParams for more details.
Create an intent to update a wallet. The intent must be authorized by the wallet owner before it can be executed.
360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/privy/resources/intents.rb', line 360 def update_wallet(wallet_id, params = {}) parsed, = Privy::IntentUpdateWalletParams.dump_request(params) header_params = {privy_request_expiry: "privy-request-expiry"} @client.request( method: :patch, path: ["v1/intents/wallets/%1$s", wallet_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Privy::WalletIntentResponse, options: ) end |