# FlattiesApi.ListingApi

All URIs are relative to *https://endpoints-dot-flatties-test01.appspot.com/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**getAllListings**](ListingApi.md#getAllListings) | **GET** /listings/all | Get all listings.
[**getListing**](ListingApi.md#getListing) | **GET** /listings/{listingId} | Get listing details.
[**getListings**](ListingApi.md#getListings) | **GET** /listings | Get listings in the vicinity of the specified location.
[**getListingsByTileKey**](ListingApi.md#getListingsByTileKey) | **GET** /listings/byTileKey | Get listings in the tile represented by the specified tile key.
[**removeListing**](ListingApi.md#removeListing) | **DELETE** /listings/{listingId} | Delete a listing.
[**updateListing**](ListingApi.md#updateListing) | **PUT** /listings/{listingId} | Update an existing listing.


<a name="getAllListings"></a>
# **getAllListings**
> ListingLocations getAllListings(opts)

Get all listings.

Get all listings.

### Example
```javascript
var FlattiesApi = require('flatties_api');
var defaultClient = FlattiesApi.ApiClient.default;

// Configure OAuth2 access token for authorization: flatties_auth
var flatties_auth = defaultClient.authentications['flatties_auth'];
flatties_auth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new FlattiesApi.ListingApi();

var opts = { 
  'limit': 56, // Integer | An optional number listings that are returned in each page. If zero or less, a default limit is used. Note that this is an upper limit. If there are not enough listings remaining in the list, then fewer will be returned.
  'start': "start_example" // String | An optional cursor that points to the starting page of data. Typically obtained from a previous call.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getAllListings(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **limit** | **Integer**| An optional number listings that are returned in each page. If zero or less, a default limit is used. Note that this is an upper limit. If there are not enough listings remaining in the list, then fewer will be returned. | [optional] 
 **start** | **String**| An optional cursor that points to the starting page of data. Typically obtained from a previous call. | [optional] 

### Return type

[**ListingLocations**](ListingLocations.md)

### Authorization

[flatties_auth](../README.md#flatties_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="getListing"></a>
# **getListing**
> Listing getListing(listingId)

Get listing details.

Get listing details.

### Example
```javascript
var FlattiesApi = require('flatties_api');
var defaultClient = FlattiesApi.ApiClient.default;

// Configure OAuth2 access token for authorization: flatties_auth
var flatties_auth = defaultClient.authentications['flatties_auth'];
flatties_auth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new FlattiesApi.ListingApi();

var listingId = 789; // Integer | The ID of the listing to retrieve.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getListing(listingId, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **listingId** | **Integer**| The ID of the listing to retrieve. | 

### Return type

[**Listing**](Listing.md)

### Authorization

[flatties_auth](../README.md#flatties_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="getListings"></a>
# **getListings**
> ListingLocations getListings(latitude, longitude, radius)

Get listings in the vicinity of the specified location.

Get listings in the vicinity of the specified location and at the specified zoom level.

### Example
```javascript
var FlattiesApi = require('flatties_api');
var defaultClient = FlattiesApi.ApiClient.default;

// Configure OAuth2 access token for authorization: flatties_auth
var flatties_auth = defaultClient.authentications['flatties_auth'];
flatties_auth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new FlattiesApi.ListingApi();

var latitude = 1.2; // Number | Latitude component of location.

var longitude = 1.2; // Number | Longitude component of location.

var radius = 1.2; // Number | The radius in metres.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getListings(latitude, longitude, radius, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **latitude** | **Number**| Latitude component of location. | 
 **longitude** | **Number**| Longitude component of location. | 
 **radius** | **Number**| The radius in metres. | 

### Return type

[**ListingLocations**](ListingLocations.md)

### Authorization

[flatties_auth](../README.md#flatties_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="getListingsByTileKey"></a>
# **getListingsByTileKey**
> &#39;String&#39; getListingsByTileKey(tileKey, opts)

Get listings in the tile represented by the specified tile key.

Get listings in the tile represented by the specified tile key. Optionally, return the specified depth of sub-levels.

### Example
```javascript
var FlattiesApi = require('flatties_api');
var defaultClient = FlattiesApi.ApiClient.default;

// Configure OAuth2 access token for authorization: flatties_auth
var flatties_auth = defaultClient.authentications['flatties_auth'];
flatties_auth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new FlattiesApi.ListingApi();

var tileKey = "tileKey_example"; // String | The tile key.

var opts = { 
  'sublevels': 56 // Integer | The number of sub-levels to return. Must be between 0 and 2 inclusive. Defaults to zero.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getListingsByTileKey(tileKey, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **tileKey** | **String**| The tile key. | 
 **sublevels** | **Integer**| The number of sub-levels to return. Must be between 0 and 2 inclusive. Defaults to zero. | [optional] 

### Return type

**&#39;String&#39;**

### Authorization

[flatties_auth](../README.md#flatties_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/octet-stream

<a name="removeListing"></a>
# **removeListing**
> removeListing(listingId)

Delete a listing.

Delete a listing.

### Example
```javascript
var FlattiesApi = require('flatties_api');
var defaultClient = FlattiesApi.ApiClient.default;

// Configure OAuth2 access token for authorization: flatties_auth
var flatties_auth = defaultClient.authentications['flatties_auth'];
flatties_auth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new FlattiesApi.ListingApi();

var listingId = 789; // Integer | The ID of the listing to remove.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.removeListing(listingId, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **listingId** | **Integer**| The ID of the listing to remove. | 

### Return type

null (empty response body)

### Authorization

[flatties_auth](../README.md#flatties_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="updateListing"></a>
# **updateListing**
> &#39;Integer&#39; updateListing(listingId, listing)

Update an existing listing.

Update an existing listing via listing ID.

### Example
```javascript
var FlattiesApi = require('flatties_api');
var defaultClient = FlattiesApi.ApiClient.default;

// Configure OAuth2 access token for authorization: flatties_auth
var flatties_auth = defaultClient.authentications['flatties_auth'];
flatties_auth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new FlattiesApi.ListingApi();

var listingId = 789; // Integer | The ID of the listing to retrieve.

var listing = new FlattiesApi.Listing(); // Listing | Listing that needs to be updated. The listing ID must be valid.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.updateListing(listingId, listing, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **listingId** | **Integer**| The ID of the listing to retrieve. | 
 **listing** | [**Listing**](Listing.md)| Listing that needs to be updated. The listing ID must be valid. | 

### Return type

**&#39;Integer&#39;**

### Authorization

[flatties_auth](../README.md#flatties_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

