@meowinc/meow-sdk 0.1.6 → 0.2.1

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/.prettierrc CHANGED
@@ -1,5 +1,5 @@
1
- {
2
- "tabWidth": 4,
3
- "printWidth": 120,
4
- "endOfLine": "lf"
1
+ {
2
+ "tabWidth": 4,
3
+ "printWidth": 120,
4
+ "endOfLine": "lf"
5
5
  }
@@ -0,0 +1,6 @@
1
+ import { AuthorizationProvider } from "../..";
2
+ import { MeowResult } from "../../types";
3
+ export interface Response {
4
+ sessionId: string;
5
+ }
6
+ export declare function request(mailbox: string, authorizationProvider: AuthorizationProvider): Promise<MeowResult<Response>>;
@@ -0,0 +1,14 @@
1
+ import { ACCOUNT_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(mailbox, authorizationProvider) {
5
+ return await new HttpClient()
6
+ .withUrl(`${ACCOUNT_API}/v1/auth/2fa/email`)
7
+ .withAuthorization(authorizationProvider)
8
+ .withMethodPost()
9
+ .withJsonBody({
10
+ mailbox,
11
+ })
12
+ .send()
13
+ .then((r) => r.mapError(ErrorToMessage));
14
+ }
@@ -6,4 +6,6 @@ export declare class AuthRequests {
6
6
  baseLogIn(login: string, password: string): Promise<import("../../types").MeowResult<import("./log-in").Response>>;
7
7
  twoFactorLogIn(code: string, requestId: string): Promise<import("../../types").MeowResult<import("./log-in").Response>>;
8
8
  signIn(login: string, password: string, verificationType: VerificationType): Promise<import("../../types").MeowResult<void>>;
9
+ addTwoFactorEmail(email: string): Promise<import("../../types").MeowResult<import("./add-email").Response>>;
10
+ submitTwoFactorEmail(sessionId: string, code: string): Promise<import("../../types").MeowResult<void>>;
9
11
  }
@@ -1,5 +1,7 @@
1
1
  import { request as signIn } from "./sign-in";
2
2
  import { request as logIn } from "./log-in";
3
+ import { request as addEmail } from "./add-email";
4
+ import { request as submitAddEmail } from "./submit-add-email";
3
5
  export class AuthRequests {
4
6
  authProvider;
5
7
  constructor(authProvider) {
@@ -26,4 +28,10 @@ export class AuthRequests {
26
28
  verificationType,
27
29
  });
28
30
  }
31
+ async addTwoFactorEmail(email) {
32
+ return await addEmail(email, this.authProvider);
33
+ }
34
+ async submitTwoFactorEmail(sessionId, code) {
35
+ return await submitAddEmail(sessionId, code, this.authProvider);
36
+ }
29
37
  }
@@ -0,0 +1,3 @@
1
+ import { AuthorizationProvider } from "../..";
2
+ import { MeowResult } from "../../types";
3
+ export declare function request(sessionId: string, code: string, authorizationProvider: AuthorizationProvider): Promise<MeowResult<void>>;
@@ -0,0 +1,15 @@
1
+ import { ACCOUNT_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(sessionId, code, authorizationProvider) {
5
+ return await new HttpClient()
6
+ .withUrl(`${ACCOUNT_API}/v1/auth/2fa/email/submit`)
7
+ .withMethodPost()
8
+ .withAuthorization(authorizationProvider)
9
+ .withJsonBody({
10
+ sessionId,
11
+ code,
12
+ })
13
+ .send()
14
+ .then((r) => r.mapError(ErrorToMessage));
15
+ }
@@ -0,0 +1,3 @@
1
+ import { AuthorizationProvider } from "../../auth-provider";
2
+ import { MeowResult } from "../../types";
3
+ export declare function request(id: number, authorizationProvider: AuthorizationProvider): Promise<MeowResult<void>>;
@@ -0,0 +1,11 @@
1
+ import { MAIL_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(id, authorizationProvider) {
5
+ return await new HttpClient()
6
+ .withMethodDelete()
7
+ .withUrl(`${MAIL_API}/v1/email/${id}`)
8
+ .withAuthorization(authorizationProvider)
9
+ .send()
10
+ .then((r) => r.mapError(ErrorToMessage));
11
+ }
@@ -0,0 +1,6 @@
1
+ import { AuthorizationProvider } from "../../auth-provider";
2
+ import { MeowResult } from "../../types";
3
+ import { EmailModel } from "../types";
4
+ type Response = EmailModel;
5
+ export declare function request(id: number, authorizationProvider: AuthorizationProvider): Promise<MeowResult<Response>>;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import { MAIL_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(id, authorizationProvider) {
5
+ return await new HttpClient()
6
+ .withMethodGet()
7
+ .withUrl(`${MAIL_API}/v1/email/${id}`)
8
+ .withAuthorization(authorizationProvider)
9
+ .send()
10
+ .then((r) => r.mapError(ErrorToMessage));
11
+ }
@@ -0,0 +1,3 @@
1
+ import { AuthorizationProvider } from "../../auth-provider";
2
+ import { MeowResult } from "../../types";
3
+ export declare function request(to: string, subject: string, content: string, authorizationProvider: AuthorizationProvider): Promise<MeowResult<void>>;
@@ -0,0 +1,16 @@
1
+ import { MAIL_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(to, subject, content, authorizationProvider) {
5
+ return await new HttpClient()
6
+ .withMethodPost()
7
+ .withAuthorization(authorizationProvider)
8
+ .withUrl(`${MAIL_API}/v1/email/send-message`)
9
+ .withJsonBody({
10
+ to,
11
+ subject,
12
+ content,
13
+ })
14
+ .send()
15
+ .then((r) => r.mapError(ErrorToMessage));
16
+ }
@@ -0,0 +1,3 @@
1
+ import { AuthorizationProvider } from "../../auth-provider";
2
+ import { MeowResult } from "../../types";
3
+ export declare function request(id: number, isRead: boolean, authorizationProvider: AuthorizationProvider): Promise<MeowResult<void>>;
@@ -0,0 +1,12 @@
1
+ import { MAIL_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(id, isRead, authorizationProvider) {
5
+ return new HttpClient()
6
+ .withMethodPut()
7
+ .withUrl(`${MAIL_API}/v1/email/my/set-read`)
8
+ .withAuthorization(authorizationProvider)
9
+ .withJsonBody({ mailId: id, isRead })
10
+ .send()
11
+ .then((r) => r.mapError(ErrorToMessage));
12
+ }
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
- {
2
- "name": "@meowinc/meow-sdk",
3
- "version": "0.1.6",
4
- "description": "Meow SDK",
5
- "keywords": [
6
- "sdk"
7
- ],
8
- "homepage": "https://github.com/ProjectMeowInc/meow-sdk-ts#readme",
9
- "bugs": {
10
- "url": "https://github.com/ProjectMeowInc/meow-sdk-ts/issues"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/ProjectMeowInc/meow-sdk-ts.git"
15
- },
16
- "license": "MIT",
17
- "author": "BlackSoulHub",
18
- "type": "module",
19
- "main": "dist/index.js",
20
- "types": "dist/index.d.ts",
21
- "scripts": {
22
- "build": "tsc",
23
- "prettier": "prettier ./src --write"
24
- },
25
- "dependencies": {
26
- "ts-result-meow": ">=0.0.13",
27
- "jwt-decode": ">=4"
28
- },
29
- "devDependencies": {
30
- "typescript": "^5.9.3"
31
- }
32
- }
1
+ {
2
+ "name": "@meowinc/meow-sdk",
3
+ "version": "0.2.1",
4
+ "description": "Meow SDK",
5
+ "keywords": [
6
+ "sdk"
7
+ ],
8
+ "homepage": "https://github.com/ProjectMeowInc/meow-sdk-ts#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/ProjectMeowInc/meow-sdk-ts/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/ProjectMeowInc/meow-sdk-ts.git"
15
+ },
16
+ "license": "MIT",
17
+ "author": "BlackSoulHub",
18
+ "type": "module",
19
+ "main": "dist/index.js",
20
+ "types": "dist/index.d.ts",
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "prettier": "prettier ./src --write"
24
+ },
25
+ "dependencies": {
26
+ "ts-result-meow": ">=0.0.13",
27
+ "jwt-decode": ">=4"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "^5.9.3"
31
+ }
32
+ }
package/tsconfig.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "compilerOptions": {
3
- // File Layout
4
- "rootDir": "./src",
5
- "outDir": "./dist",
6
-
7
- "module": "ES2022",
8
- "moduleResolution": "bundler",
9
- "target": "ES2024",
10
- "declaration": true,
11
-
12
- "strict": true,
13
- "noImplicitAny": true,
14
- "esModuleInterop": true,
15
- "strictNullChecks": true,
16
- },
17
- "exclude": ["node_modules"],
18
- "include": ["src/**/*"],
19
- }
1
+ {
2
+ "compilerOptions": {
3
+ // File Layout
4
+ "rootDir": "./src",
5
+ "outDir": "./dist",
6
+
7
+ "module": "ES2022",
8
+ "moduleResolution": "bundler",
9
+ "target": "ES2024",
10
+ "declaration": true,
11
+
12
+ "strict": true,
13
+ "noImplicitAny": true,
14
+ "esModuleInterop": true,
15
+ "strictNullChecks": true,
16
+ },
17
+ "exclude": ["node_modules"],
18
+ "include": ["src/**/*"],
19
+ }