repull 0.2.17 → 0.2.19

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/airbnb_api.rb +4 -4
  3. data/lib/repull/api/booking_com_api.rb +113 -17
  4. data/lib/repull/api/health_api.rb +0 -57
  5. data/lib/repull/api/migrate_api.rb +552 -0
  6. data/lib/repull/api/reservations_api.rb +2 -2
  7. data/lib/repull/models/airbnb_permits_response.rb +1 -1
  8. data/lib/repull/models/airbnb_permits_write_request.rb +1 -1
  9. data/lib/repull/models/airbnb_permits_write_request_permits_inner.rb +43 -4
  10. data/lib/repull/models/{airbnb_permits_write_request_permits_inner_answers_inner.rb → airbnb_permits_write_request_permits_inner_answers_value.rb} +22 -34
  11. data/lib/repull/models/check_migration_cutover200_response.rb +147 -0
  12. data/lib/repull/models/check_migration_cutover_request.rb +175 -0
  13. data/lib/repull/models/check_migration_cutover_request_reservations_inner.rb +216 -0
  14. data/lib/repull/models/connect_provider.rb +18 -5
  15. data/lib/repull/models/connect_session.rb +25 -5
  16. data/lib/repull/models/create_connect_session_request.rb +81 -5
  17. data/lib/repull/models/create_connect_session_request_copy.rb +251 -0
  18. data/lib/repull/models/create_connect_session_request_workspace.rb +196 -0
  19. data/lib/repull/models/delete_migration200_response.rb +147 -0
  20. data/lib/repull/models/delete_migration200_response_data.rb +165 -0
  21. data/lib/repull/models/get_migration200_response.rb +147 -0
  22. data/lib/repull/models/get_migration_channel_map200_response.rb +147 -0
  23. data/lib/repull/models/get_migration_report200_response.rb +147 -0
  24. data/lib/repull/models/list_migrations200_response.rb +158 -0
  25. data/lib/repull/models/listing_content_update_request.rb +36 -1
  26. data/lib/repull/models/listing_content_update_request_checkout_tasks_inner.rb +210 -0
  27. data/lib/repull/models/listing_content_update_request_pricing.rb +283 -0
  28. data/lib/repull/models/listing_content_update_request_rooms_inner.rb +225 -0
  29. data/lib/repull/models/listing_content_update_request_rooms_inner_beds_inner.rb +209 -0
  30. data/lib/repull/models/listing_content_update_response.rb +1 -1
  31. data/lib/repull/models/listing_create_request.rb +24 -1
  32. data/lib/repull/models/listing_create_response.rb +14 -4
  33. data/lib/repull/models/map_booking_room_request.rb +201 -0
  34. data/lib/repull/models/map_booking_room_response.rb +315 -0
  35. data/lib/repull/models/migration.rb +303 -0
  36. data/lib/repull/models/migration_channel_map.rb +169 -0
  37. data/lib/repull/models/migration_channel_map_listings_inner.rb +208 -0
  38. data/lib/repull/models/migration_channel_map_listings_inner_airbnb.rb +156 -0
  39. data/lib/repull/models/migration_channel_map_listings_inner_booking.rb +156 -0
  40. data/lib/repull/models/migration_channel_map_sources_inner.rb +167 -0
  41. data/lib/repull/models/migration_completed_event.rb +309 -0
  42. data/lib/repull/models/migration_connections_inner.rb +195 -0
  43. data/lib/repull/models/migration_counts.rb +183 -0
  44. data/lib/repull/models/migration_cutover_check.rb +200 -0
  45. data/lib/repull/models/migration_cutover_check_mismatched_inner.rb +156 -0
  46. data/lib/repull/models/migration_failed_event.rb +309 -0
  47. data/lib/repull/models/migration_import_payload.rb +225 -0
  48. data/lib/repull/models/migration_import_payload_results_inner.rb +165 -0
  49. data/lib/repull/models/migration_import_run.rb +202 -0
  50. data/lib/repull/models/migration_import_run_results_inner.rb +165 -0
  51. data/lib/repull/models/migration_report.rb +179 -0
  52. data/lib/repull/models/migration_report_issues_inner.rb +229 -0
  53. data/lib/repull/models/migration_reservation_ref.rb +184 -0
  54. data/lib/repull/models/reservation.rb +12 -2
  55. data/lib/repull/models/run_migration_import202_response.rb +147 -0
  56. data/lib/repull/models/run_migration_import202_response_data.rb +158 -0
  57. data/lib/repull/models/run_migration_import202_response_data_queued_inner.rb +174 -0
  58. data/lib/repull/models/run_migration_import_request.rb +182 -0
  59. data/lib/repull/models/update_booking_content_request.rb +359 -0
  60. data/lib/repull/models/update_booking_content_request_content_data_inner.rb +156 -0
  61. data/lib/repull/models/update_booking_content_request_photos_inner.rb +164 -0
  62. data/lib/repull/models/webhook_event.rb +4 -0
  63. data/lib/repull/models/webhook_event_type.rb +3 -1
  64. data/lib/repull/version.rb +1 -1
  65. data/lib/repull.rb +45 -1
  66. data/openapi/v1.json +3855 -2272
  67. metadata +47 -3
@@ -0,0 +1,315 @@
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_live_YOUR_API_KEY ``` ## 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 `resetsAt` 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 'date'
14
+ require 'time'
15
+
16
+ module Repull
17
+ # Id fields are strings (API-wide convention — bigint ids are stringified to avoid 53-bit JS-number precision loss).
18
+ class MapBookingRoomResponse < ApiModelBase
19
+ attr_accessor :success
20
+
21
+ # True when the room already pointed at this listing (or was already unmapped) and its channel link agreed. Nothing was written.
22
+ attr_accessor :already_mapped
23
+
24
+ # Booking.com's room id, as recorded for this room.
25
+ attr_accessor :room_booking_id
26
+
27
+ # The listing the room now points at. Null after an unmap.
28
+ attr_accessor :listing_id
29
+
30
+ # The listing the room pointed at before this call; null when it was unmapped. Omitted on a no-op.
31
+ attr_accessor :previous_listing_id
32
+
33
+ # The Booking.com property the room belongs to.
34
+ attr_accessor :hotel_id
35
+
36
+ # Repull-side id of the room record — the `roomId` the Connect room-mapping flow takes.
37
+ attr_accessor :room_id
38
+
39
+ attr_accessor :room_name
40
+
41
+ # Id of the resulting channel-link row. Null after an unmap, and for a room Booking.com has given us no room id for.
42
+ attr_accessor :platform_link_id
43
+
44
+ # Reservations Booking.com returned for the property and ran through the import after the room was mapped — the property's active bookings, which would otherwise never reach the listing. A reservation already present is left as it is, so this counts what was processed, not what was new, and re-sending never duplicates. Runs on every successful map, including a re-map to the same listing, so re-sending retries an import that did not run. `null` means the mapping succeeded but the import could not run; the room is still mapped. Absent after an unmap, when there is nothing to pull.
45
+ attr_accessor :reservations_imported
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'success' => :'success',
51
+ :'already_mapped' => :'alreadyMapped',
52
+ :'room_booking_id' => :'roomBookingId',
53
+ :'listing_id' => :'listingId',
54
+ :'previous_listing_id' => :'previousListingId',
55
+ :'hotel_id' => :'hotelId',
56
+ :'room_id' => :'roomId',
57
+ :'room_name' => :'roomName',
58
+ :'platform_link_id' => :'platformLinkId',
59
+ :'reservations_imported' => :'reservationsImported'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'success' => :'Boolean',
77
+ :'already_mapped' => :'Boolean',
78
+ :'room_booking_id' => :'String',
79
+ :'listing_id' => :'String',
80
+ :'previous_listing_id' => :'String',
81
+ :'hotel_id' => :'String',
82
+ :'room_id' => :'String',
83
+ :'room_name' => :'String',
84
+ :'platform_link_id' => :'String',
85
+ :'reservations_imported' => :'Integer'
86
+ }
87
+ end
88
+
89
+ # List of attributes with nullable: true
90
+ def self.openapi_nullable
91
+ Set.new([
92
+ :'room_booking_id',
93
+ :'listing_id',
94
+ :'previous_listing_id',
95
+ :'room_name',
96
+ :'platform_link_id',
97
+ :'reservations_imported'
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::MapBookingRoomResponse` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ acceptable_attribute_map = self.class.acceptable_attribute_map
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!acceptable_attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::MapBookingRoomResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'success')
118
+ self.success = attributes[:'success']
119
+ else
120
+ self.success = nil
121
+ end
122
+
123
+ if attributes.key?(:'already_mapped')
124
+ self.already_mapped = attributes[:'already_mapped']
125
+ else
126
+ self.already_mapped = nil
127
+ end
128
+
129
+ if attributes.key?(:'room_booking_id')
130
+ self.room_booking_id = attributes[:'room_booking_id']
131
+ else
132
+ self.room_booking_id = nil
133
+ end
134
+
135
+ if attributes.key?(:'listing_id')
136
+ self.listing_id = attributes[:'listing_id']
137
+ else
138
+ self.listing_id = nil
139
+ end
140
+
141
+ if attributes.key?(:'previous_listing_id')
142
+ self.previous_listing_id = attributes[:'previous_listing_id']
143
+ end
144
+
145
+ if attributes.key?(:'hotel_id')
146
+ self.hotel_id = attributes[:'hotel_id']
147
+ else
148
+ self.hotel_id = nil
149
+ end
150
+
151
+ if attributes.key?(:'room_id')
152
+ self.room_id = attributes[:'room_id']
153
+ else
154
+ self.room_id = nil
155
+ end
156
+
157
+ if attributes.key?(:'room_name')
158
+ self.room_name = attributes[:'room_name']
159
+ end
160
+
161
+ if attributes.key?(:'platform_link_id')
162
+ self.platform_link_id = attributes[:'platform_link_id']
163
+ end
164
+
165
+ if attributes.key?(:'reservations_imported')
166
+ self.reservations_imported = attributes[:'reservations_imported']
167
+ end
168
+ end
169
+
170
+ # Show invalid properties with the reasons. Usually used together with valid?
171
+ # @return Array for valid properties with the reasons
172
+ def list_invalid_properties
173
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
174
+ invalid_properties = Array.new
175
+ if @success.nil?
176
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
177
+ end
178
+
179
+ if @already_mapped.nil?
180
+ invalid_properties.push('invalid value for "already_mapped", already_mapped cannot be nil.')
181
+ end
182
+
183
+ if @hotel_id.nil?
184
+ invalid_properties.push('invalid value for "hotel_id", hotel_id cannot be nil.')
185
+ end
186
+
187
+ if @room_id.nil?
188
+ invalid_properties.push('invalid value for "room_id", room_id cannot be nil.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ warn '[DEPRECATED] the `valid?` method is obsolete'
198
+ return false if @success.nil?
199
+ return false if @already_mapped.nil?
200
+ return false if @hotel_id.nil?
201
+ return false if @room_id.nil?
202
+ true
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] success Value to be assigned
207
+ def success=(success)
208
+ if success.nil?
209
+ fail ArgumentError, 'success cannot be nil'
210
+ end
211
+
212
+ @success = success
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] already_mapped Value to be assigned
217
+ def already_mapped=(already_mapped)
218
+ if already_mapped.nil?
219
+ fail ArgumentError, 'already_mapped cannot be nil'
220
+ end
221
+
222
+ @already_mapped = already_mapped
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] hotel_id Value to be assigned
227
+ def hotel_id=(hotel_id)
228
+ if hotel_id.nil?
229
+ fail ArgumentError, 'hotel_id cannot be nil'
230
+ end
231
+
232
+ @hotel_id = hotel_id
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] room_id Value to be assigned
237
+ def room_id=(room_id)
238
+ if room_id.nil?
239
+ fail ArgumentError, 'room_id cannot be nil'
240
+ end
241
+
242
+ @room_id = room_id
243
+ end
244
+
245
+ # Checks equality by comparing each attribute.
246
+ # @param [Object] Object to be compared
247
+ def ==(o)
248
+ return true if self.equal?(o)
249
+ self.class == o.class &&
250
+ success == o.success &&
251
+ already_mapped == o.already_mapped &&
252
+ room_booking_id == o.room_booking_id &&
253
+ listing_id == o.listing_id &&
254
+ previous_listing_id == o.previous_listing_id &&
255
+ hotel_id == o.hotel_id &&
256
+ room_id == o.room_id &&
257
+ room_name == o.room_name &&
258
+ platform_link_id == o.platform_link_id &&
259
+ reservations_imported == o.reservations_imported
260
+ end
261
+
262
+ # @see the `==` method
263
+ # @param [Object] Object to be compared
264
+ def eql?(o)
265
+ self == o
266
+ end
267
+
268
+ # Calculates hash code according to all attributes.
269
+ # @return [Integer] Hash code
270
+ def hash
271
+ [success, already_mapped, room_booking_id, listing_id, previous_listing_id, hotel_id, room_id, room_name, platform_link_id, reservations_imported].hash
272
+ end
273
+
274
+ # Builds the object from hash
275
+ # @param [Hash] attributes Model attributes in the form of hash
276
+ # @return [Object] Returns the model itself
277
+ def self.build_from_hash(attributes)
278
+ return nil unless attributes.is_a?(Hash)
279
+ attributes = attributes.transform_keys(&:to_sym)
280
+ transformed_hash = {}
281
+ openapi_types.each_pair do |key, type|
282
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
283
+ transformed_hash["#{key}"] = nil
284
+ elsif type =~ /\AArray<(.*)>/i
285
+ # check to ensure the input is an array given that the attribute
286
+ # is documented as an array but the input is not
287
+ if attributes[attribute_map[key]].is_a?(Array)
288
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
289
+ end
290
+ elsif !attributes[attribute_map[key]].nil?
291
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
292
+ end
293
+ end
294
+ new(transformed_hash)
295
+ end
296
+
297
+ # Returns the object in the form of hash
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_hash
300
+ hash = {}
301
+ self.class.attribute_map.each_pair do |attr, param|
302
+ value = self.send(attr)
303
+ if value.nil?
304
+ is_nullable = self.class.openapi_nullable.include?(attr)
305
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
306
+ end
307
+
308
+ hash[param] = _to_hash(value)
309
+ end
310
+ hash
311
+ end
312
+
313
+ end
314
+
315
+ end
@@ -0,0 +1,303 @@
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_live_YOUR_API_KEY ``` ## 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 `resetsAt` 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 'date'
14
+ require 'time'
15
+
16
+ module Repull
17
+ # One migration: a property manager moved through Repull Migrate, living in its own workspace.
18
+ class Migration < ApiModelBase
19
+ # Pass as `X-Workspace-Id` to read this property manager's listings, reservations and conversations through the regular endpoints.
20
+ attr_accessor :workspace_id
21
+
22
+ attr_accessor :name
23
+
24
+ # Your own id for this property manager, as sent when the migration was created.
25
+ attr_accessor :external_ref
26
+
27
+ attr_accessor :created_at
28
+
29
+ # `awaiting_connection` — not connected yet. `importing` — the first import is running. `imported` — data is in and kept fresh until cutover. `failed` — the last import failed (see `connections[].import.error`). `cut_over` — the source was disconnected. `deactivated` — the migration was deleted.
30
+ attr_accessor :state
31
+
32
+ attr_accessor :cutover_at
33
+
34
+ attr_accessor :connections
35
+
36
+ attr_accessor :counts
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'workspace_id' => :'workspaceId',
42
+ :'name' => :'name',
43
+ :'external_ref' => :'externalRef',
44
+ :'created_at' => :'createdAt',
45
+ :'state' => :'state',
46
+ :'cutover_at' => :'cutoverAt',
47
+ :'connections' => :'connections',
48
+ :'counts' => :'counts'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'workspace_id' => :'String',
66
+ :'name' => :'String',
67
+ :'external_ref' => :'String',
68
+ :'created_at' => :'Time',
69
+ :'state' => :'String',
70
+ :'cutover_at' => :'Time',
71
+ :'connections' => :'Array<MigrationConnectionsInner>',
72
+ :'counts' => :'MigrationCounts'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ :'external_ref',
80
+ :'cutover_at',
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::Migration` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::Migration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'workspace_id')
101
+ self.workspace_id = attributes[:'workspace_id']
102
+ else
103
+ self.workspace_id = nil
104
+ end
105
+
106
+ if attributes.key?(:'name')
107
+ self.name = attributes[:'name']
108
+ else
109
+ self.name = nil
110
+ end
111
+
112
+ if attributes.key?(:'external_ref')
113
+ self.external_ref = attributes[:'external_ref']
114
+ end
115
+
116
+ if attributes.key?(:'created_at')
117
+ self.created_at = attributes[:'created_at']
118
+ end
119
+
120
+ if attributes.key?(:'state')
121
+ self.state = attributes[:'state']
122
+ else
123
+ self.state = nil
124
+ end
125
+
126
+ if attributes.key?(:'cutover_at')
127
+ self.cutover_at = attributes[:'cutover_at']
128
+ end
129
+
130
+ if attributes.key?(:'connections')
131
+ if (value = attributes[:'connections']).is_a?(Array)
132
+ self.connections = value
133
+ end
134
+ else
135
+ self.connections = nil
136
+ end
137
+
138
+ if attributes.key?(:'counts')
139
+ self.counts = attributes[:'counts']
140
+ else
141
+ self.counts = nil
142
+ end
143
+ end
144
+
145
+ # Show invalid properties with the reasons. Usually used together with valid?
146
+ # @return Array for valid properties with the reasons
147
+ def list_invalid_properties
148
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
149
+ invalid_properties = Array.new
150
+ if @workspace_id.nil?
151
+ invalid_properties.push('invalid value for "workspace_id", workspace_id cannot be nil.')
152
+ end
153
+
154
+ if @name.nil?
155
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
156
+ end
157
+
158
+ if @state.nil?
159
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
160
+ end
161
+
162
+ if @connections.nil?
163
+ invalid_properties.push('invalid value for "connections", connections cannot be nil.')
164
+ end
165
+
166
+ if @counts.nil?
167
+ invalid_properties.push('invalid value for "counts", counts cannot be nil.')
168
+ end
169
+
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ warn '[DEPRECATED] the `valid?` method is obsolete'
177
+ return false if @workspace_id.nil?
178
+ return false if @name.nil?
179
+ return false if @state.nil?
180
+ return false if @connections.nil?
181
+ return false if @counts.nil?
182
+ true
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] workspace_id Value to be assigned
187
+ def workspace_id=(workspace_id)
188
+ if workspace_id.nil?
189
+ fail ArgumentError, 'workspace_id cannot be nil'
190
+ end
191
+
192
+ @workspace_id = workspace_id
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] name Value to be assigned
197
+ def name=(name)
198
+ if name.nil?
199
+ fail ArgumentError, 'name cannot be nil'
200
+ end
201
+
202
+ @name = name
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] state Value to be assigned
207
+ def state=(state)
208
+ if state.nil?
209
+ fail ArgumentError, 'state cannot be nil'
210
+ end
211
+
212
+ @state = state
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] connections Value to be assigned
217
+ def connections=(connections)
218
+ if connections.nil?
219
+ fail ArgumentError, 'connections cannot be nil'
220
+ end
221
+
222
+ @connections = connections
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] counts Value to be assigned
227
+ def counts=(counts)
228
+ if counts.nil?
229
+ fail ArgumentError, 'counts cannot be nil'
230
+ end
231
+
232
+ @counts = counts
233
+ end
234
+
235
+ # Checks equality by comparing each attribute.
236
+ # @param [Object] Object to be compared
237
+ def ==(o)
238
+ return true if self.equal?(o)
239
+ self.class == o.class &&
240
+ workspace_id == o.workspace_id &&
241
+ name == o.name &&
242
+ external_ref == o.external_ref &&
243
+ created_at == o.created_at &&
244
+ state == o.state &&
245
+ cutover_at == o.cutover_at &&
246
+ connections == o.connections &&
247
+ counts == o.counts
248
+ end
249
+
250
+ # @see the `==` method
251
+ # @param [Object] Object to be compared
252
+ def eql?(o)
253
+ self == o
254
+ end
255
+
256
+ # Calculates hash code according to all attributes.
257
+ # @return [Integer] Hash code
258
+ def hash
259
+ [workspace_id, name, external_ref, created_at, state, cutover_at, connections, counts].hash
260
+ end
261
+
262
+ # Builds the object from hash
263
+ # @param [Hash] attributes Model attributes in the form of hash
264
+ # @return [Object] Returns the model itself
265
+ def self.build_from_hash(attributes)
266
+ return nil unless attributes.is_a?(Hash)
267
+ attributes = attributes.transform_keys(&:to_sym)
268
+ transformed_hash = {}
269
+ openapi_types.each_pair do |key, type|
270
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
271
+ transformed_hash["#{key}"] = nil
272
+ elsif type =~ /\AArray<(.*)>/i
273
+ # check to ensure the input is an array given that the attribute
274
+ # is documented as an array but the input is not
275
+ if attributes[attribute_map[key]].is_a?(Array)
276
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
277
+ end
278
+ elsif !attributes[attribute_map[key]].nil?
279
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
280
+ end
281
+ end
282
+ new(transformed_hash)
283
+ end
284
+
285
+ # Returns the object in the form of hash
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_hash
288
+ hash = {}
289
+ self.class.attribute_map.each_pair do |attr, param|
290
+ value = self.send(attr)
291
+ if value.nil?
292
+ is_nullable = self.class.openapi_nullable.include?(attr)
293
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
294
+ end
295
+
296
+ hash[param] = _to_hash(value)
297
+ end
298
+ hash
299
+ end
300
+
301
+ end
302
+
303
+ end