@vertikalx/vtx-backend-client 1.0.0-dev-carlos.22 → 1.0.0-dev-geo.65

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertikalx/vtx-backend-client",
3
- "version": "1.0.0-dev-carlos.22",
3
+ "version": "1.0.0-dev-geo.65",
4
4
  "description": "GraphQL API generated client for VTX",
5
5
  "types": "src/index.d.ts",
6
6
  "main": "src/index.js",
@@ -1,6 +1,7 @@
1
- import { User, AddValuesResponse, UserToken, UserWithToken, Athlete, RegisterAthleteDto, Brand, CreateBrandDto, BrandGenqlSelection, AWSS3UploadUrl, AWSS3GetUploadDto, CreateTenantInput, Tenant, TenantWithUserLogin, RegisterUserToDomainFromEmailInput, DecodedToken, Sponsorship, SponsorshipGenqlSelection, CreateSponsorshipDto, SponsorAthleteInvitation, InviteAthletesDto, RegisterUserDto, VerificationCode, VerifyCodeDto, FindSponsorAthleteInvitationDto, FindVtxUserDto, City, SportLevel, Sport, UserImages, EditValueResponse, CreateAthleteCompetitionDto, AthleteCompetition, GetSportEventsDto, SportsEvent, CreateSportEventDto, GetAthleteCompetitionsDto, AthleteMembership, AthleteMembershipGenqlSelection, MembershipOrganizationReferenceGenqlSelection, MembershipOrganizationReference, CreateMembershipOrganizationDto, CreateAthleteMembershipDto, DeleteSingleValueDto, DeleteSingleValueResponse, FundRaisingCampaign, CreateFundingCampaignDto, FundRaisingCampaignGenqlSelection, AthleteQueryDto, AthleteQueryResponse, StripeSessionGenqlSelection, CreateStripeAccountDto, StripeSession, StripeAccountReferenceGenqlSelection, StripeAccountReference, StripeCheckoutSessionGenqlSelection, StripeCheckoutSession, DonationCheckoutDto, GetDatabaseFileDto, TextDatabaseFileGenqlSelection, TextDatabaseFile, StripeQueryDto, StripeObject, SetFundingStatusDto, EditPictureResponse, UploadAlbumsPicturesDto, AWSS3DeleteUseTypeFileDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult, SetCompetitionResultDto, AthleteCompetitionResult } from '../client';
1
+ import { User, AddValuesResponse, UserToken, UserWithToken, Athlete, RegisterAthleteDto, Brand, CreateBrandDto, BrandGenqlSelection, AWSS3UploadUrl, AWSS3GetUploadDto, CreateTenantInput, Tenant, TenantWithUserLogin, RegisterUserToDomainFromEmailInput, DecodedToken, Sponsorship, SponsorshipGenqlSelection, CreateSponsorshipDto, SponsorAthleteInvitation, InviteAthletesDto, RegisterUserDto, VerificationCode, VerifyCodeDto, FindSponsorAthleteInvitationDto, FindVtxUserDto, City, SportLevel, Sport, UserImages, EditValueResponse, CreateAthleteCompetitionDto, AthleteCompetition, GetSportEventsDto, SportsEvent, CreateSportEventDto, GetAthleteCompetitionsDto, AthleteMembership, AthleteMembershipGenqlSelection, MembershipOrganizationReferenceGenqlSelection, MembershipOrganizationReference, CreateMembershipOrganizationDto, CreateAthleteMembershipDto, DeleteSingleValueDto, DeleteSingleValueResponse, FundRaisingCampaign, CreateFundingCampaignDto, FundRaisingCampaignGenqlSelection, AthleteQueryDto, AthleteQueryResponse, StripeSessionGenqlSelection, CreateStripeAccountDto, StripeSession, StripeAccountReferenceGenqlSelection, StripeAccountReference, StripeCheckoutSessionGenqlSelection, StripeCheckoutSession, DonationCheckoutDto, GetDatabaseFileDto, TextDatabaseFileGenqlSelection, TextDatabaseFile, StripeQueryDto, StripeObject, SetFundingStatusDto, EditPictureResponse, UploadAlbumsPicturesDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult, CodeVerificationResponse, resetPasswordDto } from '../client';
2
2
  import { ITypedBackendResponse } from './backend-response';
3
3
  import { APICallHeaders } from './api-call-headers';
4
+ import { VerificationCodeType } from '@stackbus/common-types';
4
5
  export declare class VTXBaseAPI {
5
6
  protected headers: APICallHeaders;
6
7
  protected backendUrl: string;
@@ -76,17 +77,17 @@ export declare class VTXBaseAPI {
76
77
  setFundingStatus(dto: SetFundingStatusDto, desiredFields?: FundRaisingCampaignGenqlSelection): Promise<ITypedBackendResponse<FundRaisingCampaign>>;
77
78
  findAthleteForIdPublic(id: string): Promise<ITypedBackendResponse<Athlete>>;
78
79
  editPicture(newPicDto: EditPictureDto): Promise<ITypedBackendResponse<EditPictureResponse>>;
79
- DeletePictureFromBuket(deleteDto: AWSS3DeleteUseTypeFileDto): Promise<ITypedBackendResponse<DeleteSingleValueResponse>>;
80
80
  addAlbumsPictures(dto: UploadAlbumsPicturesDto): Promise<ITypedBackendResponse<AddValuesResponse>>;
81
81
  createAthleteAlbum(dto: UploadAlbumsPicturesDto): Promise<ITypedBackendResponse<Album>>;
82
82
  deleteAthleteAlbum(dto: DeleteSingleValueDto): Promise<ITypedBackendResponse<DeleteSingleValueResponse>>;
83
83
  getAthleteAlbums(): Promise<ITypedBackendResponse<Album[]>>;
84
84
  getAthleteAlbumsById(): Promise<ITypedBackendResponse<Album>>;
85
85
  queryAthletesWithFilters(dto: AthleteQueryDto): Promise<ITypedBackendResponse<AthleteQueryResponse>>;
86
- getAthleteStravaIntegration(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
87
- getAthleteInstagramIntegration(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
88
- getAthleteIntegrations(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
86
+ getAthleteIntegrationsByAthlete(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
89
87
  deleteAthleteIntegration(): Promise<ITypedBackendResponse<boolean>>;
90
88
  deleteUploadedTypeKeyFile(dto: AWSS3DeleteUseTypeKeyDto): Promise<ITypedBackendResponse<AWSS3CallResult>>;
91
- saveAthleteCompetitionResult(dto: SetCompetitionResultDto): Promise<ITypedBackendResponse<AthleteCompetitionResult>>;
89
+ createResetPasswordCode(email: string): Promise<ITypedBackendResponse<EditValueResponse>>;
90
+ getResetVerificationCode(id: string): Promise<ITypedBackendResponse<VerificationCodeType>>;
91
+ verifyCode(input: VerifyCodeDto): Promise<ITypedBackendResponse<CodeVerificationResponse>>;
92
+ resetUserPassword(input: resetPasswordDto): Promise<ITypedBackendResponse<EditValueResponse>>;
92
93
  }
@@ -5707,45 +5707,6 @@ class VTXBaseAPI {
5707
5707
  }
5708
5708
  return retValue;
5709
5709
  }
5710
- async DeletePictureFromBuket(deleteDto) {
5711
- console.log('HEADERS:');
5712
- console.log(JSON.stringify(this.headers, null, 2));
5713
- const client = (0, client_1.createClient)({
5714
- url: this.backendUrl + '/graphql',
5715
- headers: this.headers,
5716
- });
5717
- let retValue = {};
5718
- const fields = {
5719
- idToDelete: true,
5720
- deleted: true,
5721
- failureReason: {
5722
- code: true,
5723
- message: true
5724
- }
5725
- };
5726
- try {
5727
- const response = await client.mutation({
5728
- DeletePictureBuket: {
5729
- __args: {
5730
- input: deleteDto
5731
- },
5732
- ...fields
5733
- },
5734
- });
5735
- VTXBaseAPI.Logger.debug('deletePicture Response:');
5736
- VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
5737
- retValue = (0, response_builder_1.buildResponse)(response, 'DeletePictureBuket', (r) => {
5738
- const isResponseOk = true && response?.DeletePictureBuket?.idToDelete;
5739
- return isResponseOk;
5740
- });
5741
- }
5742
- catch (err1) {
5743
- VTXBaseAPI.Logger.error('editProfileValue err1:');
5744
- VTXBaseAPI.Logger.error(err1);
5745
- retValue = (0, response_builder_1.buildErrorResponse)(err1);
5746
- }
5747
- return retValue;
5748
- }
5749
5710
  async addAlbumsPictures(dto) {
5750
5711
  console.log('HEADERS:');
5751
5712
  console.log(JSON.stringify(this.headers, null, 2));
@@ -6260,7 +6221,7 @@ class VTXBaseAPI {
6260
6221
  }
6261
6222
  return retValue;
6262
6223
  }
6263
- async getAthleteStravaIntegration() {
6224
+ async getAthleteIntegrationsByAthlete() {
6264
6225
  const client = (0, client_1.createClient)({
6265
6226
  url: this.backendUrl + '/graphql',
6266
6227
  headers: this.headers,
@@ -6292,12 +6253,12 @@ class VTXBaseAPI {
6292
6253
  };
6293
6254
  try {
6294
6255
  const response = await client.query({
6295
- getAthleteStravaIntegration: {
6256
+ getAthleteIntegrationsByAthlete: {
6296
6257
  ...fields
6297
6258
  },
6298
6259
  });
6299
- retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteStravaIntegration', (r) => {
6300
- const isResponseOk = !!response?.getAthleteStravaIntegration?._id;
6260
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrationsByAthlete', (r) => {
6261
+ const isResponseOk = !!response?.getAthleteIntegrationsByAthlete?._id;
6301
6262
  return isResponseOk;
6302
6263
  });
6303
6264
  }
@@ -6306,175 +6267,144 @@ class VTXBaseAPI {
6306
6267
  }
6307
6268
  return retValue;
6308
6269
  }
6309
- async getAthleteInstagramIntegration() {
6270
+ async deleteAthleteIntegration() {
6271
+ const client = (0, client_1.createClient)({
6272
+ url: this.backendUrl + '/graphql',
6273
+ headers: this.headers,
6274
+ });
6275
+ let retValue = {};
6276
+ try {
6277
+ const response = await client.mutation({
6278
+ deleteAthleteIntegration: true
6279
+ });
6280
+ retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthleteIntegration', (r) => {
6281
+ const isResponseOk = response?.deleteAthleteIntegration === true;
6282
+ return isResponseOk;
6283
+ });
6284
+ }
6285
+ catch (err) {
6286
+ retValue = (0, response_builder_1.buildErrorResponse)(err);
6287
+ }
6288
+ return retValue;
6289
+ }
6290
+ async deleteUploadedTypeKeyFile(dto) {
6291
+ console.log('HEADERS:');
6292
+ console.log(JSON.stringify(this.headers, null, 2));
6310
6293
  const client = (0, client_1.createClient)({
6311
6294
  url: this.backendUrl + '/graphql',
6312
6295
  headers: this.headers,
6313
6296
  });
6314
6297
  let retValue = {};
6315
6298
  const fields = {
6316
- _id: true,
6317
- athlete: {
6318
- _id: true,
6319
- },
6320
- hasInstagramIntegration: true,
6321
- instagramTokenExpires: true,
6322
- instagramUserData: {
6323
- user_id: true,
6324
- username: true,
6325
- name: true,
6326
- account_type: true,
6327
- followers_count: true,
6328
- media_count: true
6329
- },
6330
- instagramMediaData: {
6331
- data: {
6332
- id: true,
6333
- caption: true,
6334
- media_type: true,
6335
- media_url: true,
6336
- permalink: true,
6337
- thumbnail_url: true,
6338
- timestamp: true,
6339
- username: true,
6340
- like_count: true,
6341
- comments_count: true,
6342
- insights: {
6343
- data: {
6344
- name: true,
6345
- period: true,
6346
- values: true
6347
- }
6348
- }
6349
- },
6350
- paging: {
6351
- cursors: {
6352
- before: true,
6353
- after: true
6354
- },
6355
- next: true
6356
- }
6357
- }
6299
+ httpStatus: true,
6300
+ result: true,
6301
+ message: true,
6302
+ errors: true
6358
6303
  };
6359
6304
  try {
6360
- const response = await client.query({
6361
- getAthleteInstagramIntegration: {
6305
+ const response = await client.mutation({
6306
+ deleteUploadedTypeKeyFile: {
6307
+ __args: {
6308
+ input: dto
6309
+ },
6362
6310
  ...fields
6363
6311
  },
6364
6312
  });
6365
- retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
6366
- const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
6313
+ console.log('deleteUploadedTypeKeyFile Response:');
6314
+ console.log(JSON.stringify(response, null, 2));
6315
+ retValue = (0, response_builder_1.buildResponse)(response, 'deleteUploadedTypeKeyFile', (r) => {
6316
+ const isResponseOk = response?.deleteUploadedTypeKeyFile?.httpStatus;
6367
6317
  return isResponseOk;
6368
6318
  });
6369
6319
  }
6370
- catch (err) {
6371
- retValue = (0, response_builder_1.buildErrorResponse)(err);
6320
+ catch (err1) {
6321
+ console.error('deleteUploadedTypeKeyFile err1:');
6322
+ console.error(err1);
6323
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
6372
6324
  }
6325
+ console.log('retValue:');
6326
+ console.log(JSON.stringify(retValue, null, 2));
6373
6327
  return retValue;
6374
6328
  }
6375
- async getAthleteIntegrations() {
6329
+ async createResetPasswordCode(email) {
6330
+ console.log('HEADERS:');
6331
+ console.log(JSON.stringify(this.headers, null, 2));
6376
6332
  const client = (0, client_1.createClient)({
6377
6333
  url: this.backendUrl + '/graphql',
6378
6334
  headers: this.headers,
6379
6335
  });
6380
6336
  let retValue = {};
6381
6337
  const fields = {
6382
- _id: true,
6383
- athlete: {
6384
- _id: true,
6385
- },
6386
- hasStravaIntegration: true,
6387
- stravaTokenExpires: true,
6388
- stravaAthleteData: {
6389
- id: true,
6390
- username: true,
6391
- firstname: true,
6392
- lastname: true,
6393
- bio: true,
6394
- city: true,
6395
- state: true,
6396
- country: true,
6397
- sex: true,
6398
- premium: true,
6399
- profile: true,
6400
- created_at: true,
6401
- updated_at: true,
6402
- weight: true
6403
- },
6404
- hasInstagramIntegration: true,
6405
- instagramTokenExpires: true,
6406
- instagramUserData: {
6407
- id: true,
6408
- username: true,
6409
- account_type: true,
6410
- media_count: true
6411
- },
6412
- instagramMediaData: {
6413
- data: {
6414
- id: true,
6415
- caption: true,
6416
- media_type: true,
6417
- media_url: true,
6418
- permalink: true,
6419
- thumbnail_url: true,
6420
- timestamp: true,
6421
- username: true,
6422
- like_count: true,
6423
- comments_count: true,
6424
- insights: {
6425
- data: {
6426
- name: true,
6427
- period: true,
6428
- values: true
6429
- }
6430
- }
6431
- },
6432
- paging: {
6433
- cursors: {
6434
- before: true,
6435
- after: true
6436
- },
6437
- next: true
6438
- }
6439
- }
6338
+ field: true,
6339
+ changed: true,
6440
6340
  };
6441
6341
  try {
6442
- const response = await client.query({
6443
- getAthleteIntegrations: {
6342
+ const response = await client.mutation({
6343
+ createResetPasswordCode: {
6344
+ __args: {
6345
+ input: email
6346
+ },
6444
6347
  ...fields
6445
6348
  },
6446
6349
  });
6447
- retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrations', (r) => {
6448
- const isResponseOk = !!response?.getAthleteIntegrations?._id;
6350
+ console.log('createResetPasswordCode Response:');
6351
+ console.log(JSON.stringify(response, null, 2));
6352
+ retValue = (0, response_builder_1.buildResponse)(response, 'createResetPasswordCode', (r) => {
6353
+ const isResponseOk = response?.createResetPasswordCode?.field !== null;
6449
6354
  return isResponseOk;
6450
6355
  });
6451
6356
  }
6452
- catch (err) {
6453
- retValue = (0, response_builder_1.buildErrorResponse)(err);
6357
+ catch (err1) {
6358
+ console.error('createResetPasswordCode err1:');
6359
+ console.error(err1);
6360
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
6454
6361
  }
6362
+ console.log('retValue:');
6363
+ console.log(JSON.stringify(retValue, null, 2));
6455
6364
  return retValue;
6456
6365
  }
6457
- async deleteAthleteIntegration() {
6366
+ async getResetVerificationCode(id) {
6367
+ console.log('HEADERS:');
6368
+ console.log(JSON.stringify(this.headers, null, 2));
6458
6369
  const client = (0, client_1.createClient)({
6459
6370
  url: this.backendUrl + '/graphql',
6460
6371
  headers: this.headers,
6461
6372
  });
6462
6373
  let retValue = {};
6374
+ const fields = {
6375
+ _id: true,
6376
+ type: true,
6377
+ recipient: true,
6378
+ expires: true,
6379
+ isExpired: true,
6380
+ createdDate: true,
6381
+ };
6463
6382
  try {
6464
- const response = await client.mutation({
6465
- deleteAthleteIntegration: true
6383
+ const response = await client.query({
6384
+ getResetVerificationCode: {
6385
+ __args: {
6386
+ input: id
6387
+ },
6388
+ ...fields
6389
+ },
6466
6390
  });
6467
- retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthleteIntegration', (r) => {
6468
- const isResponseOk = response?.deleteAthleteIntegration === true;
6391
+ console.log('getResetVerificationCode Response:');
6392
+ console.log(JSON.stringify(response, null, 2));
6393
+ retValue = (0, response_builder_1.buildResponse)(response, 'getResetVerificationCode', (r) => {
6394
+ const isResponseOk = response?.getResetVerificationCode?.changed;
6469
6395
  return isResponseOk;
6470
6396
  });
6471
6397
  }
6472
- catch (err) {
6473
- retValue = (0, response_builder_1.buildErrorResponse)(err);
6398
+ catch (err1) {
6399
+ console.error('getResetVerificationCode err1:');
6400
+ console.error(err1);
6401
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
6474
6402
  }
6403
+ console.log('retValue:');
6404
+ console.log(JSON.stringify(retValue, null, 2));
6475
6405
  return retValue;
6476
6406
  }
6477
- async deleteUploadedTypeKeyFile(dto) {
6407
+ async verifyCode(input) {
6478
6408
  console.log('HEADERS:');
6479
6409
  console.log(JSON.stringify(this.headers, null, 2));
6480
6410
  const client = (0, client_1.createClient)({
@@ -6483,29 +6413,38 @@ class VTXBaseAPI {
6483
6413
  });
6484
6414
  let retValue = {};
6485
6415
  const fields = {
6486
- httpStatus: true,
6487
6416
  result: true,
6488
- message: true,
6489
- errors: true
6417
+ code: {
6418
+ _id: true,
6419
+ type: true,
6420
+ recipient: true,
6421
+ expires: true,
6422
+ isExpired: true,
6423
+ createdDate: true,
6424
+ },
6425
+ error: {
6426
+ errorCode: true,
6427
+ errorMessage: true,
6428
+ }
6490
6429
  };
6491
6430
  try {
6492
- const response = await client.mutation({
6493
- deleteUploadedTypeKeyFile: {
6431
+ const response = await client.query({
6432
+ verifyCode: {
6494
6433
  __args: {
6495
- input: dto
6434
+ input: input
6496
6435
  },
6497
6436
  ...fields
6498
6437
  },
6499
6438
  });
6500
- console.log('deleteUploadedTypeKeyFile Response:');
6439
+ console.log('verifyCode Response:');
6501
6440
  console.log(JSON.stringify(response, null, 2));
6502
- retValue = (0, response_builder_1.buildResponse)(response, 'deleteUploadedTypeKeyFile', (r) => {
6503
- const isResponseOk = response?.deleteUploadedTypeKeyFile?.httpStatus;
6441
+ retValue = (0, response_builder_1.buildResponse)(response, 'verifyCode', (r) => {
6442
+ const isResponseOk = response?.verifyCode?.result === 'success' || response?.verifyCode?.result === 'error';
6504
6443
  return isResponseOk;
6505
6444
  });
6506
6445
  }
6507
6446
  catch (err1) {
6508
- console.error('deleteUploadedTypeKeyFile err1:');
6447
+ console.error('verifyCode err1:');
6509
6448
  console.error(err1);
6510
6449
  retValue = (0, response_builder_1.buildErrorResponse)(err1);
6511
6450
  }
@@ -6513,41 +6452,42 @@ class VTXBaseAPI {
6513
6452
  console.log(JSON.stringify(retValue, null, 2));
6514
6453
  return retValue;
6515
6454
  }
6516
- async saveAthleteCompetitionResult(dto) {
6455
+ async resetUserPassword(input) {
6456
+ console.log('HEADERS:');
6457
+ console.log(JSON.stringify(this.headers, null, 2));
6517
6458
  const client = (0, client_1.createClient)({
6518
6459
  url: this.backendUrl + '/graphql',
6519
6460
  headers: this.headers,
6520
6461
  });
6521
6462
  let retValue = {};
6522
6463
  const fields = {
6523
- _id: true,
6524
- resultType: true,
6525
- position: true,
6526
- score: true,
6527
- finishTimeMS: true,
6528
- resultWebLink: true,
6464
+ field: true,
6465
+ changed: true,
6529
6466
  };
6530
6467
  try {
6531
6468
  const response = await client.mutation({
6532
- saveAthleteCompetitionResult: {
6469
+ resetUserPassword: {
6533
6470
  __args: {
6534
- input: dto
6471
+ input: input
6535
6472
  },
6536
6473
  ...fields
6537
6474
  },
6538
6475
  });
6539
- VTXBaseAPI.Logger.debug('saveAthleteCompetitionResult Response:');
6540
- VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
6541
- retValue = (0, response_builder_1.buildResponse)(response, 'saveAthleteCompetitionResult', (r) => {
6542
- const isResponseOk = true && response?.saveAthleteCompetitionResult?._id;
6476
+ console.log('resetUserPassword Response:');
6477
+ console.log(JSON.stringify(response, null, 2));
6478
+ retValue = (0, response_builder_1.buildResponse)(response, 'resetUserPassword', (r) => {
6479
+ const isResponseOk = response?.resetUserPassword?.changed;
6480
+ ;
6543
6481
  return isResponseOk;
6544
6482
  });
6545
6483
  }
6546
6484
  catch (err1) {
6547
- VTXBaseAPI.Logger.error('saveAthleteCompetitionResult err1:');
6548
- VTXBaseAPI.Logger.error(err1);
6485
+ console.error('resetUserPassword err1:');
6486
+ console.error(err1);
6549
6487
  retValue = (0, response_builder_1.buildErrorResponse)(err1);
6550
6488
  }
6489
+ console.log('retValue:');
6490
+ console.log(JSON.stringify(retValue, null, 2));
6551
6491
  return retValue;
6552
6492
  }
6553
6493
  }