nylas 5.17.0 → 6.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nylas/client.rb +121 -0
  3. data/lib/nylas/config.rb +19 -0
  4. data/lib/nylas/errors.rb +63 -89
  5. data/lib/nylas/handler/api_operations.rb +162 -0
  6. data/lib/nylas/handler/http_client.rb +252 -0
  7. data/lib/nylas/resources/applications.rb +27 -0
  8. data/lib/nylas/resources/attachments.rb +65 -0
  9. data/lib/nylas/resources/auth.rb +209 -0
  10. data/lib/nylas/resources/calendars.rb +101 -0
  11. data/lib/nylas/resources/connectors.rb +80 -0
  12. data/lib/nylas/resources/contacts.rb +89 -0
  13. data/lib/nylas/resources/credentials.rb +75 -0
  14. data/lib/nylas/resources/drafts.rb +121 -0
  15. data/lib/nylas/resources/events.rb +98 -0
  16. data/lib/nylas/resources/folders.rb +73 -0
  17. data/lib/nylas/resources/grants.rb +59 -0
  18. data/lib/nylas/resources/messages.rb +135 -0
  19. data/lib/nylas/resources/redirect_uris.rb +68 -0
  20. data/lib/nylas/resources/resource.rb +18 -0
  21. data/lib/nylas/resources/smart_compose.rb +36 -0
  22. data/lib/nylas/resources/threads.rb +62 -0
  23. data/lib/nylas/resources/webhooks.rb +121 -0
  24. data/lib/nylas/utils/file_utils.rb +61 -0
  25. data/lib/nylas/version.rb +1 -1
  26. data/lib/nylas.rb +31 -148
  27. metadata +88 -247
  28. data/lib/nylas/account.rb +0 -56
  29. data/lib/nylas/api.rb +0 -246
  30. data/lib/nylas/application_details.rb +0 -13
  31. data/lib/nylas/calendar.rb +0 -46
  32. data/lib/nylas/calendar_collection.rb +0 -144
  33. data/lib/nylas/categorize.rb +0 -14
  34. data/lib/nylas/collection.rb +0 -175
  35. data/lib/nylas/component.rb +0 -35
  36. data/lib/nylas/component_collection.rb +0 -10
  37. data/lib/nylas/constraints.rb +0 -56
  38. data/lib/nylas/contact.rb +0 -53
  39. data/lib/nylas/contact_group.rb +0 -23
  40. data/lib/nylas/current_account.rb +0 -23
  41. data/lib/nylas/delta.rb +0 -56
  42. data/lib/nylas/deltas.rb +0 -19
  43. data/lib/nylas/deltas_collection.rb +0 -40
  44. data/lib/nylas/draft.rb +0 -100
  45. data/lib/nylas/email_address.rb +0 -12
  46. data/lib/nylas/event.rb +0 -144
  47. data/lib/nylas/event_collection.rb +0 -15
  48. data/lib/nylas/event_conferencing.rb +0 -12
  49. data/lib/nylas/event_conferencing_autocreate.rb +0 -10
  50. data/lib/nylas/event_conferencing_details.rb +0 -14
  51. data/lib/nylas/event_notification.rb +0 -17
  52. data/lib/nylas/file.rb +0 -75
  53. data/lib/nylas/filter_attributes.rb +0 -25
  54. data/lib/nylas/folder.rb +0 -26
  55. data/lib/nylas/free_busy.rb +0 -13
  56. data/lib/nylas/free_busy_collection.rb +0 -48
  57. data/lib/nylas/http_client.rb +0 -279
  58. data/lib/nylas/im_address.rb +0 -11
  59. data/lib/nylas/job_status.rb +0 -27
  60. data/lib/nylas/job_status_collection.rb +0 -21
  61. data/lib/nylas/label.rb +0 -27
  62. data/lib/nylas/logging.rb +0 -41
  63. data/lib/nylas/message.rb +0 -98
  64. data/lib/nylas/message_headers.rb +0 -27
  65. data/lib/nylas/message_tracking.rb +0 -13
  66. data/lib/nylas/model/attributable.rb +0 -89
  67. data/lib/nylas/model/attribute_definition.rb +0 -24
  68. data/lib/nylas/model/attributes.rb +0 -97
  69. data/lib/nylas/model/list_attribute_definition.rb +0 -39
  70. data/lib/nylas/model/transferable.rb +0 -53
  71. data/lib/nylas/model.rb +0 -217
  72. data/lib/nylas/native_authentication.rb +0 -39
  73. data/lib/nylas/neural.rb +0 -87
  74. data/lib/nylas/neural_categorizer.rb +0 -29
  75. data/lib/nylas/neural_clean_conversation.rb +0 -33
  76. data/lib/nylas/neural_contact_link.rb +0 -11
  77. data/lib/nylas/neural_contact_name.rb +0 -11
  78. data/lib/nylas/neural_message_options.rb +0 -35
  79. data/lib/nylas/neural_ocr.rb +0 -16
  80. data/lib/nylas/neural_sentiment_analysis.rb +0 -17
  81. data/lib/nylas/neural_signature_contact.rb +0 -81
  82. data/lib/nylas/neural_signature_extraction.rb +0 -18
  83. data/lib/nylas/new_message.rb +0 -39
  84. data/lib/nylas/nylas_date.rb +0 -25
  85. data/lib/nylas/open_hours.rb +0 -15
  86. data/lib/nylas/outbox.rb +0 -116
  87. data/lib/nylas/outbox_job_status.rb +0 -19
  88. data/lib/nylas/outbox_message.rb +0 -17
  89. data/lib/nylas/participant.rb +0 -13
  90. data/lib/nylas/phone_number.rb +0 -11
  91. data/lib/nylas/physical_address.rb +0 -17
  92. data/lib/nylas/raw_message.rb +0 -25
  93. data/lib/nylas/recurrence.rb +0 -11
  94. data/lib/nylas/registry.rb +0 -42
  95. data/lib/nylas/room_resource.rb +0 -19
  96. data/lib/nylas/rsvp.rb +0 -24
  97. data/lib/nylas/scheduler.rb +0 -51
  98. data/lib/nylas/scheduler_booking_confirmation.rb +0 -24
  99. data/lib/nylas/scheduler_booking_request.rb +0 -17
  100. data/lib/nylas/scheduler_collection.rb +0 -104
  101. data/lib/nylas/scheduler_config.rb +0 -20
  102. data/lib/nylas/scheduler_time_slot.rb +0 -14
  103. data/lib/nylas/search_collection.rb +0 -10
  104. data/lib/nylas/send_grid_verified_status.rb +0 -12
  105. data/lib/nylas/services/tunnel.rb +0 -128
  106. data/lib/nylas/thread.rb +0 -66
  107. data/lib/nylas/time_slot.rb +0 -16
  108. data/lib/nylas/time_slot_capacity.rb +0 -13
  109. data/lib/nylas/timespan.rb +0 -20
  110. data/lib/nylas/token_info.rb +0 -20
  111. data/lib/nylas/types.rb +0 -168
  112. data/lib/nylas/web_page.rb +0 -11
  113. data/lib/nylas/webhook.rb +0 -111
  114. data/lib/nylas/when.rb +0 -75
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0660c04f6656d846a55819153819877b599ed5342d8f2ea9c18a7b19e0799ec3
4
- data.tar.gz: bf1bd6d4382a6705a5146ff86202436512cf0fc5c68817c77a932e846c3150cf
3
+ metadata.gz: 3bd6fdcadf69439f1f8a8549e26e3b43f4df3cfeb8ae0c5a2aef5aca8fb3acce
4
+ data.tar.gz: b1f939a98c16ec5bf390791df31bb0f76feb45af07e4e6bcfc32c52e79e3b53f
5
5
  SHA512:
6
- metadata.gz: 076702b69e4ea6a7ef882f3ac65490d54c90bae69cdc8f940aab62a4d29997627d7936b3426158e10935f1aecfad517e17b2d3c5502aa26a636e48319c492fcd
7
- data.tar.gz: 1d7fd956e5676c2b418ed2d0d79ecfd9cf3b6a961f8768ee0dd97952f0ea043810e90499063b1940efc055506a79187f78d4daf04fe386dfbdf64141bd1d9262
6
+ metadata.gz: 591735adfae3cfefdbc513762eff603390779f14321a543bf0a2115f3a368f1b674175c6e5cbea9052b4e10db157d74a3cda80b74773b212bbda2e38fc25aea0
7
+ data.tar.gz: 17dc68c13af649f533d206a546a72cf45b508864f71d2daae1eb020f686ce5b79c39829d841dd919cc944cd038042f4075116a7a941c2f782b6ae127c35d63a8
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "resources/calendars"
4
+ require_relative "resources/connectors"
5
+ require_relative "resources/messages"
6
+ require_relative "resources/events"
7
+ require_relative "resources/auth"
8
+ require_relative "resources/webhooks"
9
+ require_relative "resources/applications"
10
+ require_relative "resources/folders"
11
+
12
+ module Nylas
13
+ # Methods to retrieve data from the Nylas API as Ruby objects.
14
+ class Client
15
+ attr_reader :api_key, :api_uri, :timeout
16
+
17
+ # Initializes a client session.
18
+ #
19
+ # @param api_key [String, nil] API key to use for the client session.
20
+ # @param api_uri [String] Client session's host.
21
+ # @param timeout [Integer, nil] Timeout value to use for the client session.
22
+ def initialize(api_key:,
23
+ api_uri: Config::DEFAULT_REGION_URL,
24
+ timeout: nil)
25
+ @api_key = api_key
26
+ @api_uri = api_uri
27
+ @timeout = timeout || 90
28
+ end
29
+
30
+ # The application resources for your Nylas application.
31
+ #
32
+ # @return [Nylas::Applications] Application resources for your Nylas application.
33
+ def applications
34
+ Applications.new(self)
35
+ end
36
+
37
+ # The attachments resources for your Nylas application.
38
+ #
39
+ # @return [Nylas::Attachments] Attachment resources for your Nylas application.
40
+ def attachments
41
+ Attachments.new(self)
42
+ end
43
+
44
+ # The auth resources for your Nylas application.
45
+ #
46
+ # @return [Nylas::Auth] Auth resources for your Nylas application.
47
+ def auth
48
+ Auth.new(self)
49
+ end
50
+
51
+ # The calendar resources for your Nylas application.
52
+ #
53
+ # @return [Nylas::Calendars] Calendar resources for your Nylas application.
54
+ def calendars
55
+ Calendars.new(self)
56
+ end
57
+
58
+ # The connector resources for your Nylas application.
59
+ #
60
+ # @return [Nylas::Connectors] Connector resources for your Nylas application.
61
+ def connectors
62
+ Connectors.new(self)
63
+ end
64
+
65
+ # The contact resources for your Nylas application.
66
+ #
67
+ # @return [Nylas::Contacts] Contact resources for your Nylas application.
68
+ def contacts
69
+ Contacts.new(self)
70
+ end
71
+
72
+ # The draft resources for your Nylas application.
73
+ #
74
+ # @return [Nylas::Drafts] Draft resources for your Nylas application.
75
+ def drafts
76
+ Drafts.new(self)
77
+ end
78
+
79
+ # The event resources for your Nylas application.
80
+ #
81
+ # @return [Nylas::Events] Event resources for your Nylas application
82
+ def events
83
+ Events.new(self)
84
+ end
85
+
86
+ # The folder resources for your Nylas application.
87
+ #
88
+ # @return [Nylas::Folder] Folder resources for your Nylas application
89
+ def folders
90
+ Folders.new(self)
91
+ end
92
+
93
+ # The grants resources for your Nylas application.
94
+ #
95
+ # @return [Nylas::Grants] Grant resources for your Nylas application
96
+ def grants
97
+ Grants.new(self)
98
+ end
99
+
100
+ # The message resources for your Nylas application.
101
+ #
102
+ # @return [Nylas::Messages] Message resources for your Nylas application
103
+ def messages
104
+ Messages.new(self)
105
+ end
106
+
107
+ # The thread resources for your Nylas application.
108
+ #
109
+ # @return [Nylas::Threads] Thread resources for your Nylas application.
110
+ def threads
111
+ Threads.new(self)
112
+ end
113
+
114
+ # The webhook resources for your Nylas application.
115
+ #
116
+ # @return [Nylas::Webhooks] Webhook resources for your Nylas application.
117
+ def webhooks
118
+ Webhooks.new(self)
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nylas
4
+ # Configuration options for the Nylas Ruby SDK.
5
+ module Config
6
+ # The configuration options for supported regions.
7
+ REGION_CONFIG = {
8
+ us: {
9
+ nylas_api_url: "https://api.us.nylas.com"
10
+ },
11
+ eu: {
12
+ nylas_api_url: "https://api.eu.nylas.com"
13
+ }
14
+ }.freeze
15
+
16
+ # The default API endpoint for the Nylas API.
17
+ DEFAULT_REGION_URL = REGION_CONFIG[:us][:nylas_api_url]
18
+ end
19
+ end
data/lib/nylas/errors.rb CHANGED
@@ -3,109 +3,83 @@
3
3
  module Nylas
4
4
  Error = Class.new(::StandardError)
5
5
 
6
- class ModelActionError < Error; end
7
- class ModelNotFilterableError < ModelActionError; end
8
- class ModelNotCreatableError < ModelActionError; end
9
- class ModelNotShowableError < ModelActionError; end
10
- class ModelNotAvailableAsRawError < ModelActionError; end
11
- class ModelNotListableError < ModelActionError; end
12
- class ModelNotFilterableError < ModelActionError; end
13
- class ModelNotSearchableError < ModelActionError; end
14
- class ModelNotUpdatableError < ModelActionError; end
15
- class ModelNotDestroyableError < ModelActionError; end
16
-
17
- class JsonParseError < Error; end
18
-
19
- # Raised when attempting to set a field that is not on a model with mass assignment
20
- class ModelMissingFieldError < ModelActionError
21
- def initialize(field, model)
22
- super("#{field} is not a valid attribute for #{model.class.name}")
23
- end
24
- end
25
-
26
- # Indicates that a given method needs an access token to work.
27
- class NoAuthToken < Error
28
- def initialize(method_name)
29
- super "No access token was provided and the #{method_name} method requires one"
30
- end
31
- end
32
-
33
- UnexpectedAccountAction = Class.new(Error)
34
- UnexpectedResponse = Class.new(Error)
35
-
36
- # Base class to inflate the standard errors returned from the Nylas API
37
- class APIError < Error
38
- attr_accessor :type
39
- attr_accessor :message
40
- attr_accessor :server_error
41
-
42
- def initialize(type, message, server_error = nil)
6
+ # Base error class for API-related errors.
7
+ class AbstractNylasApiError < Error; end
8
+
9
+ # Base error class for SDK-related errors.
10
+ class AbstractNylasSdkError < Error; end
11
+
12
+ # Error class representing a failed parse of a JSON response from the Nylas API.
13
+ class JsonParseError < AbstractNylasSdkError; end
14
+
15
+ # Error class representing a failed response from the Nylas API.
16
+ class NylasApiError < AbstractNylasApiError
17
+ attr_accessor :type, :request_id, :provider_error, :status_code
18
+
19
+ # Initializes an error and assigns the given attributes to it.
20
+ #
21
+ # @param type [Hash] Error type.
22
+ # @param message [String] Error message.
23
+ # @param status_code [Integer] Error status code.
24
+ # @param provider_error [String, nil] Provider error.
25
+ # @param request_id [Hash, nil] The ID of the request.
26
+ def initialize(type, message, status_code, provider_error = nil, request_id = nil)
43
27
  super(message)
44
28
  self.type = type
45
- self.message = message
46
- self.server_error = server_error
29
+ self.status_code = status_code
30
+ self.provider_error = provider_error
31
+ self.request_id = request_id
47
32
  end
48
33
 
49
- def self.parse_error_response(response)
34
+ # Parses the error response.
35
+ #
36
+ # @param response [Hash] Response from the Nylas API.
37
+ # @param status_code [Integer] Error status code.
38
+ def self.parse_error_response(response, status_code)
50
39
  new(
51
40
  response["type"],
52
41
  response["message"],
53
- response["server_error"]
42
+ status_code,
43
+ response["provider_error"]
54
44
  )
55
45
  end
56
46
  end
57
47
 
58
- # Error class representing a 429 error response, with details on the rate limit
59
- class RateLimitError < APIError
60
- attr_accessor :rate_limit
61
- attr_accessor :rate_limit_reset
62
-
63
- RATE_LIMIT_LIMIT_HEADER = "x_ratelimit_limit"
64
- RATE_LIMIT_RESET_HEADER = "x_ratelimit_reset"
65
-
66
- def initialize(type, message, server_error = nil, rate_limit = nil, rate_limit_reset = nil)
67
- super(type, message, server_error)
68
- self.rate_limit = rate_limit
69
- self.rate_limit_reset = rate_limit_reset
48
+ # Error class representing a failed response from the Nylas OAuth integration.
49
+ class NylasOAuthError < AbstractNylasApiError
50
+ attr_accessor :error, :error_description, :error_uri, :error_code, :status_code
51
+
52
+ # Initializes an error and assigns the given attributes to it.
53
+ #
54
+ # @param error [String] Error type.
55
+ # @param error_description [String] Description of the error.
56
+ # @param error_uri [String] Error URI.
57
+ # @param error_code [String] Error code.
58
+ # @param status_code [String] Error status code.
59
+ def initialize(error, error_description, error_uri, error_code, status_code)
60
+ super(error_description)
61
+ self.error = error
62
+ self.error_description = error_description
63
+ self.error_uri = error_uri
64
+ self.error_code = error_code
65
+ self.status_code = status_code
70
66
  end
67
+ end
71
68
 
72
- def self.parse_error_response(response)
73
- rate_limit, rate_limit_rest = extract_rate_limit_details(response)
74
-
75
- new(
76
- response["type"],
77
- response["message"],
78
- response["server_error"],
79
- rate_limit,
80
- rate_limit_rest
81
- )
82
- end
83
-
84
- def self.extract_rate_limit_details(response)
85
- return nil, nil unless response.respond_to?(:headers)
86
-
87
- rate_limit = response.headers[RATE_LIMIT_LIMIT_HEADER.to_sym].to_i
88
- rate_limit_rest = response.headers[RATE_LIMIT_RESET_HEADER.to_sym].to_i
89
-
90
- [rate_limit, rate_limit_rest]
69
+ # Error class representing a timeout from the Nylas SDK.
70
+ class NylasSdkTimeoutError < AbstractNylasSdkError
71
+ attr_accessor :url, :timeout
72
+
73
+ # Initializes an error and assigns the given attributes to it.
74
+ # @param url [String] URL that timed out.
75
+ # @param timeout [Integer] Timeout in seconds.
76
+ # @return [NylasSdkTimeoutError] The error object.
77
+ def initialize(url, timeout)
78
+ super("Nylas SDK timed out before receiving a response from the server.")
79
+ self.url = url
80
+ self.timeout = timeout
91
81
  end
92
-
93
- private_class_method :extract_rate_limit_details
94
82
  end
95
83
 
96
- AccessDenied = Class.new(APIError)
97
- ResourceNotFound = Class.new(APIError)
98
- MethodNotAllowed = Class.new(APIError)
99
- InvalidRequest = Class.new(APIError)
100
- UnauthorizedRequest = Class.new(APIError)
101
- ResourceRemoved = Class.new(APIError)
102
- TeapotError = Class.new(APIError)
103
- RequestTimedOut = Class.new(APIError)
104
- MessageRejected = Class.new(APIError)
105
- SendingQuotaExceeded = Class.new(RateLimitError)
106
- ServiceUnavailable = Class.new(APIError)
107
- BadGateway = Class.new(APIError)
108
- InternalError = Class.new(APIError)
109
- EndpointNotYetImplemented = Class.new(APIError)
110
- MailProviderError = Class.new(APIError)
84
+ HTTP_SUCCESS_CODES = [200, 201, 202, 302].freeze
111
85
  end
@@ -0,0 +1,162 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "http_client"
4
+
5
+ module Nylas
6
+ # Allows resources to perform API operations on the Nylas API endpoints without exposing the HTTP
7
+ # client to the end user.
8
+ module ApiOperations
9
+ # Performs a GET call to the Nylas API.
10
+ module Get
11
+ protected
12
+
13
+ include HttpClient
14
+ # Performs a GET call to the Nylas API for a single item response.
15
+ #
16
+ # @param path [String] Destination path for the call.
17
+ # @param query_params [Hash, {}] Query params to pass to the call.
18
+ # @return [Array([Hash, Array], String)] Nylas data object and API Request ID.
19
+ def get(path:, query_params: {})
20
+ response = get_raw(path: path, query_params: query_params)
21
+
22
+ [response[:data], response[:request_id]]
23
+ end
24
+
25
+ # Performs a GET call to the Nylas API for a list response.
26
+ #
27
+ # @param path [String] Destination path for the call.
28
+ # @param query_params [Hash, {}] Query params to pass to the call.
29
+ # @return [Array(Array(Hash), String, String)] Nylas data array, API Request ID, and next cursor.
30
+ def get_list(path:, query_params: {})
31
+ response = get_raw(path: path, query_params: query_params)
32
+
33
+ [response[:data], response[:request_id], response[:next_cursor]]
34
+ end
35
+
36
+ private
37
+
38
+ # Performs a GET call to the Nylas API.
39
+ #
40
+ # @param path [String] Destination path for the call.
41
+ # @param query_params [Hash, {}] Query params to pass to the call.
42
+ # @return [Hash] The JSON response from the Nylas API.
43
+ def get_raw(path:, query_params: {})
44
+ execute(
45
+ method: :get,
46
+ path: path,
47
+ query: query_params,
48
+ payload: nil,
49
+ api_key: api_key,
50
+ timeout: timeout
51
+ )
52
+ end
53
+ end
54
+
55
+ # Performs a POST call to the Nylas API.
56
+ module Post
57
+ protected
58
+
59
+ include HttpClient
60
+ # Performs a POST call to the Nylas API.
61
+ #
62
+ # @param path [String] Destination path for the call.
63
+ # @param query_params [Hash, {}] Query params to pass to the call.
64
+ # @param request_body [Hash, nil] Request body to pass to the call.
65
+ # @param headers [Hash, {}] Additional HTTP headers to include in the payload.
66
+ # @return Nylas data object and API Request ID.
67
+ def post(path:, query_params: {}, request_body: nil, headers: {})
68
+ response = execute(
69
+ method: :post,
70
+ path: path,
71
+ query: query_params,
72
+ payload: request_body,
73
+ headers: headers,
74
+ api_key: api_key,
75
+ timeout: timeout
76
+ )
77
+
78
+ [response[:data], response[:request_id]]
79
+ end
80
+ end
81
+
82
+ # Performs a PUT call to the Nylas API.
83
+ module Put
84
+ protected
85
+
86
+ include HttpClient
87
+ # Performs a PUT call to the Nylas API.
88
+ #
89
+ # @param path [String] Destination path for the call.
90
+ # @param query_params [Hash, {}] Query params to pass to the call.
91
+ # @param request_body [Hash, nil] Request body to pass to the call.
92
+ # @param headers [Hash, {}] Additional HTTP headers to include in the payload.
93
+ # @return Nylas data object and API Request ID.
94
+ def put(path:, query_params: {}, request_body: nil, headers: {})
95
+ response = execute(
96
+ method: :put,
97
+ path: path,
98
+ query: query_params,
99
+ payload: request_body,
100
+ headers: headers,
101
+ api_key: api_key,
102
+ timeout: timeout
103
+ )
104
+
105
+ [response[:data], response[:request_id]]
106
+ end
107
+ end
108
+
109
+ # Performs a PATCH call to the Nylas API.
110
+ module Patch
111
+ protected
112
+
113
+ include HttpClient
114
+ # Performs a PATCH call to the Nylas API.
115
+ #
116
+ # @param path [String] Destination path for the call.
117
+ # @param query_params [Hash, {}] Query params to pass to the call.
118
+ # @param request_body [Hash, nil] Request body to pass to the call.
119
+ # @param headers [Hash, {}] Additional HTTP headers to include in the payload.
120
+ # @return Nylas data object and API Request ID.
121
+ def patch(path:, query_params: {}, request_body: nil, headers: {})
122
+ response = execute(
123
+ method: :patch,
124
+ path: path,
125
+ query: query_params,
126
+ payload: request_body,
127
+ headers: headers,
128
+ api_key: api_key,
129
+ timeout: timeout
130
+ )
131
+
132
+ [response[:data], response[:request_id]]
133
+ end
134
+ end
135
+
136
+ # Performs a DELETE call to the Nylas API.
137
+ module Delete
138
+ protected
139
+
140
+ include HttpClient
141
+ # Performs a DELETE call to the Nylas API.
142
+ #
143
+ # @param path [String] Destination path for the call.
144
+ # @param query_params [Hash, {}] Query params to pass to the call.
145
+ # @param headers [Hash, {}] Additional HTTP headers to include in the payload.
146
+ # @return Nylas data object and API Request ID.
147
+ def delete(path:, query_params: {}, headers: {})
148
+ response = execute(
149
+ method: :delete,
150
+ path: path,
151
+ query: query_params,
152
+ headers: headers,
153
+ payload: nil,
154
+ api_key: api_key,
155
+ timeout: timeout
156
+ )
157
+
158
+ [response[:data], response[:request_id]]
159
+ end
160
+ end
161
+ end
162
+ end