@vertikalx/vtx-backend-client 3.0.0-dev-max.86 → 3.0.0-dev-max.88
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
|
@@ -213,4 +213,24 @@ export declare class VTXBaseAPI {
|
|
|
213
213
|
getAthleteActivities(args: {
|
|
214
214
|
input: ActivitiesQueryDto;
|
|
215
215
|
}): Promise<ITypedBackendResponse<ActivitiesResponse>>;
|
|
216
|
+
getSocialAggregates(args: {
|
|
217
|
+
input: {
|
|
218
|
+
athleteId: string;
|
|
219
|
+
platform: string;
|
|
220
|
+
startDate: string;
|
|
221
|
+
endDate: string;
|
|
222
|
+
periodType?: string;
|
|
223
|
+
};
|
|
224
|
+
}): Promise<ITypedBackendResponse<any[]>>;
|
|
225
|
+
getPostsWithComparison(args: {
|
|
226
|
+
input: {
|
|
227
|
+
athleteId: string;
|
|
228
|
+
platform: string;
|
|
229
|
+
sortBy?: string;
|
|
230
|
+
contentType?: string;
|
|
231
|
+
limit?: number;
|
|
232
|
+
offset?: number;
|
|
233
|
+
comparisonWindowDays?: number;
|
|
234
|
+
};
|
|
235
|
+
}): Promise<ITypedBackendResponse<any>>;
|
|
216
236
|
}
|
package/src/api/vtx-base-api.js
CHANGED
|
@@ -10800,6 +10800,125 @@ class VTXBaseAPI {
|
|
|
10800
10800
|
}
|
|
10801
10801
|
return retValue;
|
|
10802
10802
|
}
|
|
10803
|
+
async getSocialAggregates(args) {
|
|
10804
|
+
const client = (0, client_1.createClient)({
|
|
10805
|
+
url: this.backendUrl + "/graphql",
|
|
10806
|
+
headers: this.headers,
|
|
10807
|
+
});
|
|
10808
|
+
const fields = {
|
|
10809
|
+
_id: true,
|
|
10810
|
+
athleteId: true,
|
|
10811
|
+
platform: true,
|
|
10812
|
+
contentType: true,
|
|
10813
|
+
periodType: true,
|
|
10814
|
+
periodLabel: true,
|
|
10815
|
+
periodStart: true,
|
|
10816
|
+
periodEnd: true,
|
|
10817
|
+
totalLikes: true,
|
|
10818
|
+
totalComments: true,
|
|
10819
|
+
totalShares: true,
|
|
10820
|
+
totalSaves: true,
|
|
10821
|
+
totalReach: true,
|
|
10822
|
+
totalViews: true,
|
|
10823
|
+
totalImpressions: true,
|
|
10824
|
+
postCount: true,
|
|
10825
|
+
followerCount: true,
|
|
10826
|
+
avgEngagementRate: true,
|
|
10827
|
+
avgPostEngagement: true,
|
|
10828
|
+
};
|
|
10829
|
+
let retValue;
|
|
10830
|
+
try {
|
|
10831
|
+
const response = await client.query({
|
|
10832
|
+
socialAggregates: {
|
|
10833
|
+
__args: {
|
|
10834
|
+
athleteId: args.input.athleteId,
|
|
10835
|
+
platform: args.input.platform,
|
|
10836
|
+
range: {
|
|
10837
|
+
start: args.input.startDate,
|
|
10838
|
+
end: args.input.endDate,
|
|
10839
|
+
},
|
|
10840
|
+
periodType: args.input.periodType,
|
|
10841
|
+
},
|
|
10842
|
+
...fields
|
|
10843
|
+
}
|
|
10844
|
+
});
|
|
10845
|
+
VTXBaseAPI.Logger.debug('getSocialAggregates Response:');
|
|
10846
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
10847
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'socialAggregates', (r) => {
|
|
10848
|
+
const isResponseOk = response?.socialAggregates !== undefined;
|
|
10849
|
+
return isResponseOk;
|
|
10850
|
+
});
|
|
10851
|
+
}
|
|
10852
|
+
catch (err1) {
|
|
10853
|
+
VTXBaseAPI.Logger.error('getSocialAggregates err1:');
|
|
10854
|
+
VTXBaseAPI.Logger.error(err1);
|
|
10855
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
10856
|
+
}
|
|
10857
|
+
return retValue;
|
|
10858
|
+
}
|
|
10859
|
+
async getPostsWithComparison(args) {
|
|
10860
|
+
const client = (0, client_1.createClient)({
|
|
10861
|
+
url: this.backendUrl + "/graphql",
|
|
10862
|
+
headers: this.headers,
|
|
10863
|
+
});
|
|
10864
|
+
const postFields = {
|
|
10865
|
+
id: true,
|
|
10866
|
+
postId: true,
|
|
10867
|
+
permalink: true,
|
|
10868
|
+
thumbnailUrl: true,
|
|
10869
|
+
contentType: true,
|
|
10870
|
+
caption: true,
|
|
10871
|
+
postedAt: true,
|
|
10872
|
+
likes: true,
|
|
10873
|
+
comments: true,
|
|
10874
|
+
shares: true,
|
|
10875
|
+
saves: true,
|
|
10876
|
+
reach: true,
|
|
10877
|
+
vsAvgPercent: true,
|
|
10878
|
+
};
|
|
10879
|
+
const fields = {
|
|
10880
|
+
posts: postFields,
|
|
10881
|
+
averages: {
|
|
10882
|
+
likes: true,
|
|
10883
|
+
comments: true,
|
|
10884
|
+
reach: true,
|
|
10885
|
+
engagementRate: true,
|
|
10886
|
+
},
|
|
10887
|
+
total: true,
|
|
10888
|
+
hasMore: true,
|
|
10889
|
+
};
|
|
10890
|
+
let retValue;
|
|
10891
|
+
try {
|
|
10892
|
+
const response = await client.query({
|
|
10893
|
+
postsWithComparison: {
|
|
10894
|
+
__args: {
|
|
10895
|
+
athleteId: args.input.athleteId,
|
|
10896
|
+
platform: args.input.platform,
|
|
10897
|
+
options: {
|
|
10898
|
+
sortBy: args.input.sortBy,
|
|
10899
|
+
contentType: args.input.contentType,
|
|
10900
|
+
limit: args.input.limit,
|
|
10901
|
+
offset: args.input.offset,
|
|
10902
|
+
comparisonWindowDays: args.input.comparisonWindowDays,
|
|
10903
|
+
},
|
|
10904
|
+
},
|
|
10905
|
+
...fields
|
|
10906
|
+
}
|
|
10907
|
+
});
|
|
10908
|
+
VTXBaseAPI.Logger.debug('getPostsWithComparison Response:');
|
|
10909
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
10910
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'postsWithComparison', (r) => {
|
|
10911
|
+
const isResponseOk = response?.postsWithComparison !== undefined;
|
|
10912
|
+
return isResponseOk;
|
|
10913
|
+
});
|
|
10914
|
+
}
|
|
10915
|
+
catch (err1) {
|
|
10916
|
+
VTXBaseAPI.Logger.error('getPostsWithComparison err1:');
|
|
10917
|
+
VTXBaseAPI.Logger.error(err1);
|
|
10918
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
10919
|
+
}
|
|
10920
|
+
return retValue;
|
|
10921
|
+
}
|
|
10803
10922
|
}
|
|
10804
10923
|
exports.VTXBaseAPI = VTXBaseAPI;
|
|
10805
10924
|
VTXBaseAPI.Logger = {
|