@epilot/customer-portal-client 0.1.0
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/README.md +43 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +14 -0
- package/dist/definition.d.ts +3 -0
- package/dist/definition.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -0
- package/dist/openapi.d.ts +128 -0
- package/package.json +56 -0
- package/src/openapi.d.ts +128 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# `@epilot/customer-portal-client`
|
|
2
|
+
|
|
3
|
+
API Client for epilot customer-portal API.
|
|
4
|
+
|
|
5
|
+
Uses [`openapi-client-axios`](https://github.com/anttiviljami/openapi-client-axios)
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
Install the package:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --save-dev @epilot/customer-portal-client
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import the package:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { getClient } from '@epilot/customer-portal-client';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Use the client:
|
|
22
|
+
```typescript
|
|
23
|
+
// get typed client
|
|
24
|
+
const client = await getClient();
|
|
25
|
+
|
|
26
|
+
// call an operation
|
|
27
|
+
const res = await client.testAuth();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## BaseURL & Authorization
|
|
31
|
+
|
|
32
|
+
To pass an authorization header and set up the API url, you can use axios
|
|
33
|
+
defaults:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
const client = getClient();
|
|
37
|
+
client.defaults.baseURL = config.CUSTOMER_PORTAL_API;
|
|
38
|
+
client.defaults.headers['authorization'] = `Bearer ${token}`;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## API Docs:
|
|
42
|
+
|
|
43
|
+
https://docs.api.epilot.io/
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getClient: () => import("openapi-client-axios").OpenAPIClient<import("./openapi").OperationMethods, import("./openapi").PathsDictionary>;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getClient = void 0;
|
|
7
|
+
var openapi_client_axios_1 = __importDefault(require("openapi-client-axios"));
|
|
8
|
+
var definition_1 = __importDefault(require("./definition"));
|
|
9
|
+
var getClient = function () {
|
|
10
|
+
var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true });
|
|
11
|
+
return api.initSync();
|
|
12
|
+
};
|
|
13
|
+
exports.getClient = getClient;
|
|
14
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){for(var o in t)e[o]=t[o];t.__esModule&&Object.defineProperty(e,"__esModule",{value:!0})}(exports,(()=>{"use strict";var e={914:function(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(o(279));t.default=i.default},279:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"Customer Portal API","description":"Backend for epilot end customer portals","version":"1.0.0"},"tags":[{"name":"mock","description":"Mock endpoints"},{"name":"auth","description":"Auth endpoints"}],"security":[{"CustomerPortalAuth":[]},{"AsOrganization":[]},{"AsBrand":[]},{"AsCustomer":[]}],"paths":{"/v1/customer-portal/public/mock":{"get":{"operationId":"mockPublicOperation","summary":"mockPublicOperation","description":"Mock response from OAS definition","tags":["mock"],"security":[],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"hello":{"type":"string","example":"world"}},"required":["hello"]}}}}}}},"/v1/customer-portal/mock":{"get":{"operationId":"mockOperation","summary":"mockOperation","description":"Mock response from OAS definition","tags":["mock"],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"hello":{"type":"string","example":"world"}},"required":["hello"]}}}}}}},"/v1/customer-portal/auth":{"get":{"operationId":"testAuth","summary":"testAuth","description":"Return auth context","tags":["auth"],"responses":{"200":{"description":"ok"}}}},"/v1/customer-portal/admin/auth":{"get":{"operationId":"testAdminAuth","summary":"testAdminAuth","description":"Return auth context","tags":["auth"],"security":[{"EpilotAuth":[]},{"AsOrganization":[]}],"responses":{"200":{"description":"ok"}}}}},"components":{"securitySchemes":{"CustomerPortalAuth":{"type":"http","scheme":"bearer","description":"Customer Portal Cognito Token"},"EpilotAuth":{"type":"http","scheme":"bearer","description":"Epilot Bearer Token"},"AsOrganization":{"type":"apiKey","in":"header","name":"x-ivy-org-id","description":"Set organization id as internal user"},"AsBrand":{"type":"apiKey","in":"header","name":"x-ivy-brand-id","description":"Set brand id as internal user"},"AsContact":{"type":"apiKey","in":"header","name":"x-contact-id","description":"Set contact id as internal user"}},"schemas":{"HelloWorldObject":{"type":"object","properties":{"hello":{"type":"string","example":"world"}},"required":["hello"]}}}}')}},t={};return function o(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,o),i.exports}(914)})());
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./client"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import {
|
|
3
|
+
OpenAPIClient,
|
|
4
|
+
Parameters,
|
|
5
|
+
UnknownParamsObject,
|
|
6
|
+
OperationResponse,
|
|
7
|
+
AxiosRequestConfig,
|
|
8
|
+
} from 'openapi-client-axios';
|
|
9
|
+
|
|
10
|
+
declare namespace Components {
|
|
11
|
+
namespace Schemas {
|
|
12
|
+
export interface HelloWorldObject {
|
|
13
|
+
/**
|
|
14
|
+
* example:
|
|
15
|
+
* world
|
|
16
|
+
*/
|
|
17
|
+
hello: string;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
declare namespace Paths {
|
|
22
|
+
namespace MockOperation {
|
|
23
|
+
namespace Responses {
|
|
24
|
+
export type $200 = Components.Schemas.HelloWorldObject;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
namespace MockPublicOperation {
|
|
28
|
+
namespace Responses {
|
|
29
|
+
export type $200 = Components.Schemas.HelloWorldObject;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface OperationMethods {
|
|
35
|
+
/**
|
|
36
|
+
* mockPublicOperation - mockPublicOperation
|
|
37
|
+
*
|
|
38
|
+
* Mock response from OAS definition
|
|
39
|
+
*/
|
|
40
|
+
'mockPublicOperation'(
|
|
41
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
42
|
+
data?: any,
|
|
43
|
+
config?: AxiosRequestConfig
|
|
44
|
+
): OperationResponse<Paths.MockPublicOperation.Responses.$200>
|
|
45
|
+
/**
|
|
46
|
+
* mockOperation - mockOperation
|
|
47
|
+
*
|
|
48
|
+
* Mock response from OAS definition
|
|
49
|
+
*/
|
|
50
|
+
'mockOperation'(
|
|
51
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
52
|
+
data?: any,
|
|
53
|
+
config?: AxiosRequestConfig
|
|
54
|
+
): OperationResponse<Paths.MockOperation.Responses.$200>
|
|
55
|
+
/**
|
|
56
|
+
* testAuth - testAuth
|
|
57
|
+
*
|
|
58
|
+
* Return auth context
|
|
59
|
+
*/
|
|
60
|
+
'testAuth'(
|
|
61
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
62
|
+
data?: any,
|
|
63
|
+
config?: AxiosRequestConfig
|
|
64
|
+
): OperationResponse<any>
|
|
65
|
+
/**
|
|
66
|
+
* testAdminAuth - testAdminAuth
|
|
67
|
+
*
|
|
68
|
+
* Return auth context
|
|
69
|
+
*/
|
|
70
|
+
'testAdminAuth'(
|
|
71
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
72
|
+
data?: any,
|
|
73
|
+
config?: AxiosRequestConfig
|
|
74
|
+
): OperationResponse<any>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface PathsDictionary {
|
|
78
|
+
['/v1/customer-portal/public/mock']: {
|
|
79
|
+
/**
|
|
80
|
+
* mockPublicOperation - mockPublicOperation
|
|
81
|
+
*
|
|
82
|
+
* Mock response from OAS definition
|
|
83
|
+
*/
|
|
84
|
+
'get'(
|
|
85
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
86
|
+
data?: any,
|
|
87
|
+
config?: AxiosRequestConfig
|
|
88
|
+
): OperationResponse<Paths.MockPublicOperation.Responses.$200>
|
|
89
|
+
}
|
|
90
|
+
['/v1/customer-portal/mock']: {
|
|
91
|
+
/**
|
|
92
|
+
* mockOperation - mockOperation
|
|
93
|
+
*
|
|
94
|
+
* Mock response from OAS definition
|
|
95
|
+
*/
|
|
96
|
+
'get'(
|
|
97
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
98
|
+
data?: any,
|
|
99
|
+
config?: AxiosRequestConfig
|
|
100
|
+
): OperationResponse<Paths.MockOperation.Responses.$200>
|
|
101
|
+
}
|
|
102
|
+
['/v1/customer-portal/auth']: {
|
|
103
|
+
/**
|
|
104
|
+
* testAuth - testAuth
|
|
105
|
+
*
|
|
106
|
+
* Return auth context
|
|
107
|
+
*/
|
|
108
|
+
'get'(
|
|
109
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
110
|
+
data?: any,
|
|
111
|
+
config?: AxiosRequestConfig
|
|
112
|
+
): OperationResponse<any>
|
|
113
|
+
}
|
|
114
|
+
['/v1/customer-portal/admin/auth']: {
|
|
115
|
+
/**
|
|
116
|
+
* testAdminAuth - testAdminAuth
|
|
117
|
+
*
|
|
118
|
+
* Return auth context
|
|
119
|
+
*/
|
|
120
|
+
'get'(
|
|
121
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
122
|
+
data?: any,
|
|
123
|
+
config?: AxiosRequestConfig
|
|
124
|
+
): OperationResponse<any>
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@epilot/customer-portal-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "API Client for epilot customer-portal API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "jest",
|
|
9
|
+
"typescript": "tsc",
|
|
10
|
+
"bundle-definition": "webpack",
|
|
11
|
+
"openapi": "openapi read --json --dereference --bundle ../lambda/ApiHandlerFunction/openapi.yml > src/openapi.json",
|
|
12
|
+
"typegen": "echo '/* eslint-disable */' > src/openapi.d.ts && typegen ../lambda/ApiHandlerFunction/openapi.yml >> src/openapi.d.ts",
|
|
13
|
+
"build": "npm run openapi && npm run typegen && npm run typescript && npm run bundle-definition",
|
|
14
|
+
"eslint": "../node_modules/.bin/eslint -c ../.eslintrc.yml"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"*.js",
|
|
18
|
+
"*.d.ts",
|
|
19
|
+
"**/*.js",
|
|
20
|
+
"**/*.d.ts",
|
|
21
|
+
"!*.test.*",
|
|
22
|
+
"!**/*.test.*",
|
|
23
|
+
"!node_modules",
|
|
24
|
+
"!src",
|
|
25
|
+
"!*.config.js"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [],
|
|
28
|
+
"author": "epilot GmbH",
|
|
29
|
+
"license": "UNLICENSED",
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"axios": "^0.21.1"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"buffer": "^6.0.3",
|
|
35
|
+
"https-browserify": "^1.0.0",
|
|
36
|
+
"openapi-client-axios": "^3.13.1",
|
|
37
|
+
"stream-http": "^3.1.1",
|
|
38
|
+
"url": "^0.11.0",
|
|
39
|
+
"util": "^0.12.3"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/jest": "^26.0.20",
|
|
43
|
+
"axios": "^0.21.1",
|
|
44
|
+
"copy-webpack-plugin": "^7.0.0",
|
|
45
|
+
"jest": "^26.6.3",
|
|
46
|
+
"json-loader": "^0.5.7",
|
|
47
|
+
"openapi-client-axios-typegen": "^3.13.1",
|
|
48
|
+
"openapicmd": "^1.6.2",
|
|
49
|
+
"ts-jest": "^26.5.0",
|
|
50
|
+
"ts-loader": "^8.0.14",
|
|
51
|
+
"ts-node": "^9.1.1",
|
|
52
|
+
"typescript": "^4.1.3",
|
|
53
|
+
"webpack": "^5.18.0",
|
|
54
|
+
"webpack-cli": "^4.4.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/openapi.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import {
|
|
3
|
+
OpenAPIClient,
|
|
4
|
+
Parameters,
|
|
5
|
+
UnknownParamsObject,
|
|
6
|
+
OperationResponse,
|
|
7
|
+
AxiosRequestConfig,
|
|
8
|
+
} from 'openapi-client-axios';
|
|
9
|
+
|
|
10
|
+
declare namespace Components {
|
|
11
|
+
namespace Schemas {
|
|
12
|
+
export interface HelloWorldObject {
|
|
13
|
+
/**
|
|
14
|
+
* example:
|
|
15
|
+
* world
|
|
16
|
+
*/
|
|
17
|
+
hello: string;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
declare namespace Paths {
|
|
22
|
+
namespace MockOperation {
|
|
23
|
+
namespace Responses {
|
|
24
|
+
export type $200 = Components.Schemas.HelloWorldObject;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
namespace MockPublicOperation {
|
|
28
|
+
namespace Responses {
|
|
29
|
+
export type $200 = Components.Schemas.HelloWorldObject;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface OperationMethods {
|
|
35
|
+
/**
|
|
36
|
+
* mockPublicOperation - mockPublicOperation
|
|
37
|
+
*
|
|
38
|
+
* Mock response from OAS definition
|
|
39
|
+
*/
|
|
40
|
+
'mockPublicOperation'(
|
|
41
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
42
|
+
data?: any,
|
|
43
|
+
config?: AxiosRequestConfig
|
|
44
|
+
): OperationResponse<Paths.MockPublicOperation.Responses.$200>
|
|
45
|
+
/**
|
|
46
|
+
* mockOperation - mockOperation
|
|
47
|
+
*
|
|
48
|
+
* Mock response from OAS definition
|
|
49
|
+
*/
|
|
50
|
+
'mockOperation'(
|
|
51
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
52
|
+
data?: any,
|
|
53
|
+
config?: AxiosRequestConfig
|
|
54
|
+
): OperationResponse<Paths.MockOperation.Responses.$200>
|
|
55
|
+
/**
|
|
56
|
+
* testAuth - testAuth
|
|
57
|
+
*
|
|
58
|
+
* Return auth context
|
|
59
|
+
*/
|
|
60
|
+
'testAuth'(
|
|
61
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
62
|
+
data?: any,
|
|
63
|
+
config?: AxiosRequestConfig
|
|
64
|
+
): OperationResponse<any>
|
|
65
|
+
/**
|
|
66
|
+
* testAdminAuth - testAdminAuth
|
|
67
|
+
*
|
|
68
|
+
* Return auth context
|
|
69
|
+
*/
|
|
70
|
+
'testAdminAuth'(
|
|
71
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
72
|
+
data?: any,
|
|
73
|
+
config?: AxiosRequestConfig
|
|
74
|
+
): OperationResponse<any>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface PathsDictionary {
|
|
78
|
+
['/v1/customer-portal/public/mock']: {
|
|
79
|
+
/**
|
|
80
|
+
* mockPublicOperation - mockPublicOperation
|
|
81
|
+
*
|
|
82
|
+
* Mock response from OAS definition
|
|
83
|
+
*/
|
|
84
|
+
'get'(
|
|
85
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
86
|
+
data?: any,
|
|
87
|
+
config?: AxiosRequestConfig
|
|
88
|
+
): OperationResponse<Paths.MockPublicOperation.Responses.$200>
|
|
89
|
+
}
|
|
90
|
+
['/v1/customer-portal/mock']: {
|
|
91
|
+
/**
|
|
92
|
+
* mockOperation - mockOperation
|
|
93
|
+
*
|
|
94
|
+
* Mock response from OAS definition
|
|
95
|
+
*/
|
|
96
|
+
'get'(
|
|
97
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
98
|
+
data?: any,
|
|
99
|
+
config?: AxiosRequestConfig
|
|
100
|
+
): OperationResponse<Paths.MockOperation.Responses.$200>
|
|
101
|
+
}
|
|
102
|
+
['/v1/customer-portal/auth']: {
|
|
103
|
+
/**
|
|
104
|
+
* testAuth - testAuth
|
|
105
|
+
*
|
|
106
|
+
* Return auth context
|
|
107
|
+
*/
|
|
108
|
+
'get'(
|
|
109
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
110
|
+
data?: any,
|
|
111
|
+
config?: AxiosRequestConfig
|
|
112
|
+
): OperationResponse<any>
|
|
113
|
+
}
|
|
114
|
+
['/v1/customer-portal/admin/auth']: {
|
|
115
|
+
/**
|
|
116
|
+
* testAdminAuth - testAdminAuth
|
|
117
|
+
*
|
|
118
|
+
* Return auth context
|
|
119
|
+
*/
|
|
120
|
+
'get'(
|
|
121
|
+
parameters?: Parameters<UnknownParamsObject> | null,
|
|
122
|
+
data?: any,
|
|
123
|
+
config?: AxiosRequestConfig
|
|
124
|
+
): OperationResponse<any>
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
|