Class: Repull::ListingsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/repull/api/listings_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ListingsApi

Returns a new instance of ListingsApi.



19
20
21
# File 'lib/repull/api/listings_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/repull/api/listings_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_listing(listing_create_request, opts = {}) ⇒ ListingCreateResponse

Create a Repull listing Create a new vacation-rental listing under the authenticated workspace. The listing is stored in the canonical Vanio listings tables and can be published to multiple channels (Airbnb, Booking.com) via the publish endpoints.

Parameters:

  • listing_create_request (ListingCreateRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/repull/api/listings_api.rb', line 27

def create_listing(listing_create_request, opts = {})
  data, _status_code, _headers = create_listing_with_http_info(listing_create_request, opts)
  data
end

#create_listing_with_http_info(listing_create_request, opts = {}) ⇒ Array<(ListingCreateResponse, Integer, Hash)>

Create a Repull listing Create a new vacation-rental listing under the authenticated workspace. The listing is stored in the canonical Vanio listings tables and can be published to multiple channels (Airbnb, Booking.com) via the publish endpoints.

Parameters:

  • listing_create_request (ListingCreateRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ListingCreateResponse, Integer, Hash)>)

    ListingCreateResponse data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/repull/api/listings_api.rb', line 37

def create_listing_with_http_info(listing_create_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.create_listing ...'
  end
  # verify the required parameter 'listing_create_request' is set
  if @api_client.config.client_side_validation && listing_create_request.nil?
    fail ArgumentError, "Missing the required parameter 'listing_create_request' when calling ListingsApi.create_listing"
  end
  # resource path
  local_var_path = '/v1/listings'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(listing_create_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ListingCreateResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.create_listing",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#create_listing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#deactivate_listing(id, opts = {}) ⇒ ListingActiveResponse

Deactivate (exclude) a listing Deactivate a listing — sets it inactive and excludes it from Repull. This is a soft operation: the listing row is KEPT (never hard-deleted) and the upstream channel (Airbnb / Hospitable / Booking.com) is NEVER touched. Repull only mutates its own copy. Equivalent to PATCH /v1/listings/{id} with { \"active\": false }. This is the primary self-serve way for a free-tier customer to trim back under the plan-listings cap — DELETE is served even when the account is over the cap (a 402-locked account can still call it). To bring a listing back, use PATCH with { \"active\": true }. Idempotent: deactivating an already-inactive listing returns 200.

Parameters:

  • id (Integer)

    Repull listing id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



95
96
97
98
# File 'lib/repull/api/listings_api.rb', line 95

def deactivate_listing(id, opts = {})
  data, _status_code, _headers = deactivate_listing_with_http_info(id, opts)
  data
end

#deactivate_listing_with_http_info(id, opts = {}) ⇒ Array<(ListingActiveResponse, Integer, Hash)>

Deactivate (exclude) a listing Deactivate a listing — sets it inactive and excludes it from Repull. This is a soft operation: the listing row is KEPT (never hard-deleted) and the upstream channel (Airbnb / Hospitable / Booking.com) is NEVER touched. Repull only mutates its own copy. Equivalent to `PATCH /v1/listings/id` with `{ &quot;active&quot;: false }`. This is the primary self-serve way for a free-tier customer to trim back under the plan-listings cap — `DELETE` is served even when the account is over the cap (a 402-locked account can still call it). To bring a listing back, use `PATCH` with `{ &quot;active&quot;: true }`. Idempotent: deactivating an already-inactive listing returns 200.

Parameters:

  • id (Integer)

    Repull listing id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ListingActiveResponse, Integer, Hash)>)

    ListingActiveResponse data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/repull/api/listings_api.rb', line 105

def deactivate_listing_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.deactivate_listing ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ListingsApi.deactivate_listing"
  end
  # resource path
  local_var_path = '/v1/listings/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListingActiveResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.deactivate_listing",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#deactivate_listing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#generate_listing_content(id, opts = {}) ⇒ ListingGenerateContentResponse

AI-generate listing content Generate guest-facing copy (title, summary, description, amenities, etc.) for a listing using Repull AI. When photos are provided the vision model is used for photo-grounded copy. Persists into the listing by default.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



159
160
161
162
# File 'lib/repull/api/listings_api.rb', line 159

def generate_listing_content(id, opts = {})
  data, _status_code, _headers = generate_listing_content_with_http_info(id, opts)
  data
end

#generate_listing_content_with_http_info(id, opts = {}) ⇒ Array<(ListingGenerateContentResponse, Integer, Hash)>

AI-generate listing content Generate guest-facing copy (title, summary, description, amenities, etc.) for a listing using Repull AI. When `photos` are provided the vision model is used for photo-grounded copy. Persists into the listing by default.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/repull/api/listings_api.rb', line 170

def generate_listing_content_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.generate_listing_content ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ListingsApi.generate_listing_content"
  end
  # resource path
  local_var_path = '/v1/listings/{id}/generate-content'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'listing_generate_content_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'ListingGenerateContentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.generate_listing_content",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#generate_listing_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_listing(id, opts = {}) ⇒ Listing

Get a listing Fetch a single listing by id. Returns the same shape as one element of the GET /v1/listings response, so you can bind the result to the same model. Cross-tenant access (a listing that belongs to a different workspace) returns 404 — never 403, never reveals the listing's existence. Optional expansions: Pass ?include=amenities to enrich the response with the listing's amenity rows ([] when the listing has none). Pass ?include=content for the rich content slab (summary, description, space, house rules, etc. — sourced from listings_descriptions for the en locale; null when no row is stored). Pass ?include=details for the structural slab (bedrooms, bathrooms, person capacity, check-in window, wifi, house manual, etc.; null when no row is stored). Combine comma-separated, e.g. ?include=amenities,content,details. The default response stays lean; consumers must opt in.

Parameters:

  • id (Integer)

    Repull listing id

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: `native` (default), `calry`, `calry-v1`. Custom: any schema name created via `POST /v1/schema/custom`. Unknown / inactive schema names fall back to `native`.

  • :include (String)

    Comma-separated optional expansions. Currently supported: `amenities`, `content`, `details`. Unknown values return 422 with a `valid_values` envelope.

Returns:



230
231
232
233
# File 'lib/repull/api/listings_api.rb', line 230

def get_listing(id, opts = {})
  data, _status_code, _headers = get_listing_with_http_info(id, opts)
  data
end

#get_listing_publish_status(id, opts = {}) ⇒ ListingPublishStatusResponse

Per-channel publish status Returns connection state and sync activity per channel. channels is sync activity (empty until first push). connections is connection state (populated as soon as a channel is linked). Recommended polling cadence: at most once per 30s per listing — for bulk views, prefer GET /v1/listings and filter client-side.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



297
298
299
300
# File 'lib/repull/api/listings_api.rb', line 297

def get_listing_publish_status(id, opts = {})
  data, _status_code, _headers = get_listing_publish_status_with_http_info(id, opts)
  data
end

#get_listing_publish_status_with_http_info(id, opts = {}) ⇒ Array<(ListingPublishStatusResponse, Integer, Hash)>

Per-channel publish status Returns connection state and sync activity per channel. `channels` is sync activity (empty until first push). `connections` is connection state (populated as soon as a channel is linked). Recommended polling cadence: at most once per 30s per listing — for bulk views, prefer `GET /v1/listings` and filter client-side.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/repull/api/listings_api.rb', line 307

def get_listing_publish_status_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.get_listing_publish_status ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ListingsApi.get_listing_publish_status"
  end
  # resource path
  local_var_path = '/v1/listings/{id}/publish-status'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListingPublishStatusResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.get_listing_publish_status",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#get_listing_publish_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_listing_with_http_info(id, opts = {}) ⇒ Array<(Listing, Integer, Hash)>

Get a listing Fetch a single listing by id. Returns the same shape as one element of the `GET /v1/listings` response, so you can bind the result to the same model. Cross-tenant access (a listing that belongs to a different workspace) returns 404 — never 403, never reveals the listing's existence. Optional expansions: Pass `?include=amenities` to enrich the response with the listing's amenity rows (`[]` when the listing has none). Pass `?include=content` for the rich content slab (summary, description, space, house rules, etc. — sourced from `listings_descriptions` for the `en` locale; `null` when no row is stored). Pass `?include=details` for the structural slab (bedrooms, bathrooms, person capacity, check-in window, wifi, house manual, etc.; `null` when no row is stored). Combine comma-separated, e.g. `?include=amenities,content,details`. The default response stays lean; consumers must opt in.

Parameters:

  • id (Integer)

    Repull listing id

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: `native` (default), `calry`, `calry-v1`. Custom: any schema name created via `POST /v1/schema/custom`. Unknown / inactive schema names fall back to `native`.

  • :include (String)

    Comma-separated optional expansions. Currently supported: `amenities`, `content`, `details`. Unknown values return 422 with a `valid_values` envelope.

Returns:

  • (Array<(Listing, Integer, Hash)>)

    Listing data, response status code and response headers



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/repull/api/listings_api.rb', line 242

def get_listing_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.get_listing ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ListingsApi.get_listing"
  end
  # resource path
  local_var_path = '/v1/listings/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Schema'] = opts[:'x_schema'] if !opts[:'x_schema'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Listing'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.get_listing",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#get_listing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_listings(opts = {}) ⇒ ListingListResponse

List listings Cursor-paginated list of listings owned by the authenticated workspace. Use pagination.nextCursor from one response as the cursor query param of the next request to walk the full set. ?offset= is also accepted as a first-class alias for shallow paging (0..10000) — see the offset parameter below. Mutually exclusive with cursor. Filters: q (substring on name/street/city), status, channel. Optional expansions: Pass ?include=content to enrich each row with the rich content slab (summary, description, space, house rules, etc. — sourced from listings_descriptions for the en locale). Pass ?include=details for the structural slab (bedrooms, bathrooms, person capacity, check-in window, wifi, house manual, etc.). Both default to null per row when the underlying listings_descriptions / listings_details row is missing — distinct from the field being absent (which signals the expansion was not requested). Combine comma-separated, e.g. ?include=content,details. The default response stays lean; consumers must opt in.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: `native` (default), `calry`, `calry-v1`. Custom: any schema name created via `POST /v1/schema/custom`. Unknown / inactive schema names fall back to `native`.

  • :cursor (String)

    Opaque cursor returned in the previous response's `pagination.nextCursor`. Omit to fetch the first page.

  • :offset (Integer)

    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)

  • :limit (Integer)

    Max items per page. Hard cap is 100. (default to 20)

  • :q (String)

    Case-insensitive substring search on name, street, or city.

  • :status (String)

    Filter by listing status.

  • :channel (String)

    Restrict to listings published on the given channel (`airbnb`, `booking`, `vrbo`, etc.). Joins through `listing_platform_links` and matches active links only.

  • :include (String)

    Comma-separated optional expansions. Currently supported: `content`, `details`. Unknown values return 422 with a `valid_values` envelope. (Note: `amenities` is not yet supported on the list endpoint — use the detail endpoint to fetch amenity rows for a single listing.)

Returns:



367
368
369
370
# File 'lib/repull/api/listings_api.rb', line 367

def list_listings(opts = {})
  data, _status_code, _headers = list_listings_with_http_info(opts)
  data
end

#list_listings_with_http_info(opts = {}) ⇒ Array<(ListingListResponse, Integer, Hash)>

List listings Cursor-paginated list of listings owned by the authenticated workspace. Use `pagination.nextCursor` from one response as the `cursor` query param of the next request to walk the full set. `?offset=` is also accepted as a first-class alias for shallow paging (0..10000) — see the `offset` parameter below. Mutually exclusive with `cursor`. Filters: `q` (substring on name/street/city), `status`, `channel`. Optional expansions: Pass `?include=content` to enrich each row with the rich content slab (summary, description, space, house rules, etc. — sourced from `listings_descriptions` for the `en` locale). Pass `?include=details` for the structural slab (bedrooms, bathrooms, person capacity, check-in window, wifi, house manual, etc.). Both default to `null` per row when the underlying `listings_descriptions` / `listings_details` row is missing — distinct from the field being absent (which signals the expansion was not requested). Combine comma-separated, e.g. `?include=content,details`. The default response stays lean; consumers must opt in.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_schema (String)

    Apply a custom or built-in schema to transform the response. Built-in: `native` (default), `calry`, `calry-v1`. Custom: any schema name created via `POST /v1/schema/custom`. Unknown / inactive schema names fall back to `native`.

  • :cursor (String)

    Opaque cursor returned in the previous response's `pagination.nextCursor`. Omit to fetch the first page.

  • :offset (Integer)

    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)

  • :limit (Integer)

    Max items per page. Hard cap is 100. (default to 20)

  • :q (String)

    Case-insensitive substring search on name, street, or city.

  • :status (String)

    Filter by listing status.

  • :channel (String)

    Restrict to listings published on the given channel (`airbnb`, `booking`, `vrbo`, etc.). Joins through `listing_platform_links` and matches active links only.

  • :include (String)

    Comma-separated optional expansions. Currently supported: `content`, `details`. Unknown values return 422 with a `valid_values` envelope. (Note: `amenities` is not yet supported on the list endpoint — use the detail endpoint to fetch amenity rows for a single listing.)

Returns:

  • (Array<(ListingListResponse, Integer, Hash)>)

    ListingListResponse data, response status code and response headers



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/repull/api/listings_api.rb', line 384

def list_listings_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.list_listings ...'
  end
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling ListingsApi.list_listings, must be smaller than or equal to 10000.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling ListingsApi.list_listings, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListingsApi.list_listings, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ListingsApi.list_listings, must be greater than or equal to 1.'
  end

  allowable_values = ["active", "inactive", "archived"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/listings'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'channel'] = opts[:'channel'] if !opts[:'channel'].nil?
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Schema'] = opts[:'x_schema'] if !opts[:'x_schema'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListingListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.list_listings",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#list_listings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#publish_listing_to_airbnb(id, opts = {}) ⇒ ListingPublishResponse

Publish a listing to Airbnb Push a Repull listing to Airbnb. Pass airbnbConnectionId to update an already-mapped Airbnb listing, or hostId to create a brand-new Airbnb listing under that host.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



462
463
464
465
# File 'lib/repull/api/listings_api.rb', line 462

def publish_listing_to_airbnb(id, opts = {})
  data, _status_code, _headers = publish_listing_to_airbnb_with_http_info(id, opts)
  data
end

#publish_listing_to_airbnb_with_http_info(id, opts = {}) ⇒ Array<(ListingPublishResponse, Integer, Hash)>

Publish a listing to Airbnb Push a Repull listing to Airbnb. Pass `airbnbConnectionId` to update an already-mapped Airbnb listing, or `hostId` to create a brand-new Airbnb listing under that host.

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(ListingPublishResponse, Integer, Hash)>)

    ListingPublishResponse data, response status code and response headers



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/repull/api/listings_api.rb', line 473

def publish_listing_to_airbnb_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.publish_listing_to_airbnb ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ListingsApi.publish_listing_to_airbnb"
  end
  # resource path
  local_var_path = '/v1/listings/{id}/publish/airbnb'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'listing_publish_airbnb_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'ListingPublishResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.publish_listing_to_airbnb",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#publish_listing_to_airbnb\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#publish_listing_to_booking(id, opts = {}) ⇒ ListingPublishResponse

Publish a listing to Booking.com Push a Repull listing to Booking.com. The listing must already be mapped to a Booking property + room (created via the Booking-claim Connect flow).

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



531
532
533
534
# File 'lib/repull/api/listings_api.rb', line 531

def publish_listing_to_booking(id, opts = {})
  data, _status_code, _headers = publish_listing_to_booking_with_http_info(id, opts)
  data
end

#publish_listing_to_booking_with_http_info(id, opts = {}) ⇒ Array<(ListingPublishResponse, Integer, Hash)>

Publish a listing to Booking.com Push a Repull listing to Booking.com. The listing must already be mapped to a Booking property + room (created via the Booking-claim Connect flow).

Parameters:

  • id (Integer)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ListingPublishResponse, Integer, Hash)>)

    ListingPublishResponse data, response status code and response headers



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# File 'lib/repull/api/listings_api.rb', line 541

def publish_listing_to_booking_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.publish_listing_to_booking ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ListingsApi.publish_listing_to_booking"
  end
  # resource path
  local_var_path = '/v1/listings/{id}/publish/booking'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListingPublishResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.publish_listing_to_booking",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#publish_listing_to_booking\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_listing_active(id, listing_active_request, opts = {}) ⇒ ListingActiveResponse

Deactivate or reactivate a listing Toggle a listing's active state. Send { \"active\": false } to deactivate (exclude the listing from Repull) or { \"active\": true } to reactivate it. "Deactivate" keeps the listing row — it is NOT a hard delete, and it NEVER touches the upstream channel (Airbnb / Hospitable / Booking.com). Repull only mutates its own copy of the inventory. Deactivating is the self-serve way to get back under the plan-listings cap without paying. Reactivation respects the plan-listings cap: if activating this listing would push you over the cap for your tier, the call returns 402 listings_limit_exceeded and the listing stays inactive. Deactivate another listing or upgrade first. Idempotent: setting a listing to the state it's already in returns 200.

Parameters:

  • id (Integer)

    Repull listing id

  • listing_active_request (ListingActiveRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



595
596
597
598
# File 'lib/repull/api/listings_api.rb', line 595

def update_listing_active(id, listing_active_request, opts = {})
  data, _status_code, _headers = update_listing_active_with_http_info(id, listing_active_request, opts)
  data
end

#update_listing_active_with_http_info(id, listing_active_request, opts = {}) ⇒ Array<(ListingActiveResponse, Integer, Hash)>

Deactivate or reactivate a listing Toggle a listing's active state. Send `{ &quot;active&quot;: false }` to deactivate (exclude the listing from Repull) or `{ &quot;active&quot;: true }` to reactivate it. &quot;Deactivate&quot; keeps the listing row — it is NOT a hard delete, and it NEVER touches the upstream channel (Airbnb / Hospitable / Booking.com). Repull only mutates its own copy of the inventory. Deactivating is the self-serve way to get back under the plan-listings cap without paying. Reactivation respects the plan-listings cap: if activating this listing would push you over the cap for your tier, the call returns `402 listings_limit_exceeded` and the listing stays inactive. Deactivate another listing or upgrade first. Idempotent: setting a listing to the state it's already in returns 200.

Parameters:

  • id (Integer)

    Repull listing id

  • listing_active_request (ListingActiveRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ListingActiveResponse, Integer, Hash)>)

    ListingActiveResponse data, response status code and response headers



606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
# File 'lib/repull/api/listings_api.rb', line 606

def update_listing_active_with_http_info(id, listing_active_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ListingsApi.update_listing_active ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ListingsApi.update_listing_active"
  end
  # verify the required parameter 'listing_active_request' is set
  if @api_client.config.client_side_validation && listing_active_request.nil?
    fail ArgumentError, "Missing the required parameter 'listing_active_request' when calling ListingsApi.update_listing_active"
  end
  # resource path
  local_var_path = '/v1/listings/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(listing_active_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ListingActiveResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ListingsApi.update_listing_active",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#update_listing_active\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end