lib/helpers/Http.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 52
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 33
mnd 0
bc 0
fnc 1
dl 0
loc 52
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A Http.js ➔ getApiPossibleCodes 0 3 1
1
const RequestHeaders = {
2
  locale: 'x-locale',
3
  currency: 'x-currency',
4
  deviceType: 'x-device-type',
5
  osVersion: 'x-os-version',
6
  appVersion: 'x-app-version',
7
  accessToken: 'x-access-token',
8
};
9
10
const CurlContentTypes = {
11
  JSON: 'Application/json',
12
  MultiPartFormData: 'Multipart/form-data',
13
};
14
15
//in case of successful create, read, update, delete & any successful operation
16
const SUCCESS = 'success';
17
18
//in case of operational or process failure
19
const BAD_REQUEST = 'bad_request';
20
21
//in case of authentication failure, trying to access any protected route with expired or no API token
22
const UNAUTHORISED = 'unauthorised';
23
24
//in case of validation failure
25
const INPROCESSABLE = 'inprocessable';
26
27
//in case of validation failure
28
const VALIDATION_ERROR = 'validationError';
29
30
const Codes = {
31
  success: 200,
32
  bad_request: 400,
33
  unauthorised: 401,
34
  validationError: 422,
35
  inprocessable: 422,
36
};
37
38
function getApiPossibleCodes() {
39
  return array_values(Codes);
40
}
41
42
module.exports = {
43
  RequestHeaders: RequestHeaders,
44
  CurlContentTypes: CurlContentTypes,
45
  SUCCESS: SUCCESS,
46
  BAD_REQUEST: BAD_REQUEST,
47
  UNAUTHORISED: UNAUTHORISED,
48
  INPROCESSABLE: INPROCESSABLE,
49
  VALIDATION_ERROR: VALIDATION_ERROR,
50
  Codes: Codes,
51
  getApiPossibleCodes: getApiPossibleCodes,
52
};
53