@adspireai/adspire-node-sdk 1.0.3 → 1.0.4

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.
@@ -0,0 +1,12 @@
1
+ import type { ClientOptions } from './types.gen';
2
+ import { type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch';
3
+ /**
4
+ * The `createClientConfig()` function will be called on client initialization
5
+ * and the returned object will become the client's initial configuration.
6
+ *
7
+ * You may want to initialize your client this way instead of calling
8
+ * `setConfig()`. This is useful for example if you're using Next.js
9
+ * to ensure your client always has the correct values.
10
+ */
11
+ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
12
+ export declare const client: import("@hey-api/client-fetch").Client;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // This file is auto-generated by @hey-api/openapi-ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.client = void 0;
5
+ const client_fetch_1 = require("@hey-api/client-fetch");
6
+ exports.client = (0, client_fetch_1.createClient)((0, client_fetch_1.createConfig)({
7
+ baseUrl: 'https://stage-api.adspire.ai'
8
+ }));
9
+ //# sourceMappingURL=client.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.gen.js","sourceRoot":"","sources":["../src/client.gen.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,wDAA4H;AAY/G,QAAA,MAAM,GAAG,IAAA,2BAAY,EAAC,IAAA,2BAAY,EAAgB;IAC3D,OAAO,EAAE,8BAA8B;CAC1C,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './types.gen';
2
+ export * from './sdk.gen';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // This file is auto-generated by @hey-api/openapi-ts
18
+ __exportStar(require("./types.gen"), exports);
19
+ __exportStar(require("./sdk.gen"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,8CAA4B;AAC5B,4CAA0B"}
@@ -0,0 +1,40 @@
1
+ import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
2
+ import type { RegisterUserData, RegisterUserResponses, RegisterUserErrors, LoginUserData, LoginUserResponses, LoginUserErrors, GetMeData, GetMeResponses, GetMeErrors, LogoutUserData, LogoutUserResponses, LogoutUserErrors, RefreshTokenData, RefreshTokenResponses, RefreshTokenErrors } from './types.gen';
3
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
+ /**
5
+ * You can provide a client instance returned by `createClient()` instead of
6
+ * individual options. This might be also useful if you want to implement a
7
+ * custom client.
8
+ */
9
+ client?: Client;
10
+ /**
11
+ * You can pass arbitrary values through the `meta` object. This can be
12
+ * used to access values that aren't defined as part of the SDK function.
13
+ */
14
+ meta?: Record<string, unknown>;
15
+ };
16
+ /**
17
+ * Register a new user
18
+ * Creates a new user account and returns authentication token or success message
19
+ */
20
+ export declare const registerUser: <ThrowOnError extends boolean = false>(options: Options<RegisterUserData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<RegisterUserResponses, RegisterUserErrors, ThrowOnError, "fields">;
21
+ /**
22
+ * User login
23
+ * Logs in a user and returns an access token
24
+ */
25
+ export declare const loginUser: <ThrowOnError extends boolean = false>(options: Options<LoginUserData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<LoginUserResponses, LoginUserErrors, ThrowOnError, "fields">;
26
+ /**
27
+ * Me request
28
+ * Returns me data
29
+ */
30
+ export declare const getMe: <ThrowOnError extends boolean = false>(options?: Options<GetMeData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<GetMeResponses, GetMeErrors, ThrowOnError, "fields">;
31
+ /**
32
+ * Log out the authenticated user
33
+ * Invalidates the user's token and logs them out
34
+ */
35
+ export declare const logoutUser: <ThrowOnError extends boolean = false>(options?: Options<LogoutUserData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<LogoutUserResponses, LogoutUserErrors, ThrowOnError, "fields">;
36
+ /**
37
+ * Refresh JWT token
38
+ * Refreshes the current JWT token and returns a new one
39
+ */
40
+ export declare const refreshToken: <ThrowOnError extends boolean = false>(options?: Options<RefreshTokenData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<RefreshTokenResponses, RefreshTokenErrors, ThrowOnError, "fields">;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ // This file is auto-generated by @hey-api/openapi-ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.refreshToken = exports.logoutUser = exports.getMe = exports.loginUser = exports.registerUser = void 0;
5
+ const client_gen_1 = require("./client.gen");
6
+ /**
7
+ * Register a new user
8
+ * Creates a new user account and returns authentication token or success message
9
+ */
10
+ const registerUser = (options) => {
11
+ var _a;
12
+ return ((_a = options.client) !== null && _a !== void 0 ? _a : client_gen_1.client).post({
13
+ url: '/api/auth/register',
14
+ ...options,
15
+ headers: {
16
+ 'Content-Type': 'application/json',
17
+ ...options.headers
18
+ }
19
+ });
20
+ };
21
+ exports.registerUser = registerUser;
22
+ /**
23
+ * User login
24
+ * Logs in a user and returns an access token
25
+ */
26
+ const loginUser = (options) => {
27
+ var _a;
28
+ return ((_a = options.client) !== null && _a !== void 0 ? _a : client_gen_1.client).post({
29
+ url: '/api/auth/login',
30
+ ...options,
31
+ headers: {
32
+ 'Content-Type': 'application/json',
33
+ ...options.headers
34
+ }
35
+ });
36
+ };
37
+ exports.loginUser = loginUser;
38
+ /**
39
+ * Me request
40
+ * Returns me data
41
+ */
42
+ const getMe = (options) => {
43
+ var _a;
44
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client_gen_1.client).get({
45
+ url: '/api/auth/me/',
46
+ ...options
47
+ });
48
+ };
49
+ exports.getMe = getMe;
50
+ /**
51
+ * Log out the authenticated user
52
+ * Invalidates the user's token and logs them out
53
+ */
54
+ const logoutUser = (options) => {
55
+ var _a;
56
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client_gen_1.client).post({
57
+ url: '/api/auth/logout',
58
+ ...options
59
+ });
60
+ };
61
+ exports.logoutUser = logoutUser;
62
+ /**
63
+ * Refresh JWT token
64
+ * Refreshes the current JWT token and returns a new one
65
+ */
66
+ const refreshToken = (options) => {
67
+ var _a;
68
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : client_gen_1.client).post({
69
+ url: '/api/auth/refresh',
70
+ ...options
71
+ });
72
+ };
73
+ exports.refreshToken = refreshToken;
74
+ //# sourceMappingURL=sdk.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.gen.js","sourceRoot":"","sources":["../src/sdk.gen.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAIrD,6CAAuD;AAgBvD;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAuC,OAAgD,EAAE,EAAE;;IACnH,OAAO,CAAC,MAAA,OAAO,CAAC,MAAM,mCAAI,mBAAa,CAAC,CAAC,IAAI,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A0D;QACpG,GAAG,EAAE,mBAAmB;QACxB,GAAG,OAAO;KACb,CAAC,CAAC;AACP,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB"}
@@ -0,0 +1,129 @@
1
+ export type RegisterUserData = {
2
+ body: {
3
+ name: string;
4
+ email: string;
5
+ password: string;
6
+ };
7
+ path?: never;
8
+ query?: never;
9
+ url: '/api/auth/register';
10
+ };
11
+ export type RegisterUserErrors = {
12
+ /**
13
+ * Validation error
14
+ */
15
+ 422: unknown;
16
+ };
17
+ export type RegisterUserResponses = {
18
+ /**
19
+ * User successfully registered
20
+ */
21
+ 201: {
22
+ message?: string;
23
+ user?: {
24
+ id?: number;
25
+ name?: string;
26
+ email?: string;
27
+ };
28
+ };
29
+ };
30
+ export type RegisterUserResponse = RegisterUserResponses[keyof RegisterUserResponses];
31
+ export type LoginUserData = {
32
+ body: {
33
+ email: string;
34
+ password: string;
35
+ };
36
+ path?: never;
37
+ query?: never;
38
+ url: '/api/auth/login';
39
+ };
40
+ export type LoginUserErrors = {
41
+ /**
42
+ * Invalid credentials
43
+ */
44
+ 401: unknown;
45
+ /**
46
+ * Validation error
47
+ */
48
+ 422: unknown;
49
+ };
50
+ export type LoginUserResponses = {
51
+ /**
52
+ * Successful login
53
+ */
54
+ 200: {
55
+ access_token?: string;
56
+ token_type?: string;
57
+ expires_in?: number;
58
+ };
59
+ };
60
+ export type LoginUserResponse = LoginUserResponses[keyof LoginUserResponses];
61
+ export type GetMeData = {
62
+ body?: never;
63
+ path?: never;
64
+ query?: never;
65
+ url: '/api/auth/me/';
66
+ };
67
+ export type GetMeErrors = {
68
+ /**
69
+ * Bad request
70
+ */
71
+ 400: unknown;
72
+ /**
73
+ * Resource Not Found
74
+ */
75
+ 404: unknown;
76
+ };
77
+ export type GetMeResponses = {
78
+ /**
79
+ * successful operation
80
+ */
81
+ 200: unknown;
82
+ };
83
+ export type LogoutUserData = {
84
+ body?: never;
85
+ path?: never;
86
+ query?: never;
87
+ url: '/api/auth/logout';
88
+ };
89
+ export type LogoutUserErrors = {
90
+ /**
91
+ * Unauthenticated
92
+ */
93
+ 401: unknown;
94
+ };
95
+ export type LogoutUserResponses = {
96
+ /**
97
+ * Successfully logged out
98
+ */
99
+ 200: {
100
+ message?: string;
101
+ };
102
+ };
103
+ export type LogoutUserResponse = LogoutUserResponses[keyof LogoutUserResponses];
104
+ export type RefreshTokenData = {
105
+ body?: never;
106
+ path?: never;
107
+ query?: never;
108
+ url: '/api/auth/refresh';
109
+ };
110
+ export type RefreshTokenErrors = {
111
+ /**
112
+ * Unauthorized
113
+ */
114
+ 401: unknown;
115
+ };
116
+ export type RefreshTokenResponses = {
117
+ /**
118
+ * Token refreshed successfully
119
+ */
120
+ 200: {
121
+ access_token?: string;
122
+ token_type?: string;
123
+ expires_in?: number;
124
+ };
125
+ };
126
+ export type RefreshTokenResponse = RefreshTokenResponses[keyof RefreshTokenResponses];
127
+ export type ClientOptions = {
128
+ baseUrl: 'https://stage-api.adspire.ai' | (string & {});
129
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // This file is auto-generated by @hey-api/openapi-ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=types.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.gen.js","sourceRoot":"","sources":["../src/types.gen.ts"],"names":[],"mappings":";AAAA,qDAAqD"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@adspireai/adspire-node-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Official Node.js SDK for AdspireAI API",
5
- "main": "dist/src/index.js",
6
- "types": "dist/src/index.d.ts",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
7
  "files": [
8
- "dist/src"
8
+ "dist"
9
9
  ],
10
10
  "scripts": {
11
11
  "setup": "cp env.example .env",