Skip to content

rentalo/listings-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

listings-service

Open endpoints

Authenticated endpoints

Endpoints details

Get listings (public)

Uri: /public/v1/listings/{geohash}

Method: GET

Description: Get some listings in a region

Path parameters:

  • geohash

Get listings (private)

Uri: /v1/listings/{geohash}

Method: GET

Description: Get listings in a region while applying some filters

Path parameters:

  • geohash

Query parameters:

  • category
  • min_height
  • min_width
  • min_depth
  • max_price
  • is_shared
  • from_date
  • to_date

Publish a listing

Uri: /v1/listing

Method: PUT

Description: Publish or update a listing

Sample body:

{

  "id": "4c343850-13b3-41e1-974c-aaaa2c387444",
  "geohash": "gbsvh",
  "category": "BOX",
  "rent": 40,
  "address": {
     "street": "Via Roma 123",
     "city": "Torino",
     "state": "TO",
     "zip": "12345",
     "country": "Italy"
  },
  "position": {
    "latitude": 45.076035, 
    "longitude": 7.669416
  },
  "height": 5,
  "width": 6,
  "depth": 4,
  "isNegotiable": false,
  "isShared": true,
  "photos": ["avMQpjqbGEzCCPuTZjTEJQ=="],
  "phone": "+393211234567",
  "description": "Esempio descrizione con dettagli particolari",
  "availability": {
    "from": "2018-01-01T00:00:00Z",
    "to": "2021-01-01T00:00:00Z"
  }

}

Get listing details

Uri: /v1/listing/{geohash}/{id}

Method: GET

Sample response:

{

  "listingId": "4c343850-13b3-41e1-974c-aaaa2c387444",
  "locationId": "gbsvh",
  "category": "BOX",
  "rent": 40,
  "address": {
     "street": "Via Roma 123",
     "city": "Torino",
     "state": "TO",
     "zip": "12345",
     "country": "Italy"
  },
  "position": {
    "latitude": 45.076035, 
    "longitude": 7.669416
  },
  "height": 5,
  "width": 6,
  "depth": 4,
  "isNegotiable": false,
  "isShared": true,
  "photos": ["avMQpjqbGEzCCPuTZjTEJQ=="],
  "email": "[email protected]", 
  "phone": "+393211234567",
  "owner": "42e9b4da-f4c9-4f8f-93be-97fb7bec9bc5",
  "description": "Esempio descrizione con dettagli particolari",
  "availability": {
    "from": "2018-01-01T00:00:00Z",
    "to": "2021-01-01T00:00:00Z"
  }

}

Delete a listing

Uri: /v1/listing/{geohash}/{id}

Method: DELETE

Publish a listing photo

Uri: /v1/listing/photo

Method: PUT

Body:

  • hash: Base64-encoded MD5 hash of base64-encoded image
  • base64: Base64-encoded image

Sample body:

{
  "hash": "eteFLxUBax1QDtrbBXiszQ==",
  "base64": "/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABaKADAAQAAAABAAABwgAAAAD/wAARCAHCAWgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9sAQwAcHBwcHBwwHBwwRDAwMERcRERERFx0XFxcXFx0jHR0dHR0dIyMjIyMjIyMqKioqKioxMTExMTc3Nzc3Nzc3Nz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ZixigZEQRSVYk+7VagBaKSiqEOoptOoAWkoooAliOGFawPFYyH5hWqp4oAmzRmo80ZpjJM0ZqPNGaBElFMzRmgD/04xThTRThVCFprU6mtSAbRRRQMSiiigAooooAKWkpaAFFLSClpDKE/36r1Yn+/VekAlFFFABQKKBQBOvSnGmr0pxpiIGplPamUgEpKWkoAKKKKQC1KlRVKlA0OfpUNTP0qGhDYUtJS1RIUUUUALSUtJQA9etaa9KzF61pr0oAdRRRQMKKKKYgooooA//2Q=="
}

Get a listing photo

Uri: /v1/listing/photo/{hash}

Method: GET

Description: Get a listing photo by its hash

Get user listings

Uri: /v1/user/listings

Method: GET

Description: Get all listings created by the authenticated user

Testing

Requirements

  • localstack
  • awslocal
  • api-gateway-mapping-template

Setup

  1. Run localstack

    export USE_SINGLE_REGION=true; localstack start -d
    
  2. Initialize resources

    awslocal dynamodb create-table --cli-input-json file://tests/init/listings-table.json
    awslocal s3 mb s3://listings-photos-bucket
    

Run

python -m unittest discover tests/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published