@authenty/authapi-types 1.0.46 → 1.0.49

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 CHANGED
@@ -80,6 +80,7 @@ import type {
80
80
 
81
81
  3. Faça o build do pacote:
82
82
  ```bash
83
+ npm install
83
84
  npm run build
84
85
  ```
85
86
 
package/dist/index.d.ts CHANGED
@@ -280,6 +280,18 @@ export declare namespace AuthApi {
280
280
  referer?: string;
281
281
  };
282
282
  };
283
+ type Article = {
284
+ id: number;
285
+ title: string;
286
+ areas_interesse: string;
287
+ autor: string;
288
+ descricao_autor: string;
289
+ content: string;
290
+ showInSite: boolean;
291
+ thumbnail_url: string | null;
292
+ createdAt: string;
293
+ deletedAt?: string | null;
294
+ };
283
295
  namespace PaymentSystem {
284
296
  type PG_Customer = {
285
297
  id: string;
@@ -352,6 +364,7 @@ export declare namespace AuthApi {
352
364
  adminMaster: Privilege;
353
365
  activityTrakking: Privilege;
354
366
  financial: Privilege;
367
+ articles: Privilege;
355
368
  };
356
369
  type CronJob = {
357
370
  id: number;
@@ -531,6 +544,22 @@ export declare namespace AuthApi {
531
544
  }
532
545
  }
533
546
  }
547
+ namespace article {
548
+ type POST = {
549
+ msg: string;
550
+ article?: objects.Article;
551
+ };
552
+ namespace $articleId {
553
+ type GET = objects.Article;
554
+ type PUT = objects.Article;
555
+ type DELETE = {
556
+ msg: string;
557
+ };
558
+ }
559
+ }
560
+ namespace articles {
561
+ type GET = objects.Article[];
562
+ }
534
563
  namespace bundle {
535
564
  type POST = {
536
565
  msg: string;
@@ -909,7 +938,7 @@ export declare namespace AuthApi {
909
938
  delete: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<responses.user.$userId.purchase.$purchaseId.DELETE>>;
910
939
  listForUser: (userId: number) => Promise<responses.ApiResponse<responses.user.$userId.purchases.GET>>;
911
940
  list: (page?: number, pageSize?: number) => Promise<responses.ApiResponse<responses.admin.purchases.search.POST>>;
912
- getFromGateway: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<objects.PaymentSystem.PG_Purchase>>;
941
+ getFromGateway: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<objects.PaymentSystem.PG_Purchase>>;
913
942
  };
914
943
  products: {
915
944
  list: () => Promise<responses.ApiResponse<responses.products.GET>>;
@@ -955,6 +984,13 @@ export declare namespace AuthApi {
955
984
  licenseStatus?: objects.PaymentSystem.PG_PurchaseLicenseStatus;
956
985
  }) => Promise<responses.ApiResponse<responses.admin.purchases.search.POST>>;
957
986
  };
987
+ articles: {
988
+ list: () => Promise<responses.ApiResponse<responses.articles.GET>>;
989
+ get: (articleId: number, includeDeleted: boolean) => Promise<responses.ApiResponse<objects.Article>>;
990
+ create: (articleData: objects.Article) => Promise<responses.ApiResponse<responses.article.POST>>;
991
+ update: (articleId: number, articleData: objects.Article) => Promise<responses.ApiResponse<objects.Article>>;
992
+ delete: (articleId: number) => Promise<responses.ApiResponse<responses.article.$articleId.DELETE>>;
993
+ };
958
994
  reports: {
959
995
  users: () => Promise<responses.ApiResponse<responses.report.users.GET>>;
960
996
  usersMonthlyUsage: (iniDate?: string, endDate?: string, userId?: number) => Promise<responses.ApiResponse<responses.report.users.usage.monthly.GET>>;
package/dist/index.js CHANGED
@@ -125,15 +125,6 @@ var AuthApi;
125
125
  * Verifica a sessão atual
126
126
  */
127
127
  checkSession: async () => {
128
- if (!this.bearer) {
129
- return {
130
- conex: true,
131
- reqStat: 401,
132
- success: false,
133
- data: {},
134
- msg: 'Token not found'
135
- };
136
- }
137
128
  return this.request('GET', 'auth', {}, { retryAttempts: 2, retryDelay: 1000 });
138
129
  }
139
130
  };
@@ -190,7 +181,7 @@ var AuthApi;
190
181
  list: async (page = 1, pageSize = 10) => {
191
182
  return await this.request('GET', `admin/purchases/search`, { page, pageSize });
192
183
  },
193
- getFromGateway: async (purchaseId, userId, async = false) => {
184
+ getFromGateway: async (purchaseId, userId) => {
194
185
  return await this.request('GET', `user/${userId}/purchase/${purchaseId}/getFromGateway`, {});
195
186
  },
196
187
  };
@@ -270,6 +261,23 @@ var AuthApi;
270
261
  return await this.request('POST', 'admin/purchases/search', filters);
271
262
  }
272
263
  },
264
+ articles: {
265
+ list: async () => {
266
+ return await this.request('GET', 'articles', {});
267
+ },
268
+ get: async (articleId, includeDeleted) => {
269
+ return await this.request('GET', `article/${articleId}`, { includeDeleted });
270
+ },
271
+ create: async (articleData) => {
272
+ return await this.request('POST', 'article', articleData);
273
+ },
274
+ update: async (articleId, articleData) => {
275
+ return await this.request('PUT', `article/${articleId}`, articleData);
276
+ },
277
+ delete: async (articleId) => {
278
+ return await this.request('DELETE', `article/${articleId}`, {});
279
+ }
280
+ },
273
281
  reports: {
274
282
  users: async () => {
275
283
  return await this.request('GET', 'report/users', {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authenty/authapi-types",
3
- "version": "1.0.46",
3
+ "version": "1.0.49",
4
4
  "description": "Shared types for Authenty API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -302,6 +302,19 @@ export namespace AuthApi {
302
302
  };
303
303
  }
304
304
 
305
+ export type Article = {
306
+ id: number;
307
+ title: string;
308
+ areas_interesse: string;
309
+ autor: string;
310
+ descricao_autor: string;
311
+ content: string;
312
+ showInSite: boolean;
313
+ thumbnail_url: string | null;
314
+ createdAt: string;
315
+ deletedAt?: string | null;
316
+ }
317
+
305
318
  export namespace PaymentSystem {
306
319
 
307
320
  export type PG_Customer = {
@@ -396,6 +409,7 @@ export namespace AuthApi {
396
409
  adminMaster: Privilege;
397
410
  activityTrakking: Privilege;
398
411
  financial: Privilege;
412
+ articles: Privilege;
399
413
  }
400
414
 
401
415
  export type CronJob = {
@@ -574,6 +588,18 @@ export namespace AuthApi {
574
588
  }
575
589
  }
576
590
 
591
+ export namespace article {
592
+ export type POST = { msg: string, article?: objects.Article };
593
+ export namespace $articleId {
594
+ export type GET = objects.Article;
595
+ export type PUT = objects.Article;
596
+ export type DELETE = { msg: string };
597
+ }
598
+ }
599
+
600
+ export namespace articles {
601
+ export type GET = objects.Article[]
602
+ }
577
603
  export namespace bundle {
578
604
  export type POST = { msg: string, Bundle?: objects.Bundle };
579
605
  export namespace $bundleId {
@@ -1268,6 +1294,25 @@ export namespace AuthApi {
1268
1294
  }
1269
1295
  },
1270
1296
 
1297
+ articles: {
1298
+
1299
+ list: async () => {
1300
+ return await this.request<responses.articles.GET>('GET', 'articles', {});
1301
+ },
1302
+ get: async (articleId:number, includeDeleted:boolean) => {
1303
+ return await this.request<responses.article.$articleId.GET>('GET', `article/${articleId}`, {includeDeleted});
1304
+ },
1305
+ create: async (articleData: objects.Article) => {
1306
+ return await this.request<responses.article.POST>('POST', 'article', articleData);
1307
+ },
1308
+ update: async (articleId: number, articleData: objects.Article) => {
1309
+ return await this.request<responses.article.$articleId.PUT>('PUT', `article/${articleId}`, articleData);
1310
+ },
1311
+ delete: async (articleId: number) => {
1312
+ return await this.request<responses.article.$articleId.DELETE>('DELETE', `article/${articleId}`, {});
1313
+ }
1314
+ },
1315
+
1271
1316
  reports: {
1272
1317
  users: async () => {
1273
1318
  return await this.request<responses.report.users.GET>('GET', 'report/users', {});