@morambacrypto/connect 0.0.2 → 0.0.3
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/MorambaClient.d.ts +11 -0
- package/dist/MorambaClient.js +12 -0
- package/dist/apis/auth.api.d.ts +7 -0
- package/dist/apis/auth.api.js +8 -0
- package/dist/apis/index.d.ts +0 -0
- package/dist/apis/index.js +1 -0
- package/dist/client/HttpClient.d.ts +6 -0
- package/dist/client/HttpClient.js +16 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -5
- package/dist/types/auth.types.d.ts +15 -0
- package/dist/types/auth.types.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AuthAPI } from "./apis/auth.api";
|
|
2
|
+
export interface MorambaClientConfig {
|
|
3
|
+
baseURL: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
partnerId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class MorambaClient {
|
|
8
|
+
auth: AuthAPI;
|
|
9
|
+
private http;
|
|
10
|
+
constructor(config: MorambaClientConfig);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpClient } from "./client/HttpClient";
|
|
2
|
+
import { AuthAPI } from "./apis/auth.api";
|
|
3
|
+
export class MorambaClient {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.http = new HttpClient(config.baseURL, {
|
|
6
|
+
"Content-Type": "application/json",
|
|
7
|
+
"x-api-key": config.apiKey,
|
|
8
|
+
"x-partner-id": config.partnerId,
|
|
9
|
+
});
|
|
10
|
+
this.auth = new AuthAPI(this.http);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HttpClient } from "../client/HttpClient";
|
|
2
|
+
import { CreateJwtRequest, CreateJwtResponse } from "../types/auth.types";
|
|
3
|
+
export declare class AuthAPI {
|
|
4
|
+
private http;
|
|
5
|
+
constructor(http: HttpClient);
|
|
6
|
+
createJwtToken(payload: CreateJwtRequest): Promise<CreateJwtResponse>;
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export class HttpClient {
|
|
3
|
+
constructor(baseURL, headers = {}) {
|
|
4
|
+
this.client = axios.create({
|
|
5
|
+
baseURL,
|
|
6
|
+
headers,
|
|
7
|
+
timeout: 10000,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
post(url, data) {
|
|
11
|
+
return this.client.post(url, data).then(res => res.data);
|
|
12
|
+
}
|
|
13
|
+
get(url) {
|
|
14
|
+
return this.client.get(url).then(res => res.data);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./HttpClient";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./HttpClient";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./MorambaClient";
|
|
2
|
+
export * from "./types";
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CreateJwtRequest {
|
|
2
|
+
userid: string;
|
|
3
|
+
partner_id: string;
|
|
4
|
+
api_key: string;
|
|
5
|
+
}
|
|
6
|
+
export interface JwtTokenData {
|
|
7
|
+
token: string;
|
|
8
|
+
iat: number;
|
|
9
|
+
exp: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CreateJwtResponse {
|
|
12
|
+
success: boolean;
|
|
13
|
+
message: string;
|
|
14
|
+
data: JwtTokenData;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./auth.types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./auth.types";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morambacrypto/connect",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "This library use for interact with moramba-crypto project",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,5 +18,8 @@
|
|
|
18
18
|
"library"
|
|
19
19
|
],
|
|
20
20
|
"author": "Moramba Crypto",
|
|
21
|
-
"license": "MIT"
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"axios": "^1.13.2"
|
|
24
|
+
}
|
|
22
25
|
}
|