glitch-javascript-sdk 1.7.2 → 1.7.3

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
@@ -4436,76 +4436,57 @@ declare class Scheduler {
4436
4436
  */
4437
4437
  static getSchedulerProgression<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4438
4438
  /**
4439
- * List active cross-promote relationships for a scheduler.
4440
- *
4441
- * @param scheduler_id The ID of the promotion schedule
4442
- * @param params Optional query params
4443
- */
4444
- static crossPromoteListRelationships<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4445
- /**
4446
- * Find potential cross-promote partners for a scheduler.
4447
- *
4448
- * @param scheduler_id The ID of the promotion schedule
4449
- * @param params Optional query params
4439
+ * Search for cross-promote partners.
4440
+ * Uses query parameter `my_scheduler_id`
4450
4441
  */
4451
- static crossPromoteFind<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4442
+ static crossPromoteSearch<T>(my_scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4452
4443
  /**
4453
- * List cross-promote invites for a scheduler.
4454
- *
4455
- * @param scheduler_id The ID of the promotion schedule
4456
- * @param params Optional query params
4444
+ * List cross-promote invitations for a scheduler.
4445
+ * Expects a query param `scheduler_id`
4457
4446
  */
4458
4447
  static crossPromoteInvitesList<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4459
4448
  /**
4460
4449
  * Send an invite to cross-promote.
4461
- *
4462
- * @param scheduler_id The ID of the promotion schedule
4463
- * @param data { partner_scheduler_id, optional_message }
4450
+ * Converts `partner_scheduler_id` and `optional_message` into the PHP expected fields.
4464
4451
  */
4465
- static crossPromoteInviteSend<T>(scheduler_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
4452
+ static crossPromoteInviteSend<T>(scheduler_id: string, data: {
4453
+ partner_scheduler_id: string;
4454
+ optional_message?: string;
4455
+ }, params?: Record<string, any>): AxiosPromise<Response<T>>;
4466
4456
  /**
4467
- * Accept an invite to cross-promote.
4468
- *
4469
- * @param scheduler_id The ID of the promotion schedule
4470
- * @param invite_id The ID of the invite
4457
+ * Respond to an invitation (accept or deny).
4471
4458
  */
4472
- static crossPromoteInviteAccept<T>(scheduler_id: string, invite_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4459
+ static crossPromoteInviteRespond<T>(invitation_id: string, data: {
4460
+ status: 'accepted' | 'denied';
4461
+ platforms?: string[];
4462
+ }, params?: Record<string, any>): AxiosPromise<Response<T>>;
4473
4463
  /**
4474
- * Reject an invite to cross-promote.
4475
- *
4476
- * @param scheduler_id The ID of the promotion schedule
4477
- * @param invite_id The ID of the invite
4464
+ * List cross-promote relationships for a scheduler.
4465
+ * Expects a query param `scheduler_id`
4478
4466
  */
4479
- static crossPromoteInviteReject<T>(scheduler_id: string, invite_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4467
+ static crossPromoteListRelationships<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4480
4468
  /**
4481
4469
  * End a cross-promote relationship.
4482
- *
4483
- * @param scheduler_id The ID of the promotion schedule
4484
- * @param relationship_id The ID of the relationship
4485
4470
  */
4486
- static crossPromoteRelationshipDelete<T>(scheduler_id: string, relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4471
+ static crossPromoteEndRelationship<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4472
+ /**
4473
+ * List logs for a cross-promote relationship.
4474
+ */
4475
+ static crossPromoteListLogs<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4487
4476
  /**
4488
4477
  * Get which platforms are cross-promoted in an existing relationship.
4489
- *
4490
- * @param scheduler_id The ID of the promotion schedule
4491
- * @param relationship_id The ID of the relationship
4492
4478
  */
4493
- static crossPromoteRelationshipGetPlatforms<T>(scheduler_id: string, relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4479
+ static crossPromoteRelationshipGetPlatforms<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4494
4480
  /**
4495
4481
  * Set which platforms are cross-promoted in an existing relationship.
4496
- *
4497
- * @param scheduler_id The ID of the promotion schedule
4498
- * @param relationship_id The ID of the relationship
4499
- * @param data An object like { platforms: ['twitter', 'facebook', ...] }
4500
4482
  */
4501
- static crossPromoteRelationshipSetPlatforms<T>(scheduler_id: string, relationship_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
4483
+ static crossPromoteRelationshipSetPlatforms<T>(relationship_id: string, data: {
4484
+ platforms: string[];
4485
+ }, params?: Record<string, any>): AxiosPromise<Response<T>>;
4502
4486
  /**
4503
4487
  * Get recently cross-promoted posts under a relationship.
4504
- *
4505
- * @param scheduler_id The ID of the promotion schedule
4506
- * @param relationship_id The ID of the relationship
4507
4488
  */
4508
- static crossPromoteRelationshipPosts<T>(scheduler_id: string, relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4489
+ static crossPromoteRelationshipPosts<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
4509
4490
  }
4510
4491
 
4511
4492
  declare class Funnel {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -394,154 +394,85 @@ class Scheduler {
394
394
  }
395
395
 
396
396
  /**
397
- * List active cross-promote relationships for a scheduler.
398
- *
399
- * @param scheduler_id The ID of the promotion schedule
400
- * @param params Optional query params
397
+ * Search for cross-promote partners.
398
+ * Uses query parameter `my_scheduler_id`
401
399
  */
402
- public static crossPromoteListRelationships<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
403
- return Requests.processRoute(
404
- SchedulerRoute.routes.crossPromoteListRelationships,
405
- {},
406
- { scheduler_id },
407
- params
408
- );
400
+ public static crossPromoteSearch<T>(my_scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
401
+ const newParams = { ...params, my_scheduler_id };
402
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteSearch, {}, {}, newParams);
409
403
  }
410
404
 
411
405
  /**
412
- * Find potential cross-promote partners for a scheduler.
413
- *
414
- * @param scheduler_id The ID of the promotion schedule
415
- * @param params Optional query params
406
+ * List cross-promote invitations for a scheduler.
407
+ * Expects a query param `scheduler_id`
416
408
  */
417
- public static crossPromoteFind<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
418
- return Requests.processRoute(
419
- SchedulerRoute.routes.crossPromoteFind,
420
- {},
421
- { scheduler_id },
422
- params
423
- );
409
+ public static crossPromoteInvitesList<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
410
+ const newParams = { ...params, scheduler_id };
411
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteInvitesList, {}, {}, newParams);
424
412
  }
425
413
 
426
414
  /**
427
- * List cross-promote invites for a scheduler.
428
- *
429
- * @param scheduler_id The ID of the promotion schedule
430
- * @param params Optional query params
415
+ * Send an invite to cross-promote.
416
+ * Converts `partner_scheduler_id` and `optional_message` into the PHP expected fields.
431
417
  */
432
- public static crossPromoteInvitesList<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
433
- return Requests.processRoute(
434
- SchedulerRoute.routes.crossPromoteInvitesList,
435
- {},
436
- { scheduler_id },
437
- params
438
- );
418
+ public static crossPromoteInviteSend<T>(scheduler_id: string, data: { partner_scheduler_id: string, optional_message?: string }, params?: Record<string, any>): AxiosPromise<Response<T>> {
419
+ const payload = {
420
+ from_scheduler_id: scheduler_id,
421
+ to_scheduler_id: data.partner_scheduler_id,
422
+ message: data.optional_message || ''
423
+ };
424
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteInviteSend, payload, {}, params);
439
425
  }
440
426
 
441
427
  /**
442
- * Send an invite to cross-promote.
443
- *
444
- * @param scheduler_id The ID of the promotion schedule
445
- * @param data { partner_scheduler_id, optional_message }
428
+ * Respond to an invitation (accept or deny).
446
429
  */
447
- public static crossPromoteInviteSend<T>(scheduler_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
448
- return Requests.processRoute(
449
- SchedulerRoute.routes.crossPromoteInviteSend,
450
- data,
451
- { scheduler_id },
452
- params
453
- );
430
+ public static crossPromoteInviteRespond<T>(invitation_id: string, data: { status: 'accepted' | 'denied', platforms?: string[] }, params?: Record<string, any>): AxiosPromise<Response<T>> {
431
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteInviteRespond, data, { invitation_id }, params);
454
432
  }
455
433
 
456
434
  /**
457
- * Accept an invite to cross-promote.
458
- *
459
- * @param scheduler_id The ID of the promotion schedule
460
- * @param invite_id The ID of the invite
435
+ * List cross-promote relationships for a scheduler.
436
+ * Expects a query param `scheduler_id`
461
437
  */
462
- public static crossPromoteInviteAccept<T>(scheduler_id: string, invite_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
463
- return Requests.processRoute(
464
- SchedulerRoute.routes.crossPromoteInviteAccept,
465
- {},
466
- { scheduler_id, invite_id },
467
- params
468
- );
438
+ public static crossPromoteListRelationships<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
439
+ const newParams = { ...params, scheduler_id };
440
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteListRelationships, {}, {}, newParams);
469
441
  }
470
442
 
471
443
  /**
472
- * Reject an invite to cross-promote.
473
- *
474
- * @param scheduler_id The ID of the promotion schedule
475
- * @param invite_id The ID of the invite
444
+ * End a cross-promote relationship.
476
445
  */
477
- public static crossPromoteInviteReject<T>(scheduler_id: string, invite_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
478
- return Requests.processRoute(
479
- SchedulerRoute.routes.crossPromoteInviteReject,
480
- {},
481
- { scheduler_id, invite_id },
482
- params
483
- );
446
+ public static crossPromoteEndRelationship<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
447
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteEndRelationship, {}, { relationship_id }, params);
484
448
  }
485
449
 
486
450
  /**
487
- * End a cross-promote relationship.
488
- *
489
- * @param scheduler_id The ID of the promotion schedule
490
- * @param relationship_id The ID of the relationship
451
+ * List logs for a cross-promote relationship.
491
452
  */
492
- public static crossPromoteRelationshipDelete<T>(scheduler_id: string, relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
493
- return Requests.processRoute(
494
- SchedulerRoute.routes.crossPromoteRelationshipDelete,
495
- {},
496
- { scheduler_id, relationship_id },
497
- params
498
- );
453
+ public static crossPromoteListLogs<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
454
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteListLogs, {}, { relationship_id }, params);
499
455
  }
500
456
 
501
457
  /**
502
458
  * Get which platforms are cross-promoted in an existing relationship.
503
- *
504
- * @param scheduler_id The ID of the promotion schedule
505
- * @param relationship_id The ID of the relationship
506
459
  */
507
- public static crossPromoteRelationshipGetPlatforms<T>(scheduler_id: string, relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
508
- return Requests.processRoute(
509
- SchedulerRoute.routes.crossPromoteRelationshipGetPlatforms,
510
- {},
511
- { scheduler_id, relationship_id },
512
- params
513
- );
460
+ public static crossPromoteRelationshipGetPlatforms<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
461
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteRelationshipGetPlatforms, {}, { relationship_id }, params);
514
462
  }
515
463
 
516
464
  /**
517
465
  * Set which platforms are cross-promoted in an existing relationship.
518
- *
519
- * @param scheduler_id The ID of the promotion schedule
520
- * @param relationship_id The ID of the relationship
521
- * @param data An object like { platforms: ['twitter', 'facebook', ...] }
522
466
  */
523
- public static crossPromoteRelationshipSetPlatforms<T>(scheduler_id: string, relationship_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
524
- return Requests.processRoute(
525
- SchedulerRoute.routes.crossPromoteRelationshipSetPlatforms,
526
- data,
527
- { scheduler_id, relationship_id },
528
- params
529
- );
467
+ public static crossPromoteRelationshipSetPlatforms<T>(relationship_id: string, data: { platforms: string[] }, params?: Record<string, any>): AxiosPromise<Response<T>> {
468
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteRelationshipSetPlatforms, data, { relationship_id }, params);
530
469
  }
531
470
 
532
471
  /**
533
472
  * Get recently cross-promoted posts under a relationship.
534
- *
535
- * @param scheduler_id The ID of the promotion schedule
536
- * @param relationship_id The ID of the relationship
537
473
  */
538
- public static crossPromoteRelationshipPosts<T>(scheduler_id: string, relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
539
- return Requests.processRoute(
540
- SchedulerRoute.routes.crossPromoteRelationshipPosts,
541
- {},
542
- { scheduler_id, relationship_id },
543
- params
544
- );
474
+ public static crossPromoteRelationshipPosts<T>(relationship_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
475
+ return Requests.processRoute(SchedulerRoute.routes.crossPromoteRelationshipPosts, {}, { relationship_id }, params);
545
476
  }
546
477
 
547
478
  }
@@ -46,60 +46,44 @@ class SchedulerRoute {
46
46
  getRedditSubredditFlairs: { url: '/schedulers/{scheduler_id}/reddit/subreddits/{subreddit}/flairs', method: HTTP_METHODS.GET },
47
47
  getDiscordChannels: { url: '/schedulers/{scheduler_id}/discord/channels', method: HTTP_METHODS.GET },
48
48
 
49
- crossPromoteListRelationships: {
50
- url: '/schedulers/{scheduler_id}/crosspromote/relationships',
51
- method: HTTP_METHODS.GET
52
- },
53
-
54
- // 2) Find potential cross-promote partners
55
- crossPromoteFind: {
56
- url: '/schedulers/{scheduler_id}/crosspromote/find',
49
+ crossPromoteSearch: {
50
+ url: '/schedulers/cross-promote/search',
57
51
  method: HTTP_METHODS.GET
58
52
  },
59
-
60
- // 3) List invites
61
53
  crossPromoteInvitesList: {
62
- url: '/schedulers/{scheduler_id}/crosspromote/invites',
54
+ url: '/schedulers/cross-promote/invitations',
63
55
  method: HTTP_METHODS.GET
64
56
  },
65
-
66
- // 4) Send an invite to cross-promote
67
57
  crossPromoteInviteSend: {
68
- url: '/schedulers/{scheduler_id}/crosspromote/invites',
58
+ url: '/schedulers/cross-promote/invitations',
69
59
  method: HTTP_METHODS.POST
70
60
  },
71
-
72
- // 5) Accept an invite
73
- crossPromoteInviteAccept: {
74
- url: '/schedulers/{scheduler_id}/crosspromote/invites/{invite_id}/accept',
61
+ crossPromoteInviteRespond: {
62
+ url: '/schedulers/cross-promote/invitations/{invitation_id}/respond',
75
63
  method: HTTP_METHODS.POST
76
64
  },
77
-
78
- // 6) Reject an invite
79
- crossPromoteInviteReject: {
80
- url: '/schedulers/{scheduler_id}/crosspromote/invites/{invite_id}/reject',
65
+ crossPromoteListRelationships: {
66
+ url: '/schedulers/cross-promote/relationships',
67
+ method: HTTP_METHODS.GET
68
+ },
69
+ crossPromoteEndRelationship: {
70
+ url: '/schedulers/cross-promote/relationships/{relationship_id}/end',
81
71
  method: HTTP_METHODS.POST
82
72
  },
83
-
84
- // 7) End a cross-promote relationship
85
- crossPromoteRelationshipDelete: {
86
- url: '/schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id}',
87
- method: HTTP_METHODS.DELETE
73
+ crossPromoteListLogs: {
74
+ url: '/schedulers/cross-promote/relationships/{relationship_id}/logs',
75
+ method: HTTP_METHODS.GET
88
76
  },
89
-
90
- // 8) Get/Set which platforms are cross-promoted in an existing relationship
91
77
  crossPromoteRelationshipGetPlatforms: {
92
- url: '/schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id}/platforms',
78
+ url: '/schedulers/cross-promote/relationships/{relationship_id}/platforms',
93
79
  method: HTTP_METHODS.GET
94
80
  },
95
81
  crossPromoteRelationshipSetPlatforms: {
96
- url: '/schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id}/platforms',
82
+ url: '/schedulers/cross-promote/relationships/{relationship_id}/platforms',
97
83
  method: HTTP_METHODS.PUT
98
84
  },
99
-
100
- // 9) Get recently cross-promoted posts under a relationship
101
85
  crossPromoteRelationshipPosts: {
102
- url: '/schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id}/posts',
86
+ url: '/schedulers/cross-promote/relationships/{relationship_id}/posts',
103
87
  method: HTTP_METHODS.GET
104
88
  },
105
89