@vertikalx/vtx-backend-client 1.0.0-dev-daniel.237 → 1.0.0-dev-carlos.26

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-daniel.237",
3
+ "version": "1.0.0-dev-carlos.26",
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, AWSS3DeleteUseTypeFileDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult } 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, AWSS3DeleteUseTypeFileDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult, SetCompetitionResultDto, AthleteCompetitionResult } from '../client';
2
2
  import { ITypedBackendResponse } from './backend-response';
3
3
  import { APICallHeaders } from './api-call-headers';
4
4
  export declare class VTXBaseAPI {
@@ -83,7 +83,10 @@ export declare class VTXBaseAPI {
83
83
  getAthleteAlbums(): Promise<ITypedBackendResponse<Album[]>>;
84
84
  getAthleteAlbumsById(): Promise<ITypedBackendResponse<Album>>;
85
85
  queryAthletesWithFilters(dto: AthleteQueryDto): Promise<ITypedBackendResponse<AthleteQueryResponse>>;
86
- getAthleteIntegrationsByAthlete(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
87
- deleteAthleteIntegration(): Promise<ITypedBackendResponse<boolean>>;
86
+ getAthleteStravaIntegration(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
87
+ getAthleteInstagramIntegration(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
88
+ getAthleteIntegrations(): Promise<ITypedBackendResponse<AthleteIntegrationReference>>;
89
+ updateAthleteIntegration(type: string): Promise<ITypedBackendResponse<boolean>>;
88
90
  deleteUploadedTypeKeyFile(dto: AWSS3DeleteUseTypeKeyDto): Promise<ITypedBackendResponse<AWSS3CallResult>>;
91
+ saveAthleteCompetitionResult(dto: SetCompetitionResultDto): Promise<ITypedBackendResponse<AthleteCompetitionResult>>;
89
92
  }
@@ -6260,7 +6260,7 @@ class VTXBaseAPI {
6260
6260
  }
6261
6261
  return retValue;
6262
6262
  }
6263
- async getAthleteIntegrationsByAthlete() {
6263
+ async getAthleteStravaIntegration() {
6264
6264
  const client = (0, client_1.createClient)({
6265
6265
  url: this.backendUrl + '/graphql',
6266
6266
  headers: this.headers,
@@ -6292,12 +6292,12 @@ class VTXBaseAPI {
6292
6292
  };
6293
6293
  try {
6294
6294
  const response = await client.query({
6295
- getAthleteIntegrationsByAthlete: {
6295
+ getAthleteStravaIntegration: {
6296
6296
  ...fields
6297
6297
  },
6298
6298
  });
6299
- retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrationsByAthlete', (r) => {
6300
- const isResponseOk = !!response?.getAthleteIntegrationsByAthlete?._id;
6299
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteStravaIntegration', (r) => {
6300
+ const isResponseOk = !!response?.getAthleteStravaIntegration?._id;
6301
6301
  return isResponseOk;
6302
6302
  });
6303
6303
  }
@@ -6306,7 +6306,157 @@ class VTXBaseAPI {
6306
6306
  }
6307
6307
  return retValue;
6308
6308
  }
6309
- async deleteAthleteIntegration() {
6309
+ async getAthleteInstagramIntegration() {
6310
+ const client = (0, client_1.createClient)({
6311
+ url: this.backendUrl + '/graphql',
6312
+ headers: this.headers,
6313
+ });
6314
+ let retValue = {};
6315
+ 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
+ }
6358
+ };
6359
+ try {
6360
+ const response = await client.query({
6361
+ getAthleteInstagramIntegration: {
6362
+ ...fields
6363
+ },
6364
+ });
6365
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
6366
+ const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
6367
+ return isResponseOk;
6368
+ });
6369
+ }
6370
+ catch (err) {
6371
+ retValue = (0, response_builder_1.buildErrorResponse)(err);
6372
+ }
6373
+ return retValue;
6374
+ }
6375
+ async getAthleteIntegrations() {
6376
+ const client = (0, client_1.createClient)({
6377
+ url: this.backendUrl + '/graphql',
6378
+ headers: this.headers,
6379
+ });
6380
+ let retValue = {};
6381
+ 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
+ user_id: true,
6408
+ username: true,
6409
+ name: true,
6410
+ account_type: true,
6411
+ followers_count: true,
6412
+ media_count: true
6413
+ },
6414
+ instagramMediaData: {
6415
+ data: {
6416
+ id: true,
6417
+ caption: true,
6418
+ media_type: true,
6419
+ media_url: true,
6420
+ permalink: true,
6421
+ thumbnail_url: true,
6422
+ timestamp: true,
6423
+ username: true,
6424
+ like_count: true,
6425
+ comments_count: true,
6426
+ insights: {
6427
+ data: {
6428
+ name: true,
6429
+ period: true,
6430
+ values: true
6431
+ }
6432
+ }
6433
+ },
6434
+ paging: {
6435
+ cursors: {
6436
+ before: true,
6437
+ after: true
6438
+ },
6439
+ next: true
6440
+ }
6441
+ }
6442
+ };
6443
+ try {
6444
+ const response = await client.query({
6445
+ getAthleteIntegrations: {
6446
+ ...fields
6447
+ },
6448
+ });
6449
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrations', (r) => {
6450
+ const isResponseOk = !!response?.getAthleteIntegrations?._id;
6451
+ return isResponseOk;
6452
+ });
6453
+ }
6454
+ catch (err) {
6455
+ retValue = (0, response_builder_1.buildErrorResponse)(err);
6456
+ }
6457
+ return retValue;
6458
+ }
6459
+ async updateAthleteIntegration(type) {
6310
6460
  const client = (0, client_1.createClient)({
6311
6461
  url: this.backendUrl + '/graphql',
6312
6462
  headers: this.headers,
@@ -6314,10 +6464,14 @@ class VTXBaseAPI {
6314
6464
  let retValue = {};
6315
6465
  try {
6316
6466
  const response = await client.mutation({
6317
- deleteAthleteIntegration: true
6467
+ updateAthleteIntegration: {
6468
+ __args: {
6469
+ type: type
6470
+ },
6471
+ }
6318
6472
  });
6319
- retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthleteIntegration', (r) => {
6320
- const isResponseOk = response?.deleteAthleteIntegration === true;
6473
+ retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteIntegration', (r) => {
6474
+ const isResponseOk = response?.updateAthleteIntegration === true;
6321
6475
  return isResponseOk;
6322
6476
  });
6323
6477
  }
@@ -6365,6 +6519,43 @@ class VTXBaseAPI {
6365
6519
  console.log(JSON.stringify(retValue, null, 2));
6366
6520
  return retValue;
6367
6521
  }
6522
+ async saveAthleteCompetitionResult(dto) {
6523
+ const client = (0, client_1.createClient)({
6524
+ url: this.backendUrl + '/graphql',
6525
+ headers: this.headers,
6526
+ });
6527
+ let retValue = {};
6528
+ const fields = {
6529
+ _id: true,
6530
+ resultType: true,
6531
+ position: true,
6532
+ score: true,
6533
+ finishTimeMS: true,
6534
+ resultWebLink: true,
6535
+ };
6536
+ try {
6537
+ const response = await client.mutation({
6538
+ saveAthleteCompetitionResult: {
6539
+ __args: {
6540
+ input: dto
6541
+ },
6542
+ ...fields
6543
+ },
6544
+ });
6545
+ VTXBaseAPI.Logger.debug('saveAthleteCompetitionResult Response:');
6546
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
6547
+ retValue = (0, response_builder_1.buildResponse)(response, 'saveAthleteCompetitionResult', (r) => {
6548
+ const isResponseOk = true && response?.saveAthleteCompetitionResult?._id;
6549
+ return isResponseOk;
6550
+ });
6551
+ }
6552
+ catch (err1) {
6553
+ VTXBaseAPI.Logger.error('saveAthleteCompetitionResult err1:');
6554
+ VTXBaseAPI.Logger.error(err1);
6555
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
6556
+ }
6557
+ return retValue;
6558
+ }
6368
6559
  }
6369
6560
  exports.VTXBaseAPI = VTXBaseAPI;
6370
6561
  VTXBaseAPI.Logger = {