@authenty/authapi-types 1.0.13 → 1.0.15

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/index.d.ts CHANGED
@@ -338,159 +338,159 @@ export declare namespace AuthApi {
338
338
  };
339
339
  namespace auth {
340
340
  namespace login {
341
- type POST = ApiResponse<{
341
+ type POST = {
342
342
  user: objects.LocalUser;
343
343
  msg?: string;
344
- }>;
344
+ };
345
345
  }
346
346
  namespace logout {
347
- type GET = ApiResponse<{}>;
347
+ type GET = {};
348
348
  }
349
349
  namespace checkSession {
350
- type GET = ApiResponse<{
350
+ type GET = {
351
351
  user?: objects.LocalUser;
352
352
  msg?: string;
353
- }>;
353
+ };
354
354
  }
355
355
  }
356
356
  namespace users {
357
- type GET = ApiResponse<objects.LocalUser[]>;
357
+ type GET = objects.LocalUser[];
358
358
  }
359
359
  namespace user {
360
- type GET = ApiResponse<objects.LocalUser & {
360
+ type GET = objects.LocalUser & {
361
361
  Wallets?: objects.Wallet[];
362
362
  PurchasesShares?: objects.PurchaseShare[];
363
- }>;
364
- type PUT = ApiResponse<objects.LocalUser>;
363
+ };
364
+ type PUT = objects.LocalUser;
365
365
  namespace updateConfig {
366
- type PUT = ApiResponse<{
366
+ type PUT = {
367
367
  msg?: string;
368
- }>;
368
+ };
369
369
  }
370
370
  namespace updateAdmin {
371
- type PUT = ApiResponse<objects.LocalUser>;
371
+ type PUT = objects.LocalUser;
372
372
  }
373
373
  namespace license {
374
- type PUT = ApiResponse<{
374
+ type PUT = {
375
375
  availableLicenses: number;
376
376
  heldLicenses: number;
377
377
  usedLicenses: number;
378
378
  msg?: string;
379
- }>;
379
+ };
380
380
  }
381
381
  }
382
382
  namespace purchase {
383
383
  namespace create {
384
- type POST = ApiResponse<{
384
+ type POST = {
385
385
  msg?: string;
386
386
  purchase: objects.Purchase;
387
387
  url?: string;
388
- }>;
388
+ };
389
389
  }
390
390
  namespace id {
391
391
  namespace sync {
392
- type POST = ApiResponse<objects.Purchase & {
392
+ type POST = objects.Purchase & {
393
393
  msg?: string;
394
- }>;
394
+ };
395
395
  }
396
396
  }
397
- type PUT = ApiResponse<objects.Purchase | {
397
+ type PUT = objects.Purchase | {
398
398
  msg?: string;
399
- }>;
399
+ };
400
400
  namespace cancel {
401
- type PUT = ApiResponse<objects.Purchase>;
401
+ type PUT = objects.Purchase;
402
402
  }
403
- type DELETE = ApiResponse<{
403
+ type DELETE = {
404
404
  msg?: string;
405
- }>;
405
+ };
406
406
  namespace getFromGateway {
407
- type GET = ApiResponse<objects.PaymentSystem.PG_Purchase>;
407
+ type GET = objects.PaymentSystem.PG_Purchase;
408
408
  }
409
409
  }
410
410
  namespace purchases {
411
- type post_list = ApiResponse<{
411
+ type post_list = {
412
412
  purchases: objects.Purchase[];
413
413
  pagination: {
414
414
  page: number;
415
415
  pageSize: number;
416
416
  count: number;
417
417
  };
418
- }>;
418
+ };
419
419
  }
420
420
  namespace product {
421
- type GET = ApiResponse<objects.Product>;
422
- type PUT = ApiResponse<objects.Product>;
421
+ type GET = objects.Product;
422
+ type PUT = objects.Product;
423
423
  }
424
424
  namespace products {
425
- type GET = ApiResponse<objects.Product[]>;
425
+ type GET = objects.Product[];
426
426
  }
427
427
  namespace paymentMethod {
428
- type POST = ApiResponse<objects.PaymentMethod>;
429
- type PUT = ApiResponse<objects.PaymentMethod>;
430
- type DELETE = ApiResponse<{
428
+ type POST = objects.PaymentMethod;
429
+ type PUT = objects.PaymentMethod;
430
+ type DELETE = {
431
431
  msg?: string;
432
- }>;
432
+ };
433
433
  }
434
434
  namespace logs {
435
- type POST_SEARCH = ApiResponse<{
435
+ type POST_SEARCH = {
436
436
  data: {
437
437
  logs: objects.LogEntry[];
438
438
  pagination: auxiliarTypes.PaginationInfo;
439
439
  available: boolean;
440
440
  };
441
- }>;
441
+ };
442
442
  namespace status {
443
- type GET = ApiResponse<{
443
+ type GET = {
444
444
  saveToFile: boolean;
445
445
  logPretty: boolean;
446
446
  fileExists: boolean;
447
447
  filePath: string;
448
448
  logLevel: string;
449
449
  canListLogs: boolean;
450
- }>;
450
+ };
451
451
  }
452
452
  }
453
453
  namespace cronJobs {
454
454
  namespace status {
455
- type GET = ApiResponse<auxiliarTypes.CronjobsStatuses>;
455
+ type GET = auxiliarTypes.CronjobsStatuses;
456
456
  }
457
457
  namespace run {
458
- type POST = ApiResponse<{
458
+ type POST = {
459
459
  msg: string;
460
- }>;
460
+ };
461
461
  }
462
462
  }
463
463
  namespace aux {
464
464
  namespace countries {
465
- type GET = ApiResponse<Array<{
465
+ type GET = Array<{
466
466
  id: number;
467
467
  nome: string;
468
468
  nome_pt: string;
469
- }>>;
469
+ }>;
470
470
  }
471
471
  namespace states {
472
- type GET = ApiResponse<Array<{
472
+ type GET = Array<{
473
473
  id: number;
474
474
  nome: string;
475
475
  uf: string;
476
476
  ibge: number;
477
477
  pais?: number;
478
478
  ddd?: string;
479
- }>>;
479
+ }>;
480
480
  }
481
481
  namespace cities {
482
- type GET = ApiResponse<Array<{
482
+ type GET = Array<{
483
483
  id: number;
484
484
  nome: string;
485
485
  uf: number;
486
486
  ibge: number;
487
- }>>;
487
+ }>;
488
488
  }
489
489
  }
490
490
  namespace report {
491
- type POST = ApiResponse<{
491
+ type POST = {
492
492
  msg?: string;
493
- }>;
493
+ };
494
494
  }
495
495
  }
496
496
  /**
@@ -555,45 +555,45 @@ export declare namespace AuthApi {
555
555
  /**
556
556
  * Faz login na API
557
557
  */
558
- login: (email: string, password: string) => Promise<responses.auth.login.POST>;
558
+ login: (email: string, password: string) => Promise<responses.ApiResponse<responses.auth.login.POST>>;
559
559
  /**
560
560
  * Faz logout da API
561
561
  */
562
- logout: () => Promise<responses.auth.logout.GET>;
562
+ logout: () => Promise<responses.ApiResponse<responses.auth.logout.GET>>;
563
563
  /**
564
564
  * Verifica a sessão atual
565
565
  */
566
- checkSession: () => Promise<responses.auth.checkSession.GET>;
566
+ checkSession: () => Promise<responses.ApiResponse<responses.auth.checkSession.GET>>;
567
567
  };
568
568
  checkHealth(): Promise<boolean>;
569
- user: {
569
+ users: {
570
570
  list: () => Promise<responses.ApiResponse<responses.users.GET>>;
571
571
  get: (userId: number, includePurchases?: boolean) => Promise<responses.ApiResponse<responses.user.GET>>;
572
- update: (userId: number, userData: Partial<objects.LocalUser>) => Promise<responses.ApiResponse<responses.user.PUT>>;
572
+ update: (userId: number, userData: Partial<objects.LocalUser>) => Promise<responses.ApiResponse<objects.LocalUser>>;
573
573
  updateConfig: (obj: {
574
574
  id: number;
575
575
  config_ihm_showRates?: boolean;
576
576
  }) => Promise<responses.ApiResponse<responses.user.updateConfig.PUT>>;
577
- updateAdmin: (userId: number, isAdmin: boolean) => Promise<responses.ApiResponse<responses.user.updateAdmin.PUT>>;
577
+ updateAdmin: (userId: number, isAdmin: boolean) => Promise<responses.ApiResponse<objects.LocalUser>>;
578
578
  license: (userId: number) => Promise<responses.ApiResponse<responses.user.license.PUT>>;
579
579
  };
580
- purchase: {
580
+ purchases: {
581
581
  new: (paymentMethodId: number, userId: number) => Promise<responses.ApiResponse<responses.purchase.create.POST>>;
582
582
  sync: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<responses.purchase.id.sync.POST>>;
583
583
  update: (userId: number, purchase: objects.Purchase) => Promise<responses.ApiResponse<responses.purchase.PUT>>;
584
- cancel: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<responses.purchase.cancel.PUT>>;
584
+ cancel: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<objects.Purchase>>;
585
585
  delete: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<responses.purchase.DELETE>>;
586
586
  list: (page?: number, pageSize?: number, userId?: number) => Promise<responses.ApiResponse<responses.purchases.post_list>>;
587
- getFromGateway: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<responses.purchase.getFromGateway.GET>>;
587
+ getFromGateway: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<objects.PaymentSystem.PG_Purchase>>;
588
588
  };
589
589
  products: {
590
590
  list: () => Promise<responses.ApiResponse<responses.products.GET>>;
591
- get: (productId: number) => Promise<responses.ApiResponse<responses.product.GET>>;
592
- update: (productId: number, productData: any) => Promise<responses.ApiResponse<responses.product.PUT>>;
591
+ get: (productId: number) => Promise<responses.ApiResponse<objects.Product>>;
592
+ update: (productId: number, productData: any) => Promise<responses.ApiResponse<objects.Product>>;
593
593
  };
594
594
  paymentMethods: {
595
- create: (id: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<responses.paymentMethod.POST>>;
596
- update: (id: number, paymentMethodId: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<responses.paymentMethod.PUT>>;
595
+ create: (id: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<objects.PaymentMethod>>;
596
+ update: (id: number, paymentMethodId: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<objects.PaymentMethod>>;
597
597
  delete: (id: number, paymentMethodId: number) => Promise<responses.ApiResponse<responses.paymentMethod.DELETE>>;
598
598
  };
599
599
  aux: {
@@ -611,7 +611,7 @@ export declare namespace AuthApi {
611
611
  status: () => Promise<responses.ApiResponse<responses.logs.status.GET>>;
612
612
  };
613
613
  cronJobs: {
614
- status: () => Promise<responses.ApiResponse<responses.cronJobs.status.GET>>;
614
+ status: () => Promise<responses.ApiResponse<auxiliarTypes.CronjobsStatuses>>;
615
615
  run: (name: string) => Promise<responses.ApiResponse<responses.cronJobs.run.POST>>;
616
616
  };
617
617
  };
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ var AuthApi;
117
117
  return this.request('GET', 'auth', {}, { retryAttempts: 2, retryDelay: 1000 });
118
118
  }
119
119
  };
120
- this.user = {
120
+ this.users = {
121
121
  list: async () => {
122
122
  return await this.request('GET', 'users', {});
123
123
  },
@@ -137,7 +137,7 @@ var AuthApi;
137
137
  return await this.request('GET', `user/${userId}/license`, {});
138
138
  }
139
139
  };
140
- this.purchase = {
140
+ this.purchases = {
141
141
  new: async (paymentMethodId, userId) => {
142
142
  return await this.request('POST', `user/${userId}/purchase/new/${paymentMethodId}`, {});
143
143
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authenty/authapi-types",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
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
@@ -388,122 +388,122 @@ export namespace AuthApi {
388
388
 
389
389
  export namespace auth {
390
390
  export namespace login {
391
- export type POST = ApiResponse<{ user: objects.LocalUser; msg?: string }>;
391
+ export type POST = { user: objects.LocalUser; msg?: string };
392
392
  }
393
393
  export namespace logout {
394
- export type GET = ApiResponse<{}>;
394
+ export type GET = {};
395
395
  }
396
396
  export namespace checkSession {
397
- export type GET = ApiResponse<{ user?: objects.LocalUser; msg?: string }>;
397
+ export type GET = { user?: objects.LocalUser; msg?: string };
398
398
  }
399
399
  }
400
400
 
401
401
  export namespace users {
402
- export type GET = ApiResponse<objects.LocalUser[]>;
402
+ export type GET = objects.LocalUser[];
403
403
  }
404
404
 
405
405
  export namespace user {
406
- export type GET = ApiResponse<objects.LocalUser & { Wallets?: objects.Wallet[]; PurchasesShares?: objects.PurchaseShare[] }>;
407
- export type PUT = ApiResponse<objects.LocalUser>;
406
+ export type GET = objects.LocalUser & { Wallets?: objects.Wallet[]; PurchasesShares?: objects.PurchaseShare[] };
407
+ export type PUT = objects.LocalUser;
408
408
 
409
409
  export namespace updateConfig {
410
- export type PUT = ApiResponse<{ msg?: string }>;
410
+ export type PUT = { msg?: string };
411
411
  }
412
412
  export namespace updateAdmin {
413
- export type PUT = ApiResponse<objects.LocalUser>;
413
+ export type PUT = objects.LocalUser;
414
414
  }
415
415
  export namespace license {
416
- export type PUT = ApiResponse<{ availableLicenses: number; heldLicenses: number; usedLicenses: number; msg?: string }>;
416
+ export type PUT = { availableLicenses: number; heldLicenses: number; usedLicenses: number; msg?: string };
417
417
  }
418
418
  }
419
419
 
420
420
  export namespace purchase {
421
421
  export namespace create {
422
- export type POST = ApiResponse<{ msg?: string; purchase: objects.Purchase; url?: string }>;
422
+ export type POST = { msg?: string; purchase: objects.Purchase; url?: string };
423
423
  }
424
424
  export namespace id {
425
425
  export namespace sync {
426
- export type POST = ApiResponse<objects.Purchase & { msg?: string }>;
426
+ export type POST = objects.Purchase & { msg?: string };
427
427
  }
428
428
  }
429
- export type PUT = ApiResponse<objects.Purchase | { msg?: string }>;
429
+ export type PUT = objects.Purchase | { msg?: string };
430
430
  export namespace cancel {
431
- export type PUT = ApiResponse<objects.Purchase>;
431
+ export type PUT = objects.Purchase;
432
432
  }
433
- export type DELETE = ApiResponse<{ msg?: string }>;
433
+ export type DELETE = { msg?: string };
434
434
  export namespace getFromGateway {
435
- export type GET = ApiResponse<objects.PaymentSystem.PG_Purchase>;
435
+ export type GET = objects.PaymentSystem.PG_Purchase;
436
436
  }
437
437
  }
438
438
 
439
439
  export namespace purchases {
440
- export type post_list = ApiResponse<{
440
+ export type post_list = {
441
441
  purchases: objects.Purchase[];
442
442
  pagination: {
443
443
  page: number;
444
444
  pageSize: number;
445
445
  count: number;
446
446
  };
447
- }>;
447
+ };
448
448
  }
449
449
 
450
450
  export namespace product {
451
- export type GET = ApiResponse<objects.Product>;
452
- export type PUT = ApiResponse<objects.Product>;
451
+ export type GET = objects.Product;
452
+ export type PUT = objects.Product;
453
453
  }
454
454
  export namespace products {
455
455
 
456
- export type GET = ApiResponse<objects.Product[]>;
456
+ export type GET = objects.Product[];
457
457
  }
458
458
 
459
459
  export namespace paymentMethod {
460
- export type POST = ApiResponse<objects.PaymentMethod>;
461
- export type PUT = ApiResponse<objects.PaymentMethod>;
462
- export type DELETE = ApiResponse<{ msg?: string }>;
460
+ export type POST = objects.PaymentMethod;
461
+ export type PUT = objects.PaymentMethod;
462
+ export type DELETE = { msg?: string };
463
463
  }
464
464
 
465
465
  export namespace logs {
466
466
 
467
- export type POST_SEARCH = ApiResponse<{ data: {
467
+ export type POST_SEARCH = { data: {
468
468
  logs: objects.LogEntry[];
469
469
  pagination: auxiliarTypes.PaginationInfo;
470
470
  available: boolean;
471
- } }>;
471
+ } };
472
472
  export namespace status {
473
- export type GET = ApiResponse<{
473
+ export type GET = {
474
474
  saveToFile: boolean;
475
475
  logPretty: boolean;
476
476
  fileExists: boolean;
477
477
  filePath: string;
478
478
  logLevel: string;
479
479
  canListLogs: boolean;
480
- }>;
480
+ };
481
481
  }
482
482
  }
483
483
 
484
484
  export namespace cronJobs {
485
485
  export namespace status {
486
- export type GET = ApiResponse<auxiliarTypes.CronjobsStatuses>;
486
+ export type GET = auxiliarTypes.CronjobsStatuses;
487
487
  }
488
488
  export namespace run {
489
- export type POST = ApiResponse<{ msg: string }>;
489
+ export type POST = { msg: string };
490
490
  }
491
491
  }
492
492
 
493
493
  export namespace aux {
494
494
  export namespace countries {
495
- export type GET = ApiResponse<Array<{ id: number; nome: string; nome_pt: string }>>;
495
+ export type GET = Array<{ id: number; nome: string; nome_pt: string }>;
496
496
  }
497
497
  export namespace states {
498
- export type GET = ApiResponse<Array<{ id: number; nome: string; uf: string; ibge: number; pais?: number; ddd?: string }>>;
498
+ export type GET = Array<{ id: number; nome: string; uf: string; ibge: number; pais?: number; ddd?: string }>;
499
499
  }
500
500
  export namespace cities {
501
- export type GET = ApiResponse<Array<{ id: number; nome: string; uf: number; ibge: number }>>;
501
+ export type GET = Array<{ id: number; nome: string; uf: number; ibge: number }>;
502
502
  }
503
503
  }
504
504
 
505
505
  export namespace report {
506
- export type POST = ApiResponse<{ msg?: string }>;
506
+ export type POST = { msg?: string };
507
507
  }
508
508
  }
509
509
 
@@ -621,7 +621,8 @@ export namespace AuthApi {
621
621
  retryAttempts?: number;
622
622
  retryDelay?: number;
623
623
  }
624
- ): Promise<responses.ApiResponse<T>> {
624
+ ) {
625
+
625
626
  const result: responses.ApiResponse<T> = {
626
627
  conex: true,
627
628
  reqStat: 0,
@@ -739,15 +740,15 @@ export namespace AuthApi {
739
740
  /**
740
741
  * Faz login na API
741
742
  */
742
- login: async (email: string, password: string): Promise<responses.auth.login.POST> => {
743
- return this.request<responses.auth.login.POST['data']>('POST', 'auth/login', { email, password });
743
+ login: async (email: string, password: string) => {
744
+ return this.request<responses.auth.login.POST>('POST', 'auth/login', { email, password });
744
745
  },
745
746
 
746
747
  /**
747
748
  * Faz logout da API
748
749
  */
749
- logout: async (): Promise<responses.auth.logout.GET> => {
750
- const result = await this.request<responses.auth.logout.GET['data']>('GET', 'auth/logout', {});
750
+ logout: async () => {
751
+ const result = await this.request<responses.auth.logout.GET>('GET', 'auth/logout', {});
751
752
  this.setToken('');
752
753
  this.setPin1('');
753
754
  return result;
@@ -756,7 +757,7 @@ export namespace AuthApi {
756
757
  /**
757
758
  * Verifica a sessão atual
758
759
  */
759
- checkSession: async (): Promise<responses.auth.checkSession.GET> => {
760
+ checkSession: async () => {
760
761
  if (!this.bearer) {
761
762
  return {
762
763
  conex: true,
@@ -766,7 +767,7 @@ export namespace AuthApi {
766
767
  msg: 'Token not found'
767
768
  };
768
769
  }
769
- return this.request<responses.auth.checkSession.GET['data']>('GET', 'auth', {}, { retryAttempts: 2, retryDelay: 1000 });
770
+ return this.request<responses.auth.checkSession.GET>('GET', 'auth', {}, { retryAttempts: 2, retryDelay: 1000 });
770
771
  }
771
772
  }
772
773
 
@@ -785,7 +786,7 @@ export namespace AuthApi {
785
786
  return true;
786
787
  }
787
788
 
788
- public user = {
789
+ public users = {
789
790
  list: async () => {
790
791
  return await this.request<responses.users.GET>('GET', 'users', {});
791
792
  },
@@ -806,7 +807,7 @@ export namespace AuthApi {
806
807
  }
807
808
  }
808
809
 
809
- public purchase = {
810
+ public purchases = {
810
811
  new: async (paymentMethodId: number, userId: number) => {
811
812
  return await this.request<responses.purchase.create.POST>('POST', `user/${userId}/purchase/new/${paymentMethodId}`, {});
812
813
  },