2018-01-24 15:41:46 -08:00
|
|
|
/**
|
|
|
|
* Defines available api version types
|
|
|
|
*/
|
|
|
|
export type ApiVersion = 'v1' | 'v2';
|
|
|
|
|
2017-08-18 03:42:40 -07:00
|
|
|
/**
|
|
|
|
* Defines the root path for wherehows front-end api requests
|
2018-01-24 15:41:46 -08:00
|
|
|
* @param {ApiVersion} [version = 'v1'] the
|
|
|
|
* @return {string}
|
2017-08-18 03:42:40 -07:00
|
|
|
*/
|
2018-01-24 15:41:46 -08:00
|
|
|
export const getApiRoot = (version: ApiVersion = 'v1') => `/api/${version}`;
|
2017-08-18 03:42:40 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines the literal possible string enum values for the an api response status
|
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
export enum ApiStatus {
|
|
|
|
OK = 'ok',
|
2017-09-10 19:31:54 -07:00
|
|
|
// Adds support for success response used in api's like /comments, will refactored to use ok
|
|
|
|
SUCCESS = 'success',
|
2017-11-16 14:54:06 -08:00
|
|
|
FAILED = 'failed',
|
|
|
|
ERROR = 'error'
|
2017-08-18 03:42:40 -07:00
|
|
|
}
|