bzapper 0.15.2 → 0.16.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 697a35b6c63dfce682d817591acce81e85db056e0c6df02a6516f58937e658b6
4
- data.tar.gz: 200eeea0422240ad4576b18f849240210ef5393177f98e93bb1dbf5d28697f58
3
+ metadata.gz: 9ec33a77a74e1314917359ecb2a1041545b9319a863083f1d7e73c1cf9b33f1e
4
+ data.tar.gz: b65d4ab29da069ad591659c219b98b904ce58189a31574e2519c4eab6b9295bb
5
5
  SHA512:
6
- metadata.gz: b72e5ac34cba530268ff666fb4d3628b6fef1c66bce331b1b379c467866d4029ed1bd24c6cc36f0c43c2b384887b8d0e53cadccd3ec9b2000caab220bc8519a7
7
- data.tar.gz: dd99f005da6f3a7ce1a0331becb3a1f6516e61110aa0ec5c7ea515b919e67ad60cc0cde2770027716e719338fe1d5468bee35a240639e1523b6d9230735d8636
6
+ metadata.gz: 819fad38e9ff7c821ee302e5132f63ceeb57d0e1ab128bce1d1188a3053cbc3e0f1dfaa47e73ff959512c3ed2ef1158cae543a54aae05825b0e906574f605dcc
7
+ data.tar.gz: 832faba9e6d432dc0fac3815c0b02762d513caa09d1b0cbc282b6a75f35a5a234f7703a5a8f29b4ecf36c2f0ee980e913bcd8a0a514cd2dfc49d96d044579efc
data/README.md CHANGED
@@ -10,13 +10,13 @@ Zero dependências de runtime (só biblioteca padrão: `net/http`, `json`, `open
10
10
  ## Instalação
11
11
 
12
12
  ```bash
13
- gem install bzapper -v 0.15.2
13
+ gem install bzapper -v 0.16.0
14
14
  ```
15
15
 
16
16
  Ou no `Gemfile` — **fixe a versão exata** (cada release declara se muda a superfície pública):
17
17
 
18
18
  ```ruby
19
- gem "bzapper", "0.15.2"
19
+ gem "bzapper", "0.16.0"
20
20
  ```
21
21
 
22
22
  ## Hello world
@@ -83,7 +83,7 @@ spec OpenAPI em snake_case (`sendText` → `send_text`):
83
83
  | --- | --- |
84
84
  | `client.messages` | `send_text`, `send_image`, `send_video`, `send_document`, `send_audio`, `send_sticker`, `send_location`, `send_contact`, `send_poll`, `send_reaction`, `send_buttons`, `send_list`, `send_otp`, `send_template` (trilho oficial), `mark_read`, `presence_chat` |
85
85
  | `client.scheduling` | `list_scheduled`, `cancel_scheduled` |
86
- | `client.instances` | números: `list_instances`, `create_instance`, `connect_instance` (QR/código), `get_instance`, `disconnect_instance`, `logout_instance`, `clear_instance_session`, `archive_instance`, proxy, filtros de entrada… |
86
+ | `client.instances` | números: `list_instances`, `create_instance`, `connect_instance` (QR/código), `get_instance`, `get_instance_uptime` (disponibilidade em 24h/7d/30d), `disconnect_instance`, `logout_instance`, `clear_instance_session`, `archive_instance`, proxy, filtros de entrada… |
87
87
  | `client.official` | trilho oficial (WhatsApp Cloud API): `get_official_account`, `connect_official_account`, `disconnect_official_account`, `get_official_status`, Embedded Signup (`get_official_signup_config`, `complete_official_signup`), números da WABA (`list_official_numbers`, `list_available_official_numbers`, `add_official_number`, `set_default_official_number`, `disconnect_official_number`), perfil comercial (`get/update_official_profile`, `upload_official_profile_photo`, `reregister_official_profile` e as variantes `*_official_number_profile*` por número) |
88
88
  | `client.templates` | templates aprovados pela Meta: `list_templates`, `create_template`, `get_template`, `delete_template`, `sync_templates`, `upload_template_media`, `get/set_fallback_template` |
89
89
  | `client.groups` | `list_groups`, `create_group`, `get_group`, `update_group`, `update_group_participants`, `group_invite_link`, `join_group`, `preview_group_invite`, `leave_group`, pedidos de entrada |
@@ -97,6 +97,7 @@ spec OpenAPI em snake_case (`sendText` → `send_text`):
97
97
  | `client.usage` / `client.billing` | consumo; plano, assinatura, add-ons, faturas, preços |
98
98
  | `client.accounts` | perfil, chaves de API (`rotate_my_key`), marca, projetos, usuários |
99
99
  | `client.connect` | apps parceiros conectados à sua conta |
100
+ | `client.ai` | apps de IA (conector MCP) com acesso à conta: `list_ai_connections`, `revoke_ai_connection` |
100
101
  | `client.system` | `get_health` |
101
102
 
102
103
  Convenções (iguais em todos os métodos):
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ # GERADO por script/generate.rb a partir de packages/sdk/openapi.yaml — não edite à mão.
4
+
5
+ module Bzapper
6
+ module Resources
7
+ # Conector de IA (MCP): apps de IA autorizados a operar a conta e revogação do acesso — `client.ai`.
8
+ class Ai < Base
9
+ # AI apps connected to this account (MCP connector). `GET /ai-connections`
10
+ #
11
+ # Active connections of the AI connector. An admin sees every connection of the account; an
12
+ # agent sees only their own. An API key without a person behind it sees them only if it is an
13
+ # admin key.
14
+ #
15
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
16
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
17
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
18
+ def list_ai_connections(timeout: nil)
19
+ request("GET", "/ai-connections", timeout: timeout)
20
+ end
21
+
22
+ # Revoke an AI app's access. Its tokens stop working on the next call. `DELETE
23
+ # /ai-connections/{id}`
24
+ #
25
+ # An admin can revoke any connection of the account; an agent, only their own.
26
+ #
27
+ # @param id [String] Connection ID.
28
+ # @param idempotency_key [String, nil] chave de idempotência (senão a SDK gera uma).
29
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
30
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
31
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
32
+ # @raise [ArgumentError] parâmetro de caminho vazio, "." ou "..".
33
+ def revoke_ai_connection(id, idempotency_key: nil, timeout: nil)
34
+ request("DELETE",
35
+ "/ai-connections/#{segment(id, "id")}",
36
+ idempotency_key: idempotency_key,
37
+ timeout: timeout)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -104,6 +104,24 @@ module Bzapper
104
104
  timeout: timeout)
105
105
  end
106
106
 
107
+ # Number availability — share of time connected in 24h, 7d and 30d, and the latest status
108
+ # changes. `GET /instances/{id}/uptime`
109
+ #
110
+ # Every status change of a number is recorded. This returns the share of time it was connected
111
+ # (warming counts as connected) over the last 24 hours, 7 days and 30 days, since when it is in
112
+ # its current status, and the 20 latest transitions. History starts when it began to be
113
+ # recorded: a window that goes back further shrinks to `tracked_since` instead of counting the
114
+ # unrecorded time as offline.
115
+ #
116
+ # @param id [String] Instance ID (UUID).
117
+ # @param timeout [Numeric, nil] segundos por tentativa (padrão: o do cliente).
118
+ # @return [Hash, Array, nil] o JSON da resposta, inteiro (nil em 204).
119
+ # @raise [Bzapper::Error] resposta fora de 2xx ou falha de rede.
120
+ # @raise [ArgumentError] parâmetro de caminho vazio, "." ou "..".
121
+ def get_instance_uptime(id, timeout: nil)
122
+ request("GET", "/instances/#{segment(id, "id")}/uptime", timeout: timeout)
123
+ end
124
+
107
125
  # Connect the instance via QR or pairing code. `POST /instances/{id}/connect`
108
126
  #
109
127
  # @param id [String] Instance ID (UUID).
@@ -19,6 +19,7 @@ require_relative "resources/advisories"
19
19
  require_relative "resources/webhooks"
20
20
  require_relative "resources/pools"
21
21
  require_relative "resources/connect"
22
+ require_relative "resources/ai"
22
23
  require_relative "resources/official"
23
24
  require_relative "resources/templates"
24
25
  require_relative "resources/partner"
@@ -75,6 +76,9 @@ module Bzapper
75
76
  # @return [Resources::Connect] bZapper Connect do lado do CLIENTE: apps parceiros conectados à conta.
76
77
  attr_reader :connect
77
78
 
79
+ # @return [Resources::Ai] Conector de IA (MCP): apps de IA autorizados a operar a conta e revogação do acesso.
80
+ attr_reader :ai
81
+
78
82
  # @return [Resources::Official] Trilho oficial (WhatsApp Cloud API): conta WABA, Embedded Signup, números e perfil comercial.
79
83
  attr_reader :official
80
84
 
@@ -82,7 +86,7 @@ module Bzapper
82
86
  attr_reader :templates
83
87
 
84
88
  # Nomes dos recursos, na ordem da spec.
85
- RESOURCES = %i[accounts contacts usage billing advanced conversations instances groups system messages scheduling campaigns advisories webhooks pools connect official templates].freeze
89
+ RESOURCES = %i[accounts contacts usage billing advanced conversations instances groups system messages scheduling campaigns advisories webhooks pools connect ai official templates].freeze
86
90
 
87
91
  private
88
92
 
@@ -103,6 +107,7 @@ module Bzapper
103
107
  @webhooks = Resources::Webhooks.new(transport)
104
108
  @pools = Resources::Pools.new(transport)
105
109
  @connect = Resources::Connect.new(transport)
110
+ @ai = Resources::Ai.new(transport)
106
111
  @official = Resources::Official.new(transport)
107
112
  @templates = Resources::Templates.new(transport)
108
113
  end
@@ -3,5 +3,5 @@
3
3
  module Bzapper
4
4
  # Versão da gem. O `scripts/release-sdks.sh` do monorepo bumpa a linha abaixo por regex
5
5
  # (ancorada no início da linha) e o `bzapper.gemspec` lê daqui — não mude o formato dela.
6
- VERSION = "0.15.2"
6
+ VERSION = "0.16.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bzapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Berni Software
@@ -26,6 +26,7 @@ files:
26
26
  - lib/bzapper/resources/accounts.rb
27
27
  - lib/bzapper/resources/advanced.rb
28
28
  - lib/bzapper/resources/advisories.rb
29
+ - lib/bzapper/resources/ai.rb
29
30
  - lib/bzapper/resources/base.rb
30
31
  - lib/bzapper/resources/billing.rb
31
32
  - lib/bzapper/resources/campaigns.rb