@infisale-client/api 0.0.27 → 0.0.29

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.
package/dist/index.d.ts CHANGED
@@ -1,26 +1,52 @@
1
1
  export * from './api';
2
2
  import * as doc from './api';
3
- import 'axios';
4
- import type { AxiosInstance } from 'axios';
5
- declare module 'axios' {
6
- interface AxiosInstance {
7
- UserApi: doc.UserApi;
8
- AuthApi: doc.AuthApi;
9
- NotificationApi: doc.NotificationApi;
10
- CompanyApi: doc.CompanyApi;
11
- OperationApi: doc.OperationApi;
12
- FileApi: doc.FileApi;
13
- AddressApi: doc.AddressApi;
14
- PageApi: doc.PageApi;
15
- CategoryApi: doc.CategoryApi;
16
- ProductApi: doc.ProductApi;
17
- BrandApi: doc.BrandApi;
18
- CollectionApi: doc.CollectionApi;
19
- ThemeApi: doc.ThemeApi;
20
- TemplateApi: doc.TemplateApi;
21
- }
3
+ import type { AxiosInstance, AxiosInterceptorManager, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
4
+ interface IApiClient {
5
+ UserApi: doc.UserApi;
6
+ AuthApi: doc.AuthApi;
7
+ NotificationApi: doc.NotificationApi;
8
+ CompanyApi: doc.CompanyApi;
9
+ OperationApi: doc.OperationApi;
10
+ FileApi: doc.FileApi;
11
+ AddressApi: doc.AddressApi;
12
+ PageApi: doc.PageApi;
13
+ CategoryApi: doc.CategoryApi;
14
+ ProductApi: doc.ProductApi;
15
+ BrandApi: doc.BrandApi;
16
+ CollectionApi: doc.CollectionApi;
17
+ ThemeApi: doc.ThemeApi;
18
+ TemplateApi: doc.TemplateApi;
19
+ interceptors: {
20
+ request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
21
+ response: AxiosInterceptorManager<AxiosResponse>;
22
+ };
22
23
  }
23
- declare const createApiClient: (baseURL: string, options?: {
24
- headers?: Record<string, string>;
25
- }) => AxiosInstance;
26
- export default createApiClient;
24
+ declare class ApiClient implements IApiClient {
25
+ baseURL: string;
26
+ options?: {
27
+ headers?: Record<string, string>;
28
+ } | undefined;
29
+ api: AxiosInstance;
30
+ interceptors: {
31
+ request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
32
+ response: AxiosInterceptorManager<AxiosResponse>;
33
+ };
34
+ UserApi: doc.UserApi;
35
+ AuthApi: doc.AuthApi;
36
+ NotificationApi: doc.NotificationApi;
37
+ CompanyApi: doc.CompanyApi;
38
+ OperationApi: doc.OperationApi;
39
+ FileApi: doc.FileApi;
40
+ AddressApi: doc.AddressApi;
41
+ PageApi: doc.PageApi;
42
+ CategoryApi: doc.CategoryApi;
43
+ ProductApi: doc.ProductApi;
44
+ BrandApi: doc.BrandApi;
45
+ CollectionApi: doc.CollectionApi;
46
+ ThemeApi: doc.ThemeApi;
47
+ TemplateApi: doc.TemplateApi;
48
+ constructor(baseURL: string, options?: {
49
+ headers?: Record<string, string>;
50
+ } | undefined);
51
+ }
52
+ export default ApiClient;
package/dist/index.js CHANGED
@@ -1,31 +1,55 @@
1
1
  export * from './api';
2
2
  import * as doc from './api';
3
- import 'axios';
4
3
  import Axios from 'axios';
5
- const createApiClient = (baseURL, options) => {
6
- const api = Axios.create({
7
- baseURL,
8
- headers: {
9
- 'X-Requested-With': 'XMLHttpRequest',
10
- Accept: 'application/json',
11
- 'Content-Type': 'application/json',
12
- ...options?.headers,
13
- },
14
- });
15
- api.UserApi = new doc.UserApi(undefined, baseURL, api);
16
- api.AuthApi = new doc.AuthApi(undefined, baseURL, api);
17
- api.NotificationApi = new doc.NotificationApi(undefined, baseURL, api);
18
- api.CompanyApi = new doc.CompanyApi(undefined, baseURL, api);
19
- api.OperationApi = new doc.OperationApi(undefined, baseURL, api);
20
- api.FileApi = new doc.FileApi(undefined, baseURL, api);
21
- api.AddressApi = new doc.AddressApi(undefined, baseURL, api);
22
- api.PageApi = new doc.PageApi(undefined, baseURL, api);
23
- api.CategoryApi = new doc.CategoryApi(undefined, baseURL, api);
24
- api.ProductApi = new doc.ProductApi(undefined, baseURL, api);
25
- api.BrandApi = new doc.BrandApi(undefined, baseURL, api);
26
- api.CollectionApi = new doc.CollectionApi(undefined, baseURL, api);
27
- api.ThemeApi = new doc.ThemeApi(undefined, baseURL, api);
28
- api.TemplateApi = new doc.TemplateApi(undefined, baseURL, api);
29
- return api;
30
- };
31
- export default createApiClient;
4
+ class ApiClient {
5
+ baseURL;
6
+ options;
7
+ api;
8
+ interceptors;
9
+ UserApi;
10
+ AuthApi;
11
+ NotificationApi;
12
+ CompanyApi;
13
+ OperationApi;
14
+ FileApi;
15
+ AddressApi;
16
+ PageApi;
17
+ CategoryApi;
18
+ ProductApi;
19
+ BrandApi;
20
+ CollectionApi;
21
+ ThemeApi;
22
+ TemplateApi;
23
+ constructor(baseURL, options) {
24
+ this.baseURL = baseURL;
25
+ this.options = options;
26
+ this.api = Axios.create({
27
+ baseURL,
28
+ headers: {
29
+ 'X-Requested-With': 'XMLHttpRequest',
30
+ Accept: 'application/json',
31
+ 'Content-Type': 'application/json',
32
+ ...options?.headers,
33
+ },
34
+ });
35
+ this.UserApi = new doc.UserApi(undefined, baseURL, this.api);
36
+ this.AuthApi = new doc.AuthApi(undefined, baseURL, this.api);
37
+ this.NotificationApi = new doc.NotificationApi(undefined, baseURL, this.api);
38
+ this.CompanyApi = new doc.CompanyApi(undefined, baseURL, this.api);
39
+ this.OperationApi = new doc.OperationApi(undefined, baseURL, this.api);
40
+ this.FileApi = new doc.FileApi(undefined, baseURL, this.api);
41
+ this.AddressApi = new doc.AddressApi(undefined, baseURL, this.api);
42
+ this.PageApi = new doc.PageApi(undefined, baseURL, this.api);
43
+ this.CategoryApi = new doc.CategoryApi(undefined, baseURL, this.api);
44
+ this.ProductApi = new doc.ProductApi(undefined, baseURL, this.api);
45
+ this.BrandApi = new doc.BrandApi(undefined, baseURL, this.api);
46
+ this.CollectionApi = new doc.CollectionApi(undefined, baseURL, this.api);
47
+ this.ThemeApi = new doc.ThemeApi(undefined, baseURL, this.api);
48
+ this.TemplateApi = new doc.TemplateApi(undefined, baseURL, this.api);
49
+ this.interceptors = {
50
+ request: Axios.interceptors.request,
51
+ response: Axios.interceptors.response,
52
+ };
53
+ }
54
+ }
55
+ export default ApiClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infisale-client/api",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "api-sdk",
5
5
  "author": "Muhammet KÖKLÜ <105980019+byhipernova@users.noreply.github.com>",
6
6
  "homepage": "https://github.com/infisale/infisale-client#readme",
@@ -30,7 +30,7 @@
30
30
  "bugs": {
31
31
  "url": "https://github.com/infisale/infisale-client/issues"
32
32
  },
33
- "gitHead": "7183b86d941a5162f1002223510727c8e3e6ed75",
33
+ "gitHead": "baf4a618c7e5344dead3137cc21765b5911ddfd7",
34
34
  "devDependencies": {
35
35
  "typescript": "^5.6.2"
36
36
  }