@meowinc/meow-sdk 0.6.0 → 0.7.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
+ }
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+ import { AuthorizationProvider } from "..";
2
+ import { PushSubscriptionRequests } from "./push-subscription";
3
+ export declare const NOTIFICATION_API = "https://notification.meowinc.tech/api";
4
+ export declare class NotificationClient {
5
+ pushSubscription: PushSubscriptionRequests;
6
+ constructor(authorizationProvider: AuthorizationProvider);
7
+ }
@@ -0,0 +1,8 @@
1
+ import { PushSubscriptionRequests } from "./push-subscription";
2
+ export const NOTIFICATION_API = "https://notification.meowinc.tech/api";
3
+ export class NotificationClient {
4
+ pushSubscription;
5
+ constructor(authorizationProvider) {
6
+ this.pushSubscription = new PushSubscriptionRequests(authorizationProvider);
7
+ }
8
+ }
@@ -0,0 +1,3 @@
1
+ import { AuthorizationProvider } from "../..";
2
+ import { MeowResult } from "../../types";
3
+ export declare function request(app: string, fcmToken: string, auth: AuthorizationProvider): Promise<MeowResult<void>>;
@@ -0,0 +1,15 @@
1
+ import { NOTIFICATION_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(app, fcmToken, auth) {
5
+ return await new HttpClient()
6
+ .withAuthorization(auth)
7
+ .withMethodPost()
8
+ .withJsonBody({
9
+ app,
10
+ fcmToken,
11
+ })
12
+ .withUrl(`${NOTIFICATION_API}/v1/subscription/add`)
13
+ .send()
14
+ .then((r) => r.mapError(ErrorToMessage));
15
+ }
@@ -0,0 +1,6 @@
1
+ import { AuthorizationProvider } from "../..";
2
+ export declare class PushSubscriptionRequests {
3
+ private auth;
4
+ constructor(auth: AuthorizationProvider);
5
+ addSubscriptionToPushNotification(app: string, fcmToken: string): Promise<import("../../types").MeowResult<void>>;
6
+ }
@@ -0,0 +1,10 @@
1
+ import { request as addSubscriptionToPushNotification } from "./add-subscription-to-push-notification";
2
+ export class PushSubscriptionRequests {
3
+ auth;
4
+ constructor(auth) {
5
+ this.auth = auth;
6
+ }
7
+ async addSubscriptionToPushNotification(app, fcmToken) {
8
+ return await addSubscriptionToPushNotification(app, fcmToken, this.auth);
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
- {
2
- "name": "@meowinc/meow-sdk",
3
- "version": "0.6.0",
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
- "@meowinc/result": ">=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.7.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
+ "@meowinc/result": ">=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
+ }