repull 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/repull/api/airbnb_api.rb +1391 -117
- data/lib/repull/api/availability_api.rb +99 -0
- data/lib/repull/api/billing_api.rb +226 -0
- data/lib/repull/api/booking_com_api.rb +590 -0
- data/lib/repull/api/plumguide_api.rb +245 -0
- data/lib/repull/models/acknowledge_booking_reservations_request.rb +176 -0
- data/lib/repull/models/airbnb_alteration.rb +191 -0
- data/lib/repull/models/airbnb_amenity.rb +171 -0
- data/lib/repull/models/booking_setup_request.rb +220 -0
- data/lib/repull/models/create_airbnb_alteration_request.rb +195 -0
- data/lib/repull/models/create_airbnb_offer_request.rb +211 -0
- data/lib/repull/models/create_booking_webhook_request.rb +192 -0
- data/lib/repull/models/delete_airbnb_listing_photo200_response.rb +147 -0
- data/lib/repull/models/get_airbnb_alteration200_response.rb +190 -0
- data/lib/repull/models/get_airbnb_listing_quality200_response.rb +177 -0
- data/lib/repull/models/get_airbnb_listing_settings200_response.rb +177 -0
- data/lib/repull/models/get_airbnb_thread200_response.rb +190 -0
- data/lib/repull/models/get_usage_logs200_response.rb +167 -0
- data/lib/repull/models/get_usage_logs200_response_data_inner.rb +264 -0
- data/lib/repull/models/get_usage_logs200_response_pagination.rb +166 -0
- data/lib/repull/models/get_usage_summary200_response.rb +232 -0
- data/lib/repull/models/get_usage_summary200_response_breakdown_inner.rb +183 -0
- data/lib/repull/models/get_usage_summary200_response_limits.rb +158 -0
- data/lib/repull/models/get_usage_summary200_response_remaining.rb +158 -0
- data/lib/repull/models/get_usage_summary200_response_status_distribution.rb +174 -0
- data/lib/repull/models/get_usage_summary200_response_timeline_inner.rb +165 -0
- data/lib/repull/models/get_usage_summary200_response_totals.rb +165 -0
- data/lib/repull/models/get_usage_summary200_response_used.rb +156 -0
- data/lib/repull/models/get_usage_tier200_response.rb +183 -0
- data/lib/repull/models/get_usage_tier200_response_limits.rb +168 -0
- data/lib/repull/models/get_usage_tier200_response_remaining.rb +168 -0
- data/lib/repull/models/get_usage_tier200_response_used.rb +165 -0
- data/lib/repull/models/list_airbnb_alterations200_response.rb +192 -0
- data/lib/repull/models/list_airbnb_listing_amenities200_response.rb +190 -0
- data/lib/repull/models/list_airbnb_listing_amenities200_response_data.rb +160 -0
- data/lib/repull/models/list_airbnb_transactions200_response.rb +192 -0
- data/lib/repull/models/property_availability.rb +222 -0
- data/lib/repull/models/property_availability_day.rb +247 -0
- data/lib/repull/models/update_airbnb_message_request.rb +209 -0
- data/lib/repull/models/update_booking_charges_request.rb +194 -0
- data/lib/repull/version.rb +1 -1
- data/lib/repull.rb +36 -0
- data/openapi/v1.json +3297 -1000
- metadata +37 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Repull API
|
|
3
|
+
|
|
4
|
+
#The unified API for vacation rental tech. Connect to 50+ PMS platforms and 4 OTA channels through one REST API. Built-in AI operations for guest communication, pricing, and listing optimization. ## Designed for AI agents Every error response on this API includes machine-parseable fields so an LLM (Claude in MCP, Cursor, Cline, GPT, etc.) can self-recover without escalating to a human: - `error.code` — stable string identifier (e.g. `invalid_params`, `rate_limit_exceeded`) - `error.message` — human-readable cause - `error.fix` — exact recovery steps (e.g. \"Pass `check_in_after` as ISO 8601: `?check_in_after=2026-01-15`\") - `error.docs_url` — link to the canonical write-up at `https://repull.dev/docs/errors/{code}` - `error.request_id` — id to correlate with server-side logs - `error.field` / `error.value_received` / `error.valid_values` / `error.did_you_mean` — when the error is parameter-specific - `error.retry_after` — seconds to wait before retrying (rate-limit + transient upstream) `Access-Control-Expose-Headers` lists `x-request-id` and the `X-RateLimit-*` family so browsers can read them on cross-origin responses. ## Quick Start 1. Get an API key at https://repull.dev/dashboard 2. Connect a PMS: `POST /v1/connect/{provider}` 3. List properties: `GET /v1/properties` 4. Get reservations: `GET /v1/reservations` ## Authentication All requests require a Bearer token: ``` Authorization: Bearer sk_test_YOUR_API_KEY ``` Sandbox keys start with `sk_test_`, production with `sk_live_`. ## Request Correlation (X-Request-ID) Every response carries an `X-Request-ID` header, e.g. `X-Request-ID: req_01HXY...`. Include this id in support tickets and bug reports — we can trace the full request lifecycle (auth, rate limit, handler, downstream calls, log row) from a single id. You may set the header on the inbound request to forward your own trace id; we will echo it back instead of generating a new one. Accepted format: `^[\\\\w.-]{1,128}$`. The id is also embedded in error envelopes as `request_id` so server-side log diffs work even when the response headers are stripped by an intermediate proxy. ## Rate Limits The public API enforces a per-API-key sliding-window rate limit on top of the per-tier monthly + daily-AI quotas. **Default policy:** 600 requests per 60 seconds, per API key. Sliding window — there is no fixed-minute boundary you can burst across. Every response includes: | Header | Meaning | |---|---| | `X-RateLimit-Limit` | Requests permitted in the current window. | | `X-RateLimit-Remaining` | Requests left in the current window after this call. | | `X-RateLimit-Reset` | Unix epoch (seconds) when the next slot opens. | | `X-RateLimit-Policy` | Machine-readable policy descriptor, e.g. `600;w=60`. | | `Retry-After` | Seconds to wait before retrying. **Only present on 429 responses.** | **On 429 (rate_limit_exceeded):** the response body matches the standard error envelope with `code: \"rate_limit_exceeded\"`, plus `limit`, `window_seconds`, `retry_after`, and `request_id` fields. SDKs MUST honor `Retry-After` and use exponential backoff with jitter on subsequent retries — never a tight loop. Recommended backoff: ``` sleep_ms = (Retry-After * 1000) + random(0..250) ``` Monthly + daily-AI tier quotas (`free`, `starter`, `custom`) are enforced separately and also surface as 429s; they include `tier`, `scope`, and `resets_at` fields. ## Plan Limits (402 — `listings_limit_exceeded`) The Repull API also enforces a per-tier cap on **active listings**: | Tier | Active listings cap | |---|---| | `free` | 3 | | `starter` | 50 | | `custom` | unlimited | When a customer's active-listing count is above their tier cap, the API returns **`402 Payment Required`** with `error.code = \"listings_limit_exceeded\"` on every route EXCEPT: - `/v1/health` — uptime probes are never gated. - `/v1/usage/*` — so dashboards can render the over-cap state. - Any `DELETE` — so the customer can trim listings to get back under the cap without paying. Unlike 429, 402 is NOT a \"wait and retry\" condition — `Retry-After` is not set. The only paths back to 200 are: 1. `DELETE` enough listings to come back under the cap, or 2. Upgrade at `https://repull.dev/dashboard/billing`. The server-side usage cache is 60s, so the first 200 after an upgrade may take up to a minute. The envelope mirrors `rate_limit_exceeded` for SDK ergonomics: `tier`, `limit`, `active_listings`, `upgrade_url`, plus the standard `code` / `message` / `fix` / `docs_url` / `request_id`.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: ivan@vanio.ai
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.22.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Repull
|
|
16
|
+
class AvailabilityApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Get property availability
|
|
23
|
+
# Channel-agnostic day-by-day availability calendar for a property over a date window. Returns a thin per-date shape — `{ date, available, price, minNights }` — projected from the connected channel calendar (currently Airbnb). The `from` and `to` query params are **required** (ISO `YYYY-MM-DD`, inclusive) — omitting or malforming either returns 422. The window is capped at 366 days; longer ranges are truncated to the first 366 days. Every date in the window is present in `days`: dates with no explicit calendar row fall back to `available: true` at the property's default nightly price. A property with no channel calendar still returns a real 200 (a fully-default calendar), never a 404 — 404 means the property id does not exist or belongs to a different workspace. This endpoint is read-only. Availability **writes** stay per-channel: `PUT /v1/channels/airbnb/listings/{id}/availability` (Airbnb) or `PUT /v1/channels/booking/availability` (Booking.com).
|
|
24
|
+
# @param property_id [Integer] Repull property id (equal to `listings.id`; the same integer used as `propertyId` on availability and `listingId` on reservations).
|
|
25
|
+
# @param from [Date] Start of the window (inclusive), ISO `YYYY-MM-DD`. Required — missing/malformed returns 422. `startDate` is accepted as an alias.
|
|
26
|
+
# @param to [Date] End of the window (inclusive), ISO `YYYY-MM-DD`. Required — missing/malformed returns 422. `endDate` is accepted as an alias.
|
|
27
|
+
# @param [Hash] opts the optional parameters
|
|
28
|
+
# @return [PropertyAvailability]
|
|
29
|
+
def get_availability(property_id, from, to, opts = {})
|
|
30
|
+
data, _status_code, _headers = get_availability_with_http_info(property_id, from, to, opts)
|
|
31
|
+
data
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Get property availability
|
|
35
|
+
# Channel-agnostic day-by-day availability calendar for a property over a date window. Returns a thin per-date shape — `{ date, available, price, minNights }` — projected from the connected channel calendar (currently Airbnb). The `from` and `to` query params are **required** (ISO `YYYY-MM-DD`, inclusive) — omitting or malforming either returns 422. The window is capped at 366 days; longer ranges are truncated to the first 366 days. Every date in the window is present in `days`: dates with no explicit calendar row fall back to `available: true` at the property's default nightly price. A property with no channel calendar still returns a real 200 (a fully-default calendar), never a 404 — 404 means the property id does not exist or belongs to a different workspace. This endpoint is read-only. Availability **writes** stay per-channel: `PUT /v1/channels/airbnb/listings/{id}/availability` (Airbnb) or `PUT /v1/channels/booking/availability` (Booking.com).
|
|
36
|
+
# @param property_id [Integer] Repull property id (equal to `listings.id`; the same integer used as `propertyId` on availability and `listingId` on reservations).
|
|
37
|
+
# @param from [Date] Start of the window (inclusive), ISO `YYYY-MM-DD`. Required — missing/malformed returns 422. `startDate` is accepted as an alias.
|
|
38
|
+
# @param to [Date] End of the window (inclusive), ISO `YYYY-MM-DD`. Required — missing/malformed returns 422. `endDate` is accepted as an alias.
|
|
39
|
+
# @param [Hash] opts the optional parameters
|
|
40
|
+
# @return [Array<(PropertyAvailability, Integer, Hash)>] PropertyAvailability data, response status code and response headers
|
|
41
|
+
def get_availability_with_http_info(property_id, from, to, opts = {})
|
|
42
|
+
if @api_client.config.debugging
|
|
43
|
+
@api_client.config.logger.debug 'Calling API: AvailabilityApi.get_availability ...'
|
|
44
|
+
end
|
|
45
|
+
# verify the required parameter 'property_id' is set
|
|
46
|
+
if @api_client.config.client_side_validation && property_id.nil?
|
|
47
|
+
fail ArgumentError, "Missing the required parameter 'property_id' when calling AvailabilityApi.get_availability"
|
|
48
|
+
end
|
|
49
|
+
# verify the required parameter 'from' is set
|
|
50
|
+
if @api_client.config.client_side_validation && from.nil?
|
|
51
|
+
fail ArgumentError, "Missing the required parameter 'from' when calling AvailabilityApi.get_availability"
|
|
52
|
+
end
|
|
53
|
+
# verify the required parameter 'to' is set
|
|
54
|
+
if @api_client.config.client_side_validation && to.nil?
|
|
55
|
+
fail ArgumentError, "Missing the required parameter 'to' when calling AvailabilityApi.get_availability"
|
|
56
|
+
end
|
|
57
|
+
# resource path
|
|
58
|
+
local_var_path = '/v1/availability/{propertyId}'.sub('{propertyId}', CGI.escape(property_id.to_s))
|
|
59
|
+
|
|
60
|
+
# query parameters
|
|
61
|
+
query_params = opts[:query_params] || {}
|
|
62
|
+
query_params[:'from'] = from
|
|
63
|
+
query_params[:'to'] = to
|
|
64
|
+
|
|
65
|
+
# header parameters
|
|
66
|
+
header_params = opts[:header_params] || {}
|
|
67
|
+
# HTTP header 'Accept' (if needed)
|
|
68
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
69
|
+
|
|
70
|
+
# form parameters
|
|
71
|
+
form_params = opts[:form_params] || {}
|
|
72
|
+
|
|
73
|
+
# http body (model)
|
|
74
|
+
post_body = opts[:debug_body]
|
|
75
|
+
|
|
76
|
+
# return_type
|
|
77
|
+
return_type = opts[:debug_return_type] || 'PropertyAvailability'
|
|
78
|
+
|
|
79
|
+
# auth_names
|
|
80
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
81
|
+
|
|
82
|
+
new_options = opts.merge(
|
|
83
|
+
:operation => :"AvailabilityApi.get_availability",
|
|
84
|
+
:header_params => header_params,
|
|
85
|
+
:query_params => query_params,
|
|
86
|
+
:form_params => form_params,
|
|
87
|
+
:body => post_body,
|
|
88
|
+
:auth_names => auth_names,
|
|
89
|
+
:return_type => return_type
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
93
|
+
if @api_client.config.debugging
|
|
94
|
+
@api_client.config.logger.debug "API called: AvailabilityApi#get_availability\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
95
|
+
end
|
|
96
|
+
return data, status_code, headers
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -80,5 +80,231 @@ module Repull
|
|
|
80
80
|
end
|
|
81
81
|
return data, status_code, headers
|
|
82
82
|
end
|
|
83
|
+
|
|
84
|
+
# List API request logs
|
|
85
|
+
# Cursor-paginated raw API request log for the authenticated workspace, newest first. Filter by time `range`, `operation` id(s), status class, or free-text `q`. Walk pages with `cursor` from `pagination.next_cursor` until `pagination.has_more` is `false`; `offset` is accepted as a shallow alias (deep walks must use `cursor`).
|
|
86
|
+
# @param [Hash] opts the optional parameters
|
|
87
|
+
# @option opts [String] :range Time window ending now. (default to '24h')
|
|
88
|
+
# @option opts [String] :operation Comma-separated `operation_id` filter.
|
|
89
|
+
# @option opts [String] :status Status-class filter.
|
|
90
|
+
# @option opts [String] :q Free-text match on path / operation / request id.
|
|
91
|
+
# @option opts [Integer] :limit Page size (max 200). (default to 50)
|
|
92
|
+
# @option opts [String] :cursor Opaque cursor from the previous response's `pagination.next_cursor`.
|
|
93
|
+
# @option opts [Integer] :offset First-class alias for cursor-based pagination. Mutually exclusive with `cursor` — passing both returns 422. Accepts integers in `[0, 10000]`; deeper walks must use `cursor` (constant per-page cost). The response always includes `pagination.next_cursor` so consumers can switch from offset → cursor mid-walk for deep pagination without re-keying. (default to 0)
|
|
94
|
+
# @option opts [Boolean] :include_total When `true` (default), the response's `pagination.total` carries the count of rows matching the current filter, across all pages. Pass `false` to skip the count for very large workspaces where the per-page COUNT(*) cost matters. (default to true)
|
|
95
|
+
# @return [GetUsageLogs200Response]
|
|
96
|
+
def get_usage_logs(opts = {})
|
|
97
|
+
data, _status_code, _headers = get_usage_logs_with_http_info(opts)
|
|
98
|
+
data
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# List API request logs
|
|
102
|
+
# Cursor-paginated raw API request log for the authenticated workspace, newest first. Filter by time `range`, `operation` id(s), status class, or free-text `q`. Walk pages with `cursor` from `pagination.next_cursor` until `pagination.has_more` is `false`; `offset` is accepted as a shallow alias (deep walks must use `cursor`).
|
|
103
|
+
# @param [Hash] opts the optional parameters
|
|
104
|
+
# @option opts [String] :range Time window ending now. (default to '24h')
|
|
105
|
+
# @option opts [String] :operation Comma-separated `operation_id` filter.
|
|
106
|
+
# @option opts [String] :status Status-class filter.
|
|
107
|
+
# @option opts [String] :q Free-text match on path / operation / request id.
|
|
108
|
+
# @option opts [Integer] :limit Page size (max 200). (default to 50)
|
|
109
|
+
# @option opts [String] :cursor Opaque cursor from the previous response's `pagination.next_cursor`.
|
|
110
|
+
# @option opts [Integer] :offset First-class alias for cursor-based pagination. Mutually exclusive with `cursor` — passing both returns 422. Accepts integers in `[0, 10000]`; deeper walks must use `cursor` (constant per-page cost). The response always includes `pagination.next_cursor` so consumers can switch from offset → cursor mid-walk for deep pagination without re-keying. (default to 0)
|
|
111
|
+
# @option opts [Boolean] :include_total When `true` (default), the response's `pagination.total` carries the count of rows matching the current filter, across all pages. Pass `false` to skip the count for very large workspaces where the per-page COUNT(*) cost matters. (default to true)
|
|
112
|
+
# @return [Array<(GetUsageLogs200Response, Integer, Hash)>] GetUsageLogs200Response data, response status code and response headers
|
|
113
|
+
def get_usage_logs_with_http_info(opts = {})
|
|
114
|
+
if @api_client.config.debugging
|
|
115
|
+
@api_client.config.logger.debug 'Calling API: BillingApi.get_usage_logs ...'
|
|
116
|
+
end
|
|
117
|
+
allowable_values = ["1h", "24h", "7d", "30d"]
|
|
118
|
+
if @api_client.config.client_side_validation && opts[:'range'] && !allowable_values.include?(opts[:'range'])
|
|
119
|
+
fail ArgumentError, "invalid value for \"range\", must be one of #{allowable_values}"
|
|
120
|
+
end
|
|
121
|
+
allowable_values = ["2xx", "3xx", "4xx", "5xx"]
|
|
122
|
+
if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
|
|
123
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
|
|
124
|
+
end
|
|
125
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
|
|
126
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BillingApi.get_usage_logs, must be smaller than or equal to 200.'
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
130
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BillingApi.get_usage_logs, must be greater than or equal to 1.'
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] > 10000
|
|
134
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling BillingApi.get_usage_logs, must be smaller than or equal to 10000.'
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
|
138
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling BillingApi.get_usage_logs, must be greater than or equal to 0.'
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# resource path
|
|
142
|
+
local_var_path = '/v1/usage/logs'
|
|
143
|
+
|
|
144
|
+
# query parameters
|
|
145
|
+
query_params = opts[:query_params] || {}
|
|
146
|
+
query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?
|
|
147
|
+
query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?
|
|
148
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
149
|
+
query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
|
|
150
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
151
|
+
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
|
|
152
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
153
|
+
query_params[:'include_total'] = opts[:'include_total'] if !opts[:'include_total'].nil?
|
|
154
|
+
|
|
155
|
+
# header parameters
|
|
156
|
+
header_params = opts[:header_params] || {}
|
|
157
|
+
# HTTP header 'Accept' (if needed)
|
|
158
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
159
|
+
|
|
160
|
+
# form parameters
|
|
161
|
+
form_params = opts[:form_params] || {}
|
|
162
|
+
|
|
163
|
+
# http body (model)
|
|
164
|
+
post_body = opts[:debug_body]
|
|
165
|
+
|
|
166
|
+
# return_type
|
|
167
|
+
return_type = opts[:debug_return_type] || 'GetUsageLogs200Response'
|
|
168
|
+
|
|
169
|
+
# auth_names
|
|
170
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
171
|
+
|
|
172
|
+
new_options = opts.merge(
|
|
173
|
+
:operation => :"BillingApi.get_usage_logs",
|
|
174
|
+
:header_params => header_params,
|
|
175
|
+
:query_params => query_params,
|
|
176
|
+
:form_params => form_params,
|
|
177
|
+
:body => post_body,
|
|
178
|
+
:auth_names => auth_names,
|
|
179
|
+
:return_type => return_type
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
183
|
+
if @api_client.config.debugging
|
|
184
|
+
@api_client.config.logger.debug "API called: BillingApi#get_usage_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
185
|
+
end
|
|
186
|
+
return data, status_code, headers
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Get usage summary
|
|
190
|
+
# Aggregated usage over the requested `range` — tier + plan limits, quota used/remaining, next reset, a per-operation breakdown (request/error counts, error rate, avg latency), a daily timeline, status-class distribution, and range totals.
|
|
191
|
+
# @param [Hash] opts the optional parameters
|
|
192
|
+
# @option opts [String] :range Aggregation window ending now. (default to '30d')
|
|
193
|
+
# @return [GetUsageSummary200Response]
|
|
194
|
+
def get_usage_summary(opts = {})
|
|
195
|
+
data, _status_code, _headers = get_usage_summary_with_http_info(opts)
|
|
196
|
+
data
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Get usage summary
|
|
200
|
+
# Aggregated usage over the requested `range` — tier + plan limits, quota used/remaining, next reset, a per-operation breakdown (request/error counts, error rate, avg latency), a daily timeline, status-class distribution, and range totals.
|
|
201
|
+
# @param [Hash] opts the optional parameters
|
|
202
|
+
# @option opts [String] :range Aggregation window ending now. (default to '30d')
|
|
203
|
+
# @return [Array<(GetUsageSummary200Response, Integer, Hash)>] GetUsageSummary200Response data, response status code and response headers
|
|
204
|
+
def get_usage_summary_with_http_info(opts = {})
|
|
205
|
+
if @api_client.config.debugging
|
|
206
|
+
@api_client.config.logger.debug 'Calling API: BillingApi.get_usage_summary ...'
|
|
207
|
+
end
|
|
208
|
+
allowable_values = ["7d", "30d", "90d"]
|
|
209
|
+
if @api_client.config.client_side_validation && opts[:'range'] && !allowable_values.include?(opts[:'range'])
|
|
210
|
+
fail ArgumentError, "invalid value for \"range\", must be one of #{allowable_values}"
|
|
211
|
+
end
|
|
212
|
+
# resource path
|
|
213
|
+
local_var_path = '/v1/usage/summary'
|
|
214
|
+
|
|
215
|
+
# query parameters
|
|
216
|
+
query_params = opts[:query_params] || {}
|
|
217
|
+
query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?
|
|
218
|
+
|
|
219
|
+
# header parameters
|
|
220
|
+
header_params = opts[:header_params] || {}
|
|
221
|
+
# HTTP header 'Accept' (if needed)
|
|
222
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
223
|
+
|
|
224
|
+
# form parameters
|
|
225
|
+
form_params = opts[:form_params] || {}
|
|
226
|
+
|
|
227
|
+
# http body (model)
|
|
228
|
+
post_body = opts[:debug_body]
|
|
229
|
+
|
|
230
|
+
# return_type
|
|
231
|
+
return_type = opts[:debug_return_type] || 'GetUsageSummary200Response'
|
|
232
|
+
|
|
233
|
+
# auth_names
|
|
234
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
235
|
+
|
|
236
|
+
new_options = opts.merge(
|
|
237
|
+
:operation => :"BillingApi.get_usage_summary",
|
|
238
|
+
:header_params => header_params,
|
|
239
|
+
:query_params => query_params,
|
|
240
|
+
:form_params => form_params,
|
|
241
|
+
:body => post_body,
|
|
242
|
+
:auth_names => auth_names,
|
|
243
|
+
:return_type => return_type
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
247
|
+
if @api_client.config.debugging
|
|
248
|
+
@api_client.config.logger.debug "API called: BillingApi#get_usage_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
249
|
+
end
|
|
250
|
+
return data, status_code, headers
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Get tier and quota
|
|
254
|
+
# Lightweight current-tier snapshot for status badges and quota meters — plan limits (monthly requests, daily AI requests, dynamic-pricing listings), the amount used, the amount remaining, and the next reset. `null` limits mean unlimited on that dimension.
|
|
255
|
+
# @param [Hash] opts the optional parameters
|
|
256
|
+
# @return [GetUsageTier200Response]
|
|
257
|
+
def get_usage_tier(opts = {})
|
|
258
|
+
data, _status_code, _headers = get_usage_tier_with_http_info(opts)
|
|
259
|
+
data
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Get tier and quota
|
|
263
|
+
# Lightweight current-tier snapshot for status badges and quota meters — plan limits (monthly requests, daily AI requests, dynamic-pricing listings), the amount used, the amount remaining, and the next reset. `null` limits mean unlimited on that dimension.
|
|
264
|
+
# @param [Hash] opts the optional parameters
|
|
265
|
+
# @return [Array<(GetUsageTier200Response, Integer, Hash)>] GetUsageTier200Response data, response status code and response headers
|
|
266
|
+
def get_usage_tier_with_http_info(opts = {})
|
|
267
|
+
if @api_client.config.debugging
|
|
268
|
+
@api_client.config.logger.debug 'Calling API: BillingApi.get_usage_tier ...'
|
|
269
|
+
end
|
|
270
|
+
# resource path
|
|
271
|
+
local_var_path = '/v1/usage/tier'
|
|
272
|
+
|
|
273
|
+
# query parameters
|
|
274
|
+
query_params = opts[:query_params] || {}
|
|
275
|
+
|
|
276
|
+
# header parameters
|
|
277
|
+
header_params = opts[:header_params] || {}
|
|
278
|
+
# HTTP header 'Accept' (if needed)
|
|
279
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
280
|
+
|
|
281
|
+
# form parameters
|
|
282
|
+
form_params = opts[:form_params] || {}
|
|
283
|
+
|
|
284
|
+
# http body (model)
|
|
285
|
+
post_body = opts[:debug_body]
|
|
286
|
+
|
|
287
|
+
# return_type
|
|
288
|
+
return_type = opts[:debug_return_type] || 'GetUsageTier200Response'
|
|
289
|
+
|
|
290
|
+
# auth_names
|
|
291
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
292
|
+
|
|
293
|
+
new_options = opts.merge(
|
|
294
|
+
:operation => :"BillingApi.get_usage_tier",
|
|
295
|
+
:header_params => header_params,
|
|
296
|
+
:query_params => query_params,
|
|
297
|
+
:form_params => form_params,
|
|
298
|
+
:body => post_body,
|
|
299
|
+
:auth_names => auth_names,
|
|
300
|
+
:return_type => return_type
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
304
|
+
if @api_client.config.debugging
|
|
305
|
+
@api_client.config.logger.debug "API called: BillingApi#get_usage_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
306
|
+
end
|
|
307
|
+
return data, status_code, headers
|
|
308
|
+
end
|
|
83
309
|
end
|
|
84
310
|
end
|