swagger: "2.0" info: version: "0.0.1" title: AirBnB Cleaning API # during dev, should point to your local machine host: localhost:8080 # basePath prefixes all resource paths basePath: / # schemes: # tip: remove http to make production-grade - http - https # format of bodies a client can send (Content-Type) consumes: - application/json - application/x-www-form-urlencoded # format of the responses to the client (Accepts) produces: - application/json paths: /properties: x-swagger-router-controller: properties_controller get: description: Returns a list of properties to the caller x-swagger-router-controller: properties_controller parameters: - in: query name: cleanings required: true type: boolean description: return all future cleanings with the properties operationId: getproperties responses: "200": description: Success schema: $ref: "#/definitions/PropertiesResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" post: description: Adds a new property to the database operationId: insertproperty parameters: - in: body name: property required: true schema: $ref: "#/definitions/Property" description: The property to add to the database responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" /properties/update: x-swagger-router-controller: cleanings_controller get: description: Update the cleaning database for all properties operationId: updatecleanings responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" /properties/{id}: x-swagger-router-controller: properties_controller parameters: - in: path name: id required: true type: string description: The id of the property to get get: description: Returns the specified property to the caller operationId: getproperty responses: "200": description: Success schema: $ref: "#/definitions/PropertiesResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" put: description: Updates the specified property in the database operationId: updateproperty parameters: - in: body name: property required: false schema: $ref: "#/definitions/PropertyUpdate" description: the updated property info responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" delete: description: Deletes the specified movie from the database operationId: deleteproperty responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" /properties/{id}/update: x-swagger-router-controller: cleanings_controller parameters: - in: path name: id required: true type: string description: The id of the property to update. get: description: Update the cleaning database for this property operationId: updatepropertycleanings responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" /cleaners: x-swagger-router-controller: cleaners_controller get: description: Get all cleaners from the database operationId: getcleaners responses: "200": description: Success schema: $ref: "#/definitions/CleanersResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" post: description: Add a new cleaner to the database operationId: insertcleaner parameters: - in: body name: cleaner required: true schema: $ref: "#/definitions/Cleaner" description: The info for the new cleaner responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" /cleaners/{id}: x-swagger-router-controller: cleaners_controller parameters: - in: path name: id type: string required: true description: id of cleaner get: description: Get the specified cleaner from the database operationId: getcleaner responses: "200": description: Success schema: $ref: "#/definitions/CleanersResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" put: description: Update the specified cleaner in the database operationId: updatecleaner parameters: - in: body name: cleaner required: true schema: $ref: "#/definitions/CleanerUpdate" description: New information for the cleaner responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" delete: description: Delete the specified cleaner form the database operationId: deletecleaner responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" /cleaning/{id}: x-swagger-router-controller: cleanings_controller get: description: Update the cleaning (Mark it as completed) operationId: updatecleaning parameters: - in: path name: id required: true type: string description: id of cleaning event to mark cleaned - in: query name: done required: true type: boolean default: false responses: "200": description: Success schema: $ref: "#/definitions/GenericResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" # We might need to change the controller for the next two slightly so we can capture # whether we are coming from properties or cleaners /properties/{id}/cleanings: x-swagger-router-controller: cleanings_controller get: description: Get cleanings for a specified property (optionally specify a range of dates) operationId: getpropertycleanings parameters: - in: path name: id required: true type: string description: The id of the property - in: query name: start required: false type: string description: The start date of the cleanings to return - in: query name: end required: false type: string description: The end date of the cleanings to return responses: "200": description: Success schema: $ref: "#/definitions/CleaningsResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" /cleaners/{id}/cleanings: x-swagger-router-controller: cleanings_controller get: description: Get cleanings for a specified cleaner (optionally specify a range of dates) operationId: getcleanercleanings parameters: - in: path name: id required: true type: string description: The id of the cleaner - in: query name: start required: false type: string description: The start date of the cleanings to return - in: query name: end required: false type: string description: The end date of the cleanings to return responses: "200": description: Success schema: $ref: "#/definitions/CleaningsResponse" default: description: Failure schema: $ref: "#/definitions/ErrorResponse" # complex objects have schema definitions definitions: Property: type: object required: - name - address - city - state - zip - cleaner - calendar properties: name: type: string address: type: string city: type: string state: type: string zip: type: string cleaner: type: string calendar: type: string PropertyUpdate: type: object properties: name: type: string address: type: string city: type: string state: type: string zip: type: string cleaner: type: string calendar: type: string PropertiesResponse: # Response for Getting any number of properties required: - size - properties properties: size: type: integer 'properties': type: array items: $ref: "#/definitions/Property" Cleaner: type: object required: - name - email - phone properties: name: type: string email: type: string phone: type: string CleanerUpdate: type: object properties: name: type: string email: type: string phone: type: string CleanersResponse: # Used for Getting a specific cleaner required: - cleaners properties: cleaners: type: array items: $ref: "#/definitions/Cleaner" Cleaning: type: object required: - cleaned - property - cleaner - start - end properties: property: type: string cleaner: type: string cleaned: type: boolean start: type: string end: type: string CleaningsResponse: # Used as response for: # /cleaners/{id}/cleanings to return a list of cleanings for this cleaner # and /properties/{id}/cleanings to return a list of cleanings for this property required: - cleanings properties: cleanings: type: array items: $ref: "#/definitions/Cleaning" ErrorResponse: required: - message properties: message: type: string GenericResponse: # Used to send message. For example, item added! required: - message properties: message: type: string