Module: MixinBot::API::Me
- Included in:
- MixinBot::API
- Defined in:
- lib/mixin_bot/api/me.rb
Overview
API methods for bot profile management.
Provides methods to:
-
Retrieve bot profile information
-
Update bot profile (name, avatar)
-
List friends
-
Access Safe API profile
Instance Method Summary collapse
-
#friends(access_token: nil) ⇒ Array<Hash>
Retrieves the bot’s friend list.
-
#me(access_token: nil) ⇒ Hash
Retrieves the bot’s profile information.
- #relationship(user_id:, action:, access_token: nil) ⇒ Object
-
#safe_me(access_token: nil) ⇒ Hash
(also: #request_user_me)
Retrieves the bot’s Safe API profile.
-
#update_me(**kwargs) ⇒ Hash
Updates the bot’s profile.
- #update_preferences(message_source: nil, conversation_source: nil, currency: nil, threshold: nil, access_token: nil) ⇒ Object (also: #update_preference)
Instance Method Details
#friends(access_token: nil) ⇒ Array<Hash>
Retrieves the bot’s friend list.
Returns an array of users who have interacted with the bot and are in the bot’s contact list.
86 87 88 89 |
# File 'lib/mixin_bot/api/me.rb', line 86 def friends(access_token: nil) path = '/friends' client.get path, access_token: end |
#me(access_token: nil) ⇒ Hash
Retrieves the bot’s profile information.
Returns detailed information about the bot including:
-
user_id
-
full_name
-
avatar_url
-
identity_number
-
phone
-
biography
-
created_at
37 38 39 40 |
# File 'lib/mixin_bot/api/me.rb', line 37 def me(access_token: nil) path = '/me' client.get path, access_token: end |
#relationship(user_id:, action:, access_token: nil) ⇒ Object
125 126 127 128 |
# File 'lib/mixin_bot/api/me.rb', line 125 def relationship(user_id:, action:, access_token: nil) path = '/relationships' client.post path, user_id:, action:, access_token: end |
#safe_me(access_token: nil) ⇒ Hash Also known as: request_user_me
Retrieves the bot’s Safe API profile.
Returns Safe API-specific profile information including:
-
Safe wallet address
-
TIP signing key
-
Safe network status
106 107 108 109 |
# File 'lib/mixin_bot/api/me.rb', line 106 def safe_me(access_token: nil) path = '/safe/me' client.get path, access_token: end |
#update_me(**kwargs) ⇒ Hash
Updates the bot’s profile.
Allows updating:
-
full_name: the bot’s display name
-
avatar_base64: Base64-encoded avatar image (PNG, JPEG, or GIF, size > 1024 bytes)
59 60 61 62 63 64 65 66 67 |
# File 'lib/mixin_bot/api/me.rb', line 59 def update_me(**kwargs) path = '/me' payload = { full_name: kwargs[:full_name], avatar_base64: kwargs[:avatar_base64], access_token: kwargs[:access_token] } client.post path, **payload end |
#update_preferences(message_source: nil, conversation_source: nil, currency: nil, threshold: nil, access_token: nil) ⇒ Object Also known as: update_preference
112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/mixin_bot/api/me.rb', line 112 def update_preferences(message_source: nil, conversation_source: nil, currency: nil, threshold: nil, access_token: nil) path = '/me/preferences' payload = { receive_message_source: , accept_conversation_source: conversation_source, fiat_currency: currency, transfer_notification_threshold: threshold }.compact client.post path, **payload, access_token: end |