svix 1.23.0 → 1.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/svix/api/endpoint_api.rb +475 -2
  4. data/lib/svix/api/message_api.rb +218 -2
  5. data/lib/svix/api/streams_api.rb +185 -0
  6. data/lib/svix/api/transformation_template_api.rb +195 -24
  7. data/lib/svix/models/auth_token_out.rb +272 -0
  8. data/lib/svix/models/client_secret_jwt_params_in.rb +3 -0
  9. data/lib/svix/models/create_message_token_in.rb +250 -0
  10. data/lib/svix/models/create_stream_in.rb +225 -0
  11. data/lib/svix/models/endpoint_created_event_data.rb +1 -0
  12. data/lib/svix/models/endpoint_deleted_event_data.rb +1 -0
  13. data/lib/svix/models/endpoint_mtls_config_in.rb +235 -0
  14. data/lib/svix/models/endpoint_oauth_config_in.rb +42 -2
  15. data/lib/svix/models/endpoint_updated_event_data.rb +1 -0
  16. data/lib/svix/models/environment_settings_out.rb +15 -4
  17. data/lib/svix/models/event_in.rb +223 -0
  18. data/lib/svix/models/event_out.rb +223 -0
  19. data/lib/svix/models/event_type_from_open_api.rb +280 -0
  20. data/lib/svix/models/event_type_import_open_api_in.rb +13 -1
  21. data/lib/svix/models/event_type_import_open_api_out_data.rb +16 -4
  22. data/lib/svix/models/hubspot_oauth_config_in.rb +223 -0
  23. data/lib/svix/models/{oauth_payload_out.rb → incoming_webhook_payload_out.rb} +3 -3
  24. data/lib/svix/models/kafka_security_protocol_type.rb +38 -0
  25. data/lib/svix/models/list_response_event_out.rb +259 -0
  26. data/lib/svix/models/list_response_sink_out.rb +259 -0
  27. data/lib/svix/models/message_subscriber_auth_token_out.rb +237 -0
  28. data/lib/svix/models/{oauth_payload_in.rb → o_auth_payload_in.rb} +3 -3
  29. data/lib/svix/models/o_auth_payload_out.rb +239 -0
  30. data/lib/svix/models/{oauth2_grant_type.rb → oauth2_grant_type_in.rb} +4 -3
  31. data/lib/svix/models/settings_in.rb +15 -4
  32. data/lib/svix/models/settings_out.rb +15 -4
  33. data/lib/svix/models/sink_in.rb +107 -0
  34. data/lib/svix/models/sink_in_one_of.rb +285 -0
  35. data/lib/svix/models/sink_in_one_of1.rb +313 -0
  36. data/lib/svix/models/sink_in_one_of2.rb +321 -0
  37. data/lib/svix/models/sink_in_one_of3.rb +271 -0
  38. data/lib/svix/models/sink_out.rb +107 -0
  39. data/lib/svix/version.rb +1 -1
  40. metadata +25 -5
@@ -19,6 +19,109 @@ module Svix
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Update Hubspot Oauth Config
23
+ # Create/update endpoint Hubsport OAuth configuration Specific private endpoint just for us, to avoid exposing the Hubspot secret to the client.
24
+ # @param app_id [String] The app's ID or UID
25
+ # @param endpoint_id [String] The ep's ID or UID
26
+ # @param hubspot_oauth_config_in [HubspotOauthConfigIn]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [nil]
29
+ def v1_endpoint_update_hubspot_oauth_config(app_id, endpoint_id, hubspot_oauth_config_in, opts = {})
30
+ v1_endpoint_update_hubspot_oauth_config_with_http_info(app_id, endpoint_id, hubspot_oauth_config_in, opts)
31
+ nil
32
+ end
33
+
34
+ # Update Hubspot Oauth Config
35
+ # Create/update endpoint Hubsport OAuth configuration Specific private endpoint just for us, to avoid exposing the Hubspot secret to the client.
36
+ # @param app_id [String] The app's ID or UID
37
+ # @param endpoint_id [String] The ep's ID or UID
38
+ # @param hubspot_oauth_config_in [HubspotOauthConfigIn]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
41
+ def v1_endpoint_update_hubspot_oauth_config_with_http_info(app_id, endpoint_id, hubspot_oauth_config_in, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config ...'
44
+ end
45
+ # verify the required parameter 'app_id' is set
46
+ if @api_client.config.client_side_validation && app_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config"
48
+ end
49
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
50
+ fail ArgumentError, 'invalid value for "app_id" when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config, the character length must be smaller than or equal to 256.'
51
+ end
52
+
53
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
54
+ fail ArgumentError, 'invalid value for "app_id" when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config, the character length must be great than or equal to 1.'
55
+ end
56
+
57
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
58
+ if @api_client.config.client_side_validation && app_id !~ pattern
59
+ fail ArgumentError, "invalid value for 'app_id' when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config, must conform to the pattern #{pattern}."
60
+ end
61
+
62
+ # verify the required parameter 'endpoint_id' is set
63
+ if @api_client.config.client_side_validation && endpoint_id.nil?
64
+ fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config"
65
+ end
66
+ if @api_client.config.client_side_validation && endpoint_id.to_s.length > 256
67
+ fail ArgumentError, 'invalid value for "endpoint_id" when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config, the character length must be smaller than or equal to 256.'
68
+ end
69
+
70
+ if @api_client.config.client_side_validation && endpoint_id.to_s.length < 1
71
+ fail ArgumentError, 'invalid value for "endpoint_id" when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config, the character length must be great than or equal to 1.'
72
+ end
73
+
74
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
75
+ if @api_client.config.client_side_validation && endpoint_id !~ pattern
76
+ fail ArgumentError, "invalid value for 'endpoint_id' when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config, must conform to the pattern #{pattern}."
77
+ end
78
+
79
+ # verify the required parameter 'hubspot_oauth_config_in' is set
80
+ if @api_client.config.client_side_validation && hubspot_oauth_config_in.nil?
81
+ fail ArgumentError, "Missing the required parameter 'hubspot_oauth_config_in' when calling TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config"
82
+ end
83
+ # resource path
84
+ local_var_path = '/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation-template/oauth/hubspot'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'endpoint_id' + '}', CGI.escape(endpoint_id.to_s))
85
+
86
+ # query parameters
87
+ query_params = opts[:query_params] || {}
88
+
89
+ # header parameters
90
+ header_params = opts[:header_params] || {}
91
+ # HTTP header 'Accept' (if needed)
92
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
93
+ # HTTP header 'Content-Type'
94
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
95
+
96
+ # form parameters
97
+ form_params = opts[:form_params] || {}
98
+
99
+ # http body (model)
100
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(hubspot_oauth_config_in)
101
+
102
+ # return_type
103
+ return_type = opts[:debug_return_type]
104
+
105
+ # auth_names
106
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
107
+
108
+ new_options = opts.merge(
109
+ :operation => :"TransformationTemplateApi.v1_endpoint_update_hubspot_oauth_config",
110
+ :header_params => header_params,
111
+ :query_params => query_params,
112
+ :form_params => form_params,
113
+ :body => post_body,
114
+ :auth_names => auth_names,
115
+ :return_type => return_type
116
+ )
117
+
118
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
119
+ if @api_client.config.debugging
120
+ @api_client.config.logger.debug "API called: TransformationTemplateApi#v1_endpoint_update_hubspot_oauth_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
121
+ end
122
+ return data, status_code, headers
123
+ end
124
+
22
125
  # Create Transformation Template
23
126
  # Create a new transformation template
24
127
  # @param template_in [TemplateIn]
@@ -357,28 +460,28 @@ module Svix
357
460
 
358
461
  # Authorize Discord
359
462
  # Get Discord Incoming webhook URL
360
- # @param oauth_payload_in [OauthPayloadIn]
463
+ # @param o_auth_payload_in [OAuthPayloadIn]
361
464
  # @param [Hash] opts the optional parameters
362
465
  # @option opts [String] :idempotency_key The request&#39;s idempotency key
363
- # @return [OauthPayloadOut]
364
- def v1_transformation_template_oauth_discord(oauth_payload_in, opts = {})
365
- data, _status_code, _headers = v1_transformation_template_oauth_discord_with_http_info(oauth_payload_in, opts)
466
+ # @return [IncomingWebhookPayloadOut]
467
+ def v1_transformation_template_oauth_discord(o_auth_payload_in, opts = {})
468
+ data, _status_code, _headers = v1_transformation_template_oauth_discord_with_http_info(o_auth_payload_in, opts)
366
469
  data
367
470
  end
368
471
 
369
472
  # Authorize Discord
370
473
  # Get Discord Incoming webhook URL
371
- # @param oauth_payload_in [OauthPayloadIn]
474
+ # @param o_auth_payload_in [OAuthPayloadIn]
372
475
  # @param [Hash] opts the optional parameters
373
476
  # @option opts [String] :idempotency_key The request&#39;s idempotency key
374
- # @return [Array<(OauthPayloadOut, Integer, Hash)>] OauthPayloadOut data, response status code and response headers
375
- def v1_transformation_template_oauth_discord_with_http_info(oauth_payload_in, opts = {})
477
+ # @return [Array<(IncomingWebhookPayloadOut, Integer, Hash)>] IncomingWebhookPayloadOut data, response status code and response headers
478
+ def v1_transformation_template_oauth_discord_with_http_info(o_auth_payload_in, opts = {})
376
479
  if @api_client.config.debugging
377
480
  @api_client.config.logger.debug 'Calling API: TransformationTemplateApi.v1_transformation_template_oauth_discord ...'
378
481
  end
379
- # verify the required parameter 'oauth_payload_in' is set
380
- if @api_client.config.client_side_validation && oauth_payload_in.nil?
381
- fail ArgumentError, "Missing the required parameter 'oauth_payload_in' when calling TransformationTemplateApi.v1_transformation_template_oauth_discord"
482
+ # verify the required parameter 'o_auth_payload_in' is set
483
+ if @api_client.config.client_side_validation && o_auth_payload_in.nil?
484
+ fail ArgumentError, "Missing the required parameter 'o_auth_payload_in' when calling TransformationTemplateApi.v1_transformation_template_oauth_discord"
382
485
  end
383
486
  # resource path
384
487
  local_var_path = '/api/v1/transformation-template/oauth/discord'
@@ -398,10 +501,10 @@ module Svix
398
501
  form_params = opts[:form_params] || {}
399
502
 
400
503
  # http body (model)
401
- post_body = opts[:debug_body] || @api_client.object_to_http_body(oauth_payload_in)
504
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(o_auth_payload_in)
402
505
 
403
506
  # return_type
404
- return_type = opts[:debug_return_type] || 'OauthPayloadOut'
507
+ return_type = opts[:debug_return_type] || 'IncomingWebhookPayloadOut'
405
508
 
406
509
  # auth_names
407
510
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']
@@ -423,30 +526,98 @@ module Svix
423
526
  return data, status_code, headers
424
527
  end
425
528
 
529
+ # Authorize Hubspot
530
+ # Get Hubspot access token using authorization code
531
+ # @param o_auth_payload_in [OAuthPayloadIn]
532
+ # @param [Hash] opts the optional parameters
533
+ # @option opts [String] :idempotency_key The request&#39;s idempotency key
534
+ # @return [OAuthPayloadOut]
535
+ def v1_transformation_template_oauth_hubspot(o_auth_payload_in, opts = {})
536
+ data, _status_code, _headers = v1_transformation_template_oauth_hubspot_with_http_info(o_auth_payload_in, opts)
537
+ data
538
+ end
539
+
540
+ # Authorize Hubspot
541
+ # Get Hubspot access token using authorization code
542
+ # @param o_auth_payload_in [OAuthPayloadIn]
543
+ # @param [Hash] opts the optional parameters
544
+ # @option opts [String] :idempotency_key The request&#39;s idempotency key
545
+ # @return [Array<(OAuthPayloadOut, Integer, Hash)>] OAuthPayloadOut data, response status code and response headers
546
+ def v1_transformation_template_oauth_hubspot_with_http_info(o_auth_payload_in, opts = {})
547
+ if @api_client.config.debugging
548
+ @api_client.config.logger.debug 'Calling API: TransformationTemplateApi.v1_transformation_template_oauth_hubspot ...'
549
+ end
550
+ # verify the required parameter 'o_auth_payload_in' is set
551
+ if @api_client.config.client_side_validation && o_auth_payload_in.nil?
552
+ fail ArgumentError, "Missing the required parameter 'o_auth_payload_in' when calling TransformationTemplateApi.v1_transformation_template_oauth_hubspot"
553
+ end
554
+ # resource path
555
+ local_var_path = '/api/v1/transformation-template/oauth/hubspot'
556
+
557
+ # query parameters
558
+ query_params = opts[:query_params] || {}
559
+
560
+ # header parameters
561
+ header_params = opts[:header_params] || {}
562
+ # HTTP header 'Accept' (if needed)
563
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
564
+ # HTTP header 'Content-Type'
565
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
566
+ header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
567
+
568
+ # form parameters
569
+ form_params = opts[:form_params] || {}
570
+
571
+ # http body (model)
572
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(o_auth_payload_in)
573
+
574
+ # return_type
575
+ return_type = opts[:debug_return_type] || 'OAuthPayloadOut'
576
+
577
+ # auth_names
578
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
579
+
580
+ new_options = opts.merge(
581
+ :operation => :"TransformationTemplateApi.v1_transformation_template_oauth_hubspot",
582
+ :header_params => header_params,
583
+ :query_params => query_params,
584
+ :form_params => form_params,
585
+ :body => post_body,
586
+ :auth_names => auth_names,
587
+ :return_type => return_type
588
+ )
589
+
590
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
591
+ if @api_client.config.debugging
592
+ @api_client.config.logger.debug "API called: TransformationTemplateApi#v1_transformation_template_oauth_hubspot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
593
+ end
594
+ return data, status_code, headers
595
+ end
596
+
426
597
  # Authorize Slack
427
598
  # Get Slack Incoming webhook URL
428
- # @param oauth_payload_in [OauthPayloadIn]
599
+ # @param o_auth_payload_in [OAuthPayloadIn]
429
600
  # @param [Hash] opts the optional parameters
430
601
  # @option opts [String] :idempotency_key The request&#39;s idempotency key
431
- # @return [OauthPayloadOut]
432
- def v1_transformation_template_oauth_slack(oauth_payload_in, opts = {})
433
- data, _status_code, _headers = v1_transformation_template_oauth_slack_with_http_info(oauth_payload_in, opts)
602
+ # @return [IncomingWebhookPayloadOut]
603
+ def v1_transformation_template_oauth_slack(o_auth_payload_in, opts = {})
604
+ data, _status_code, _headers = v1_transformation_template_oauth_slack_with_http_info(o_auth_payload_in, opts)
434
605
  data
435
606
  end
436
607
 
437
608
  # Authorize Slack
438
609
  # Get Slack Incoming webhook URL
439
- # @param oauth_payload_in [OauthPayloadIn]
610
+ # @param o_auth_payload_in [OAuthPayloadIn]
440
611
  # @param [Hash] opts the optional parameters
441
612
  # @option opts [String] :idempotency_key The request&#39;s idempotency key
442
- # @return [Array<(OauthPayloadOut, Integer, Hash)>] OauthPayloadOut data, response status code and response headers
443
- def v1_transformation_template_oauth_slack_with_http_info(oauth_payload_in, opts = {})
613
+ # @return [Array<(IncomingWebhookPayloadOut, Integer, Hash)>] IncomingWebhookPayloadOut data, response status code and response headers
614
+ def v1_transformation_template_oauth_slack_with_http_info(o_auth_payload_in, opts = {})
444
615
  if @api_client.config.debugging
445
616
  @api_client.config.logger.debug 'Calling API: TransformationTemplateApi.v1_transformation_template_oauth_slack ...'
446
617
  end
447
- # verify the required parameter 'oauth_payload_in' is set
448
- if @api_client.config.client_side_validation && oauth_payload_in.nil?
449
- fail ArgumentError, "Missing the required parameter 'oauth_payload_in' when calling TransformationTemplateApi.v1_transformation_template_oauth_slack"
618
+ # verify the required parameter 'o_auth_payload_in' is set
619
+ if @api_client.config.client_side_validation && o_auth_payload_in.nil?
620
+ fail ArgumentError, "Missing the required parameter 'o_auth_payload_in' when calling TransformationTemplateApi.v1_transformation_template_oauth_slack"
450
621
  end
451
622
  # resource path
452
623
  local_var_path = '/api/v1/transformation-template/oauth/slack'
@@ -466,10 +637,10 @@ module Svix
466
637
  form_params = opts[:form_params] || {}
467
638
 
468
639
  # http body (model)
469
- post_body = opts[:debug_body] || @api_client.object_to_http_body(oauth_payload_in)
640
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(o_auth_payload_in)
470
641
 
471
642
  # return_type
472
- return_type = opts[:debug_return_type] || 'OauthPayloadOut'
643
+ return_type = opts[:debug_return_type] || 'IncomingWebhookPayloadOut'
473
644
 
474
645
  # auth_names
475
646
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class AuthTokenOut
18
+ attr_accessor :created_at
19
+
20
+ attr_accessor :expires_at
21
+
22
+ # The key's ID
23
+ attr_accessor :id
24
+
25
+ attr_accessor :name
26
+
27
+ attr_accessor :token
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'created_at' => :'createdAt',
33
+ :'expires_at' => :'expiresAt',
34
+ :'id' => :'id',
35
+ :'name' => :'name',
36
+ :'token' => :'token'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'created_at' => :'Time',
49
+ :'expires_at' => :'Time',
50
+ :'id' => :'String',
51
+ :'name' => :'String',
52
+ :'token' => :'String'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ :'expires_at',
60
+ :'name',
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::AuthTokenOut` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::AuthTokenOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'created_at')
80
+ self.created_at = attributes[:'created_at']
81
+ end
82
+
83
+ if attributes.key?(:'expires_at')
84
+ self.expires_at = attributes[:'expires_at']
85
+ end
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ end
90
+
91
+ if attributes.key?(:'name')
92
+ self.name = attributes[:'name']
93
+ end
94
+
95
+ if attributes.key?(:'token')
96
+ self.token = attributes[:'token']
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ if @created_at.nil?
105
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
106
+ end
107
+
108
+ if @id.nil?
109
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
110
+ end
111
+
112
+ if @token.nil?
113
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
114
+ end
115
+
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ return false if @created_at.nil?
123
+ return false if @id.nil?
124
+ return false if @token.nil?
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ created_at == o.created_at &&
134
+ expires_at == o.expires_at &&
135
+ id == o.id &&
136
+ name == o.name &&
137
+ token == o.token
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [created_at, expires_at, id, name, token].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ new.build_from_hash(attributes)
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def build_from_hash(attributes)
163
+ return nil unless attributes.is_a?(Hash)
164
+ self.class.openapi_types.each_pair do |key, type|
165
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
166
+ self.send("#{key}=", nil)
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
171
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
172
+ end
173
+ elsif !attributes[self.class.attribute_map[key]].nil?
174
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
175
+ end
176
+ end
177
+
178
+ self
179
+ end
180
+
181
+ # Deserializes the data based on type
182
+ # @param string type Data type
183
+ # @param string value Value to be deserialized
184
+ # @return [Object] Deserialized data
185
+ def _deserialize(type, value)
186
+ case type.to_sym
187
+ when :Time
188
+ Time.parse(value)
189
+ when :Date
190
+ Date.parse(value)
191
+ when :String
192
+ value.to_s
193
+ when :Integer
194
+ value.to_i
195
+ when :Float
196
+ value.to_f
197
+ when :Boolean
198
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
199
+ true
200
+ else
201
+ false
202
+ end
203
+ when :Object
204
+ # generic object (usually a Hash), return directly
205
+ value
206
+ when /\AArray<(?<inner_type>.+)>\z/
207
+ inner_type = Regexp.last_match[:inner_type]
208
+ value.map { |v| _deserialize(inner_type, v) }
209
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
210
+ k_type = Regexp.last_match[:k_type]
211
+ v_type = Regexp.last_match[:v_type]
212
+ {}.tap do |hash|
213
+ value.each do |k, v|
214
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
215
+ end
216
+ end
217
+ else # model
218
+ # models (e.g. Pet) or oneOf
219
+ klass = Svix.const_get(type)
220
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+
272
+ end
@@ -15,12 +15,15 @@ require 'time'
15
15
 
16
16
  module Svix
17
17
  class ClientSecretJwtParamsIn
18
+ # The base64-encoded secret used for signing the JWT.
18
19
  attr_accessor :secret_base64
19
20
 
21
+ # Optional secret identifier. If supplied, this will be populated in the JWT header in the `kid` field.
20
22
  attr_accessor :secret_id
21
23
 
22
24
  attr_accessor :signing_algorithm
23
25
 
26
+ # Optional number of seconds after which the JWT should expire. Defaults to 300 seconds.
24
27
  attr_accessor :token_expiry_secs
25
28
 
26
29
  # Attribute mapping from ruby-style variable name to JSON key.