apologist 1.1.0 → 1.2.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 +4 -4
- data/.fern/metadata.json +2 -2
- data/.fern/replay.lock +47 -1
- data/lib/Apologist/agent/client.rb +84 -0
- data/lib/Apologist/agent/types/pause_agent_response.rb +11 -0
- data/lib/Apologist/agent/types/resume_agent_response.rb +11 -0
- data/lib/Apologist/channels/client.rb +100 -0
- data/lib/Apologist/channels/types/receive_whats_app_message_request.rb +15 -0
- data/lib/Apologist/channels/types/verify_whats_app_webhook_request.rb +17 -0
- data/lib/Apologist/channels/types/verify_whats_app_webhook_request_hub_mode.rb +13 -0
- data/lib/Apologist/client.rb +11 -1
- data/lib/Apologist/conversations/client.rb +168 -0
- data/lib/Apologist/conversations/types/get_conversation_request.rb +11 -0
- data/lib/Apologist/conversations/types/get_conversation_response.rb +11 -0
- data/lib/Apologist/conversations/types/list_conversations_request.rb +13 -0
- data/lib/Apologist/conversations/types/list_conversations_response.rb +17 -0
- data/lib/Apologist/conversations/types/pause_conversation_request.rb +11 -0
- data/lib/Apologist/conversations/types/pause_conversation_response.rb +11 -0
- data/lib/Apologist/conversations/types/resume_conversation_request.rb +11 -0
- data/lib/Apologist/conversations/types/resume_conversation_response.rb +11 -0
- data/lib/Apologist/types/agent_pause_state.rb +18 -0
- data/lib/Apologist/types/conversation.rb +28 -0
- data/lib/Apologist/version.rb +1 -1
- data/lib/Apologist.rb +17 -0
- data/reference.md +539 -0
- metadata +18 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e27c5f8d43b4ee1b57eb564bd1726321cac37d5c84b811b393d9ce4201286559
|
|
4
|
+
data.tar.gz: 3ae4204096640bfa470269728328f80375ff7ca0c08ffb03915fc6cc2d33bf26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33c6b125c14788c2ce7c25d4b365328a3f83aa1026cb99147356a6ea667baaa698ce57fd9e1452a0a7d89dbf6fc83188b62b69ee83a73b3b269f6da5f559e4b0
|
|
7
|
+
data.tar.gz: fbd9b0198961d5962b6829a9928ffd512cdb6d1cd43242551f2fb96903b51b9ed3c73b8635276e3c62c5ade138f9f30bddb7c7decba0785a09d1ea672e124a01
|
data/.fern/metadata.json
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"moduleName": "Apologist",
|
|
7
7
|
"clientModuleName": "AgentClient"
|
|
8
8
|
},
|
|
9
|
-
"originGitCommit": "
|
|
9
|
+
"originGitCommit": "b939d4f55706b529800e2b0a7cb51582fd764206",
|
|
10
10
|
"originGitCommitIsDirty": false,
|
|
11
11
|
"invokedBy": "ci",
|
|
12
12
|
"ciProvider": "github",
|
|
13
|
-
"sdkVersion": "1.
|
|
13
|
+
"sdkVersion": "1.1.1"
|
|
14
14
|
}
|
data/.fern/replay.lock
CHANGED
|
@@ -18,7 +18,13 @@ generations:
|
|
|
18
18
|
cli_version: unknown
|
|
19
19
|
generator_versions:
|
|
20
20
|
fernapi/fern-ruby-sdk: 1.20.2
|
|
21
|
-
|
|
21
|
+
- commit_sha: 9f892528827622170ef9dbf8ae8bd2af9b36ab49
|
|
22
|
+
tree_hash: a3c01408729d88d2074ea3c27446779728e93dea
|
|
23
|
+
timestamp: 2026-08-16T19:24:40.075Z
|
|
24
|
+
cli_version: unknown
|
|
25
|
+
generator_versions:
|
|
26
|
+
fernapi/fern-ruby-sdk: 1.20.2
|
|
27
|
+
current_generation: 9f892528827622170ef9dbf8ae8bd2af9b36ab49
|
|
22
28
|
patches:
|
|
23
29
|
- id: patch-b2534827
|
|
24
30
|
content_hash: sha256:c0e690c52123f547bfb10b269e15cdf8fc30efc06f659245a89b685ad5f01e00
|
|
@@ -61,3 +67,43 @@ patches:
|
|
|
61
67
|
VERSION = "1.0.4"
|
|
62
68
|
end
|
|
63
69
|
status: unresolved
|
|
70
|
+
- id: patch-a022d6a4
|
|
71
|
+
content_hash: sha256:a326550ec15fed946c79d51281694d85ee01e110945a2c29f06281fbb966d20b
|
|
72
|
+
original_commit: a022d6a443853a5d9891f1d647086085833e4326
|
|
73
|
+
original_message: Release 1.1.0.
|
|
74
|
+
original_author: Jake Carlson <jake@carlsonville.com>
|
|
75
|
+
base_generation: d717b15ab3ca1c43aea27a140756d6525bbae651
|
|
76
|
+
files:
|
|
77
|
+
- lib/Apologist/version.rb
|
|
78
|
+
patch_content: |+
|
|
79
|
+
From a022d6a443853a5d9891f1d647086085833e4326 Mon Sep 17 00:00:00 2001
|
|
80
|
+
From: Jake Carlson <jake@carlsonville.com>
|
|
81
|
+
Date: Sun, 16 Aug 2026 13:28:38 -0500
|
|
82
|
+
Subject: [PATCH] Release 1.1.0.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
lib/Apologist/version.rb | 2 +-
|
|
86
|
+
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
87
|
+
|
|
88
|
+
diff --git a/lib/Apologist/version.rb b/lib/Apologist/version.rb
|
|
89
|
+
index df5e61e..32e15e1 100644
|
|
90
|
+
--- a/lib/Apologist/version.rb
|
|
91
|
+
+++ b/lib/Apologist/version.rb
|
|
92
|
+
@@ -1,5 +1,5 @@
|
|
93
|
+
# frozen_string_literal: true
|
|
94
|
+
|
|
95
|
+
module Apologist
|
|
96
|
+
- VERSION = "1.0.5"
|
|
97
|
+
+ VERSION = "1.1.0"
|
|
98
|
+
end
|
|
99
|
+
--
|
|
100
|
+
2.52.0
|
|
101
|
+
|
|
102
|
+
theirs_snapshot:
|
|
103
|
+
lib/Apologist/version.rb: |
|
|
104
|
+
# frozen_string_literal: true
|
|
105
|
+
|
|
106
|
+
module Apologist
|
|
107
|
+
VERSION = "1.1.0"
|
|
108
|
+
end
|
|
109
|
+
status: unresolved
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Agent
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Apologist::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Pauses the agent globally and fans out pause transition messages to open conversations. Requires an API key.
|
|
14
|
+
#
|
|
15
|
+
# @param request_options [Hash]
|
|
16
|
+
# @param _params [Hash]
|
|
17
|
+
# @option request_options [String] :base_url
|
|
18
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
21
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
22
|
+
#
|
|
23
|
+
# @example
|
|
24
|
+
# client.agent.pause_agent
|
|
25
|
+
#
|
|
26
|
+
# @return [Apologist::Agent::Types::PauseAgentResponse]
|
|
27
|
+
def pause_agent(request_options: {}, **_params)
|
|
28
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
29
|
+
base_url: request_options[:base_url],
|
|
30
|
+
method: "POST",
|
|
31
|
+
path: "pause",
|
|
32
|
+
request_options: request_options
|
|
33
|
+
)
|
|
34
|
+
begin
|
|
35
|
+
response = @client.send(request)
|
|
36
|
+
rescue Net::HTTPRequestTimeout
|
|
37
|
+
raise Apologist::Errors::TimeoutError
|
|
38
|
+
end
|
|
39
|
+
code = response.code.to_i
|
|
40
|
+
if code.between?(200, 299)
|
|
41
|
+
Apologist::Agent::Types::PauseAgentResponse.load(response.body)
|
|
42
|
+
else
|
|
43
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
44
|
+
raise error_class.new(response.body, code: code)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Resumes the agent globally and fans out resume transition messages to open conversations. Requires an API key.
|
|
49
|
+
#
|
|
50
|
+
# @param request_options [Hash]
|
|
51
|
+
# @param _params [Hash]
|
|
52
|
+
# @option request_options [String] :base_url
|
|
53
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
54
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
55
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
56
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
57
|
+
#
|
|
58
|
+
# @example
|
|
59
|
+
# client.agent.resume_agent
|
|
60
|
+
#
|
|
61
|
+
# @return [Apologist::Agent::Types::ResumeAgentResponse]
|
|
62
|
+
def resume_agent(request_options: {}, **_params)
|
|
63
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
64
|
+
base_url: request_options[:base_url],
|
|
65
|
+
method: "POST",
|
|
66
|
+
path: "resume",
|
|
67
|
+
request_options: request_options
|
|
68
|
+
)
|
|
69
|
+
begin
|
|
70
|
+
response = @client.send(request)
|
|
71
|
+
rescue Net::HTTPRequestTimeout
|
|
72
|
+
raise Apologist::Errors::TimeoutError
|
|
73
|
+
end
|
|
74
|
+
code = response.code.to_i
|
|
75
|
+
if code.between?(200, 299)
|
|
76
|
+
Apologist::Agent::Types::ResumeAgentResponse.load(response.body)
|
|
77
|
+
else
|
|
78
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
79
|
+
raise error_class.new(response.body, code: code)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -402,6 +402,106 @@ module Apologist
|
|
|
402
402
|
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
403
403
|
raise error_class.new(response.body, code: code)
|
|
404
404
|
end
|
|
405
|
+
|
|
406
|
+
# Handles the Meta WhatsApp Cloud API webhook verification handshake, echoing `hub.challenge` when
|
|
407
|
+
# `hub.verify_token` matches the channel's configured token.
|
|
408
|
+
#
|
|
409
|
+
# @param request_options [Hash]
|
|
410
|
+
# @param params [Hash]
|
|
411
|
+
# @option request_options [String] :base_url
|
|
412
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
413
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
414
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
415
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
416
|
+
# @option params [String] :id
|
|
417
|
+
# @option params [Apologist::Channels::Types::VerifyWhatsAppWebhookRequestHubMode] :hub_mode
|
|
418
|
+
# @option params [String] :hub_verify_token
|
|
419
|
+
# @option params [String, nil] :hub_challenge
|
|
420
|
+
#
|
|
421
|
+
# @example
|
|
422
|
+
# client.channels.verify_whats_app_webhook(
|
|
423
|
+
# id: "id",
|
|
424
|
+
# hub_mode: "subscribe",
|
|
425
|
+
# hub_verify_token: "hub.verify_token"
|
|
426
|
+
# )
|
|
427
|
+
#
|
|
428
|
+
# @return [String]
|
|
429
|
+
def verify_whats_app_webhook(request_options: {}, **params)
|
|
430
|
+
params = Apologist::Internal::Types::Utils.normalize_keys(params)
|
|
431
|
+
query_params = {}
|
|
432
|
+
query_params["hub.mode"] = params[:hub_mode] if params.key?(:hub_mode)
|
|
433
|
+
query_params["hub.verify_token"] = params[:hub_verify_token] if params.key?(:hub_verify_token)
|
|
434
|
+
query_params["hub.challenge"] = params[:hub_challenge] if params.key?(:hub_challenge)
|
|
435
|
+
|
|
436
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
437
|
+
base_url: request_options[:base_url],
|
|
438
|
+
method: "GET",
|
|
439
|
+
path: "channels/#{URI.encode_uri_component(params[:id].to_s)}/whatsapp",
|
|
440
|
+
query: query_params,
|
|
441
|
+
request_options: request_options
|
|
442
|
+
)
|
|
443
|
+
begin
|
|
444
|
+
response = @client.send(request)
|
|
445
|
+
rescue Net::HTTPRequestTimeout
|
|
446
|
+
raise Apologist::Errors::TimeoutError
|
|
447
|
+
end
|
|
448
|
+
code = response.code.to_i
|
|
449
|
+
return if code.between?(200, 299)
|
|
450
|
+
|
|
451
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
452
|
+
raise error_class.new(response.body, code: code)
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
# Receives WhatsApp Cloud API message events for the channel. Payload shape is defined by Meta. Signature
|
|
456
|
+
# verification via `x-hub-signature-256` is used when the channel has an App Secret configured; otherwise the
|
|
457
|
+
# webhook relies on URL secrecy and/or an `api_key` query parameter.
|
|
458
|
+
#
|
|
459
|
+
# @param request_options [Hash]
|
|
460
|
+
# @param params [Hash]
|
|
461
|
+
# @option request_options [String] :base_url
|
|
462
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
463
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
464
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
465
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
466
|
+
# @option params [String] :id
|
|
467
|
+
# @option params [String, nil] :hub_signature256
|
|
468
|
+
#
|
|
469
|
+
# @example
|
|
470
|
+
# client.channels.receive_whats_app_message(
|
|
471
|
+
# id: "id",
|
|
472
|
+
# body: {
|
|
473
|
+
# key: "value"
|
|
474
|
+
# }
|
|
475
|
+
# )
|
|
476
|
+
#
|
|
477
|
+
# @return [untyped]
|
|
478
|
+
def receive_whats_app_message(request_options: {}, **params)
|
|
479
|
+
params = Apologist::Internal::Types::Utils.normalize_keys(params)
|
|
480
|
+
path_param_names = %i[id]
|
|
481
|
+
body_params = params.except(*path_param_names)
|
|
482
|
+
|
|
483
|
+
headers = {}
|
|
484
|
+
headers["x-hub-signature-256"] = params[:hub_signature256] if params[:hub_signature256]
|
|
485
|
+
|
|
486
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
487
|
+
base_url: request_options[:base_url],
|
|
488
|
+
method: "POST",
|
|
489
|
+
path: "channels/#{URI.encode_uri_component(params[:id].to_s)}/whatsapp",
|
|
490
|
+
headers: headers,
|
|
491
|
+
body: body_params,
|
|
492
|
+
request_options: request_options
|
|
493
|
+
)
|
|
494
|
+
begin
|
|
495
|
+
response = @client.send(request)
|
|
496
|
+
rescue Net::HTTPRequestTimeout
|
|
497
|
+
raise Apologist::Errors::TimeoutError
|
|
498
|
+
end
|
|
499
|
+
code = response.code.to_i
|
|
500
|
+
return if code.between?(200, 299)
|
|
501
|
+
|
|
502
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
503
|
+
raise error_class.new(response.body, code: code)
|
|
504
|
+
end
|
|
405
505
|
end
|
|
406
506
|
end
|
|
407
507
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Channels
|
|
5
|
+
module Types
|
|
6
|
+
class ReceiveWhatsAppMessageRequest < Internal::Types::Model
|
|
7
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :hub_signature256, -> { String }, optional: true, nullable: false, api_name: "x-hub-signature-256"
|
|
10
|
+
|
|
11
|
+
field :body, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Channels
|
|
5
|
+
module Types
|
|
6
|
+
class VerifyWhatsAppWebhookRequest < Internal::Types::Model
|
|
7
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :hub_mode, -> { Apologist::Channels::Types::VerifyWhatsAppWebhookRequestHubMode }, optional: false, nullable: false, api_name: "hub.mode"
|
|
10
|
+
|
|
11
|
+
field :hub_verify_token, -> { String }, optional: false, nullable: false, api_name: "hub.verify_token"
|
|
12
|
+
|
|
13
|
+
field :hub_challenge, -> { String }, optional: true, nullable: false, api_name: "hub.challenge"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/Apologist/client.rb
CHANGED
|
@@ -20,7 +20,7 @@ module Apologist
|
|
|
20
20
|
@raw_client = Apologist::Internal::Http::RawClient.new(
|
|
21
21
|
base_url: base_url || Apologist::Environment::DEFAULT,
|
|
22
22
|
headers: {
|
|
23
|
-
"User-Agent" => "apologist/1.
|
|
23
|
+
"User-Agent" => "apologist/1.1.1",
|
|
24
24
|
"X-Fern-Language" => "Ruby",
|
|
25
25
|
"x-api-key" => api_key.to_s
|
|
26
26
|
},
|
|
@@ -58,6 +58,16 @@ module Apologist
|
|
|
58
58
|
@benchmarks ||= Apologist::Benchmarks::Client.new(client: @raw_client)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
# @return [Apologist::Agent::Client]
|
|
62
|
+
def agent
|
|
63
|
+
@agent ||= Apologist::Agent::Client.new(client: @raw_client)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# @return [Apologist::Conversations::Client]
|
|
67
|
+
def conversations
|
|
68
|
+
@conversations ||= Apologist::Conversations::Client.new(client: @raw_client)
|
|
69
|
+
end
|
|
70
|
+
|
|
61
71
|
# @return [Apologist::Channels::Client]
|
|
62
72
|
def channels
|
|
63
73
|
@channels ||= Apologist::Channels::Client.new(client: @raw_client)
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Conversations
|
|
5
|
+
class Client
|
|
6
|
+
# @param client [Apologist::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
9
|
+
def initialize(client:)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Returns a paginated list of conversations for the requesting agent, newest first.
|
|
14
|
+
#
|
|
15
|
+
# @param request_options [Hash]
|
|
16
|
+
# @param params [Hash]
|
|
17
|
+
# @option request_options [String] :base_url
|
|
18
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
19
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
20
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
21
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
22
|
+
# @option params [Integer, nil] :page
|
|
23
|
+
# @option params [Integer, nil] :per_page
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# client.conversations.list_conversations
|
|
27
|
+
#
|
|
28
|
+
# @return [Apologist::Conversations::Types::ListConversationsResponse]
|
|
29
|
+
def list_conversations(request_options: {}, **params)
|
|
30
|
+
params = Apologist::Internal::Types::Utils.normalize_keys(params)
|
|
31
|
+
query_params = {}
|
|
32
|
+
query_params["page"] = params[:page] if params.key?(:page)
|
|
33
|
+
query_params["per_page"] = params[:per_page] if params.key?(:per_page)
|
|
34
|
+
|
|
35
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
36
|
+
base_url: request_options[:base_url],
|
|
37
|
+
method: "GET",
|
|
38
|
+
path: "conversations",
|
|
39
|
+
query: query_params,
|
|
40
|
+
request_options: request_options
|
|
41
|
+
)
|
|
42
|
+
begin
|
|
43
|
+
response = @client.send(request)
|
|
44
|
+
rescue Net::HTTPRequestTimeout
|
|
45
|
+
raise Apologist::Errors::TimeoutError
|
|
46
|
+
end
|
|
47
|
+
code = response.code.to_i
|
|
48
|
+
if code.between?(200, 299)
|
|
49
|
+
Apologist::Conversations::Types::ListConversationsResponse.load(response.body)
|
|
50
|
+
else
|
|
51
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
52
|
+
raise error_class.new(response.body, code: code)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Returns a single conversation by internal UUID or team-scoped external id.
|
|
57
|
+
#
|
|
58
|
+
# @param request_options [Hash]
|
|
59
|
+
# @param params [Hash]
|
|
60
|
+
# @option request_options [String] :base_url
|
|
61
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
62
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
63
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
64
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
65
|
+
# @option params [String] :id
|
|
66
|
+
#
|
|
67
|
+
# @example
|
|
68
|
+
# client.conversations.get_conversation(id: "id")
|
|
69
|
+
#
|
|
70
|
+
# @return [Apologist::Conversations::Types::GetConversationResponse]
|
|
71
|
+
def get_conversation(request_options: {}, **params)
|
|
72
|
+
params = Apologist::Internal::Types::Utils.normalize_keys(params)
|
|
73
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
74
|
+
base_url: request_options[:base_url],
|
|
75
|
+
method: "GET",
|
|
76
|
+
path: "conversations/#{URI.encode_uri_component(params[:id].to_s)}",
|
|
77
|
+
request_options: request_options
|
|
78
|
+
)
|
|
79
|
+
begin
|
|
80
|
+
response = @client.send(request)
|
|
81
|
+
rescue Net::HTTPRequestTimeout
|
|
82
|
+
raise Apologist::Errors::TimeoutError
|
|
83
|
+
end
|
|
84
|
+
code = response.code.to_i
|
|
85
|
+
if code.between?(200, 299)
|
|
86
|
+
Apologist::Conversations::Types::GetConversationResponse.load(response.body)
|
|
87
|
+
else
|
|
88
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
89
|
+
raise error_class.new(response.body, code: code)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Pauses the agent on a conversation identified by internal UUID or team-scoped external id. Requires an API key.
|
|
94
|
+
#
|
|
95
|
+
# @param request_options [Hash]
|
|
96
|
+
# @param params [Hash]
|
|
97
|
+
# @option request_options [String] :base_url
|
|
98
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
99
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
100
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
101
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
102
|
+
# @option params [String] :id
|
|
103
|
+
#
|
|
104
|
+
# @example
|
|
105
|
+
# client.conversations.pause_conversation(id: "id")
|
|
106
|
+
#
|
|
107
|
+
# @return [Apologist::Conversations::Types::PauseConversationResponse]
|
|
108
|
+
def pause_conversation(request_options: {}, **params)
|
|
109
|
+
params = Apologist::Internal::Types::Utils.normalize_keys(params)
|
|
110
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
111
|
+
base_url: request_options[:base_url],
|
|
112
|
+
method: "POST",
|
|
113
|
+
path: "conversations/#{URI.encode_uri_component(params[:id].to_s)}/pause",
|
|
114
|
+
request_options: request_options
|
|
115
|
+
)
|
|
116
|
+
begin
|
|
117
|
+
response = @client.send(request)
|
|
118
|
+
rescue Net::HTTPRequestTimeout
|
|
119
|
+
raise Apologist::Errors::TimeoutError
|
|
120
|
+
end
|
|
121
|
+
code = response.code.to_i
|
|
122
|
+
if code.between?(200, 299)
|
|
123
|
+
Apologist::Conversations::Types::PauseConversationResponse.load(response.body)
|
|
124
|
+
else
|
|
125
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
126
|
+
raise error_class.new(response.body, code: code)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Resumes the agent on a conversation identified by internal UUID or team-scoped external id. Requires an API key.
|
|
131
|
+
#
|
|
132
|
+
# @param request_options [Hash]
|
|
133
|
+
# @param params [Hash]
|
|
134
|
+
# @option request_options [String] :base_url
|
|
135
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
136
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
137
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
138
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
139
|
+
# @option params [String] :id
|
|
140
|
+
#
|
|
141
|
+
# @example
|
|
142
|
+
# client.conversations.resume_conversation(id: "id")
|
|
143
|
+
#
|
|
144
|
+
# @return [Apologist::Conversations::Types::ResumeConversationResponse]
|
|
145
|
+
def resume_conversation(request_options: {}, **params)
|
|
146
|
+
params = Apologist::Internal::Types::Utils.normalize_keys(params)
|
|
147
|
+
request = Apologist::Internal::JSON::Request.new(
|
|
148
|
+
base_url: request_options[:base_url],
|
|
149
|
+
method: "POST",
|
|
150
|
+
path: "conversations/#{URI.encode_uri_component(params[:id].to_s)}/resume",
|
|
151
|
+
request_options: request_options
|
|
152
|
+
)
|
|
153
|
+
begin
|
|
154
|
+
response = @client.send(request)
|
|
155
|
+
rescue Net::HTTPRequestTimeout
|
|
156
|
+
raise Apologist::Errors::TimeoutError
|
|
157
|
+
end
|
|
158
|
+
code = response.code.to_i
|
|
159
|
+
if code.between?(200, 299)
|
|
160
|
+
Apologist::Conversations::Types::ResumeConversationResponse.load(response.body)
|
|
161
|
+
else
|
|
162
|
+
error_class = Apologist::Errors::ResponseError.subclass_for_code(code)
|
|
163
|
+
raise error_class.new(response.body, code: code)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Conversations
|
|
5
|
+
module Types
|
|
6
|
+
class ListConversationsRequest < Internal::Types::Model
|
|
7
|
+
field :page, -> { Integer }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :per_page, -> { Integer }, optional: true, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Conversations
|
|
5
|
+
module Types
|
|
6
|
+
class ListConversationsResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Internal::Types::Array[Apologist::Types::Conversation] }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :total, -> { Integer }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :page, -> { Integer }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :per_page, -> { Integer }, optional: true, nullable: false
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Conversations
|
|
5
|
+
module Types
|
|
6
|
+
class PauseConversationResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Apologist::Types::Conversation }, optional: true, nullable: false
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Conversations
|
|
5
|
+
module Types
|
|
6
|
+
class ResumeConversationResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Apologist::Types::Conversation }, optional: true, nullable: false
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Apologist
|
|
4
|
+
module Types
|
|
5
|
+
# Agent-wide pause or resume result, including fan-out counts.
|
|
6
|
+
class AgentPauseState < Internal::Types::Model
|
|
7
|
+
field :is_paused, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
8
|
+
|
|
9
|
+
field :paused_at, -> { String }, optional: true, nullable: false
|
|
10
|
+
|
|
11
|
+
field :resumed_at, -> { String }, optional: true, nullable: false
|
|
12
|
+
|
|
13
|
+
field :emitted, -> { Integer }, optional: true, nullable: false
|
|
14
|
+
|
|
15
|
+
field :skipped, -> { Integer }, optional: true, nullable: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|