@selfcommunity/api-services 0.6.4-courses.232 → 0.6.4-courses.234

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,17 +2,17 @@ import { AxiosInstance, AxiosResponse } from 'axios';
2
2
  /**
3
3
  * List of all Http methods
4
4
  */
5
- export declare type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
5
+ export type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
6
6
  /**
7
7
  * AxiosResponseHeaders interface
8
8
  */
9
- export declare type AxiosResponseHeaders = Record<string, string> & {
9
+ export type AxiosResponseHeaders = Record<string, string> & {
10
10
  'set-cookie'?: string[];
11
11
  };
12
12
  /**
13
13
  * General HttpResponse
14
14
  */
15
- export declare type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
15
+ export type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
16
16
  /**
17
17
  * Interface for the ApiClient
18
18
  */
@@ -10,6 +10,9 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
10
10
  * should we choose to do so in the future, without it breaking our app.
11
11
  */
12
12
  class ApiClient {
13
+ createClient(config) {
14
+ return axios_1.default.create(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
15
+ }
13
16
  constructor(config) {
14
17
  /**
15
18
  * Set default header
@@ -51,9 +54,6 @@ class ApiClient {
51
54
  this.client = this.createClient(config);
52
55
  this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
53
56
  }
54
- createClient(config) {
55
- return axios_1.default.create(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
56
- }
57
57
  /**
58
58
  * Get client instance
59
59
  */
@@ -2,17 +2,17 @@ import { AxiosInstance, AxiosResponse } from 'axios';
2
2
  /**
3
3
  * List of all Http methods
4
4
  */
5
- export declare type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
5
+ export type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
6
6
  /**
7
7
  * AxiosResponseHeaders interface
8
8
  */
9
- export declare type AxiosResponseHeaders = Record<string, string> & {
9
+ export type AxiosResponseHeaders = Record<string, string> & {
10
10
  'set-cookie'?: string[];
11
11
  };
12
12
  /**
13
13
  * General HttpResponse
14
14
  */
15
- export declare type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
15
+ export type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
16
16
  /**
17
17
  * Interface for the ApiClient
18
18
  */
@@ -6,6 +6,9 @@ import axios from 'axios';
6
6
  * should we choose to do so in the future, without it breaking our app.
7
7
  */
8
8
  export class ApiClient {
9
+ createClient(config) {
10
+ return axios.create(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
11
+ }
9
12
  constructor(config) {
10
13
  /**
11
14
  * Set default header
@@ -47,9 +50,6 @@ export class ApiClient {
47
50
  this.client = this.createClient(config);
48
51
  this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
49
52
  }
50
- createClient(config) {
51
- return axios.create(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
52
- }
53
53
  /**
54
54
  * Get client instance
55
55
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfcommunity/api-services",
3
- "version": "0.6.4-courses.232+e8ddfdcc0",
3
+ "version": "0.6.4-courses.234+e1d16dda0",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "./lib/cjs/index.js",
@@ -58,8 +58,8 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@selfcommunity/types": "0.7.4-courses.232+e8ddfdcc0",
62
- "@selfcommunity/utils": "0.2.61-courses.232+e8ddfdcc0",
61
+ "@selfcommunity/types": "0.7.4-courses.234+e1d16dda0",
62
+ "@selfcommunity/utils": "0.2.61-courses.234+e1d16dda0",
63
63
  "axios": "^1.4.0",
64
64
  "jose": "^4.14.4"
65
65
  },
@@ -115,5 +115,5 @@
115
115
  "bugs": {
116
116
  "url": "https://github.com/selfcommunity/community-js/issues"
117
117
  },
118
- "gitHead": "e8ddfdcc0032e5f49c876b47ee63efcb74ac36c0"
118
+ "gitHead": "e1d16dda0ad0ac52602758302e48570d45fc3af4"
119
119
  }