@vertikalx/vtx-backend-client 1.0.0-dev-geo.81 → 1.0.0-dev-geo.83

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-geo.81",
3
+ "version": "1.0.0-dev-geo.83",
4
4
  "description": "GraphQL API generated client for VTX",
5
5
  "types": "src/index.d.ts",
6
6
  "main": "src/index.js",
@@ -1,4 +1,4 @@
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, DeleteValuesDto } 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, SetCompetitionResultDto, AthleteCompetitionResult, CodeVerificationResponse, resetPasswordDto, DeleteValuesDto } from '../client';
2
2
  import { ITypedBackendResponse } from './backend-response';
3
3
  import { APICallHeaders } from './api-call-headers';
4
4
  import { VerificationCodeType } from '@stackbus/common-types';
@@ -87,8 +87,13 @@ export declare class VTXBaseAPI {
87
87
  getAndSetAlbumById(albumId: string): Promise<ITypedBackendResponse<Album>>;
88
88
  queryAthletesWithFilters(dto: AthleteQueryDto): Promise<ITypedBackendResponse<AthleteQueryResponse>>;
89
89
  getAthleteIntegrationsByAthlete(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
90
- deleteAthleteIntegration(): Promise<ITypedBackendResponse<boolean>>;
90
+ getAthleteStravaIntegration(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
91
+ getAthleteInstagramIntegration(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
92
+ getAthleteIntegrations(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
93
+ updateAthleteIntegration(type: string): Promise<ITypedBackendResponse<boolean>>;
91
94
  deleteUploadedTypeKeyFile(dto: AWSS3DeleteUseTypeKeyDto): Promise<ITypedBackendResponse<AWSS3CallResult>>;
95
+ saveAthleteCompetitionResult(dto: SetCompetitionResultDto): Promise<ITypedBackendResponse<AthleteCompetitionResult>>;
96
+ updateAthleteTpiScore(): Promise<ITypedBackendResponse<Athlete>>;
92
97
  createResetPasswordCode(email: string): Promise<ITypedBackendResponse<EditValueResponse>>;
93
98
  getResetVerificationCode(id: string): Promise<ITypedBackendResponse<VerificationCodeType>>;
94
99
  verifyCode(input: VerifyCodeDto): Promise<ITypedBackendResponse<CodeVerificationResponse>>;
@@ -5310,22 +5310,6 @@ class VTXBaseAPI {
5310
5310
  timezone: true,
5311
5311
  }
5312
5312
  },
5313
- albums: {
5314
- _id: true,
5315
- label: true,
5316
- description: true,
5317
- photos: {
5318
- photo: {
5319
- _id: true,
5320
- name: true,
5321
- contentType: true,
5322
- size: true,
5323
- useType: true,
5324
- url: true,
5325
- key: true,
5326
- },
5327
- },
5328
- },
5329
5313
  trainer: true,
5330
5314
  trainerUrl: true,
5331
5315
  aboutMe: true,
@@ -5536,9 +5520,23 @@ class VTXBaseAPI {
5536
5520
  url: true,
5537
5521
  key: true
5538
5522
  },
5523
+ bannerPicture: {
5524
+ _id: true,
5525
+ name: true,
5526
+ contentType: true,
5527
+ size: true,
5528
+ useType: true,
5529
+ url: true,
5530
+ key: true
5531
+ },
5539
5532
  preferences: {
5540
5533
  _id: true,
5541
- showProfileHelper: true
5534
+ showProfileHelper: true,
5535
+ defaultAlbum: {
5536
+ _id: true,
5537
+ label: true,
5538
+ description: true,
5539
+ }
5542
5540
  },
5543
5541
  currentCampaign: {
5544
5542
  _id: true,
@@ -5649,7 +5647,7 @@ class VTXBaseAPI {
5649
5647
  resultWebLink: true
5650
5648
  }
5651
5649
  }
5652
- }
5650
+ },
5653
5651
  };
5654
5652
  try {
5655
5653
  let response = null;
@@ -6392,6 +6390,72 @@ class VTXBaseAPI {
6392
6390
  return retValue;
6393
6391
  }
6394
6392
  async getAthleteIntegrationsByAthlete() {
6393
+ const client = (0, client_1.createClient)({
6394
+ url: this.backendUrl + '/graphql',
6395
+ headers: this.headers,
6396
+ });
6397
+ let retValue = {};
6398
+ const fields = {
6399
+ _id: true,
6400
+ athlete: {
6401
+ _id: true,
6402
+ },
6403
+ hasInstagramIntegration: true,
6404
+ instagramTokenExpires: true,
6405
+ instagramUserData: {
6406
+ user_id: true,
6407
+ username: true,
6408
+ name: true,
6409
+ account_type: true,
6410
+ followers_count: true,
6411
+ media_count: true
6412
+ },
6413
+ instagramMediaData: {
6414
+ data: {
6415
+ id: true,
6416
+ caption: true,
6417
+ media_type: true,
6418
+ media_url: true,
6419
+ permalink: true,
6420
+ thumbnail_url: true,
6421
+ timestamp: true,
6422
+ username: true,
6423
+ like_count: true,
6424
+ comments_count: true,
6425
+ insights: {
6426
+ data: {
6427
+ name: true,
6428
+ period: true,
6429
+ values: true
6430
+ }
6431
+ }
6432
+ },
6433
+ paging: {
6434
+ cursors: {
6435
+ before: true,
6436
+ after: true
6437
+ },
6438
+ next: true
6439
+ }
6440
+ }
6441
+ };
6442
+ try {
6443
+ const response = await client.query({
6444
+ getAthleteInstagramIntegration: {
6445
+ ...fields
6446
+ },
6447
+ });
6448
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
6449
+ const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
6450
+ return isResponseOk;
6451
+ });
6452
+ }
6453
+ catch (err) {
6454
+ retValue = (0, response_builder_1.buildErrorResponse)(err);
6455
+ }
6456
+ return retValue;
6457
+ }
6458
+ async getAthleteStravaIntegration() {
6395
6459
  const client = (0, client_1.createClient)({
6396
6460
  url: this.backendUrl + '/graphql',
6397
6461
  headers: this.headers,
@@ -6423,12 +6487,12 @@ class VTXBaseAPI {
6423
6487
  };
6424
6488
  try {
6425
6489
  const response = await client.query({
6426
- getAthleteIntegrationsByAthlete: {
6490
+ getAthleteStravaIntegration: {
6427
6491
  ...fields
6428
6492
  },
6429
6493
  });
6430
- retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrationsByAthlete', (r) => {
6431
- const isResponseOk = !!response?.getAthleteIntegrationsByAthlete?._id;
6494
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteStravaIntegration', (r) => {
6495
+ const isResponseOk = !!response?.getAthleteStravaIntegration?._id;
6432
6496
  return isResponseOk;
6433
6497
  });
6434
6498
  }
@@ -6437,7 +6501,157 @@ class VTXBaseAPI {
6437
6501
  }
6438
6502
  return retValue;
6439
6503
  }
6440
- async deleteAthleteIntegration() {
6504
+ async getAthleteInstagramIntegration() {
6505
+ const client = (0, client_1.createClient)({
6506
+ url: this.backendUrl + '/graphql',
6507
+ headers: this.headers,
6508
+ });
6509
+ let retValue = {};
6510
+ const fields = {
6511
+ _id: true,
6512
+ athlete: {
6513
+ _id: true,
6514
+ },
6515
+ hasInstagramIntegration: true,
6516
+ instagramTokenExpires: true,
6517
+ instagramUserData: {
6518
+ user_id: true,
6519
+ username: true,
6520
+ name: true,
6521
+ account_type: true,
6522
+ followers_count: true,
6523
+ media_count: true
6524
+ },
6525
+ instagramMediaData: {
6526
+ data: {
6527
+ id: true,
6528
+ caption: true,
6529
+ media_type: true,
6530
+ media_url: true,
6531
+ permalink: true,
6532
+ thumbnail_url: true,
6533
+ timestamp: true,
6534
+ username: true,
6535
+ like_count: true,
6536
+ comments_count: true,
6537
+ insights: {
6538
+ data: {
6539
+ name: true,
6540
+ period: true,
6541
+ values: true
6542
+ }
6543
+ }
6544
+ },
6545
+ paging: {
6546
+ cursors: {
6547
+ before: true,
6548
+ after: true
6549
+ },
6550
+ next: true
6551
+ }
6552
+ }
6553
+ };
6554
+ try {
6555
+ const response = await client.query({
6556
+ getAthleteInstagramIntegration: {
6557
+ ...fields
6558
+ },
6559
+ });
6560
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
6561
+ const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
6562
+ return isResponseOk;
6563
+ });
6564
+ }
6565
+ catch (err) {
6566
+ retValue = (0, response_builder_1.buildErrorResponse)(err);
6567
+ }
6568
+ return retValue;
6569
+ }
6570
+ async getAthleteIntegrations() {
6571
+ const client = (0, client_1.createClient)({
6572
+ url: this.backendUrl + '/graphql',
6573
+ headers: this.headers,
6574
+ });
6575
+ let retValue = {};
6576
+ const fields = {
6577
+ _id: true,
6578
+ athlete: {
6579
+ _id: true,
6580
+ },
6581
+ hasStravaIntegration: true,
6582
+ stravaTokenExpires: true,
6583
+ stravaAthleteData: {
6584
+ id: true,
6585
+ username: true,
6586
+ firstname: true,
6587
+ lastname: true,
6588
+ bio: true,
6589
+ city: true,
6590
+ state: true,
6591
+ country: true,
6592
+ sex: true,
6593
+ premium: true,
6594
+ profile: true,
6595
+ created_at: true,
6596
+ updated_at: true,
6597
+ weight: true
6598
+ },
6599
+ hasInstagramIntegration: true,
6600
+ instagramTokenExpires: true,
6601
+ instagramUserData: {
6602
+ user_id: true,
6603
+ username: true,
6604
+ name: true,
6605
+ account_type: true,
6606
+ followers_count: true,
6607
+ media_count: true
6608
+ },
6609
+ instagramMediaData: {
6610
+ data: {
6611
+ id: true,
6612
+ caption: true,
6613
+ media_type: true,
6614
+ media_url: true,
6615
+ permalink: true,
6616
+ thumbnail_url: true,
6617
+ timestamp: true,
6618
+ username: true,
6619
+ like_count: true,
6620
+ comments_count: true,
6621
+ insights: {
6622
+ data: {
6623
+ name: true,
6624
+ period: true,
6625
+ values: true
6626
+ }
6627
+ }
6628
+ },
6629
+ paging: {
6630
+ cursors: {
6631
+ before: true,
6632
+ after: true
6633
+ },
6634
+ next: true
6635
+ }
6636
+ }
6637
+ };
6638
+ try {
6639
+ const response = await client.query({
6640
+ getAthleteIntegrations: {
6641
+ ...fields
6642
+ },
6643
+ });
6644
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrations', (r) => {
6645
+ const isResponseOk = !!response?.getAthleteIntegrations?._id;
6646
+ return isResponseOk;
6647
+ });
6648
+ }
6649
+ catch (err) {
6650
+ retValue = (0, response_builder_1.buildErrorResponse)(err);
6651
+ }
6652
+ return retValue;
6653
+ }
6654
+ async updateAthleteIntegration(type) {
6441
6655
  const client = (0, client_1.createClient)({
6442
6656
  url: this.backendUrl + '/graphql',
6443
6657
  headers: this.headers,
@@ -6445,10 +6659,14 @@ class VTXBaseAPI {
6445
6659
  let retValue = {};
6446
6660
  try {
6447
6661
  const response = await client.mutation({
6448
- deleteAthleteIntegration: true
6662
+ updateAthleteIntegration: {
6663
+ __args: {
6664
+ type: type
6665
+ },
6666
+ }
6449
6667
  });
6450
- retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthleteIntegration', (r) => {
6451
- const isResponseOk = response?.deleteAthleteIntegration === true;
6668
+ retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteIntegration', (r) => {
6669
+ const isResponseOk = response?.updateAthleteIntegration === true;
6452
6670
  return isResponseOk;
6453
6671
  });
6454
6672
  }
@@ -6496,6 +6714,72 @@ class VTXBaseAPI {
6496
6714
  console.log(JSON.stringify(retValue, null, 2));
6497
6715
  return retValue;
6498
6716
  }
6717
+ async saveAthleteCompetitionResult(dto) {
6718
+ const client = (0, client_1.createClient)({
6719
+ url: this.backendUrl + '/graphql',
6720
+ headers: this.headers,
6721
+ });
6722
+ let retValue = {};
6723
+ const fields = {
6724
+ _id: true,
6725
+ resultType: true,
6726
+ position: true,
6727
+ score: true,
6728
+ finishTimeMS: true,
6729
+ resultWebLink: true,
6730
+ };
6731
+ try {
6732
+ const response = await client.mutation({
6733
+ saveAthleteCompetitionResult: {
6734
+ __args: {
6735
+ input: dto
6736
+ },
6737
+ ...fields
6738
+ },
6739
+ });
6740
+ VTXBaseAPI.Logger.debug('saveAthleteCompetitionResult Response:');
6741
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
6742
+ retValue = (0, response_builder_1.buildResponse)(response, 'saveAthleteCompetitionResult', (r) => {
6743
+ const isResponseOk = true && response?.saveAthleteCompetitionResult?._id;
6744
+ return isResponseOk;
6745
+ });
6746
+ }
6747
+ catch (err1) {
6748
+ VTXBaseAPI.Logger.error('saveAthleteCompetitionResult err1:');
6749
+ VTXBaseAPI.Logger.error(err1);
6750
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
6751
+ }
6752
+ return retValue;
6753
+ }
6754
+ async updateAthleteTpiScore() {
6755
+ const client = (0, client_1.createClient)({
6756
+ url: this.backendUrl + '/graphql',
6757
+ headers: this.headers,
6758
+ });
6759
+ let retValue = {};
6760
+ try {
6761
+ const response = await client.mutation({
6762
+ updateAthleteTpiScore: {
6763
+ _id: true,
6764
+ firstName: true,
6765
+ lastName: true,
6766
+ scores: {
6767
+ vtxScore: true,
6768
+ socialScore: true,
6769
+ trainingScore: true
6770
+ }
6771
+ },
6772
+ });
6773
+ retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteTpiScore', (r) => {
6774
+ const isResponseOk = !!response?.updateAthleteTpiScore?._id;
6775
+ return isResponseOk;
6776
+ });
6777
+ }
6778
+ catch (err) {
6779
+ retValue = (0, response_builder_1.buildErrorResponse)(err);
6780
+ }
6781
+ return retValue;
6782
+ }
6499
6783
  async createResetPasswordCode(email) {
6500
6784
  console.log('HEADERS:');
6501
6785
  console.log(JSON.stringify(this.headers, null, 2));