@zennify/sdk-js 1.0.0-beta.3 → 1.0.0-beta.31
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/images.js +19 -0
- package/dist/interfaces/Guild.js +2 -0
- package/dist/interfaces/Media.js +2 -0
- package/dist/interfaces/Panels.js +2 -0
- package/dist/interfaces/Products.js +2 -0
- package/dist/interfaces/Statistics.js +2 -0
- package/dist/interfaces/Stores.js +2 -0
- package/dist/main.js +8 -0
- package/dist/utils.js +2 -4
- package/dist/var.js +4 -0
- package/package.json +3 -1
- package/src/RequestError.ts +1 -1
- package/src/errors.ts +141 -81
- package/src/images.ts +27 -0
- package/src/interfaces/Guild.ts +22 -0
- package/src/interfaces/Media.ts +6 -0
- package/src/interfaces/Panels.ts +15 -0
- package/src/interfaces/Products.ts +29 -0
- package/src/interfaces/Statistics.ts +13 -0
- package/src/interfaces/Stores.ts +44 -0
- package/src/main.ts +10 -1
- package/src/utils.ts +6 -23
- package/src/var.ts +5 -3
- package/translations/en_US.json +109 -17
- package/translations/pt_BR.json +114 -22
- package/types/RequestError.d.ts +1 -1
- package/types/errors.d.ts +138 -1
- package/types/images.d.ts +9 -0
- package/types/interfaces/Guild.d.ts +19 -0
- package/types/interfaces/Media.d.ts +6 -0
- package/types/interfaces/Panels.d.ts +14 -0
- package/types/interfaces/Products.d.ts +28 -0
- package/types/interfaces/Statistics.d.ts +12 -0
- package/types/interfaces/Stores.d.ts +27 -0
- package/types/main.d.ts +8 -0
- package/types/utils.d.ts +3 -17
- package/types/var.d.ts +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface PartialProduct {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
value: number;
|
|
5
|
+
icon_id: number | null;
|
|
6
|
+
banner_id: number | null;
|
|
7
|
+
stock_locked: boolean | null;
|
|
8
|
+
stock_count: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Product {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
store_id: number;
|
|
15
|
+
owner_id: number;
|
|
16
|
+
icon_id?: null | number;
|
|
17
|
+
banner_id?: null | number;
|
|
18
|
+
value: number;
|
|
19
|
+
description: {
|
|
20
|
+
short: null | string;
|
|
21
|
+
discord: null | string;
|
|
22
|
+
website: null | string;
|
|
23
|
+
};
|
|
24
|
+
stock: {
|
|
25
|
+
size: number;
|
|
26
|
+
locked: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Statistic = {
|
|
2
|
+
count: number;
|
|
3
|
+
users: number;
|
|
4
|
+
value: number;
|
|
5
|
+
rating: number;
|
|
6
|
+
};
|
|
7
|
+
export type Statistics = Record<string, Record<number, Statistic>>;
|
|
8
|
+
export type StatisticsResponse = {
|
|
9
|
+
last_update: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
statistics: Statistics;
|
|
12
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DiscordGuild } from "./Guild";
|
|
2
|
+
export type Addons = 'custom_bot' | 'divulgation' | 'antiraid' | 'managed_automod';
|
|
3
|
+
export type Banks = 'Banco Inter S.A.' | 'Nu Pagamentos S.A.' | 'Picpay Serviços S.A.' | 'Mercadopago.com Representações Ltda.' | 'Caixa Econômica Federal' | 'PagSeguro Internet S.A.' | 'Banco do Brasil S.A.' | 'Banco Bradesco S.A.' | 'Banco Santander (Brasil) S.A.';
|
|
4
|
+
export interface PartialStore {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
expires_at: string;
|
|
8
|
+
icon_id?: number | null;
|
|
9
|
+
}
|
|
10
|
+
export interface FullStore {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
expires_at: string;
|
|
15
|
+
owner_id: number;
|
|
16
|
+
icon_id: number | null;
|
|
17
|
+
banner_id: number | null;
|
|
18
|
+
addons: Addons[];
|
|
19
|
+
blocked_banks: Banks[];
|
|
20
|
+
discord_channels: Record<string /** guild id */, Record<'sale' | 'voice' | 'feedback' | 'carts', string | null | void /** channel id */>>;
|
|
21
|
+
discord_bot: {
|
|
22
|
+
id: string;
|
|
23
|
+
app_id: string | null;
|
|
24
|
+
token: string | null;
|
|
25
|
+
};
|
|
26
|
+
discord_bot_guilds: Record<string, DiscordGuild>;
|
|
27
|
+
}
|
package/types/main.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export * from './var';
|
|
2
2
|
export * from './errors';
|
|
3
3
|
export * from './utils';
|
|
4
|
+
export * from './RequestError';
|
|
5
|
+
export * from './images';
|
|
6
|
+
export * from './interfaces/Media';
|
|
7
|
+
export * from './interfaces/Panels';
|
|
8
|
+
export * from './interfaces/Products';
|
|
9
|
+
export * from './interfaces/Guild';
|
|
10
|
+
export * from './interfaces/Stores';
|
|
11
|
+
export * from './interfaces/Statistics';
|
package/types/utils.d.ts
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { APIErrors } from './errors';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
type ExpectedError = Extract<APIErrors, 'EXPECTED_AN_OBJECT_ARRAY' | 'EXPECTED_A_STRING_ARRAY' | 'EXPECTED_A_NUMBER_ARRAY' | 'EXPECTED_AN_OBJECT' | 'EXPECTED_A_NON_EMPTY_OBJECT' | 'EXPECTED_A_STRING' | 'EXPECTED_A_NUMBER' | 'EXPECTED_A_VALID_ID'>;
|
|
8
|
-
type CommonError = Exclude<APIErrors, ExpectedError>;
|
|
9
|
-
export declare function GetResponseError(code: CommonError): {
|
|
10
|
-
code: CommonError;
|
|
11
|
-
};
|
|
12
|
-
export declare function GetResponseError(code: ExpectedError, additional: ExpectedErrorAdditional): {
|
|
13
|
-
code: ExpectedError;
|
|
14
|
-
} & ExpectedErrorAdditional;
|
|
15
|
-
export declare function GetResponseError<T extends object>(code: CommonError, additional?: T): {
|
|
16
|
-
code: CommonError;
|
|
17
|
-
} & T;
|
|
2
|
+
export declare function GetResponseError<Code extends keyof APIErrors>(code: Code, additional: APIErrors[Code]): {
|
|
3
|
+
code: Code;
|
|
4
|
+
} & APIErrors[Code];
|
|
18
5
|
export declare function TreatZennifyResponse<T extends any>(response: Response): Promise<T>;
|
|
19
|
-
export {};
|
package/types/var.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
type
|
|
2
|
-
export declare let ZENNIFY_API_RESPONSE_LANGUAGE:
|
|
3
|
-
export
|
|
1
|
+
export type SupportedLanguages = 'pt_BR' | 'en_US';
|
|
2
|
+
export declare let ZENNIFY_API_RESPONSE_LANGUAGE: SupportedLanguages;
|
|
3
|
+
export declare function SetAPIResponseLanguage(lang: SupportedLanguages): SupportedLanguages;
|