Sign inSign up

cabsolutely/api2-partnerservice

By cabsolutely

Updated almost 10 years ago

This is a partner service for Cabsolutely API2.0

Image
0

1.7K

cabsolutely/api2-partnerservice repository overview

PartnerService

Partner service for Cabsolutely API 2.0 - created with Odin

Running the process

make start

This starts your application on port 9000.

Usage

To use this service, you will need Befrost. Here is an example:

var Befrost = require('befrost');

var config = {
    serviceName: 'partner-service',
    hostPortList: ['127.0.0.1:21300'],
    timeout: 5000,
    secretKey: 'secret_key',
};

var client = Befrost(config, onConnected);

function onConnected(err, service) {
    if (err) {
        // Handle error
        return;
    }
    
    var serviceType = {
        name: 'TestServiceType',
        iconUrl: 'TestUrl',
        description: 'Test service type'
    };
    service.postServiceType({
    	serviceType: serviceType
    }, function onResult(error, res) {
    	if (error) {
	        // Handle error
	        return;
	    }
	    console.log(res);
    });
}
Structures
  • ServiceType:
    • name (string): The name of the service type. Required.
    • iconUrl (string): The icon url of the service type. Required.
    • description (string): A description about the service type. Not required.
    • id (string): The id of an element. Not required.
  • City:
    • name (string): The name of the city. Required.
    • active (bool): Shows the city's availability in our system. Required.
    • boundaries (GeoJSONPolygon): The boundaries of the city. Required.
    • availableServices (list): The available service id's in the city. Not required.
    • id (string): The id of an element. Not required.
  • Company:
    • name (string): The name of the company. Required.
    • active (bool): Shows the company's availability in our system. Required.
    • address (string): The address of the company. Required.
    • logoUrl (string): The logo url of the company. Required.
    • cityId (string): The city's id in which the company can be found. Required.
    • companyDomain (string): A unique domain of the company. Required.
    • availableServices (list): The available service id's of the company. Required.
    • description (string): A description about the company. Not required.
    • id (string): The id of an element. Not required.
Functions

All response has an "ok" boolean property, which shows if the request has succeeded, and a "body" property, which contains the actual data.

  • getServiceType(id): Returns with a service type with the given id.
  • getServiceTypes(query, skip, limit): Returns with a service type array from those that matches the given filter.
  • postServiceType(serviceType): Posts a service type. Returns with the service type's id.
  • putServiceType(id, serviceType): Updates a service type with the given id. Returns with the service type's id.
  • deleteServiceType(id): Deletes a service type with the given id. Returns null.
  • getCity(id): Returns with a city with the given id.
  • getCities(query, skip, limit): Returns with a city array from those that matches the given filter.
  • postCity(city): Posts a city. Returns with the city's id.
  • putCity(id, city): Updates a city with the given id. Returns with the city's id.
  • deleteCity(id): Deletes a city with the given id. Returns null.
  • getCompany(id): Returns with a company with the given id.
  • getCompanies(query, skip, limit): Returns with a company array from those that matches the given filter.
  • postCompany(company): Posts a company, and updates the associated city's "availableServices" property. Returns with the company's id.
  • putCompany(id, company): Updates a company with the given id, and updates the associated city's "availableServices" property. Returns with the company's id.
  • deleteCompany(id): Deletes a company with the given id. Returns null.

NPM scripts

  • npm test This will run the tests.
  • npm run view-cover This will show code coverage in a browser

Contributors

  • Balazs Fabian

Tag summary

Content type

Image

Digest

Size

281.6 MB

Last updated

almost 10 years ago

docker pull cabsolutely/api2-partnerservice