@sparkstudio/accounts-sdk 1.0.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 ADDED
@@ -0,0 +1,73 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
41
+ },
42
+ },
43
+ ])
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x'
51
+ import reactDom from 'eslint-plugin-react-dom'
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
70
+ },
71
+ },
72
+ ])
73
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ SparkStudioAccountsSDK: () => SparkStudioAccountsSDK
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/api/Controllers/Home.ts
28
+ var Home = class {
29
+ constructor(baseUrl) {
30
+ this.baseUrl = baseUrl;
31
+ }
32
+ };
33
+
34
+ // src/api/Controllers/Users.ts
35
+ var Users = class {
36
+ constructor(baseUrl) {
37
+ this.baseUrl = baseUrl;
38
+ }
39
+ async GetUser(id) {
40
+ const url = `${this.baseUrl}/api/Users/GetUser/` + id;
41
+ const requestOptions = {
42
+ method: "GET",
43
+ headers: {
44
+ "Content-Type": "application/json"
45
+ }
46
+ };
47
+ const response = await fetch(url, requestOptions);
48
+ if (!response.ok) throw new Error(await response.text());
49
+ return await response.json();
50
+ }
51
+ async CreateUser(userDTO) {
52
+ const url = `${this.baseUrl}/api/Users/CreateUser`;
53
+ const requestOptions = {
54
+ method: "POST",
55
+ headers: {
56
+ "Content-Type": "application/json"
57
+ },
58
+ body: JSON.stringify(userDTO)
59
+ };
60
+ const response = await fetch(url, requestOptions);
61
+ if (!response.ok) throw new Error(await response.text());
62
+ return await response.json();
63
+ }
64
+ };
65
+
66
+ // src/api/SparkStudioAccountsSDK.ts
67
+ var SparkStudioAccountsSDK = class {
68
+ constructor(baseUrl) {
69
+ this.home = new Home(baseUrl);
70
+ this.users = new Users(baseUrl);
71
+ }
72
+ };
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ SparkStudioAccountsSDK
76
+ });
77
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/api/Controllers/Home.ts","../src/api/Controllers/Users.ts","../src/api/SparkStudioAccountsSDK.ts"],"sourcesContent":["export * from \"./api/SparkStudioAccountsSDK\";","\r\n\r\n /**\r\n * Auto-generated client for the Home controller.\r\n */\r\nexport class Home {\r\n private baseUrl: string;\r\n\r\n constructor(baseUrl: string) {\r\n this.baseUrl = baseUrl;\r\n }\r\n\r\n}","\r\nimport type { UserDTO } from \"../DTOs/UserDTO\";\r\n\r\n /**\r\n * Auto-generated client for the Users controller.\r\n */\r\nexport class Users {\r\n private baseUrl: string;\r\n\r\n constructor(baseUrl: string) {\r\n this.baseUrl = baseUrl;\r\n }\r\n\r\n public async GetUser(id: string ): Promise<UserDTO> {\r\n const url = `${this.baseUrl}/api/Users/GetUser/` + id + ``\r\n\r\n // Construct the request options\r\n const requestOptions: RequestInit = {\r\n method: 'GET',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }, \r\n };\r\n\r\n // Perform the fetch request\r\n const response = await fetch(url, requestOptions);\r\n\r\n // Throw an error if the response is not successful\r\n if (!response.ok) throw new Error(await response.text());\r\n\r\n // Return the parsed response\r\n return await response.json();\r\n } \r\n public async CreateUser(userDTO: UserDTO ): Promise<UserDTO> {\r\n const url = `${this.baseUrl}/api/Users/CreateUser`\r\n\r\n // Construct the request options\r\n const requestOptions: RequestInit = {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }, \r\n body: JSON.stringify(userDTO) \r\n };\r\n\r\n // Perform the fetch request\r\n const response = await fetch(url, requestOptions);\r\n\r\n // Throw an error if the response is not successful\r\n if (!response.ok) throw new Error(await response.text());\r\n\r\n // Return the parsed response\r\n return await response.json();\r\n } \r\n}","\r\nimport { Home } from \"./Controllers/Home\";\r\nimport { Users } from \"./Controllers/Users\";\r\n\r\n /**\r\n * Auto-generated API client.\r\n */\r\nexport class SparkStudioAccountsSDK {\r\n\r\n public home: Home;\r\n public users: Users;\r\n\r\n constructor(baseUrl: string) { \r\n this.home = new Home(baseUrl);\r\n this.users = new Users(baseUrl);\r\n }\r\n}\r\n\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,OAAN,MAAW;AAAA,EAGd,YAAY,SAAiB;AACzB,SAAK,UAAU;AAAA,EACnB;AAEJ;;;ACNO,IAAM,QAAN,MAAY;AAAA,EAGf,YAAY,SAAiB;AACzB,SAAK,UAAU;AAAA,EACnB;AAAA,EAEA,MAAa,QAAQ,IAA+B;AAChD,UAAM,MAAM,GAAG,KAAK,OAAO,wBAAwB;AAGnD,UAAM,iBAA8B;AAAA,MAChC,QAAQ;AAAA,MACR,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,IACJ;AAGA,UAAM,WAAW,MAAM,MAAM,KAAK,cAAc;AAGhD,QAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,MAAM,SAAS,KAAK,CAAC;AAGvD,WAAO,MAAM,SAAS,KAAK;AAAA,EAC/B;AAAA,EACA,MAAa,WAAW,SAAqC;AACzD,UAAM,MAAM,GAAG,KAAK,OAAO;AAG3B,UAAM,iBAA8B;AAAA,MAChC,QAAQ;AAAA,MACR,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,MAAM,KAAK,UAAU,OAAO;AAAA,IAChC;AAGA,UAAM,WAAW,MAAM,MAAM,KAAK,cAAc;AAGhD,QAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,MAAM,SAAS,KAAK,CAAC;AAGvD,WAAO,MAAM,SAAS,KAAK;AAAA,EAC/B;AACJ;;;AC/CO,IAAM,yBAAN,MAA6B;AAAA,EAKhC,YAAY,SAAiB;AACzB,SAAK,OAAO,IAAI,KAAK,OAAO;AAC5B,SAAK,QAAQ,IAAI,MAAM,OAAO;AAAA,EAClC;AACJ;","names":[]}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Auto-generated client for the Home controller.
3
+ */
4
+ declare class Home {
5
+ private baseUrl;
6
+ constructor(baseUrl: string);
7
+ }
8
+
9
+ declare enum SubscriptionType {
10
+ NotSubscribed = 0,
11
+ PremiumModelSubscription = 1
12
+ }
13
+
14
+ /**
15
+ * Represents an Auto-generated model for UserDTO.
16
+ */
17
+ interface IUserDTO {
18
+ Id: string;
19
+ Name?: string;
20
+ Email?: string;
21
+ ProfilePicture?: string;
22
+ IsAdmin: boolean;
23
+ Subscription: SubscriptionType;
24
+ }
25
+ type UserDTOInit = Partial<IUserDTO> & Pick<IUserDTO, "Id" | "IsAdmin" | "Subscription">;
26
+ declare class UserDTO implements IUserDTO {
27
+ Id: string;
28
+ Name?: string;
29
+ Email?: string;
30
+ ProfilePicture?: string;
31
+ IsAdmin: boolean;
32
+ Subscription: SubscriptionType;
33
+ constructor(init: UserDTOInit);
34
+ }
35
+
36
+ /**
37
+ * Auto-generated client for the Users controller.
38
+ */
39
+ declare class Users {
40
+ private baseUrl;
41
+ constructor(baseUrl: string);
42
+ GetUser(id: string): Promise<UserDTO>;
43
+ CreateUser(userDTO: UserDTO): Promise<UserDTO>;
44
+ }
45
+
46
+ /**
47
+ * Auto-generated API client.
48
+ */
49
+ declare class SparkStudioAccountsSDK {
50
+ home: Home;
51
+ users: Users;
52
+ constructor(baseUrl: string);
53
+ }
54
+
55
+ export { SparkStudioAccountsSDK };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Auto-generated client for the Home controller.
3
+ */
4
+ declare class Home {
5
+ private baseUrl;
6
+ constructor(baseUrl: string);
7
+ }
8
+
9
+ declare enum SubscriptionType {
10
+ NotSubscribed = 0,
11
+ PremiumModelSubscription = 1
12
+ }
13
+
14
+ /**
15
+ * Represents an Auto-generated model for UserDTO.
16
+ */
17
+ interface IUserDTO {
18
+ Id: string;
19
+ Name?: string;
20
+ Email?: string;
21
+ ProfilePicture?: string;
22
+ IsAdmin: boolean;
23
+ Subscription: SubscriptionType;
24
+ }
25
+ type UserDTOInit = Partial<IUserDTO> & Pick<IUserDTO, "Id" | "IsAdmin" | "Subscription">;
26
+ declare class UserDTO implements IUserDTO {
27
+ Id: string;
28
+ Name?: string;
29
+ Email?: string;
30
+ ProfilePicture?: string;
31
+ IsAdmin: boolean;
32
+ Subscription: SubscriptionType;
33
+ constructor(init: UserDTOInit);
34
+ }
35
+
36
+ /**
37
+ * Auto-generated client for the Users controller.
38
+ */
39
+ declare class Users {
40
+ private baseUrl;
41
+ constructor(baseUrl: string);
42
+ GetUser(id: string): Promise<UserDTO>;
43
+ CreateUser(userDTO: UserDTO): Promise<UserDTO>;
44
+ }
45
+
46
+ /**
47
+ * Auto-generated API client.
48
+ */
49
+ declare class SparkStudioAccountsSDK {
50
+ home: Home;
51
+ users: Users;
52
+ constructor(baseUrl: string);
53
+ }
54
+
55
+ export { SparkStudioAccountsSDK };
package/dist/index.js ADDED
@@ -0,0 +1,50 @@
1
+ // src/api/Controllers/Home.ts
2
+ var Home = class {
3
+ constructor(baseUrl) {
4
+ this.baseUrl = baseUrl;
5
+ }
6
+ };
7
+
8
+ // src/api/Controllers/Users.ts
9
+ var Users = class {
10
+ constructor(baseUrl) {
11
+ this.baseUrl = baseUrl;
12
+ }
13
+ async GetUser(id) {
14
+ const url = `${this.baseUrl}/api/Users/GetUser/` + id;
15
+ const requestOptions = {
16
+ method: "GET",
17
+ headers: {
18
+ "Content-Type": "application/json"
19
+ }
20
+ };
21
+ const response = await fetch(url, requestOptions);
22
+ if (!response.ok) throw new Error(await response.text());
23
+ return await response.json();
24
+ }
25
+ async CreateUser(userDTO) {
26
+ const url = `${this.baseUrl}/api/Users/CreateUser`;
27
+ const requestOptions = {
28
+ method: "POST",
29
+ headers: {
30
+ "Content-Type": "application/json"
31
+ },
32
+ body: JSON.stringify(userDTO)
33
+ };
34
+ const response = await fetch(url, requestOptions);
35
+ if (!response.ok) throw new Error(await response.text());
36
+ return await response.json();
37
+ }
38
+ };
39
+
40
+ // src/api/SparkStudioAccountsSDK.ts
41
+ var SparkStudioAccountsSDK = class {
42
+ constructor(baseUrl) {
43
+ this.home = new Home(baseUrl);
44
+ this.users = new Users(baseUrl);
45
+ }
46
+ };
47
+ export {
48
+ SparkStudioAccountsSDK
49
+ };
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/api/Controllers/Home.ts","../src/api/Controllers/Users.ts","../src/api/SparkStudioAccountsSDK.ts"],"sourcesContent":["\r\n\r\n /**\r\n * Auto-generated client for the Home controller.\r\n */\r\nexport class Home {\r\n private baseUrl: string;\r\n\r\n constructor(baseUrl: string) {\r\n this.baseUrl = baseUrl;\r\n }\r\n\r\n}","\r\nimport type { UserDTO } from \"../DTOs/UserDTO\";\r\n\r\n /**\r\n * Auto-generated client for the Users controller.\r\n */\r\nexport class Users {\r\n private baseUrl: string;\r\n\r\n constructor(baseUrl: string) {\r\n this.baseUrl = baseUrl;\r\n }\r\n\r\n public async GetUser(id: string ): Promise<UserDTO> {\r\n const url = `${this.baseUrl}/api/Users/GetUser/` + id + ``\r\n\r\n // Construct the request options\r\n const requestOptions: RequestInit = {\r\n method: 'GET',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }, \r\n };\r\n\r\n // Perform the fetch request\r\n const response = await fetch(url, requestOptions);\r\n\r\n // Throw an error if the response is not successful\r\n if (!response.ok) throw new Error(await response.text());\r\n\r\n // Return the parsed response\r\n return await response.json();\r\n } \r\n public async CreateUser(userDTO: UserDTO ): Promise<UserDTO> {\r\n const url = `${this.baseUrl}/api/Users/CreateUser`\r\n\r\n // Construct the request options\r\n const requestOptions: RequestInit = {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n }, \r\n body: JSON.stringify(userDTO) \r\n };\r\n\r\n // Perform the fetch request\r\n const response = await fetch(url, requestOptions);\r\n\r\n // Throw an error if the response is not successful\r\n if (!response.ok) throw new Error(await response.text());\r\n\r\n // Return the parsed response\r\n return await response.json();\r\n } \r\n}","\r\nimport { Home } from \"./Controllers/Home\";\r\nimport { Users } from \"./Controllers/Users\";\r\n\r\n /**\r\n * Auto-generated API client.\r\n */\r\nexport class SparkStudioAccountsSDK {\r\n\r\n public home: Home;\r\n public users: Users;\r\n\r\n constructor(baseUrl: string) { \r\n this.home = new Home(baseUrl);\r\n this.users = new Users(baseUrl);\r\n }\r\n}\r\n\r\n"],"mappings":";AAKO,IAAM,OAAN,MAAW;AAAA,EAGd,YAAY,SAAiB;AACzB,SAAK,UAAU;AAAA,EACnB;AAEJ;;;ACNO,IAAM,QAAN,MAAY;AAAA,EAGf,YAAY,SAAiB;AACzB,SAAK,UAAU;AAAA,EACnB;AAAA,EAEA,MAAa,QAAQ,IAA+B;AAChD,UAAM,MAAM,GAAG,KAAK,OAAO,wBAAwB;AAGnD,UAAM,iBAA8B;AAAA,MAChC,QAAQ;AAAA,MACR,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,IACJ;AAGA,UAAM,WAAW,MAAM,MAAM,KAAK,cAAc;AAGhD,QAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,MAAM,SAAS,KAAK,CAAC;AAGvD,WAAO,MAAM,SAAS,KAAK;AAAA,EAC/B;AAAA,EACA,MAAa,WAAW,SAAqC;AACzD,UAAM,MAAM,GAAG,KAAK,OAAO;AAG3B,UAAM,iBAA8B;AAAA,MAChC,QAAQ;AAAA,MACR,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,MAAM,KAAK,UAAU,OAAO;AAAA,IAChC;AAGA,UAAM,WAAW,MAAM,MAAM,KAAK,cAAc;AAGhD,QAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,MAAM,SAAS,KAAK,CAAC;AAGvD,WAAO,MAAM,SAAS,KAAK;AAAA,EAC/B;AACJ;;;AC/CO,IAAM,yBAAN,MAA6B;AAAA,EAKhC,YAAY,SAAiB;AACzB,SAAK,OAAO,IAAI,KAAK,OAAO;AAC5B,SAAK,QAAQ,IAAI,MAAM,OAAO;AAAA,EAClC;AACJ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@sparkstudio/accounts-sdk",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": ["dist", "README.md", "LICENSE"],
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "prepublishOnly": "npm run build",
19
+ "test": "echo \"(no tests)\""
20
+ }
21
+ }