incident_io_api 2.29.0 → 2.31.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: a74cd0e95f6cef1e4dcb2a3ff4fb55c5c1fb59a01bf57f05040a5f5fced152cf
4
- data.tar.gz: d865d70d83caa8b325be9cb802855f911f4472842a30a01b3c2b4444811f5c87
3
+ metadata.gz: ba73a5d757889226f11342b7b9c31d21ce20d74c8450b9545451bd3e90eec754
4
+ data.tar.gz: 71d1d3dc999e515eed83d35396132851d57efd588954a6b79ae157a640dfe368
5
5
  SHA512:
6
- metadata.gz: 5a422f7cadebf0cda16605e479f14b39f9c971c58dd1996f3d3df74afdaa1d7ef8c1485cacd31bcdc5f5a4e0babd49f6fa07764083ddfa04accd632e363e6ac9
7
- data.tar.gz: 2eeaf35048f66e2485218d12aa5e1a55024c7d0d583e9871f75e30571ca841a91351f2f77734eb720d27859406e6cb5cb1222b2c5b7b7256e91bcc4c3703e0f7
6
+ metadata.gz: 826a9ca4862968efab7d3b3a487bfa97ba474f6d9b9bc714fa546810bbff6e1493fa222040cfaf6373050150942180154cc344da70f4eff1f84ef062fb71a304
7
+ data.tar.gz: 377ed2f317323bd2f138d1ce14403851af6040ba2343bdaca2191901f6d0f0969a6d8e133557c9e3a86c15eef0111c2d2a7cb9a2caa8eb10dd6f22fab1b55a9c
@@ -0,0 +1,230 @@
1
+ =begin
2
+ #incident.io
3
+
4
+ #Ruby client for the incident.io API.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module IncidentIo
16
+ class AlertAttachmentsV2Api
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Alert Attachments V2
23
+ # Attach a URL to an alert or alert group. Provide exactly one of alert_id or alert_group_id. A URL for a ticket or pull request from a connected integration is attached as that ticket or pull request. Any other URL is attached as a link. A URL that is already attached returns a 422.
24
+ # @param alert_attachments_create_payload_v2 [AlertAttachmentsCreatePayloadV2]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [AlertAttachmentsCreateResultV2]
27
+ def alert_attachments_v2_create(alert_attachments_create_payload_v2, opts = {})
28
+ data, _status_code, _headers = alert_attachments_v2_create_with_http_info(alert_attachments_create_payload_v2, opts)
29
+ data
30
+ end
31
+
32
+ # Create Alert Attachments V2
33
+ # Attach a URL to an alert or alert group. Provide exactly one of alert_id or alert_group_id. A URL for a ticket or pull request from a connected integration is attached as that ticket or pull request. Any other URL is attached as a link. A URL that is already attached returns a 422.
34
+ # @param alert_attachments_create_payload_v2 [AlertAttachmentsCreatePayloadV2]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(AlertAttachmentsCreateResultV2, Integer, Hash)>] AlertAttachmentsCreateResultV2 data, response status code and response headers
37
+ def alert_attachments_v2_create_with_http_info(alert_attachments_create_payload_v2, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AlertAttachmentsV2Api.alert_attachments_v2_create ...'
40
+ end
41
+ # verify the required parameter 'alert_attachments_create_payload_v2' is set
42
+ if @api_client.config.client_side_validation && alert_attachments_create_payload_v2.nil?
43
+ fail ArgumentError, "Missing the required parameter 'alert_attachments_create_payload_v2' when calling AlertAttachmentsV2Api.alert_attachments_v2_create"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v2/alert_attachments'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(alert_attachments_create_payload_v2)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'AlertAttachmentsCreateResultV2'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"AlertAttachmentsV2Api.alert_attachments_v2_create",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: AlertAttachmentsV2Api#alert_attachments_v2_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Delete Alert Attachments V2
91
+ # Remove an attachment from its alert or alert group.
92
+ # @param id [String] ID of the alert attachment
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [nil]
95
+ def alert_attachments_v2_delete(id, opts = {})
96
+ alert_attachments_v2_delete_with_http_info(id, opts)
97
+ nil
98
+ end
99
+
100
+ # Delete Alert Attachments V2
101
+ # Remove an attachment from its alert or alert group.
102
+ # @param id [String] ID of the alert attachment
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
105
+ def alert_attachments_v2_delete_with_http_info(id, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: AlertAttachmentsV2Api.alert_attachments_v2_delete ...'
108
+ end
109
+ # verify the required parameter 'id' is set
110
+ if @api_client.config.client_side_validation && id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'id' when calling AlertAttachmentsV2Api.alert_attachments_v2_delete"
112
+ end
113
+ # resource path
114
+ local_var_path = '/v2/alert_attachments/{id}'.sub('{id}', CGI.escape(id.to_s))
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+
124
+ # form parameters
125
+ form_params = opts[:form_params] || {}
126
+
127
+ # http body (model)
128
+ post_body = opts[:debug_body]
129
+
130
+ # return_type
131
+ return_type = opts[:debug_return_type]
132
+
133
+ # auth_names
134
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
135
+
136
+ new_options = opts.merge(
137
+ :operation => :"AlertAttachmentsV2Api.alert_attachments_v2_delete",
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: AlertAttachmentsV2Api#alert_attachments_v2_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ return data, status_code, headers
151
+ end
152
+
153
+ # List Alert Attachments V2
154
+ # List the attachments on an alert or alert group, newest first. Provide exactly one of alert_id or alert_group_id. Listing by alert_id returns only what is attached to that alert, not what is attached to its alert group.
155
+ # @param [Hash] opts the optional parameters
156
+ # @option opts [String] :alert_id ID of the alert to list attachments for. Provide exactly one of alert_id or alert_group_id.
157
+ # @option opts [String] :alert_group_id ID of the alert group to list attachments for. Provide exactly one of alert_id or alert_group_id.
158
+ # @option opts [Integer] :page_size Integer number of records to return (default to 25)
159
+ # @option opts [String] :after An alert attachment&#39;s ID. This endpoint will return the attachments after this one in the response order.
160
+ # @return [AlertAttachmentsListResultV2]
161
+ def alert_attachments_v2_list(opts = {})
162
+ data, _status_code, _headers = alert_attachments_v2_list_with_http_info(opts)
163
+ data
164
+ end
165
+
166
+ # List Alert Attachments V2
167
+ # List the attachments on an alert or alert group, newest first. Provide exactly one of alert_id or alert_group_id. Listing by alert_id returns only what is attached to that alert, not what is attached to its alert group.
168
+ # @param [Hash] opts the optional parameters
169
+ # @option opts [String] :alert_id ID of the alert to list attachments for. Provide exactly one of alert_id or alert_group_id.
170
+ # @option opts [String] :alert_group_id ID of the alert group to list attachments for. Provide exactly one of alert_id or alert_group_id.
171
+ # @option opts [Integer] :page_size Integer number of records to return (default to 25)
172
+ # @option opts [String] :after An alert attachment&#39;s ID. This endpoint will return the attachments after this one in the response order.
173
+ # @return [Array<(AlertAttachmentsListResultV2, Integer, Hash)>] AlertAttachmentsListResultV2 data, response status code and response headers
174
+ def alert_attachments_v2_list_with_http_info(opts = {})
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug 'Calling API: AlertAttachmentsV2Api.alert_attachments_v2_list ...'
177
+ end
178
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 250
179
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AlertAttachmentsV2Api.alert_attachments_v2_list, must be smaller than or equal to 250.'
180
+ end
181
+
182
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
183
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AlertAttachmentsV2Api.alert_attachments_v2_list, must be greater than or equal to 1.'
184
+ end
185
+
186
+ # resource path
187
+ local_var_path = '/v2/alert_attachments'
188
+
189
+ # query parameters
190
+ query_params = opts[:query_params] || {}
191
+ query_params[:'alert_id'] = opts[:'alert_id'] if !opts[:'alert_id'].nil?
192
+ query_params[:'alert_group_id'] = opts[:'alert_group_id'] if !opts[:'alert_group_id'].nil?
193
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
194
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
195
+
196
+ # header parameters
197
+ header_params = opts[:header_params] || {}
198
+ # HTTP header 'Accept' (if needed)
199
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
200
+
201
+ # form parameters
202
+ form_params = opts[:form_params] || {}
203
+
204
+ # http body (model)
205
+ post_body = opts[:debug_body]
206
+
207
+ # return_type
208
+ return_type = opts[:debug_return_type] || 'AlertAttachmentsListResultV2'
209
+
210
+ # auth_names
211
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
212
+
213
+ new_options = opts.merge(
214
+ :operation => :"AlertAttachmentsV2Api.alert_attachments_v2_list",
215
+ :header_params => header_params,
216
+ :query_params => query_params,
217
+ :form_params => form_params,
218
+ :body => post_body,
219
+ :auth_names => auth_names,
220
+ :return_type => return_type
221
+ )
222
+
223
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
224
+ if @api_client.config.debugging
225
+ @api_client.config.logger.debug "API called: AlertAttachmentsV2Api#alert_attachments_v2_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
226
+ end
227
+ return data, status_code, headers
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,267 @@
1
+ =begin
2
+ #incident.io
3
+
4
+ #Ruby client for the incident.io API.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IncidentIo
17
+ # Something attached to an alert or alert group, such as a ticket, a pull request or a link.
18
+ class AlertAttachmentV2 < ApiModelBase
19
+ # ID of the alert group this is attached to. Exactly one of alert_id or alert_group_id is set.
20
+ attr_accessor :alert_group_id
21
+
22
+ # ID of the alert this is attached to. Exactly one of alert_id or alert_group_id is set.
23
+ attr_accessor :alert_id
24
+
25
+ # When it was attached
26
+ attr_accessor :created_at
27
+
28
+ # Unique identifier for the alert attachment
29
+ attr_accessor :id
30
+
31
+ # The ticket or pull request's title, or the link's title
32
+ attr_accessor :title
33
+
34
+ # URL of the attached ticket, pull request or link
35
+ attr_accessor :url
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'alert_group_id' => :'alert_group_id',
41
+ :'alert_id' => :'alert_id',
42
+ :'created_at' => :'created_at',
43
+ :'id' => :'id',
44
+ :'title' => :'title',
45
+ :'url' => :'url'
46
+ }
47
+ end
48
+
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ acceptable_attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'alert_group_id' => :'String',
63
+ :'alert_id' => :'String',
64
+ :'created_at' => :'Time',
65
+ :'id' => :'String',
66
+ :'title' => :'String',
67
+ :'url' => :'String'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IncidentIo::AlertAttachmentV2` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IncidentIo::AlertAttachmentV2`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'alert_group_id')
94
+ self.alert_group_id = attributes[:'alert_group_id']
95
+ end
96
+
97
+ if attributes.key?(:'alert_id')
98
+ self.alert_id = attributes[:'alert_id']
99
+ end
100
+
101
+ if attributes.key?(:'created_at')
102
+ self.created_at = attributes[:'created_at']
103
+ else
104
+ self.created_at = nil
105
+ end
106
+
107
+ if attributes.key?(:'id')
108
+ self.id = attributes[:'id']
109
+ else
110
+ self.id = nil
111
+ end
112
+
113
+ if attributes.key?(:'title')
114
+ self.title = attributes[:'title']
115
+ else
116
+ self.title = nil
117
+ end
118
+
119
+ if attributes.key?(:'url')
120
+ self.url = attributes[:'url']
121
+ else
122
+ self.url = nil
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
130
+ invalid_properties = Array.new
131
+ if @created_at.nil?
132
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
133
+ end
134
+
135
+ if @id.nil?
136
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
137
+ end
138
+
139
+ if @title.nil?
140
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
141
+ end
142
+
143
+ if @url.nil?
144
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if @created_at.nil?
155
+ return false if @id.nil?
156
+ return false if @title.nil?
157
+ return false if @url.nil?
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method with validation
162
+ # @param [Object] created_at Value to be assigned
163
+ def created_at=(created_at)
164
+ if created_at.nil?
165
+ fail ArgumentError, 'created_at cannot be nil'
166
+ end
167
+
168
+ @created_at = created_at
169
+ end
170
+
171
+ # Custom attribute writer method with validation
172
+ # @param [Object] id Value to be assigned
173
+ def id=(id)
174
+ if id.nil?
175
+ fail ArgumentError, 'id cannot be nil'
176
+ end
177
+
178
+ @id = id
179
+ end
180
+
181
+ # Custom attribute writer method with validation
182
+ # @param [Object] title Value to be assigned
183
+ def title=(title)
184
+ if title.nil?
185
+ fail ArgumentError, 'title cannot be nil'
186
+ end
187
+
188
+ @title = title
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] url Value to be assigned
193
+ def url=(url)
194
+ if url.nil?
195
+ fail ArgumentError, 'url cannot be nil'
196
+ end
197
+
198
+ @url = url
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ alert_group_id == o.alert_group_id &&
207
+ alert_id == o.alert_id &&
208
+ created_at == o.created_at &&
209
+ id == o.id &&
210
+ title == o.title &&
211
+ url == o.url
212
+ end
213
+
214
+ # @see the `==` method
215
+ # @param [Object] Object to be compared
216
+ def eql?(o)
217
+ self == o
218
+ end
219
+
220
+ # Calculates hash code according to all attributes.
221
+ # @return [Integer] Hash code
222
+ def hash
223
+ [alert_group_id, alert_id, created_at, id, title, url].hash
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def self.build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ attributes = attributes.transform_keys(&:to_sym)
232
+ transformed_hash = {}
233
+ openapi_types.each_pair do |key, type|
234
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
235
+ transformed_hash["#{key}"] = nil
236
+ elsif type =~ /\AArray<(.*)>/i
237
+ # check to ensure the input is an array given that the attribute
238
+ # is documented as an array but the input is not
239
+ if attributes[attribute_map[key]].is_a?(Array)
240
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
241
+ end
242
+ elsif !attributes[attribute_map[key]].nil?
243
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
244
+ end
245
+ end
246
+ new(transformed_hash)
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ end
266
+
267
+ end