skikrumb-api 2.1.15 → 2.1.16

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/dist/index.d.ts CHANGED
@@ -62,6 +62,7 @@ export declare const skiKrumb: (options?: {
62
62
  error?: any;
63
63
  }>;
64
64
  getReplayData: (serialNumber: string, date: string, timezone?: string, size?: number) => Promise<any>;
65
+ getReplayFull: (serialNumber: string, date: string, timezone?: string, size?: number) => Promise<any>;
65
66
  getDailyStats: (serialNumber: string, date: string, timezone?: string) => Promise<any>;
66
67
  getActivityDates: (serialNumber: string, timezone?: string) => Promise<{
67
68
  success: boolean;
@@ -73,6 +74,7 @@ export declare const skiKrumb: (options?: {
73
74
  } | undefined;
74
75
  error?: any;
75
76
  }>;
77
+ getLeaderboardStats: (serialNumbers: string[], startDate: string, endDate: string, timezone?: string) => Promise<any>;
76
78
  getAccessibleProfiles: () => Promise<{
77
79
  success: boolean;
78
80
  accessibleProfiles: any[];
package/dist/index.js CHANGED
@@ -485,9 +485,28 @@ export const skiKrumb = (options = {
485
485
  .json();
486
486
  return response;
487
487
  };
488
+ const getReplayFull = async (serialNumber, date, timezone = 'America/Vancouver', size = 10000) => {
489
+ const requestWithAuth = ky.create({
490
+ prefixUrl: options.url,
491
+ timeout: 60000,
492
+ headers: {
493
+ 'Content-Type': 'application/json',
494
+ Authorization: `Bearer ${options.apiKey}`,
495
+ 'supabase-auth-token': options.supabaseToken || '',
496
+ 'x-client': options.requestedWith,
497
+ },
498
+ });
499
+ const response = await requestWithAuth
500
+ .get(`data/replay-full/${serialNumber}`, {
501
+ searchParams: { date, timezone, size },
502
+ })
503
+ .json();
504
+ return response;
505
+ };
488
506
  const getDailyStats = async (serialNumber, date, timezone = 'America/Vancouver') => {
489
507
  const requestWithAuth = ky.create({
490
508
  prefixUrl: options.url,
509
+ timeout: 60000,
491
510
  headers: {
492
511
  'Content-Type': 'application/json',
493
512
  Authorization: `Bearer ${options.apiKey}`,
@@ -505,6 +524,7 @@ export const skiKrumb = (options = {
505
524
  const getActivityDates = async (serialNumber, timezone = 'America/Vancouver') => {
506
525
  const requestWithAuth = ky.create({
507
526
  prefixUrl: options.url,
527
+ timeout: 60000,
508
528
  headers: {
509
529
  'Content-Type': 'application/json',
510
530
  Authorization: `Bearer ${options.apiKey}`,
@@ -519,6 +539,29 @@ export const skiKrumb = (options = {
519
539
  .json();
520
540
  return response;
521
541
  };
542
+ const getLeaderboardStats = async (serialNumbers, startDate, endDate, timezone = 'America/Vancouver') => {
543
+ const requestWithAuth = ky.create({
544
+ prefixUrl: options.url,
545
+ timeout: 60000,
546
+ headers: {
547
+ 'Content-Type': 'application/json',
548
+ Authorization: `Bearer ${options.apiKey}`,
549
+ 'supabase-auth-token': options.supabaseToken || '',
550
+ 'x-client': options.requestedWith,
551
+ 'TimeZone': timezone,
552
+ },
553
+ });
554
+ const response = await requestWithAuth
555
+ .get('stats/leaderboard', {
556
+ searchParams: {
557
+ serials: serialNumbers.join(','),
558
+ startDate,
559
+ endDate,
560
+ },
561
+ })
562
+ .json();
563
+ return response;
564
+ };
522
565
  const getAccessibleProfiles = async () => {
523
566
  const requestWithAuth = ky.create({
524
567
  prefixUrl: options.url,
@@ -612,8 +655,10 @@ export const skiKrumb = (options = {
612
655
  deleteFamilyShare,
613
656
  updateFamilyShare,
614
657
  getReplayData,
658
+ getReplayFull,
615
659
  getDailyStats,
616
660
  getActivityDates,
661
+ getLeaderboardStats,
617
662
  getAccessibleProfiles,
618
663
  getLatestDeviceData,
619
664
  createRealtimeClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skikrumb-api",
3
- "version": "2.1.15",
3
+ "version": "2.1.16",
4
4
  "description": "Wrapper for the skiKrumb API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",