@vertikalx/vtx-backend-client 3.0.0-dev-max.106 → 3.0.0-dev-max.107
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,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, UpdateSportEventDto, 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, UpdateUserSuspendedStatusDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult, SetCompetitionResultDto, AthleteCompetitionResult, CodeVerificationResponse, resetPasswordDto, DeleteValuesDto, existValueDto, ExistValueResponse, Receipt, ReceiptUrl, GetReceiptDto, DeleteValuesResponse, BudgetData, AddCompetitionBudgetDto, EditCompetitionBudgetDto, EditCampaignBudgetDto, SetCurrentCampaignDto, GetAthleteCampaignsDto, UpdateFundingCampaignDto, EditDisplayIndexDto, MergeEventsResponse, MergeSportsEventsDto, BudgetConcept, BudgetItemUnit, CompetitionDeleteVerificationResponse, RegisterMemberDto, Member, Donation, DonationGenqlSelection, GetHistoricalScoresDto, HistoricalScore, GetMyHistoricalScoresDto, HistoricalScoresPeriod, GetTransactionDetailsDto, TransactionDetails, TransactionDetailsGenqlSelection, AdminUserView, AdminTransactionView, PaginatedTransactions, TransactionQueryDto, PaginatedUsers, UserQueryDto, EventQueryDto, PaginatedSports, SportQueryDto, StripeBalance, StripeBalanceGenqlSelection, DeleteVtxUserDto, DeleteVtxUserResponse, ForceScoreRefreshResponse, Offer, OfferGenqlSelection, CreateOfferDto, Sponsor, SponsorGenqlSelection, CreateSponsorDto, PaginatedBrands, BrandQueryDto, PaginatedEvents, SponsorQueryDto, PaginatedSponsors, OfferQueryDto, PaginatedOffers, PaginatedOffersWithEligibility, UploadResult, LeaderboardResponse, UserRank, LeaderboardQueryDto, UserRankQueryDto, DashboardSummary, ScoreHistoryEntry, RankHistoryEntry, RankContext, ActivitiesResponse, ActivityDetail, ComponentSummary, ScoreHistoryQueryDto, RankHistoryQueryDto, RankContextQueryDto, ActivitiesQueryDto, ActivityDetailQueryDto, ComponentSummaryQueryDto, ActivityDatesResponse, Platform, PeriodType, ContentType, PostSortOption } 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, UpdateSportEventDto, 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, UpdateUserSuspendedStatusDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult, SetCompetitionResultDto, AthleteCompetitionResult, CodeVerificationResponse, resetPasswordDto, DeleteValuesDto, existValueDto, ExistValueResponse, Receipt, ReceiptUrl, GetReceiptDto, DeleteValuesResponse, BudgetData, AddCompetitionBudgetDto, EditCompetitionBudgetDto, EditCampaignBudgetDto, SetCurrentCampaignDto, GetAthleteCampaignsDto, UpdateFundingCampaignDto, EditDisplayIndexDto, MergeEventsResponse, MergeSportsEventsDto, BudgetConcept, BudgetItemUnit, CompetitionDeleteVerificationResponse, RegisterMemberDto, Member, Donation, DonationGenqlSelection, GetHistoricalScoresDto, HistoricalScore, GetMyHistoricalScoresDto, HistoricalScoresPeriod, GetTransactionDetailsDto, TransactionDetails, TransactionDetailsGenqlSelection, AdminUserView, AdminTransactionView, PaginatedTransactions, TransactionQueryDto, PaginatedUsers, UserQueryDto, EventQueryDto, PaginatedSports, SportQueryDto, StripeBalance, StripeBalanceGenqlSelection, DeleteVtxUserDto, DeleteVtxUserResponse, ForceScoreRefreshResponse, Offer, OfferGenqlSelection, CreateOfferDto, Sponsor, SponsorGenqlSelection, CreateSponsorDto, PaginatedBrands, BrandQueryDto, PaginatedEvents, SponsorQueryDto, PaginatedSponsors, OfferQueryDto, PaginatedOffers, PaginatedOffersWithEligibility, UploadResult, LeaderboardResponse, UserRank, LeaderboardQueryDto, UserRankQueryDto, DashboardSummary, ScoreHistoryEntry, RankHistoryEntry, RankContext, ActivitiesResponse, ActivityDetail, ComponentSummary, ScoreHistoryQueryDto, RankHistoryQueryDto, RankContextQueryDto, ActivitiesQueryDto, ActivityDetailQueryDto, ComponentSummaryQueryDto, ActivityDatesResponse, Platform, PeriodType, ContentType, PostSortOption, Notification, NotificationListResponse, UnreadCountResponse, NotificationPreference } from '../client';
|
|
2
2
|
import { ITypedBackendResponse } from './backend-response';
|
|
3
3
|
import { APICallHeaders } from './api-call-headers';
|
|
4
4
|
import { VerificationCodeType } from '@vertikalx/common-types';
|
|
@@ -240,4 +240,22 @@ export declare class VTXBaseAPI {
|
|
|
240
240
|
};
|
|
241
241
|
}): Promise<ITypedBackendResponse<any>>;
|
|
242
242
|
getAthleteActivityDates(athleteId: string): Promise<ITypedBackendResponse<ActivityDatesResponse>>;
|
|
243
|
+
getMyNotifications(options?: {
|
|
244
|
+
limit?: number;
|
|
245
|
+
offset?: number;
|
|
246
|
+
includeRead?: boolean;
|
|
247
|
+
includeDismissed?: boolean;
|
|
248
|
+
types?: string[];
|
|
249
|
+
}): Promise<ITypedBackendResponse<NotificationListResponse>>;
|
|
250
|
+
getNotificationUnreadCount(): Promise<ITypedBackendResponse<UnreadCountResponse>>;
|
|
251
|
+
getMyNotificationPreferences(): Promise<ITypedBackendResponse<NotificationPreference>>;
|
|
252
|
+
markNotificationAsRead(notificationId: string): Promise<ITypedBackendResponse<Notification>>;
|
|
253
|
+
markAllNotificationsAsRead(): Promise<ITypedBackendResponse<number>>;
|
|
254
|
+
dismissNotification(notificationId: string): Promise<ITypedBackendResponse<boolean>>;
|
|
255
|
+
updateNotificationPreferences(input: {
|
|
256
|
+
emailEnabled?: boolean;
|
|
257
|
+
inAppEnabled?: boolean;
|
|
258
|
+
pushEnabled?: boolean;
|
|
259
|
+
mutedTypes?: string[];
|
|
260
|
+
}): Promise<ITypedBackendResponse<NotificationPreference>>;
|
|
243
261
|
}
|
package/src/api/vtx-base-api.js
CHANGED
|
@@ -11046,6 +11046,229 @@ class VTXBaseAPI {
|
|
|
11046
11046
|
}
|
|
11047
11047
|
return retValue;
|
|
11048
11048
|
}
|
|
11049
|
+
async getMyNotifications(options) {
|
|
11050
|
+
const client = (0, client_1.createClient)({
|
|
11051
|
+
url: this.backendUrl + "/graphql",
|
|
11052
|
+
headers: this.headers,
|
|
11053
|
+
});
|
|
11054
|
+
const notificationFields = {
|
|
11055
|
+
id: true,
|
|
11056
|
+
type: true,
|
|
11057
|
+
title: true,
|
|
11058
|
+
message: true,
|
|
11059
|
+
iconType: true,
|
|
11060
|
+
iconUrl: true,
|
|
11061
|
+
actionRoute: true,
|
|
11062
|
+
actionParams: true,
|
|
11063
|
+
actionLabel: true,
|
|
11064
|
+
read: true,
|
|
11065
|
+
dismissed: true,
|
|
11066
|
+
createdAt: true,
|
|
11067
|
+
};
|
|
11068
|
+
const fields = {
|
|
11069
|
+
notifications: notificationFields,
|
|
11070
|
+
total: true,
|
|
11071
|
+
hasMore: true,
|
|
11072
|
+
};
|
|
11073
|
+
let retValue;
|
|
11074
|
+
try {
|
|
11075
|
+
const response = await client.query({
|
|
11076
|
+
myNotifications: {
|
|
11077
|
+
__args: { input: options || {} },
|
|
11078
|
+
...fields
|
|
11079
|
+
}
|
|
11080
|
+
});
|
|
11081
|
+
VTXBaseAPI.Logger.debug('getMyNotifications Response:');
|
|
11082
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
11083
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'myNotifications', (r) => {
|
|
11084
|
+
const isResponseOk = response?.myNotifications?.notifications !== undefined;
|
|
11085
|
+
return isResponseOk;
|
|
11086
|
+
});
|
|
11087
|
+
}
|
|
11088
|
+
catch (err1) {
|
|
11089
|
+
VTXBaseAPI.Logger.error('getMyNotifications err1:');
|
|
11090
|
+
VTXBaseAPI.Logger.error(err1);
|
|
11091
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
11092
|
+
}
|
|
11093
|
+
return retValue;
|
|
11094
|
+
}
|
|
11095
|
+
async getNotificationUnreadCount() {
|
|
11096
|
+
const client = (0, client_1.createClient)({
|
|
11097
|
+
url: this.backendUrl + "/graphql",
|
|
11098
|
+
headers: this.headers,
|
|
11099
|
+
});
|
|
11100
|
+
const fields = {
|
|
11101
|
+
count: true,
|
|
11102
|
+
};
|
|
11103
|
+
let retValue;
|
|
11104
|
+
try {
|
|
11105
|
+
const response = await client.query({
|
|
11106
|
+
notificationUnreadCount: {
|
|
11107
|
+
...fields
|
|
11108
|
+
}
|
|
11109
|
+
});
|
|
11110
|
+
VTXBaseAPI.Logger.debug('getNotificationUnreadCount Response:');
|
|
11111
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
11112
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'notificationUnreadCount', (r) => {
|
|
11113
|
+
const isResponseOk = response?.notificationUnreadCount?.count !== undefined;
|
|
11114
|
+
return isResponseOk;
|
|
11115
|
+
});
|
|
11116
|
+
}
|
|
11117
|
+
catch (err1) {
|
|
11118
|
+
VTXBaseAPI.Logger.error('getNotificationUnreadCount err1:');
|
|
11119
|
+
VTXBaseAPI.Logger.error(err1);
|
|
11120
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
11121
|
+
}
|
|
11122
|
+
return retValue;
|
|
11123
|
+
}
|
|
11124
|
+
async getMyNotificationPreferences() {
|
|
11125
|
+
const client = (0, client_1.createClient)({
|
|
11126
|
+
url: this.backendUrl + "/graphql",
|
|
11127
|
+
headers: this.headers,
|
|
11128
|
+
});
|
|
11129
|
+
const fields = {
|
|
11130
|
+
id: true,
|
|
11131
|
+
emailEnabled: true,
|
|
11132
|
+
inAppEnabled: true,
|
|
11133
|
+
pushEnabled: true,
|
|
11134
|
+
mutedTypes: true,
|
|
11135
|
+
};
|
|
11136
|
+
let retValue;
|
|
11137
|
+
try {
|
|
11138
|
+
const response = await client.query({
|
|
11139
|
+
myNotificationPreferences: {
|
|
11140
|
+
...fields
|
|
11141
|
+
}
|
|
11142
|
+
});
|
|
11143
|
+
VTXBaseAPI.Logger.debug('getMyNotificationPreferences Response:');
|
|
11144
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
11145
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'myNotificationPreferences', (r) => {
|
|
11146
|
+
const isResponseOk = response?.myNotificationPreferences?.id !== undefined;
|
|
11147
|
+
return isResponseOk;
|
|
11148
|
+
});
|
|
11149
|
+
}
|
|
11150
|
+
catch (err1) {
|
|
11151
|
+
VTXBaseAPI.Logger.error('getMyNotificationPreferences err1:');
|
|
11152
|
+
VTXBaseAPI.Logger.error(err1);
|
|
11153
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
11154
|
+
}
|
|
11155
|
+
return retValue;
|
|
11156
|
+
}
|
|
11157
|
+
async markNotificationAsRead(notificationId) {
|
|
11158
|
+
const client = (0, client_1.createClient)({
|
|
11159
|
+
url: this.backendUrl + "/graphql",
|
|
11160
|
+
headers: this.headers,
|
|
11161
|
+
});
|
|
11162
|
+
const fields = {
|
|
11163
|
+
id: true,
|
|
11164
|
+
read: true,
|
|
11165
|
+
};
|
|
11166
|
+
let retValue;
|
|
11167
|
+
try {
|
|
11168
|
+
const response = await client.mutation({
|
|
11169
|
+
markNotificationAsRead: {
|
|
11170
|
+
__args: { input: { notificationId } },
|
|
11171
|
+
...fields
|
|
11172
|
+
}
|
|
11173
|
+
});
|
|
11174
|
+
VTXBaseAPI.Logger.debug('markNotificationAsRead Response:');
|
|
11175
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
11176
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'markNotificationAsRead', (r) => {
|
|
11177
|
+
const isResponseOk = response?.markNotificationAsRead?.id !== undefined;
|
|
11178
|
+
return isResponseOk;
|
|
11179
|
+
});
|
|
11180
|
+
}
|
|
11181
|
+
catch (err1) {
|
|
11182
|
+
VTXBaseAPI.Logger.error('markNotificationAsRead err1:');
|
|
11183
|
+
VTXBaseAPI.Logger.error(err1);
|
|
11184
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
11185
|
+
}
|
|
11186
|
+
return retValue;
|
|
11187
|
+
}
|
|
11188
|
+
async markAllNotificationsAsRead() {
|
|
11189
|
+
const client = (0, client_1.createClient)({
|
|
11190
|
+
url: this.backendUrl + "/graphql",
|
|
11191
|
+
headers: this.headers,
|
|
11192
|
+
});
|
|
11193
|
+
let retValue;
|
|
11194
|
+
try {
|
|
11195
|
+
const response = await client.mutation({
|
|
11196
|
+
markAllNotificationsAsRead: true
|
|
11197
|
+
});
|
|
11198
|
+
VTXBaseAPI.Logger.debug('markAllNotificationsAsRead Response:');
|
|
11199
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
11200
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'markAllNotificationsAsRead', (r) => {
|
|
11201
|
+
const isResponseOk = response?.markAllNotificationsAsRead !== undefined;
|
|
11202
|
+
return isResponseOk;
|
|
11203
|
+
});
|
|
11204
|
+
}
|
|
11205
|
+
catch (err1) {
|
|
11206
|
+
VTXBaseAPI.Logger.error('markAllNotificationsAsRead err1:');
|
|
11207
|
+
VTXBaseAPI.Logger.error(err1);
|
|
11208
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
11209
|
+
}
|
|
11210
|
+
return retValue;
|
|
11211
|
+
}
|
|
11212
|
+
async dismissNotification(notificationId) {
|
|
11213
|
+
const client = (0, client_1.createClient)({
|
|
11214
|
+
url: this.backendUrl + "/graphql",
|
|
11215
|
+
headers: this.headers,
|
|
11216
|
+
});
|
|
11217
|
+
let retValue;
|
|
11218
|
+
try {
|
|
11219
|
+
const response = await client.mutation({
|
|
11220
|
+
dismissNotification: {
|
|
11221
|
+
__args: { input: { notificationId } },
|
|
11222
|
+
}
|
|
11223
|
+
});
|
|
11224
|
+
VTXBaseAPI.Logger.debug('dismissNotification Response:');
|
|
11225
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
11226
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'dismissNotification', (r) => {
|
|
11227
|
+
const isResponseOk = response?.dismissNotification !== undefined;
|
|
11228
|
+
return isResponseOk;
|
|
11229
|
+
});
|
|
11230
|
+
}
|
|
11231
|
+
catch (err1) {
|
|
11232
|
+
VTXBaseAPI.Logger.error('dismissNotification err1:');
|
|
11233
|
+
VTXBaseAPI.Logger.error(err1);
|
|
11234
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
11235
|
+
}
|
|
11236
|
+
return retValue;
|
|
11237
|
+
}
|
|
11238
|
+
async updateNotificationPreferences(input) {
|
|
11239
|
+
const client = (0, client_1.createClient)({
|
|
11240
|
+
url: this.backendUrl + "/graphql",
|
|
11241
|
+
headers: this.headers,
|
|
11242
|
+
});
|
|
11243
|
+
const fields = {
|
|
11244
|
+
id: true,
|
|
11245
|
+
emailEnabled: true,
|
|
11246
|
+
inAppEnabled: true,
|
|
11247
|
+
pushEnabled: true,
|
|
11248
|
+
mutedTypes: true,
|
|
11249
|
+
};
|
|
11250
|
+
let retValue;
|
|
11251
|
+
try {
|
|
11252
|
+
const response = await client.mutation({
|
|
11253
|
+
updateNotificationPreferences: {
|
|
11254
|
+
__args: { input },
|
|
11255
|
+
...fields
|
|
11256
|
+
}
|
|
11257
|
+
});
|
|
11258
|
+
VTXBaseAPI.Logger.debug('updateNotificationPreferences Response:');
|
|
11259
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
11260
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'updateNotificationPreferences', (r) => {
|
|
11261
|
+
const isResponseOk = response?.updateNotificationPreferences?.id !== undefined;
|
|
11262
|
+
return isResponseOk;
|
|
11263
|
+
});
|
|
11264
|
+
}
|
|
11265
|
+
catch (err1) {
|
|
11266
|
+
VTXBaseAPI.Logger.error('updateNotificationPreferences err1:');
|
|
11267
|
+
VTXBaseAPI.Logger.error(err1);
|
|
11268
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
11269
|
+
}
|
|
11270
|
+
return retValue;
|
|
11271
|
+
}
|
|
11049
11272
|
}
|
|
11050
11273
|
exports.VTXBaseAPI = VTXBaseAPI;
|
|
11051
11274
|
VTXBaseAPI.Logger = {
|