timelogic-api 1.0.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 +7 -0
- data/README.md +188 -0
- data/docs/ApiError.md +22 -0
- data/docs/BulkError.md +24 -0
- data/docs/CalendarResponse.md +48 -0
- data/docs/DiffEndpointRef.md +18 -0
- data/docs/DiffResponse.md +36 -0
- data/docs/DstResponse.md +42 -0
- data/docs/ElapsedResponse.md +32 -0
- data/docs/ErrorResponse.md +22 -0
- data/docs/GetCurrentTime200Response.md +49 -0
- data/docs/GetTimezone200Response.md +49 -0
- data/docs/JwkKey.md +28 -0
- data/docs/JwksResponse.md +18 -0
- data/docs/TimeApi.md +1093 -0
- data/docs/TimePayload.md +38 -0
- data/docs/TimePayloadBulkItem.md +49 -0
- data/docs/TimePayloadBulkResponse.md +15 -0
- data/docs/TimezoneMatch.md +42 -0
- data/docs/TimezoneOffsetResponse.md +44 -0
- data/docs/TimezoneResolvedResponse.md +42 -0
- data/docs/UtilityApi.md +74 -0
- data/lib/timelogic-api/api/time_api.rb +1344 -0
- data/lib/timelogic-api/api/utility_api.rb +82 -0
- data/lib/timelogic-api/api_client.rb +394 -0
- data/lib/timelogic-api/api_error.rb +58 -0
- data/lib/timelogic-api/configuration.rb +353 -0
- data/lib/timelogic-api/models/api_error.rb +282 -0
- data/lib/timelogic-api/models/bulk_error.rb +271 -0
- data/lib/timelogic-api/models/calendar_response.rb +474 -0
- data/lib/timelogic-api/models/diff_endpoint_ref.rb +222 -0
- data/lib/timelogic-api/models/diff_response.rb +386 -0
- data/lib/timelogic-api/models/dst_response.rb +427 -0
- data/lib/timelogic-api/models/elapsed_response.rb +354 -0
- data/lib/timelogic-api/models/error_response.rb +247 -0
- data/lib/timelogic-api/models/get_current_time200_response.rb +105 -0
- data/lib/timelogic-api/models/get_timezone200_response.rb +105 -0
- data/lib/timelogic-api/models/jwk_key.rb +371 -0
- data/lib/timelogic-api/models/jwks_response.rb +223 -0
- data/lib/timelogic-api/models/time_payload.rb +395 -0
- data/lib/timelogic-api/models/time_payload_bulk_item.rb +106 -0
- data/lib/timelogic-api/models/time_payload_bulk_response.rb +210 -0
- data/lib/timelogic-api/models/timezone_match.rb +437 -0
- data/lib/timelogic-api/models/timezone_offset_response.rb +452 -0
- data/lib/timelogic-api/models/timezone_resolved_response.rb +434 -0
- data/lib/timelogic-api/transport_configuration.rb +34 -0
- data/lib/timelogic-api/version.rb +7 -0
- data/lib/timelogic-api.rb +63 -0
- metadata +134 -0
|
@@ -0,0 +1,1344 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#TimeLogic API | A World Time API
|
|
3
|
+
|
|
4
|
+
# Official public API contract for TimeLogic API.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.10.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module TimeLogic::Api
|
|
16
|
+
class TimeApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Add modifiers to a timestamp
|
|
23
|
+
# Adds `seconds`, `minutes`, `hours`, and `days` to an optional base timestamp. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` - if no input timestamp is provided, the base timestamp defaults to the request time Modifiers: - `seconds=30` - `minutes=15` - `hours=2` - `days=7` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` - `utc=true` Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is not supported on this route Examples: - `/v1/time/add?iso=2026-04-16T09:00:00&source_tz=America/New_York&days=1&tz=Europe/London` - `/v1/time/add?minutes=30&utc=true`
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @option opts [Integer] :unix
|
|
26
|
+
# @option opts [Integer] :unix_ms
|
|
27
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
28
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
29
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
30
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
31
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
32
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
33
|
+
# @option opts [Integer] :seconds
|
|
34
|
+
# @option opts [Integer] :minutes
|
|
35
|
+
# @option opts [Integer] :hours
|
|
36
|
+
# @option opts [Integer] :days
|
|
37
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
38
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
39
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
40
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
41
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
42
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
43
|
+
# @option opts [Boolean] :utc Set to `true` to force UTC on routes that support it.
|
|
44
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
45
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
46
|
+
# @return [TimePayload]
|
|
47
|
+
def add_time(opts = {})
|
|
48
|
+
data, _status_code, _headers = add_time_with_http_info(opts)
|
|
49
|
+
data
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Add modifiers to a timestamp
|
|
53
|
+
# Adds `seconds`, `minutes`, `hours`, and `days` to an optional base timestamp. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` - if no input timestamp is provided, the base timestamp defaults to the request time Modifiers: - `seconds=30` - `minutes=15` - `hours=2` - `days=7` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` - `utc=true` Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is not supported on this route Examples: - `/v1/time/add?iso=2026-04-16T09:00:00&source_tz=America/New_York&days=1&tz=Europe/London` - `/v1/time/add?minutes=30&utc=true`
|
|
54
|
+
# @param [Hash] opts the optional parameters
|
|
55
|
+
# @option opts [Integer] :unix
|
|
56
|
+
# @option opts [Integer] :unix_ms
|
|
57
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
58
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
59
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
60
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
61
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
62
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
63
|
+
# @option opts [Integer] :seconds
|
|
64
|
+
# @option opts [Integer] :minutes
|
|
65
|
+
# @option opts [Integer] :hours
|
|
66
|
+
# @option opts [Integer] :days
|
|
67
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
68
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
69
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
70
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
71
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
72
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
73
|
+
# @option opts [Boolean] :utc Set to `true` to force UTC on routes that support it.
|
|
74
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
75
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
76
|
+
# @return [Array<(TimePayload, Integer, Hash)>] TimePayload data, response status code and response headers
|
|
77
|
+
def add_time_with_http_info(opts = {})
|
|
78
|
+
if @api_client.config.debugging
|
|
79
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.add_time ...'
|
|
80
|
+
end
|
|
81
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
|
|
82
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.add_time, must be smaller than or equal to 90.'
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
|
|
86
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.add_time, must be greater than or equal to -90.'
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
|
|
90
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.add_time, must be smaller than or equal to 180.'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
|
|
94
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.add_time, must be greater than or equal to -180.'
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
98
|
+
if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
|
|
99
|
+
fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.add_time, must conform to the pattern #{pattern}."
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
103
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.add_time, the character length must be smaller than or equal to 64.'
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
107
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.add_time, must be smaller than or equal to 90.'
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
111
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.add_time, must be greater than or equal to -90.'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
115
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.add_time, must be smaller than or equal to 180.'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
119
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.add_time, must be greater than or equal to -180.'
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
123
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
124
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.add_time, must conform to the pattern #{pattern}."
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# resource path
|
|
128
|
+
local_var_path = '/v1/time/add'
|
|
129
|
+
|
|
130
|
+
# query parameters
|
|
131
|
+
query_params = opts[:query_params] || {}
|
|
132
|
+
query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
|
|
133
|
+
query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
|
|
134
|
+
query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
|
|
135
|
+
query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
|
|
136
|
+
query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
|
|
137
|
+
query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
|
|
138
|
+
query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
|
|
139
|
+
query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
|
|
140
|
+
query_params[:'seconds'] = opts[:'seconds'] if !opts[:'seconds'].nil?
|
|
141
|
+
query_params[:'minutes'] = opts[:'minutes'] if !opts[:'minutes'].nil?
|
|
142
|
+
query_params[:'hours'] = opts[:'hours'] if !opts[:'hours'].nil?
|
|
143
|
+
query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
|
|
144
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
145
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
146
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
147
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
148
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
149
|
+
query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
|
|
150
|
+
query_params[:'utc'] = opts[:'utc'] if !opts[:'utc'].nil?
|
|
151
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
152
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
153
|
+
|
|
154
|
+
# header parameters
|
|
155
|
+
header_params = opts[:header_params] || {}
|
|
156
|
+
# HTTP header 'Accept' (if needed)
|
|
157
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
158
|
+
|
|
159
|
+
# form parameters
|
|
160
|
+
form_params = opts[:form_params] || {}
|
|
161
|
+
|
|
162
|
+
# http body (model)
|
|
163
|
+
post_body = opts[:debug_body]
|
|
164
|
+
|
|
165
|
+
# return_type
|
|
166
|
+
return_type = opts[:debug_return_type] || 'TimePayload'
|
|
167
|
+
|
|
168
|
+
# auth_names
|
|
169
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
170
|
+
|
|
171
|
+
new_options = opts.merge(
|
|
172
|
+
:operation => :"TimeApi.add_time",
|
|
173
|
+
:header_params => header_params,
|
|
174
|
+
:query_params => query_params,
|
|
175
|
+
:form_params => form_params,
|
|
176
|
+
:body => post_body,
|
|
177
|
+
:auth_names => auth_names,
|
|
178
|
+
:return_type => return_type
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
182
|
+
if @api_client.config.debugging
|
|
183
|
+
@api_client.config.logger.debug "API called: TimeApi#add_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
184
|
+
end
|
|
185
|
+
return data, status_code, headers
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Convert a timestamp into a target timezone or offset
|
|
189
|
+
# Converts one required input timestamp into a single target or a bulk array. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` - `utc=true` Incompatible combinations: - exactly one input timestamp form - exactly one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is allowed only through one comma-separated `tz`, `ip`, or `offset` selector Examples: - Single target: `/v1/time/convert?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London` - Bulk target set: `/v1/time/convert?unix=1711300000&offset=-04:00,+00:00,+09:00`
|
|
190
|
+
# @param [Hash] opts the optional parameters
|
|
191
|
+
# @option opts [Integer] :unix
|
|
192
|
+
# @option opts [Integer] :unix_ms
|
|
193
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
194
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
195
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
196
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
197
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
198
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
199
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
200
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
201
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
202
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
203
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
204
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
205
|
+
# @option opts [Boolean] :utc Set to `true` to force UTC on routes that support it.
|
|
206
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
207
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
208
|
+
# @return [GetCurrentTime200Response]
|
|
209
|
+
def convert_time(opts = {})
|
|
210
|
+
data, _status_code, _headers = convert_time_with_http_info(opts)
|
|
211
|
+
data
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Convert a timestamp into a target timezone or offset
|
|
215
|
+
# Converts one required input timestamp into a single target or a bulk array. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` - `utc=true` Incompatible combinations: - exactly one input timestamp form - exactly one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is allowed only through one comma-separated `tz`, `ip`, or `offset` selector Examples: - Single target: `/v1/time/convert?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London` - Bulk target set: `/v1/time/convert?unix=1711300000&offset=-04:00,+00:00,+09:00`
|
|
216
|
+
# @param [Hash] opts the optional parameters
|
|
217
|
+
# @option opts [Integer] :unix
|
|
218
|
+
# @option opts [Integer] :unix_ms
|
|
219
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
220
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
221
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
222
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
223
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
224
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
225
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
226
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
227
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
228
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
229
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
230
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
231
|
+
# @option opts [Boolean] :utc Set to `true` to force UTC on routes that support it.
|
|
232
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
233
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
234
|
+
# @return [Array<(GetCurrentTime200Response, Integer, Hash)>] GetCurrentTime200Response data, response status code and response headers
|
|
235
|
+
def convert_time_with_http_info(opts = {})
|
|
236
|
+
if @api_client.config.debugging
|
|
237
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.convert_time ...'
|
|
238
|
+
end
|
|
239
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
|
|
240
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.convert_time, must be smaller than or equal to 90.'
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
|
|
244
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.convert_time, must be greater than or equal to -90.'
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
|
|
248
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.convert_time, must be smaller than or equal to 180.'
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
|
|
252
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.convert_time, must be greater than or equal to -180.'
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
256
|
+
if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
|
|
257
|
+
fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.convert_time, must conform to the pattern #{pattern}."
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
261
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.convert_time, the character length must be smaller than or equal to 64.'
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
265
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.convert_time, must be smaller than or equal to 90.'
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
269
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.convert_time, must be greater than or equal to -90.'
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
273
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.convert_time, must be smaller than or equal to 180.'
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
277
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.convert_time, must be greater than or equal to -180.'
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
281
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
282
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.convert_time, must conform to the pattern #{pattern}."
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# resource path
|
|
286
|
+
local_var_path = '/v1/time/convert'
|
|
287
|
+
|
|
288
|
+
# query parameters
|
|
289
|
+
query_params = opts[:query_params] || {}
|
|
290
|
+
query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
|
|
291
|
+
query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
|
|
292
|
+
query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
|
|
293
|
+
query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
|
|
294
|
+
query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
|
|
295
|
+
query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
|
|
296
|
+
query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
|
|
297
|
+
query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
|
|
298
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
299
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
300
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
301
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
302
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
303
|
+
query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
|
|
304
|
+
query_params[:'utc'] = opts[:'utc'] if !opts[:'utc'].nil?
|
|
305
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
306
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
307
|
+
|
|
308
|
+
# header parameters
|
|
309
|
+
header_params = opts[:header_params] || {}
|
|
310
|
+
# HTTP header 'Accept' (if needed)
|
|
311
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
312
|
+
|
|
313
|
+
# form parameters
|
|
314
|
+
form_params = opts[:form_params] || {}
|
|
315
|
+
|
|
316
|
+
# http body (model)
|
|
317
|
+
post_body = opts[:debug_body]
|
|
318
|
+
|
|
319
|
+
# return_type
|
|
320
|
+
return_type = opts[:debug_return_type] || 'GetCurrentTime200Response'
|
|
321
|
+
|
|
322
|
+
# auth_names
|
|
323
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
324
|
+
|
|
325
|
+
new_options = opts.merge(
|
|
326
|
+
:operation => :"TimeApi.convert_time",
|
|
327
|
+
:header_params => header_params,
|
|
328
|
+
:query_params => query_params,
|
|
329
|
+
:form_params => form_params,
|
|
330
|
+
:body => post_body,
|
|
331
|
+
:auth_names => auth_names,
|
|
332
|
+
:return_type => return_type
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
336
|
+
if @api_client.config.debugging
|
|
337
|
+
@api_client.config.logger.debug "API called: TimeApi#convert_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
338
|
+
end
|
|
339
|
+
return data, status_code, headers
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Difference between two instants
|
|
343
|
+
# Computes the duration between `from` and `to`. Required query fields: `from` and `to` only. Do not send every optional companion field. For each side, choose one supported specifier form. A `from_*` or `to_*` companion is allowed only when that side uses `iso=...` with no explicit offset; use at most one companion selector, except that coordinate input requires its paired latitude and longitude. `from` and `to` are embedded specifier strings. Accepted specifier forms: - `from=now` - `from=unix=1711300000` - `from=unix_ms=1711300000000` - `from=iso=2026-04-16T09:00:00` - `from=tz=America/New_York` - `from=ip=8.8.8.8` - `from=offset=-05:00` - the same forms are accepted for `to` Timezone hint pairings: - `from_tz` only with `from=iso=...` that has no explicit offset - `from_ip`, `from_lat`/`from_lon`, and `from_offset` only with `from=iso=...` that has no explicit offset - `to_tz` only with `to=iso=...` that has no explicit offset - `to_ip`, `to_lat`/`to_lon`, and `to_offset` only with `to=iso=...` that has no explicit offset Selector semantics: - `tz=...`, `ip=...`, and `offset=...` inside `from` or `to` mean the current request-time instant resolved through that selector - those selector forms do not represent an arbitrary local wall-clock time - returned duration magnitudes are absolute; use `direction` to see whether `to` is after, before, or the same instant as `from` Business-day rules: - `holiday_country` and `holiday_subdivision` require `business_days=true` - `holiday_subdivision` also requires `holiday_country` Examples: - Selector-current instant: `/v1/time/diff?from=unix=1711300000&to=tz=America/New_York` - Wall-clock pairing: `/v1/time/diff?from=iso=2026-04-16T09:00:00&from_tz=America/New_York&to=iso=2026-04-16T09:00:00&to_tz=Europe/London` - Wall-clock via selector: `/v1/time/diff?from=iso=2026-01-01T12:00:00&from_ip=8.8.8.8&to=iso=2026-01-01T12:00:00&to_offset=-05:00`
|
|
344
|
+
# @param from [String] Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `from=iso=...` together with one of `from_tz`, `from_ip`, `from_lat`+`from_lon`, or `from_offset`.
|
|
345
|
+
# @param to [String] Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `to=iso=...` together with one of `to_tz`, `to_ip`, `to_lat`+`to_lon`, or `to_offset`.
|
|
346
|
+
# @param [Hash] opts the optional parameters
|
|
347
|
+
# @option opts [String] :from_tz Used only with `from=iso=...` when the ISO value has no explicit offset.
|
|
348
|
+
# @option opts [String] :from_ip Used only with `from=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
349
|
+
# @option opts [Float] :from_lat Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
350
|
+
# @option opts [Float] :from_lon Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lat`.
|
|
351
|
+
# @option opts [String] :from_offset Used only with `from=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
352
|
+
# @option opts [String] :to_tz Used only with `to=iso=...` when the ISO value has no explicit offset.
|
|
353
|
+
# @option opts [String] :to_ip Used only with `to=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
354
|
+
# @option opts [Float] :to_lat Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
355
|
+
# @option opts [Float] :to_lon Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lat`.
|
|
356
|
+
# @option opts [String] :to_offset Used only with `to=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
357
|
+
# @option opts [String] :format Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.
|
|
358
|
+
# @option opts [Boolean] :business_days Set to `true` to enable weekday/business-day counting.
|
|
359
|
+
# @option opts [String] :holiday_country ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.
|
|
360
|
+
# @option opts [String] :holiday_subdivision Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.
|
|
361
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
362
|
+
# @return [DiffResponse]
|
|
363
|
+
def diff_time(from, to, opts = {})
|
|
364
|
+
data, _status_code, _headers = diff_time_with_http_info(from, to, opts)
|
|
365
|
+
data
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Difference between two instants
|
|
369
|
+
# Computes the duration between `from` and `to`. Required query fields: `from` and `to` only. Do not send every optional companion field. For each side, choose one supported specifier form. A `from_*` or `to_*` companion is allowed only when that side uses `iso=...` with no explicit offset; use at most one companion selector, except that coordinate input requires its paired latitude and longitude. `from` and `to` are embedded specifier strings. Accepted specifier forms: - `from=now` - `from=unix=1711300000` - `from=unix_ms=1711300000000` - `from=iso=2026-04-16T09:00:00` - `from=tz=America/New_York` - `from=ip=8.8.8.8` - `from=offset=-05:00` - the same forms are accepted for `to` Timezone hint pairings: - `from_tz` only with `from=iso=...` that has no explicit offset - `from_ip`, `from_lat`/`from_lon`, and `from_offset` only with `from=iso=...` that has no explicit offset - `to_tz` only with `to=iso=...` that has no explicit offset - `to_ip`, `to_lat`/`to_lon`, and `to_offset` only with `to=iso=...` that has no explicit offset Selector semantics: - `tz=...`, `ip=...`, and `offset=...` inside `from` or `to` mean the current request-time instant resolved through that selector - those selector forms do not represent an arbitrary local wall-clock time - returned duration magnitudes are absolute; use `direction` to see whether `to` is after, before, or the same instant as `from` Business-day rules: - `holiday_country` and `holiday_subdivision` require `business_days=true` - `holiday_subdivision` also requires `holiday_country` Examples: - Selector-current instant: `/v1/time/diff?from=unix=1711300000&to=tz=America/New_York` - Wall-clock pairing: `/v1/time/diff?from=iso=2026-04-16T09:00:00&from_tz=America/New_York&to=iso=2026-04-16T09:00:00&to_tz=Europe/London` - Wall-clock via selector: `/v1/time/diff?from=iso=2026-01-01T12:00:00&from_ip=8.8.8.8&to=iso=2026-01-01T12:00:00&to_offset=-05:00`
|
|
370
|
+
# @param from [String] Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `from=iso=...` together with one of `from_tz`, `from_ip`, `from_lat`+`from_lon`, or `from_offset`.
|
|
371
|
+
# @param to [String] Time specifier. Supported forms are `now`, `unix=<seconds>`, `unix_ms=<milliseconds>`, `iso=<ISO-8601>`, `offset=±HH:MM`, `tz=<IANA timezone>`, and `ip=<IP address>`. For `tz=...`, `ip=...`, and `offset=...`, the specifier means the current request-time instant resolved through that selector. To express a local wall-clock time, use `to=iso=...` together with one of `to_tz`, `to_ip`, `to_lat`+`to_lon`, or `to_offset`.
|
|
372
|
+
# @param [Hash] opts the optional parameters
|
|
373
|
+
# @option opts [String] :from_tz Used only with `from=iso=...` when the ISO value has no explicit offset.
|
|
374
|
+
# @option opts [String] :from_ip Used only with `from=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
375
|
+
# @option opts [Float] :from_lat Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
376
|
+
# @option opts [Float] :from_lon Used only with `from=iso=...` when the ISO value has no explicit offset. Provide together with `from_lat`.
|
|
377
|
+
# @option opts [String] :from_offset Used only with `from=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
378
|
+
# @option opts [String] :to_tz Used only with `to=iso=...` when the ISO value has no explicit offset.
|
|
379
|
+
# @option opts [String] :to_ip Used only with `to=iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
380
|
+
# @option opts [Float] :to_lat Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
381
|
+
# @option opts [Float] :to_lon Used only with `to=iso=...` when the ISO value has no explicit offset. Provide together with `to_lat`.
|
|
382
|
+
# @option opts [String] :to_offset Used only with `to=iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
383
|
+
# @option opts [String] :format Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.
|
|
384
|
+
# @option opts [Boolean] :business_days Set to `true` to enable weekday/business-day counting.
|
|
385
|
+
# @option opts [String] :holiday_country ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.
|
|
386
|
+
# @option opts [String] :holiday_subdivision Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.
|
|
387
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
388
|
+
# @return [Array<(DiffResponse, Integer, Hash)>] DiffResponse data, response status code and response headers
|
|
389
|
+
def diff_time_with_http_info(from, to, opts = {})
|
|
390
|
+
if @api_client.config.debugging
|
|
391
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.diff_time ...'
|
|
392
|
+
end
|
|
393
|
+
# verify the required parameter 'from' is set
|
|
394
|
+
if @api_client.config.client_side_validation && from.nil?
|
|
395
|
+
fail ArgumentError, "Missing the required parameter 'from' when calling TimeApi.diff_time"
|
|
396
|
+
end
|
|
397
|
+
# verify the required parameter 'to' is set
|
|
398
|
+
if @api_client.config.client_side_validation && to.nil?
|
|
399
|
+
fail ArgumentError, "Missing the required parameter 'to' when calling TimeApi.diff_time"
|
|
400
|
+
end
|
|
401
|
+
if @api_client.config.client_side_validation && !opts[:'from_lat'].nil? && opts[:'from_lat'] > 90
|
|
402
|
+
fail ArgumentError, 'invalid value for "opts[:"from_lat"]" when calling TimeApi.diff_time, must be smaller than or equal to 90.'
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
if @api_client.config.client_side_validation && !opts[:'from_lat'].nil? && opts[:'from_lat'] < -90
|
|
406
|
+
fail ArgumentError, 'invalid value for "opts[:"from_lat"]" when calling TimeApi.diff_time, must be greater than or equal to -90.'
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
if @api_client.config.client_side_validation && !opts[:'from_lon'].nil? && opts[:'from_lon'] > 180
|
|
410
|
+
fail ArgumentError, 'invalid value for "opts[:"from_lon"]" when calling TimeApi.diff_time, must be smaller than or equal to 180.'
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
if @api_client.config.client_side_validation && !opts[:'from_lon'].nil? && opts[:'from_lon'] < -180
|
|
414
|
+
fail ArgumentError, 'invalid value for "opts[:"from_lon"]" when calling TimeApi.diff_time, must be greater than or equal to -180.'
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
418
|
+
if @api_client.config.client_side_validation && !opts[:'from_offset'].nil? && opts[:'from_offset'] !~ pattern
|
|
419
|
+
fail ArgumentError, "invalid value for 'opts[:\"from_offset\"]' when calling TimeApi.diff_time, must conform to the pattern #{pattern}."
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
if @api_client.config.client_side_validation && !opts[:'to_lat'].nil? && opts[:'to_lat'] > 90
|
|
423
|
+
fail ArgumentError, 'invalid value for "opts[:"to_lat"]" when calling TimeApi.diff_time, must be smaller than or equal to 90.'
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
if @api_client.config.client_side_validation && !opts[:'to_lat'].nil? && opts[:'to_lat'] < -90
|
|
427
|
+
fail ArgumentError, 'invalid value for "opts[:"to_lat"]" when calling TimeApi.diff_time, must be greater than or equal to -90.'
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
if @api_client.config.client_side_validation && !opts[:'to_lon'].nil? && opts[:'to_lon'] > 180
|
|
431
|
+
fail ArgumentError, 'invalid value for "opts[:"to_lon"]" when calling TimeApi.diff_time, must be smaller than or equal to 180.'
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
if @api_client.config.client_side_validation && !opts[:'to_lon'].nil? && opts[:'to_lon'] < -180
|
|
435
|
+
fail ArgumentError, 'invalid value for "opts[:"to_lon"]" when calling TimeApi.diff_time, must be greater than or equal to -180.'
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
439
|
+
if @api_client.config.client_side_validation && !opts[:'to_offset'].nil? && opts[:'to_offset'] !~ pattern
|
|
440
|
+
fail ArgumentError, "invalid value for 'opts[:\"to_offset\"]' when calling TimeApi.diff_time, must conform to the pattern #{pattern}."
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
pattern = Regexp.new(/^[A-Z]{2}$/)
|
|
444
|
+
if @api_client.config.client_side_validation && !opts[:'holiday_country'].nil? && opts[:'holiday_country'] !~ pattern
|
|
445
|
+
fail ArgumentError, "invalid value for 'opts[:\"holiday_country\"]' when calling TimeApi.diff_time, must conform to the pattern #{pattern}."
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# resource path
|
|
449
|
+
local_var_path = '/v1/time/diff'
|
|
450
|
+
|
|
451
|
+
# query parameters
|
|
452
|
+
query_params = opts[:query_params] || {}
|
|
453
|
+
query_params[:'from'] = from
|
|
454
|
+
query_params[:'to'] = to
|
|
455
|
+
query_params[:'from_tz'] = opts[:'from_tz'] if !opts[:'from_tz'].nil?
|
|
456
|
+
query_params[:'from_ip'] = opts[:'from_ip'] if !opts[:'from_ip'].nil?
|
|
457
|
+
query_params[:'from_lat'] = opts[:'from_lat'] if !opts[:'from_lat'].nil?
|
|
458
|
+
query_params[:'from_lon'] = opts[:'from_lon'] if !opts[:'from_lon'].nil?
|
|
459
|
+
query_params[:'from_offset'] = opts[:'from_offset'] if !opts[:'from_offset'].nil?
|
|
460
|
+
query_params[:'to_tz'] = opts[:'to_tz'] if !opts[:'to_tz'].nil?
|
|
461
|
+
query_params[:'to_ip'] = opts[:'to_ip'] if !opts[:'to_ip'].nil?
|
|
462
|
+
query_params[:'to_lat'] = opts[:'to_lat'] if !opts[:'to_lat'].nil?
|
|
463
|
+
query_params[:'to_lon'] = opts[:'to_lon'] if !opts[:'to_lon'].nil?
|
|
464
|
+
query_params[:'to_offset'] = opts[:'to_offset'] if !opts[:'to_offset'].nil?
|
|
465
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
466
|
+
query_params[:'business_days'] = opts[:'business_days'] if !opts[:'business_days'].nil?
|
|
467
|
+
query_params[:'holiday_country'] = opts[:'holiday_country'] if !opts[:'holiday_country'].nil?
|
|
468
|
+
query_params[:'holiday_subdivision'] = opts[:'holiday_subdivision'] if !opts[:'holiday_subdivision'].nil?
|
|
469
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
470
|
+
|
|
471
|
+
# header parameters
|
|
472
|
+
header_params = opts[:header_params] || {}
|
|
473
|
+
# HTTP header 'Accept' (if needed)
|
|
474
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
475
|
+
|
|
476
|
+
# form parameters
|
|
477
|
+
form_params = opts[:form_params] || {}
|
|
478
|
+
|
|
479
|
+
# http body (model)
|
|
480
|
+
post_body = opts[:debug_body]
|
|
481
|
+
|
|
482
|
+
# return_type
|
|
483
|
+
return_type = opts[:debug_return_type] || 'DiffResponse'
|
|
484
|
+
|
|
485
|
+
# auth_names
|
|
486
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
487
|
+
|
|
488
|
+
new_options = opts.merge(
|
|
489
|
+
:operation => :"TimeApi.diff_time",
|
|
490
|
+
:header_params => header_params,
|
|
491
|
+
:query_params => query_params,
|
|
492
|
+
:form_params => form_params,
|
|
493
|
+
:body => post_body,
|
|
494
|
+
:auth_names => auth_names,
|
|
495
|
+
:return_type => return_type
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
499
|
+
if @api_client.config.debugging
|
|
500
|
+
@api_client.config.logger.debug "API called: TimeApi#diff_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
501
|
+
end
|
|
502
|
+
return data, status_code, headers
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
# Calendar projection for a target instant
|
|
506
|
+
# Returns calendar fields for an optional timestamp and target. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` - if no input timestamp is provided, the request time is used Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` Additional flags: - `week=true` adds `week_number` Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is not supported on this route Examples: - `/v1/time/calendar?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London&week=true` - `/v1/time/calendar?unix=1711300000&auto_tz=true`
|
|
507
|
+
# @param [Hash] opts the optional parameters
|
|
508
|
+
# @option opts [Integer] :unix
|
|
509
|
+
# @option opts [Integer] :unix_ms
|
|
510
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
511
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
512
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
513
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
514
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
515
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
516
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
517
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
518
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
519
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
520
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
521
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
522
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
523
|
+
# @option opts [Boolean] :week
|
|
524
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
525
|
+
# @return [CalendarResponse]
|
|
526
|
+
def get_calendar(opts = {})
|
|
527
|
+
data, _status_code, _headers = get_calendar_with_http_info(opts)
|
|
528
|
+
data
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
# Calendar projection for a target instant
|
|
532
|
+
# Returns calendar fields for an optional timestamp and target. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` - if no input timestamp is provided, the request time is used Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` Additional flags: - `week=true` adds `week_number` Incompatible combinations: - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - bulk is not supported on this route Examples: - `/v1/time/calendar?iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London&week=true` - `/v1/time/calendar?unix=1711300000&auto_tz=true`
|
|
533
|
+
# @param [Hash] opts the optional parameters
|
|
534
|
+
# @option opts [Integer] :unix
|
|
535
|
+
# @option opts [Integer] :unix_ms
|
|
536
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
537
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
538
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
539
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
540
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
541
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
542
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
543
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
544
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
545
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
546
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
547
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
548
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
549
|
+
# @option opts [Boolean] :week
|
|
550
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
551
|
+
# @return [Array<(CalendarResponse, Integer, Hash)>] CalendarResponse data, response status code and response headers
|
|
552
|
+
def get_calendar_with_http_info(opts = {})
|
|
553
|
+
if @api_client.config.debugging
|
|
554
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.get_calendar ...'
|
|
555
|
+
end
|
|
556
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
|
|
557
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_calendar, must be smaller than or equal to 90.'
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
|
|
561
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_calendar, must be greater than or equal to -90.'
|
|
562
|
+
end
|
|
563
|
+
|
|
564
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
|
|
565
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_calendar, must be smaller than or equal to 180.'
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
|
|
569
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_calendar, must be greater than or equal to -180.'
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
573
|
+
if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
|
|
574
|
+
fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.get_calendar, must conform to the pattern #{pattern}."
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
578
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_calendar, the character length must be smaller than or equal to 64.'
|
|
579
|
+
end
|
|
580
|
+
|
|
581
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
582
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_calendar, must be smaller than or equal to 90.'
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
586
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_calendar, must be greater than or equal to -90.'
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
590
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_calendar, must be smaller than or equal to 180.'
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
594
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_calendar, must be greater than or equal to -180.'
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
598
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
599
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_calendar, must conform to the pattern #{pattern}."
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
# resource path
|
|
603
|
+
local_var_path = '/v1/time/calendar'
|
|
604
|
+
|
|
605
|
+
# query parameters
|
|
606
|
+
query_params = opts[:query_params] || {}
|
|
607
|
+
query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
|
|
608
|
+
query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
|
|
609
|
+
query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
|
|
610
|
+
query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
|
|
611
|
+
query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
|
|
612
|
+
query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
|
|
613
|
+
query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
|
|
614
|
+
query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
|
|
615
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
616
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
617
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
618
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
619
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
620
|
+
query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
|
|
621
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
622
|
+
query_params[:'week'] = opts[:'week'] if !opts[:'week'].nil?
|
|
623
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
624
|
+
|
|
625
|
+
# header parameters
|
|
626
|
+
header_params = opts[:header_params] || {}
|
|
627
|
+
# HTTP header 'Accept' (if needed)
|
|
628
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
629
|
+
|
|
630
|
+
# form parameters
|
|
631
|
+
form_params = opts[:form_params] || {}
|
|
632
|
+
|
|
633
|
+
# http body (model)
|
|
634
|
+
post_body = opts[:debug_body]
|
|
635
|
+
|
|
636
|
+
# return_type
|
|
637
|
+
return_type = opts[:debug_return_type] || 'CalendarResponse'
|
|
638
|
+
|
|
639
|
+
# auth_names
|
|
640
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
641
|
+
|
|
642
|
+
new_options = opts.merge(
|
|
643
|
+
:operation => :"TimeApi.get_calendar",
|
|
644
|
+
:header_params => header_params,
|
|
645
|
+
:query_params => query_params,
|
|
646
|
+
:form_params => form_params,
|
|
647
|
+
:body => post_body,
|
|
648
|
+
:auth_names => auth_names,
|
|
649
|
+
:return_type => return_type
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
653
|
+
if @api_client.config.debugging
|
|
654
|
+
@api_client.config.logger.debug "API called: TimeApi#get_calendar\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
655
|
+
end
|
|
656
|
+
return data, status_code, headers
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
# Render a live HTML clock
|
|
660
|
+
# Returns an embeddable HTML clock fragment. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` Incompatible combinations: - `style` is required and must be one of the 30 names in the `style` enum - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - this route is single-target only; comma-separated `tz`, `ip`, and `offset` values are rejected - `auto_tz` is not supported on this route - `sign` is not supported on this route Examples: - Digital: `/v1/time/clock?style=digital-dashboard&iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London` - Analog: `/v1/time/clock?style=analog-station&offset=-04:00`
|
|
661
|
+
# @param style [String] Clock style name. Valid values are enumerated here; there is no separate style discovery endpoint.
|
|
662
|
+
# @param [Hash] opts the optional parameters
|
|
663
|
+
# @option opts [Integer] :unix
|
|
664
|
+
# @option opts [Integer] :unix_ms
|
|
665
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
666
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
667
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
668
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
669
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
670
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
671
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
672
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
673
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
674
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
675
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
676
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
677
|
+
# @return [String]
|
|
678
|
+
def get_clock(style, opts = {})
|
|
679
|
+
data, _status_code, _headers = get_clock_with_http_info(style, opts)
|
|
680
|
+
data
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
# Render a live HTML clock
|
|
684
|
+
# Returns an embeddable HTML clock fragment. Input timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` Target selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` Incompatible combinations: - `style` is required and must be one of the 30 names in the `style` enum - at most one input timestamp form - at most one target selector family - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - this route is single-target only; comma-separated `tz`, `ip`, and `offset` values are rejected - `auto_tz` is not supported on this route - `sign` is not supported on this route Examples: - Digital: `/v1/time/clock?style=digital-dashboard&iso=2026-04-16T09:00:00&source_tz=America/New_York&tz=Europe/London` - Analog: `/v1/time/clock?style=analog-station&offset=-04:00`
|
|
685
|
+
# @param style [String] Clock style name. Valid values are enumerated here; there is no separate style discovery endpoint.
|
|
686
|
+
# @param [Hash] opts the optional parameters
|
|
687
|
+
# @option opts [Integer] :unix
|
|
688
|
+
# @option opts [Integer] :unix_ms
|
|
689
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
690
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
691
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
692
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
693
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
694
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
695
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
696
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
697
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
698
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
699
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
700
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
701
|
+
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
|
|
702
|
+
def get_clock_with_http_info(style, opts = {})
|
|
703
|
+
if @api_client.config.debugging
|
|
704
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.get_clock ...'
|
|
705
|
+
end
|
|
706
|
+
# verify the required parameter 'style' is set
|
|
707
|
+
if @api_client.config.client_side_validation && style.nil?
|
|
708
|
+
fail ArgumentError, "Missing the required parameter 'style' when calling TimeApi.get_clock"
|
|
709
|
+
end
|
|
710
|
+
# verify enum value
|
|
711
|
+
allowable_values = ["analog-station", "analog-aviation", "analog-bauhaus", "analog-graphite", "analog-arctic", "analog-brass", "analog-marine", "analog-grid", "analog-slate", "analog-executive", "digital-segment-red", "digital-segment-amber", "digital-segment-ice", "digital-terminal-green", "digital-terminal-white", "digital-broadcast", "digital-dashboard", "digital-control-room", "digital-slate", "digital-onyx", "digital-frost", "digital-card", "digital-glass", "digital-matrix", "digital-timetable", "digital-split-flap", "digital-cyan", "digital-emerald", "digital-monolith", "digital-minimal"]
|
|
712
|
+
if @api_client.config.client_side_validation && !allowable_values.include?(style)
|
|
713
|
+
fail ArgumentError, "invalid value for \"style\", must be one of #{allowable_values}"
|
|
714
|
+
end
|
|
715
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
|
|
716
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_clock, must be smaller than or equal to 90.'
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
|
|
720
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_clock, must be greater than or equal to -90.'
|
|
721
|
+
end
|
|
722
|
+
|
|
723
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
|
|
724
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_clock, must be smaller than or equal to 180.'
|
|
725
|
+
end
|
|
726
|
+
|
|
727
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
|
|
728
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_clock, must be greater than or equal to -180.'
|
|
729
|
+
end
|
|
730
|
+
|
|
731
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
732
|
+
if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
|
|
733
|
+
fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.get_clock, must conform to the pattern #{pattern}."
|
|
734
|
+
end
|
|
735
|
+
|
|
736
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
737
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_clock, the character length must be smaller than or equal to 64.'
|
|
738
|
+
end
|
|
739
|
+
|
|
740
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
741
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_clock, must be smaller than or equal to 90.'
|
|
742
|
+
end
|
|
743
|
+
|
|
744
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
745
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_clock, must be greater than or equal to -90.'
|
|
746
|
+
end
|
|
747
|
+
|
|
748
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
749
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_clock, must be smaller than or equal to 180.'
|
|
750
|
+
end
|
|
751
|
+
|
|
752
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
753
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_clock, must be greater than or equal to -180.'
|
|
754
|
+
end
|
|
755
|
+
|
|
756
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
757
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
758
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_clock, must conform to the pattern #{pattern}."
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
# resource path
|
|
762
|
+
local_var_path = '/v1/time/clock'
|
|
763
|
+
|
|
764
|
+
# query parameters
|
|
765
|
+
query_params = opts[:query_params] || {}
|
|
766
|
+
query_params[:'style'] = style
|
|
767
|
+
query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
|
|
768
|
+
query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
|
|
769
|
+
query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
|
|
770
|
+
query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
|
|
771
|
+
query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
|
|
772
|
+
query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
|
|
773
|
+
query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
|
|
774
|
+
query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
|
|
775
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
776
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
777
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
778
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
779
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
780
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
781
|
+
|
|
782
|
+
# header parameters
|
|
783
|
+
header_params = opts[:header_params] || {}
|
|
784
|
+
# HTTP header 'Accept' (if needed)
|
|
785
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/html', 'application/json']) unless header_params['Accept']
|
|
786
|
+
|
|
787
|
+
# form parameters
|
|
788
|
+
form_params = opts[:form_params] || {}
|
|
789
|
+
|
|
790
|
+
# http body (model)
|
|
791
|
+
post_body = opts[:debug_body]
|
|
792
|
+
|
|
793
|
+
# return_type
|
|
794
|
+
return_type = opts[:debug_return_type] || 'String'
|
|
795
|
+
|
|
796
|
+
# auth_names
|
|
797
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
798
|
+
|
|
799
|
+
new_options = opts.merge(
|
|
800
|
+
:operation => :"TimeApi.get_clock",
|
|
801
|
+
:header_params => header_params,
|
|
802
|
+
:query_params => query_params,
|
|
803
|
+
:form_params => form_params,
|
|
804
|
+
:body => post_body,
|
|
805
|
+
:auth_names => auth_names,
|
|
806
|
+
:return_type => return_type
|
|
807
|
+
)
|
|
808
|
+
|
|
809
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
810
|
+
if @api_client.config.debugging
|
|
811
|
+
@api_client.config.logger.debug "API called: TimeApi#get_clock\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
812
|
+
end
|
|
813
|
+
return data, status_code, headers
|
|
814
|
+
end
|
|
815
|
+
|
|
816
|
+
# Get the current time for a target
|
|
817
|
+
# Returns current time data for a single target, or a bulk array when exactly one of `tz`, `ip`, or `offset` is supplied as a comma-separated list. Target selector rules: - Use at most one selector family per request: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - If no selector is provided, the response defaults to UTC with `timezone=null` and `iso_local=null`. - Bulk mode is available only through one comma-separated `tz`, `ip`, or `offset` selector and cannot be combined with any other selector. Example: - Single target: `/v1/time/current?tz=America/New_York` - For bulk, provide one comma-separated `tz`, `ip`, or `offset` value, for example `/v1/time/current?tz=America/New_York,Europe/London,Asia/Tokyo`.
|
|
818
|
+
# @param [Hash] opts the optional parameters
|
|
819
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
820
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
821
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
822
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
823
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
824
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
825
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
826
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
827
|
+
# @return [GetCurrentTime200Response]
|
|
828
|
+
def get_current_time(opts = {})
|
|
829
|
+
data, _status_code, _headers = get_current_time_with_http_info(opts)
|
|
830
|
+
data
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
# Get the current time for a target
|
|
834
|
+
# Returns current time data for a single target, or a bulk array when exactly one of `tz`, `ip`, or `offset` is supplied as a comma-separated list. Target selector rules: - Use at most one selector family per request: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - If no selector is provided, the response defaults to UTC with `timezone=null` and `iso_local=null`. - Bulk mode is available only through one comma-separated `tz`, `ip`, or `offset` selector and cannot be combined with any other selector. Example: - Single target: `/v1/time/current?tz=America/New_York` - For bulk, provide one comma-separated `tz`, `ip`, or `offset` value, for example `/v1/time/current?tz=America/New_York,Europe/London,Asia/Tokyo`.
|
|
835
|
+
# @param [Hash] opts the optional parameters
|
|
836
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
837
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
838
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
839
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
840
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
841
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
842
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
843
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
844
|
+
# @return [Array<(GetCurrentTime200Response, Integer, Hash)>] GetCurrentTime200Response data, response status code and response headers
|
|
845
|
+
def get_current_time_with_http_info(opts = {})
|
|
846
|
+
if @api_client.config.debugging
|
|
847
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.get_current_time ...'
|
|
848
|
+
end
|
|
849
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
850
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_current_time, the character length must be smaller than or equal to 64.'
|
|
851
|
+
end
|
|
852
|
+
|
|
853
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
854
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_current_time, must be smaller than or equal to 90.'
|
|
855
|
+
end
|
|
856
|
+
|
|
857
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
858
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_current_time, must be greater than or equal to -90.'
|
|
859
|
+
end
|
|
860
|
+
|
|
861
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
862
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_current_time, must be smaller than or equal to 180.'
|
|
863
|
+
end
|
|
864
|
+
|
|
865
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
866
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_current_time, must be greater than or equal to -180.'
|
|
867
|
+
end
|
|
868
|
+
|
|
869
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
870
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
871
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_current_time, must conform to the pattern #{pattern}."
|
|
872
|
+
end
|
|
873
|
+
|
|
874
|
+
# resource path
|
|
875
|
+
local_var_path = '/v1/time/current'
|
|
876
|
+
|
|
877
|
+
# query parameters
|
|
878
|
+
query_params = opts[:query_params] || {}
|
|
879
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
880
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
881
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
882
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
883
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
884
|
+
query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
|
|
885
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
886
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
887
|
+
|
|
888
|
+
# header parameters
|
|
889
|
+
header_params = opts[:header_params] || {}
|
|
890
|
+
# HTTP header 'Accept' (if needed)
|
|
891
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
892
|
+
|
|
893
|
+
# form parameters
|
|
894
|
+
form_params = opts[:form_params] || {}
|
|
895
|
+
|
|
896
|
+
# http body (model)
|
|
897
|
+
post_body = opts[:debug_body]
|
|
898
|
+
|
|
899
|
+
# return_type
|
|
900
|
+
return_type = opts[:debug_return_type] || 'GetCurrentTime200Response'
|
|
901
|
+
|
|
902
|
+
# auth_names
|
|
903
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
904
|
+
|
|
905
|
+
new_options = opts.merge(
|
|
906
|
+
:operation => :"TimeApi.get_current_time",
|
|
907
|
+
:header_params => header_params,
|
|
908
|
+
:query_params => query_params,
|
|
909
|
+
:form_params => form_params,
|
|
910
|
+
:body => post_body,
|
|
911
|
+
:auth_names => auth_names,
|
|
912
|
+
:return_type => return_type
|
|
913
|
+
)
|
|
914
|
+
|
|
915
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
916
|
+
if @api_client.config.debugging
|
|
917
|
+
@api_client.config.logger.debug "API called: TimeApi#get_current_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
918
|
+
end
|
|
919
|
+
return data, status_code, headers
|
|
920
|
+
end
|
|
921
|
+
|
|
922
|
+
# Daylight-saving status for a target
|
|
923
|
+
# Returns daylight-saving status for the selected target. Target selector rules: - Use at most one selector family: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - If no selector is provided, the response defaults to UTC. - Bulk is not supported on this route. - `next=true` adds `next_transition` when the resolver provides a transition timestamp. Example: - `/v1/time/dst?tz=America/New_York&next=true`
|
|
924
|
+
# @param [Hash] opts the optional parameters
|
|
925
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
926
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
927
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
928
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
929
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
930
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
931
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
932
|
+
# @option opts [Boolean] :_next
|
|
933
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
934
|
+
# @return [DstResponse]
|
|
935
|
+
def get_dst(opts = {})
|
|
936
|
+
data, _status_code, _headers = get_dst_with_http_info(opts)
|
|
937
|
+
data
|
|
938
|
+
end
|
|
939
|
+
|
|
940
|
+
# Daylight-saving status for a target
|
|
941
|
+
# Returns daylight-saving status for the selected target. Target selector rules: - Use at most one selector family: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - If no selector is provided, the response defaults to UTC. - Bulk is not supported on this route. - `next=true` adds `next_transition` when the resolver provides a transition timestamp. Example: - `/v1/time/dst?tz=America/New_York&next=true`
|
|
942
|
+
# @param [Hash] opts the optional parameters
|
|
943
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
944
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
945
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
946
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
947
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
948
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
949
|
+
# @option opts [String] :format Custom date/time format template using supported `strftime`-style directives such as `%Y-%m-%d %H:%M:%S`. Reference: [strftime](https://strftime.net/).
|
|
950
|
+
# @option opts [Boolean] :_next
|
|
951
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
952
|
+
# @return [Array<(DstResponse, Integer, Hash)>] DstResponse data, response status code and response headers
|
|
953
|
+
def get_dst_with_http_info(opts = {})
|
|
954
|
+
if @api_client.config.debugging
|
|
955
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.get_dst ...'
|
|
956
|
+
end
|
|
957
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
958
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_dst, the character length must be smaller than or equal to 64.'
|
|
959
|
+
end
|
|
960
|
+
|
|
961
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
962
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_dst, must be smaller than or equal to 90.'
|
|
963
|
+
end
|
|
964
|
+
|
|
965
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
966
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_dst, must be greater than or equal to -90.'
|
|
967
|
+
end
|
|
968
|
+
|
|
969
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
970
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_dst, must be smaller than or equal to 180.'
|
|
971
|
+
end
|
|
972
|
+
|
|
973
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
974
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_dst, must be greater than or equal to -180.'
|
|
975
|
+
end
|
|
976
|
+
|
|
977
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
978
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
979
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_dst, must conform to the pattern #{pattern}."
|
|
980
|
+
end
|
|
981
|
+
|
|
982
|
+
# resource path
|
|
983
|
+
local_var_path = '/v1/time/dst'
|
|
984
|
+
|
|
985
|
+
# query parameters
|
|
986
|
+
query_params = opts[:query_params] || {}
|
|
987
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
988
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
989
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
990
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
991
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
992
|
+
query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
|
|
993
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
994
|
+
query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?
|
|
995
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
996
|
+
|
|
997
|
+
# header parameters
|
|
998
|
+
header_params = opts[:header_params] || {}
|
|
999
|
+
# HTTP header 'Accept' (if needed)
|
|
1000
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
1001
|
+
|
|
1002
|
+
# form parameters
|
|
1003
|
+
form_params = opts[:form_params] || {}
|
|
1004
|
+
|
|
1005
|
+
# http body (model)
|
|
1006
|
+
post_body = opts[:debug_body]
|
|
1007
|
+
|
|
1008
|
+
# return_type
|
|
1009
|
+
return_type = opts[:debug_return_type] || 'DstResponse'
|
|
1010
|
+
|
|
1011
|
+
# auth_names
|
|
1012
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
1013
|
+
|
|
1014
|
+
new_options = opts.merge(
|
|
1015
|
+
:operation => :"TimeApi.get_dst",
|
|
1016
|
+
:header_params => header_params,
|
|
1017
|
+
:query_params => query_params,
|
|
1018
|
+
:form_params => form_params,
|
|
1019
|
+
:body => post_body,
|
|
1020
|
+
:auth_names => auth_names,
|
|
1021
|
+
:return_type => return_type
|
|
1022
|
+
)
|
|
1023
|
+
|
|
1024
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
1025
|
+
if @api_client.config.debugging
|
|
1026
|
+
@api_client.config.logger.debug "API called: TimeApi#get_dst\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1027
|
+
end
|
|
1028
|
+
return data, status_code, headers
|
|
1029
|
+
end
|
|
1030
|
+
|
|
1031
|
+
# Time elapsed since or remaining until a reference instant
|
|
1032
|
+
# Computes elapsed or remaining duration relative to one required reference timestamp. Reference timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` Compare timestamp forms: - `compare_unix=1711213600` - `compare_unix_ms=1711213600000` - `compare_iso=2026-04-16T09:00:00Z` - `compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London` - `compare_iso=2026-04-16T09:00:00&compare_source_ip=8.8.8.8` - `compare_iso=2026-04-16T09:00:00&compare_source_lat=40.7128&compare_source_lon=-74.0060` - `compare_iso=2026-04-16T09:00:00&compare_source_offset=-05:00` Compare selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` Incompatible combinations: - exactly one reference timestamp form - use either one compare timestamp form or one compare selector family, not both - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - use at most one of `compare_source_tz`, `compare_source_ip`, `compare_source_lat`/`compare_source_lon`, or `compare_source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - compare local-ISO companion selectors are valid only with `compare_iso=...` that has no explicit offset - if no compare input is provided, the comparison defaults to the request time Business-day rules: - `holiday_country` and `holiday_subdivision` require `business_days=true` - `holiday_subdivision` also requires `holiday_country` Examples: - Timestamp-to-timestamp: `/v1/time/elapsed?iso=2026-04-16T09:00:00&source_tz=America/New_York&compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London` - Timestamp-to-selector: `/v1/time/elapsed?unix=1711300000&tz=America/New_York&business_days=true`
|
|
1033
|
+
# @param [Hash] opts the optional parameters
|
|
1034
|
+
# @option opts [Integer] :unix
|
|
1035
|
+
# @option opts [Integer] :unix_ms
|
|
1036
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
1037
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
1038
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
1039
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
1040
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
1041
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
1042
|
+
# @option opts [Integer] :compare_unix
|
|
1043
|
+
# @option opts [Integer] :compare_unix_ms
|
|
1044
|
+
# @option opts [String] :compare_iso ISO-8601 comparison timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `compare_source_tz=Area/City`, `compare_source_ip=...`, `compare_source_lat=...&compare_source_lon=...`, or `compare_source_offset=±HH:MM`.
|
|
1045
|
+
# @option opts [String] :compare_source_tz Used only with `compare_iso=...` when the ISO value has no explicit offset.
|
|
1046
|
+
# @option opts [String] :compare_source_ip Used only with `compare_iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
1047
|
+
# @option opts [Float] :compare_source_lat Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
1048
|
+
# @option opts [Float] :compare_source_lon Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lat`.
|
|
1049
|
+
# @option opts [String] :compare_source_offset Used only with `compare_iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
1050
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1051
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1052
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
1053
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
1054
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1055
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
1056
|
+
# @option opts [String] :format Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.
|
|
1057
|
+
# @option opts [Boolean] :business_days Set to `true` to enable weekday/business-day counting.
|
|
1058
|
+
# @option opts [String] :holiday_country ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.
|
|
1059
|
+
# @option opts [String] :holiday_subdivision Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.
|
|
1060
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
1061
|
+
# @return [ElapsedResponse]
|
|
1062
|
+
def get_elapsed(opts = {})
|
|
1063
|
+
data, _status_code, _headers = get_elapsed_with_http_info(opts)
|
|
1064
|
+
data
|
|
1065
|
+
end
|
|
1066
|
+
|
|
1067
|
+
# Time elapsed since or remaining until a reference instant
|
|
1068
|
+
# Computes elapsed or remaining duration relative to one required reference timestamp. Reference timestamp forms: - `unix=1711300000` - `unix_ms=1711300000000` - `iso=2026-04-16T09:00:00Z` - `iso=2026-04-16T09:00:00&source_tz=America/New_York` - `iso=2026-04-16T09:00:00&source_ip=8.8.8.8` - `iso=2026-04-16T09:00:00&source_lat=40.7128&source_lon=-74.0060` - `iso=2026-04-16T09:00:00&source_offset=-05:00` Compare timestamp forms: - `compare_unix=1711213600` - `compare_unix_ms=1711213600000` - `compare_iso=2026-04-16T09:00:00Z` - `compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London` - `compare_iso=2026-04-16T09:00:00&compare_source_ip=8.8.8.8` - `compare_iso=2026-04-16T09:00:00&compare_source_lat=40.7128&compare_source_lon=-74.0060` - `compare_iso=2026-04-16T09:00:00&compare_source_offset=-05:00` Compare selector forms: - `tz=America/New_York` - `ip=8.8.8.8` - `lat=40.7128&lon=-74.0060` - `offset=-04:00` - `auto_tz=true` Incompatible combinations: - exactly one reference timestamp form - use either one compare timestamp form or one compare selector family, not both - use at most one of `source_tz`, `source_ip`, `source_lat`/`source_lon`, or `source_offset` - use at most one of `compare_source_tz`, `compare_source_ip`, `compare_source_lat`/`compare_source_lon`, or `compare_source_offset` - local-ISO companion selectors are valid only with `iso=...` that has no explicit offset - compare local-ISO companion selectors are valid only with `compare_iso=...` that has no explicit offset - if no compare input is provided, the comparison defaults to the request time Business-day rules: - `holiday_country` and `holiday_subdivision` require `business_days=true` - `holiday_subdivision` also requires `holiday_country` Examples: - Timestamp-to-timestamp: `/v1/time/elapsed?iso=2026-04-16T09:00:00&source_tz=America/New_York&compare_iso=2026-04-16T09:00:00&compare_source_tz=Europe/London` - Timestamp-to-selector: `/v1/time/elapsed?unix=1711300000&tz=America/New_York&business_days=true`
|
|
1069
|
+
# @param [Hash] opts the optional parameters
|
|
1070
|
+
# @option opts [Integer] :unix
|
|
1071
|
+
# @option opts [Integer] :unix_ms
|
|
1072
|
+
# @option opts [String] :iso ISO-8601 timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `source_tz=Area/City`, `source_ip=...`, `source_lat=...&source_lon=...`, or `source_offset=±HH:MM`.
|
|
1073
|
+
# @option opts [String] :source_tz Used only with `iso=...` when the ISO value has no explicit offset.
|
|
1074
|
+
# @option opts [String] :source_ip Used only with `iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
1075
|
+
# @option opts [Float] :source_lat Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
1076
|
+
# @option opts [Float] :source_lon Used only with `iso=...` when the ISO value has no explicit offset. Provide together with `source_lat`.
|
|
1077
|
+
# @option opts [String] :source_offset Used only with `iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
1078
|
+
# @option opts [Integer] :compare_unix
|
|
1079
|
+
# @option opts [Integer] :compare_unix_ms
|
|
1080
|
+
# @option opts [String] :compare_iso ISO-8601 comparison timestamp. To supply a local wall-clock time without an explicit offset, pair it with one of `compare_source_tz=Area/City`, `compare_source_ip=...`, `compare_source_lat=...&compare_source_lon=...`, or `compare_source_offset=±HH:MM`.
|
|
1081
|
+
# @option opts [String] :compare_source_tz Used only with `compare_iso=...` when the ISO value has no explicit offset.
|
|
1082
|
+
# @option opts [String] :compare_source_ip Used only with `compare_iso=...` when the ISO value has no explicit offset. Resolves that local wall-clock time through the timezone mapped from this IP address.
|
|
1083
|
+
# @option opts [Float] :compare_source_lat Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lon` to resolve that local wall-clock time through the timezone mapped from these coordinates.
|
|
1084
|
+
# @option opts [Float] :compare_source_lon Used only with `compare_iso=...` when the ISO value has no explicit offset. Provide together with `compare_source_lat`.
|
|
1085
|
+
# @option opts [String] :compare_source_offset Used only with `compare_iso=...` when the ISO value has no explicit offset. Interprets that local wall-clock time at this fixed UTC offset.
|
|
1086
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1087
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1088
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
1089
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
1090
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1091
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
1092
|
+
# @option opts [String] :format Custom duration format template using `%days`, `%hours`, `%minutes`, and `%seconds`.
|
|
1093
|
+
# @option opts [Boolean] :business_days Set to `true` to enable weekday/business-day counting.
|
|
1094
|
+
# @option opts [String] :holiday_country ISO 3166-1 alpha-2 holiday calendar country code. Requires `business_days=true`.
|
|
1095
|
+
# @option opts [String] :holiday_subdivision Holiday calendar subdivision code from the upstream `python-holidays` calendar, for example `CA` or `ENG`. Requires `holiday_country` and `business_days=true`.
|
|
1096
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
1097
|
+
# @return [Array<(ElapsedResponse, Integer, Hash)>] ElapsedResponse data, response status code and response headers
|
|
1098
|
+
def get_elapsed_with_http_info(opts = {})
|
|
1099
|
+
if @api_client.config.debugging
|
|
1100
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.get_elapsed ...'
|
|
1101
|
+
end
|
|
1102
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] > 90
|
|
1103
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 90.'
|
|
1104
|
+
end
|
|
1105
|
+
|
|
1106
|
+
if @api_client.config.client_side_validation && !opts[:'source_lat'].nil? && opts[:'source_lat'] < -90
|
|
1107
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lat"]" when calling TimeApi.get_elapsed, must be greater than or equal to -90.'
|
|
1108
|
+
end
|
|
1109
|
+
|
|
1110
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] > 180
|
|
1111
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 180.'
|
|
1112
|
+
end
|
|
1113
|
+
|
|
1114
|
+
if @api_client.config.client_side_validation && !opts[:'source_lon'].nil? && opts[:'source_lon'] < -180
|
|
1115
|
+
fail ArgumentError, 'invalid value for "opts[:"source_lon"]" when calling TimeApi.get_elapsed, must be greater than or equal to -180.'
|
|
1116
|
+
end
|
|
1117
|
+
|
|
1118
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
1119
|
+
if @api_client.config.client_side_validation && !opts[:'source_offset'].nil? && opts[:'source_offset'] !~ pattern
|
|
1120
|
+
fail ArgumentError, "invalid value for 'opts[:\"source_offset\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
|
|
1121
|
+
end
|
|
1122
|
+
|
|
1123
|
+
if @api_client.config.client_side_validation && !opts[:'compare_source_lat'].nil? && opts[:'compare_source_lat'] > 90
|
|
1124
|
+
fail ArgumentError, 'invalid value for "opts[:"compare_source_lat"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 90.'
|
|
1125
|
+
end
|
|
1126
|
+
|
|
1127
|
+
if @api_client.config.client_side_validation && !opts[:'compare_source_lat'].nil? && opts[:'compare_source_lat'] < -90
|
|
1128
|
+
fail ArgumentError, 'invalid value for "opts[:"compare_source_lat"]" when calling TimeApi.get_elapsed, must be greater than or equal to -90.'
|
|
1129
|
+
end
|
|
1130
|
+
|
|
1131
|
+
if @api_client.config.client_side_validation && !opts[:'compare_source_lon'].nil? && opts[:'compare_source_lon'] > 180
|
|
1132
|
+
fail ArgumentError, 'invalid value for "opts[:"compare_source_lon"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 180.'
|
|
1133
|
+
end
|
|
1134
|
+
|
|
1135
|
+
if @api_client.config.client_side_validation && !opts[:'compare_source_lon'].nil? && opts[:'compare_source_lon'] < -180
|
|
1136
|
+
fail ArgumentError, 'invalid value for "opts[:"compare_source_lon"]" when calling TimeApi.get_elapsed, must be greater than or equal to -180.'
|
|
1137
|
+
end
|
|
1138
|
+
|
|
1139
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
1140
|
+
if @api_client.config.client_side_validation && !opts[:'compare_source_offset'].nil? && opts[:'compare_source_offset'] !~ pattern
|
|
1141
|
+
fail ArgumentError, "invalid value for 'opts[:\"compare_source_offset\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
|
|
1142
|
+
end
|
|
1143
|
+
|
|
1144
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
1145
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_elapsed, the character length must be smaller than or equal to 64.'
|
|
1146
|
+
end
|
|
1147
|
+
|
|
1148
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
1149
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 90.'
|
|
1150
|
+
end
|
|
1151
|
+
|
|
1152
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
1153
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_elapsed, must be greater than or equal to -90.'
|
|
1154
|
+
end
|
|
1155
|
+
|
|
1156
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
1157
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_elapsed, must be smaller than or equal to 180.'
|
|
1158
|
+
end
|
|
1159
|
+
|
|
1160
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
1161
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_elapsed, must be greater than or equal to -180.'
|
|
1162
|
+
end
|
|
1163
|
+
|
|
1164
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
1165
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
1166
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
|
|
1167
|
+
end
|
|
1168
|
+
|
|
1169
|
+
pattern = Regexp.new(/^[A-Z]{2}$/)
|
|
1170
|
+
if @api_client.config.client_side_validation && !opts[:'holiday_country'].nil? && opts[:'holiday_country'] !~ pattern
|
|
1171
|
+
fail ArgumentError, "invalid value for 'opts[:\"holiday_country\"]' when calling TimeApi.get_elapsed, must conform to the pattern #{pattern}."
|
|
1172
|
+
end
|
|
1173
|
+
|
|
1174
|
+
# resource path
|
|
1175
|
+
local_var_path = '/v1/time/elapsed'
|
|
1176
|
+
|
|
1177
|
+
# query parameters
|
|
1178
|
+
query_params = opts[:query_params] || {}
|
|
1179
|
+
query_params[:'unix'] = opts[:'unix'] if !opts[:'unix'].nil?
|
|
1180
|
+
query_params[:'unix_ms'] = opts[:'unix_ms'] if !opts[:'unix_ms'].nil?
|
|
1181
|
+
query_params[:'iso'] = opts[:'iso'] if !opts[:'iso'].nil?
|
|
1182
|
+
query_params[:'source_tz'] = opts[:'source_tz'] if !opts[:'source_tz'].nil?
|
|
1183
|
+
query_params[:'source_ip'] = opts[:'source_ip'] if !opts[:'source_ip'].nil?
|
|
1184
|
+
query_params[:'source_lat'] = opts[:'source_lat'] if !opts[:'source_lat'].nil?
|
|
1185
|
+
query_params[:'source_lon'] = opts[:'source_lon'] if !opts[:'source_lon'].nil?
|
|
1186
|
+
query_params[:'source_offset'] = opts[:'source_offset'] if !opts[:'source_offset'].nil?
|
|
1187
|
+
query_params[:'compare_unix'] = opts[:'compare_unix'] if !opts[:'compare_unix'].nil?
|
|
1188
|
+
query_params[:'compare_unix_ms'] = opts[:'compare_unix_ms'] if !opts[:'compare_unix_ms'].nil?
|
|
1189
|
+
query_params[:'compare_iso'] = opts[:'compare_iso'] if !opts[:'compare_iso'].nil?
|
|
1190
|
+
query_params[:'compare_source_tz'] = opts[:'compare_source_tz'] if !opts[:'compare_source_tz'].nil?
|
|
1191
|
+
query_params[:'compare_source_ip'] = opts[:'compare_source_ip'] if !opts[:'compare_source_ip'].nil?
|
|
1192
|
+
query_params[:'compare_source_lat'] = opts[:'compare_source_lat'] if !opts[:'compare_source_lat'].nil?
|
|
1193
|
+
query_params[:'compare_source_lon'] = opts[:'compare_source_lon'] if !opts[:'compare_source_lon'].nil?
|
|
1194
|
+
query_params[:'compare_source_offset'] = opts[:'compare_source_offset'] if !opts[:'compare_source_offset'].nil?
|
|
1195
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
1196
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
1197
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
1198
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
1199
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
1200
|
+
query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
|
|
1201
|
+
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
|
1202
|
+
query_params[:'business_days'] = opts[:'business_days'] if !opts[:'business_days'].nil?
|
|
1203
|
+
query_params[:'holiday_country'] = opts[:'holiday_country'] if !opts[:'holiday_country'].nil?
|
|
1204
|
+
query_params[:'holiday_subdivision'] = opts[:'holiday_subdivision'] if !opts[:'holiday_subdivision'].nil?
|
|
1205
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
1206
|
+
|
|
1207
|
+
# header parameters
|
|
1208
|
+
header_params = opts[:header_params] || {}
|
|
1209
|
+
# HTTP header 'Accept' (if needed)
|
|
1210
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
1211
|
+
|
|
1212
|
+
# form parameters
|
|
1213
|
+
form_params = opts[:form_params] || {}
|
|
1214
|
+
|
|
1215
|
+
# http body (model)
|
|
1216
|
+
post_body = opts[:debug_body]
|
|
1217
|
+
|
|
1218
|
+
# return_type
|
|
1219
|
+
return_type = opts[:debug_return_type] || 'ElapsedResponse'
|
|
1220
|
+
|
|
1221
|
+
# auth_names
|
|
1222
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
1223
|
+
|
|
1224
|
+
new_options = opts.merge(
|
|
1225
|
+
:operation => :"TimeApi.get_elapsed",
|
|
1226
|
+
:header_params => header_params,
|
|
1227
|
+
:query_params => query_params,
|
|
1228
|
+
:form_params => form_params,
|
|
1229
|
+
:body => post_body,
|
|
1230
|
+
:auth_names => auth_names,
|
|
1231
|
+
:return_type => return_type
|
|
1232
|
+
)
|
|
1233
|
+
|
|
1234
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
1235
|
+
if @api_client.config.debugging
|
|
1236
|
+
@api_client.config.logger.debug "API called: TimeApi#get_elapsed\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1237
|
+
end
|
|
1238
|
+
return data, status_code, headers
|
|
1239
|
+
end
|
|
1240
|
+
|
|
1241
|
+
# Resolve timezone information for a target
|
|
1242
|
+
# Resolves timezone metadata for a single target. Target selector rules: - Use exactly one selector family: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - Bulk is not supported on this route. - `offset` queries return a specialized payload that includes `matching_zones` for the request-time offset match. Examples: - Single target: `/v1/timezone?tz=America/New_York` - Offset match: `/v1/timezone?offset=-04:00`
|
|
1243
|
+
# @param [Hash] opts the optional parameters
|
|
1244
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1245
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1246
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
1247
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
1248
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1249
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
1250
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
1251
|
+
# @return [GetTimezone200Response]
|
|
1252
|
+
def get_timezone(opts = {})
|
|
1253
|
+
data, _status_code, _headers = get_timezone_with_http_info(opts)
|
|
1254
|
+
data
|
|
1255
|
+
end
|
|
1256
|
+
|
|
1257
|
+
# Resolve timezone information for a target
|
|
1258
|
+
# Resolves timezone metadata for a single target. Target selector rules: - Use exactly one selector family: `tz`, `ip`, `lat` + `lon`, `offset`, or `auto_tz=true`. - Bulk is not supported on this route. - `offset` queries return a specialized payload that includes `matching_zones` for the request-time offset match. Examples: - Single target: `/v1/timezone?tz=America/New_York` - Offset match: `/v1/timezone?offset=-04:00`
|
|
1259
|
+
# @param [Hash] opts the optional parameters
|
|
1260
|
+
# @option opts [String] :tz IANA timezone name. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1261
|
+
# @option opts [String] :ip IP address. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1262
|
+
# @option opts [Float] :lat Latitude. Must be provided together with `lon`.
|
|
1263
|
+
# @option opts [Float] :lon Longitude. Must be provided together with `lat`.
|
|
1264
|
+
# @option opts [String] :offset Fixed UTC offset in `+HH:MM` or `-HH:MM` format. On bulk-capable routes, a comma-separated list enables bulk mode.
|
|
1265
|
+
# @option opts [Boolean] :auto_tz Set to `true` to resolve using the caller IP from Cloudflare headers.
|
|
1266
|
+
# @option opts [Boolean] :sign Set to exactly `true` to ask the gateway to sign the final JSON response. Every authenticated JSON response, including errors, then includes signing headers. Not supported on `/v1/time/clock`.
|
|
1267
|
+
# @return [Array<(GetTimezone200Response, Integer, Hash)>] GetTimezone200Response data, response status code and response headers
|
|
1268
|
+
def get_timezone_with_http_info(opts = {})
|
|
1269
|
+
if @api_client.config.debugging
|
|
1270
|
+
@api_client.config.logger.debug 'Calling API: TimeApi.get_timezone ...'
|
|
1271
|
+
end
|
|
1272
|
+
if @api_client.config.client_side_validation && !opts[:'tz'].nil? && opts[:'tz'].to_s.length > 64
|
|
1273
|
+
fail ArgumentError, 'invalid value for "opts[:"tz"]" when calling TimeApi.get_timezone, the character length must be smaller than or equal to 64.'
|
|
1274
|
+
end
|
|
1275
|
+
|
|
1276
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] > 90
|
|
1277
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_timezone, must be smaller than or equal to 90.'
|
|
1278
|
+
end
|
|
1279
|
+
|
|
1280
|
+
if @api_client.config.client_side_validation && !opts[:'lat'].nil? && opts[:'lat'] < -90
|
|
1281
|
+
fail ArgumentError, 'invalid value for "opts[:"lat"]" when calling TimeApi.get_timezone, must be greater than or equal to -90.'
|
|
1282
|
+
end
|
|
1283
|
+
|
|
1284
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] > 180
|
|
1285
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_timezone, must be smaller than or equal to 180.'
|
|
1286
|
+
end
|
|
1287
|
+
|
|
1288
|
+
if @api_client.config.client_side_validation && !opts[:'lon'].nil? && opts[:'lon'] < -180
|
|
1289
|
+
fail ArgumentError, 'invalid value for "opts[:"lon"]" when calling TimeApi.get_timezone, must be greater than or equal to -180.'
|
|
1290
|
+
end
|
|
1291
|
+
|
|
1292
|
+
pattern = Regexp.new(/^[+-](0\d|1\d|2[0-3]):[0-5]\d$/)
|
|
1293
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] !~ pattern
|
|
1294
|
+
fail ArgumentError, "invalid value for 'opts[:\"offset\"]' when calling TimeApi.get_timezone, must conform to the pattern #{pattern}."
|
|
1295
|
+
end
|
|
1296
|
+
|
|
1297
|
+
# resource path
|
|
1298
|
+
local_var_path = '/v1/timezone'
|
|
1299
|
+
|
|
1300
|
+
# query parameters
|
|
1301
|
+
query_params = opts[:query_params] || {}
|
|
1302
|
+
query_params[:'tz'] = opts[:'tz'] if !opts[:'tz'].nil?
|
|
1303
|
+
query_params[:'ip'] = opts[:'ip'] if !opts[:'ip'].nil?
|
|
1304
|
+
query_params[:'lat'] = opts[:'lat'] if !opts[:'lat'].nil?
|
|
1305
|
+
query_params[:'lon'] = opts[:'lon'] if !opts[:'lon'].nil?
|
|
1306
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
1307
|
+
query_params[:'auto_tz'] = opts[:'auto_tz'] if !opts[:'auto_tz'].nil?
|
|
1308
|
+
query_params[:'sign'] = opts[:'sign'] if !opts[:'sign'].nil?
|
|
1309
|
+
|
|
1310
|
+
# header parameters
|
|
1311
|
+
header_params = opts[:header_params] || {}
|
|
1312
|
+
# HTTP header 'Accept' (if needed)
|
|
1313
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
1314
|
+
|
|
1315
|
+
# form parameters
|
|
1316
|
+
form_params = opts[:form_params] || {}
|
|
1317
|
+
|
|
1318
|
+
# http body (model)
|
|
1319
|
+
post_body = opts[:debug_body]
|
|
1320
|
+
|
|
1321
|
+
# return_type
|
|
1322
|
+
return_type = opts[:debug_return_type] || 'GetTimezone200Response'
|
|
1323
|
+
|
|
1324
|
+
# auth_names
|
|
1325
|
+
auth_names = opts[:debug_auth_names] || ['directApiKeyHeader', 'directBearerAuth', 'directApiKeyQuery', 'rapidApiKey', 'rapidApiHost']
|
|
1326
|
+
|
|
1327
|
+
new_options = opts.merge(
|
|
1328
|
+
:operation => :"TimeApi.get_timezone",
|
|
1329
|
+
:header_params => header_params,
|
|
1330
|
+
:query_params => query_params,
|
|
1331
|
+
:form_params => form_params,
|
|
1332
|
+
:body => post_body,
|
|
1333
|
+
:auth_names => auth_names,
|
|
1334
|
+
:return_type => return_type
|
|
1335
|
+
)
|
|
1336
|
+
|
|
1337
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
1338
|
+
if @api_client.config.debugging
|
|
1339
|
+
@api_client.config.logger.debug "API called: TimeApi#get_timezone\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1340
|
+
end
|
|
1341
|
+
return data, status_code, headers
|
|
1342
|
+
end
|
|
1343
|
+
end
|
|
1344
|
+
end
|