glitch-javascript-sdk 1.9.9 → 2.0.1

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.
@@ -457,5 +457,24 @@ declare class Ads {
457
457
  static pauseGoogleAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
458
458
  /** POST /ads/posts/google/{post_id}/enable */
459
459
  static enableGoogleAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
460
+ /**
461
+ * Creates a new Google Ads client account under a specified manager account.
462
+ * Corresponds to POST /ads/google/accounts/create
463
+ *
464
+ * @param data The creation payload.
465
+ * @param data.scheduler_id The UUID of the scheduler with auth tokens.
466
+ * @param data.manager_customer_id The 10-digit MCC ID.
467
+ * @param data.descriptive_name The name for the new account.
468
+ * @param data.currency_code ISO 4217 currency code.
469
+ * @param data.time_zone Time zone identifier (e.g., 'America/New_York').
470
+ * @returns The newly created Google Ads account details.
471
+ */
472
+ static createGoogleAccount<T>(data: {
473
+ scheduler_id: string;
474
+ manager_customer_id: string;
475
+ descriptive_name: string;
476
+ currency_code: string;
477
+ time_zone: string;
478
+ }): AxiosPromise<Response<T>>;
460
479
  }
461
480
  export default Ads;
@@ -0,0 +1,174 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class MarketingAgencies {
4
+ /**
5
+ * List all marketing agencies.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies
8
+ *
9
+ * @param params Optional query parameters (e.g., is_admin, sort_by, sort_order, page, per_page).
10
+ * @returns promise
11
+ */
12
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
13
+ /**
14
+ * Create a new marketing agency.
15
+ *
16
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies
17
+ *
18
+ * @param data The data for the new agency.
19
+ * @returns Promise
20
+ */
21
+ static create<T>(data: object): AxiosPromise<Response<T>>;
22
+ /**
23
+ * Retrieve a single marketing agency by its ID.
24
+ *
25
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies-id
26
+ *
27
+ * @param id The UUID of the agency to retrieve.
28
+ * @returns promise
29
+ */
30
+ static view<T>(id: string): AxiosPromise<Response<T>>;
31
+ /**
32
+ * Update a marketing agency.
33
+ *
34
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/putMarketing-agencies-id
35
+ *
36
+ * @param id The UUID of the agency to update.
37
+ * @param data The data to update.
38
+ * @returns promise
39
+ */
40
+ static update<T>(id: string, data: object): AxiosPromise<Response<T>>;
41
+ /**
42
+ * Deletes a marketing agency.
43
+ *
44
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id
45
+ *
46
+ * @param id The UUID of the agency to delete.
47
+ * @returns promise
48
+ */
49
+ static delete<T>(id: string): AxiosPromise<Response<T>>;
50
+ /**
51
+ * Add a user as an administrator to an agency.
52
+ *
53
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-administrators
54
+ *
55
+ * @param id The UUID of the agency.
56
+ * @param data The data containing the user_id to add.
57
+ * @returns Promise
58
+ */
59
+ static addAdministrator<T>(id: string, data: {
60
+ user_id: string;
61
+ }): AxiosPromise<Response<T>>;
62
+ /**
63
+ * Remove a user as an administrator from an agency.
64
+ *
65
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id-administrators-user_id
66
+ *
67
+ * @param id The UUID of the agency.
68
+ * @param user_id The UUID of the user to remove.
69
+ * @returns Promise
70
+ */
71
+ static removeAdministrator<T>(id: string, user_id: string): AxiosPromise<Response<T>>;
72
+ /**
73
+ * Set the logo for an agency.
74
+ *
75
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-logo
76
+ *
77
+ * @param id The UUID of the agency.
78
+ * @param data The data containing the media_id for the logo.
79
+ * @returns Promise
80
+ */
81
+ static setLogo<T>(id: string, data: {
82
+ media_id: string;
83
+ }): AxiosPromise<Response<T>>;
84
+ /**
85
+ * Add a case study to an agency.
86
+ *
87
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-case-studies
88
+ *
89
+ * @param id The UUID of the agency.
90
+ * @param data The data containing the media_id and optional order.
91
+ * @returns Promise
92
+ */
93
+ static addCaseStudy<T>(id: string, data: {
94
+ media_id: string;
95
+ order?: number;
96
+ }): AxiosPromise<Response<T>>;
97
+ /**
98
+ * Remove a case study from an agency.
99
+ *
100
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id-case-studies-media_id
101
+ *
102
+ * @param id The UUID of the agency.
103
+ * @param media_id The UUID of the media to remove.
104
+ * @returns Promise
105
+ */
106
+ static removeCaseStudy<T>(id: string, media_id: string): AxiosPromise<Response<T>>;
107
+ /**
108
+ * Update the order of case studies for an agency.
109
+ *
110
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-case-studies-order
111
+ *
112
+ * @param id The UUID of the agency.
113
+ * @param order_data An array of objects with media_id and new order.
114
+ * @returns Promise
115
+ */
116
+ static updateCaseStudyOrder<T>(id: string, order_data: {
117
+ media_id: string;
118
+ order: number;
119
+ }[]): AxiosPromise<Response<T>>;
120
+ /**
121
+ * Invite a user to become an administrator of an agency.
122
+ *
123
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-invites
124
+ *
125
+ * @param id The UUID of the agency.
126
+ * @param data The data containing the email of the user to invite.
127
+ * @returns Promise
128
+ */
129
+ static invite<T>(id: string, data: {
130
+ email: string;
131
+ }): AxiosPromise<Response<T>>;
132
+ /**
133
+ * List all pending invitations for an agency.
134
+ *
135
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies-id-invites
136
+ *
137
+ * @param id The UUID of the agency.
138
+ * @returns Promise
139
+ */
140
+ static listInvites<T>(id: string): AxiosPromise<Response<T>>;
141
+ /**
142
+ * Revoke a pending invitation.
143
+ *
144
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id-invites-invite_id
145
+ *
146
+ * @param id The UUID of the agency.
147
+ * @param invite_id The UUID of the invitation to revoke.
148
+ * @returns Promise
149
+ */
150
+ static revokeInvite<T>(id: string, invite_id: string): AxiosPromise<Response<T>>;
151
+ /**
152
+ * Get the details of a pending invitation using its token.
153
+ *
154
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies-invites-details
155
+ *
156
+ * @param params An object containing the token.
157
+ * @returns Promise
158
+ */
159
+ static getInviteDetails<T>(params: {
160
+ token: string;
161
+ }): AxiosPromise<Response<T>>;
162
+ /**
163
+ * Accept an invitation to become an administrator.
164
+ *
165
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-invites-accept
166
+ *
167
+ * @param data The data containing the invitation token.
168
+ * @returns Promise
169
+ */
170
+ static acceptInvite<T>(data: {
171
+ token: string;
172
+ }): AxiosPromise<Response<T>>;
173
+ }
174
+ export default MarketingAgencies;
@@ -35,6 +35,7 @@ import Hashtags from "./Hashtags";
35
35
  import WebsiteAnalytics from "./WebsiteAnalytics";
36
36
  import ShortLinks from "./ShortLinks";
37
37
  import AIUsage from "./AIUsage";
38
+ import MarketingAgencies from "./MarketingAgencies";
38
39
  export { Ads };
39
40
  export { Auth };
40
41
  export { Competitions };
@@ -72,3 +73,4 @@ export { WebsiteAnalytics };
72
73
  export { Fingerprinting };
73
74
  export { ShortLinks };
74
75
  export { AIUsage };
76
+ export { MarketingAgencies };
@@ -35,6 +35,7 @@ import { WebsiteAnalytics } from "./api";
35
35
  import { Fingerprinting } from "./api";
36
36
  import { ShortLinks } from "./api";
37
37
  import { AIUsage } from "./api";
38
+ import { MarketingAgencies } from "./api";
38
39
  import Requests from "./util/Requests";
39
40
  import Parser from "./util/Parser";
40
41
  import Session from "./util/Session";
@@ -91,6 +92,7 @@ declare class Glitch {
91
92
  Fingerprinting: typeof Fingerprinting;
92
93
  ShortLinks: typeof ShortLinks;
93
94
  AIUsage: typeof AIUsage;
95
+ MarketingAgencies: typeof MarketingAgencies;
94
96
  };
95
97
  static util: {
96
98
  Requests: typeof Requests;
package/dist/esm/index.js CHANGED
@@ -7001,6 +7001,10 @@ var AdsRoute = /** @class */ (function () {
7001
7001
  url: "/ads/posts/google/{post_id}/enable",
7002
7002
  method: HTTP_METHODS.POST,
7003
7003
  },
7004
+ createGoogleAccount: {
7005
+ url: "/ads/google/accounts/create",
7006
+ method: HTTP_METHODS.POST,
7007
+ },
7004
7008
  };
7005
7009
  return AdsRoute;
7006
7010
  }());
@@ -7666,6 +7670,21 @@ var Ads = /** @class */ (function () {
7666
7670
  Ads.enableGoogleAdPost = function (post_id, params) {
7667
7671
  return Requests.processRoute(AdsRoute.routes.enableGoogleAdPost, {}, { post_id: post_id }, params);
7668
7672
  };
7673
+ /**
7674
+ * Creates a new Google Ads client account under a specified manager account.
7675
+ * Corresponds to POST /ads/google/accounts/create
7676
+ *
7677
+ * @param data The creation payload.
7678
+ * @param data.scheduler_id The UUID of the scheduler with auth tokens.
7679
+ * @param data.manager_customer_id The 10-digit MCC ID.
7680
+ * @param data.descriptive_name The name for the new account.
7681
+ * @param data.currency_code ISO 4217 currency code.
7682
+ * @param data.time_zone Time zone identifier (e.g., 'America/New_York').
7683
+ * @returns The newly created Google Ads account details.
7684
+ */
7685
+ Ads.createGoogleAccount = function (data) {
7686
+ return Requests.processRoute(AdsRoute.routes.createGoogleAccount, data, undefined, undefined);
7687
+ };
7669
7688
  return Ads;
7670
7689
  }());
7671
7690
 
@@ -14385,6 +14404,226 @@ var AIUsage = /** @class */ (function () {
14385
14404
  return AIUsage;
14386
14405
  }());
14387
14406
 
14407
+ var MarketingAgenciesRoute = /** @class */ (function () {
14408
+ function MarketingAgenciesRoute() {
14409
+ }
14410
+ MarketingAgenciesRoute.routes = {
14411
+ // CRUD for agencies
14412
+ list: { url: '/marketing-agencies', method: HTTP_METHODS.GET },
14413
+ create: { url: '/marketing-agencies', method: HTTP_METHODS.POST },
14414
+ view: { url: '/marketing-agencies/{id}', method: HTTP_METHODS.GET },
14415
+ update: { url: '/marketing-agencies/{id}', method: HTTP_METHODS.PUT },
14416
+ delete: { url: '/marketing-agencies/{id}', method: HTTP_METHODS.DELETE },
14417
+ // Administrator management
14418
+ addAdministrator: { url: '/marketing-agencies/{id}/administrators', method: HTTP_METHODS.POST },
14419
+ removeAdministrator: { url: '/marketing-agencies/{id}/administrators/{user_id}', method: HTTP_METHODS.DELETE },
14420
+ // Logo management
14421
+ setLogo: { url: '/marketing-agencies/{id}/logo', method: HTTP_METHODS.POST },
14422
+ // Case Study management
14423
+ addCaseStudy: { url: '/marketing-agencies/{id}/case-studies', method: HTTP_METHODS.POST },
14424
+ removeCaseStudy: { url: '/marketing-agencies/{id}/case-studies/{media_id}', method: HTTP_METHODS.DELETE },
14425
+ updateCaseStudyOrder: { url: '/marketing-agencies/{id}/case-studies/order', method: HTTP_METHODS.POST },
14426
+ // Invitation management
14427
+ invite: { url: '/marketing-agencies/{id}/invites', method: HTTP_METHODS.POST },
14428
+ listInvites: { url: '/marketing-agencies/{id}/invites', method: HTTP_METHODS.GET },
14429
+ revokeInvite: { url: '/marketing-agencies/{id}/invites/{invite_id}', method: HTTP_METHODS.DELETE },
14430
+ getInviteDetails: { url: '/marketing-agencies/invites/details', method: HTTP_METHODS.GET },
14431
+ acceptInvite: { url: '/marketing-agencies/invites/accept', method: HTTP_METHODS.POST },
14432
+ };
14433
+ return MarketingAgenciesRoute;
14434
+ }());
14435
+
14436
+ var MarketingAgencies = /** @class */ (function () {
14437
+ function MarketingAgencies() {
14438
+ }
14439
+ /**
14440
+ * List all marketing agencies.
14441
+ *
14442
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies
14443
+ *
14444
+ * @param params Optional query parameters (e.g., is_admin, sort_by, sort_order, page, per_page).
14445
+ * @returns promise
14446
+ */
14447
+ MarketingAgencies.list = function (params) {
14448
+ return Requests.processRoute(MarketingAgenciesRoute.routes.list, undefined, undefined, params);
14449
+ };
14450
+ /**
14451
+ * Create a new marketing agency.
14452
+ *
14453
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies
14454
+ *
14455
+ * @param data The data for the new agency.
14456
+ * @returns Promise
14457
+ */
14458
+ MarketingAgencies.create = function (data) {
14459
+ return Requests.processRoute(MarketingAgenciesRoute.routes.create, data);
14460
+ };
14461
+ /**
14462
+ * Retrieve a single marketing agency by its ID.
14463
+ *
14464
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies-id
14465
+ *
14466
+ * @param id The UUID of the agency to retrieve.
14467
+ * @returns promise
14468
+ */
14469
+ MarketingAgencies.view = function (id) {
14470
+ return Requests.processRoute(MarketingAgenciesRoute.routes.view, {}, { id: id });
14471
+ };
14472
+ /**
14473
+ * Update a marketing agency.
14474
+ *
14475
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/putMarketing-agencies-id
14476
+ *
14477
+ * @param id The UUID of the agency to update.
14478
+ * @param data The data to update.
14479
+ * @returns promise
14480
+ */
14481
+ MarketingAgencies.update = function (id, data) {
14482
+ return Requests.processRoute(MarketingAgenciesRoute.routes.update, data, { id: id });
14483
+ };
14484
+ /**
14485
+ * Deletes a marketing agency.
14486
+ *
14487
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id
14488
+ *
14489
+ * @param id The UUID of the agency to delete.
14490
+ * @returns promise
14491
+ */
14492
+ MarketingAgencies.delete = function (id) {
14493
+ return Requests.processRoute(MarketingAgenciesRoute.routes.delete, {}, { id: id });
14494
+ };
14495
+ /**
14496
+ * Add a user as an administrator to an agency.
14497
+ *
14498
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-administrators
14499
+ *
14500
+ * @param id The UUID of the agency.
14501
+ * @param data The data containing the user_id to add.
14502
+ * @returns Promise
14503
+ */
14504
+ MarketingAgencies.addAdministrator = function (id, data) {
14505
+ return Requests.processRoute(MarketingAgenciesRoute.routes.addAdministrator, data, { id: id });
14506
+ };
14507
+ /**
14508
+ * Remove a user as an administrator from an agency.
14509
+ *
14510
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id-administrators-user_id
14511
+ *
14512
+ * @param id The UUID of the agency.
14513
+ * @param user_id The UUID of the user to remove.
14514
+ * @returns Promise
14515
+ */
14516
+ MarketingAgencies.removeAdministrator = function (id, user_id) {
14517
+ return Requests.processRoute(MarketingAgenciesRoute.routes.removeAdministrator, {}, { id: id, user_id: user_id });
14518
+ };
14519
+ /**
14520
+ * Set the logo for an agency.
14521
+ *
14522
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-logo
14523
+ *
14524
+ * @param id The UUID of the agency.
14525
+ * @param data The data containing the media_id for the logo.
14526
+ * @returns Promise
14527
+ */
14528
+ MarketingAgencies.setLogo = function (id, data) {
14529
+ return Requests.processRoute(MarketingAgenciesRoute.routes.setLogo, data, { id: id });
14530
+ };
14531
+ /**
14532
+ * Add a case study to an agency.
14533
+ *
14534
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-case-studies
14535
+ *
14536
+ * @param id The UUID of the agency.
14537
+ * @param data The data containing the media_id and optional order.
14538
+ * @returns Promise
14539
+ */
14540
+ MarketingAgencies.addCaseStudy = function (id, data) {
14541
+ return Requests.processRoute(MarketingAgenciesRoute.routes.addCaseStudy, data, { id: id });
14542
+ };
14543
+ /**
14544
+ * Remove a case study from an agency.
14545
+ *
14546
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id-case-studies-media_id
14547
+ *
14548
+ * @param id The UUID of the agency.
14549
+ * @param media_id The UUID of the media to remove.
14550
+ * @returns Promise
14551
+ */
14552
+ MarketingAgencies.removeCaseStudy = function (id, media_id) {
14553
+ return Requests.processRoute(MarketingAgenciesRoute.routes.removeCaseStudy, {}, { id: id, media_id: media_id });
14554
+ };
14555
+ /**
14556
+ * Update the order of case studies for an agency.
14557
+ *
14558
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-case-studies-order
14559
+ *
14560
+ * @param id The UUID of the agency.
14561
+ * @param order_data An array of objects with media_id and new order.
14562
+ * @returns Promise
14563
+ */
14564
+ MarketingAgencies.updateCaseStudyOrder = function (id, order_data) {
14565
+ return Requests.processRoute(MarketingAgenciesRoute.routes.updateCaseStudyOrder, { order_data: order_data }, { id: id });
14566
+ };
14567
+ /**
14568
+ * Invite a user to become an administrator of an agency.
14569
+ *
14570
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-id-invites
14571
+ *
14572
+ * @param id The UUID of the agency.
14573
+ * @param data The data containing the email of the user to invite.
14574
+ * @returns Promise
14575
+ */
14576
+ MarketingAgencies.invite = function (id, data) {
14577
+ return Requests.processRoute(MarketingAgenciesRoute.routes.invite, data, { id: id });
14578
+ };
14579
+ /**
14580
+ * List all pending invitations for an agency.
14581
+ *
14582
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies-id-invites
14583
+ *
14584
+ * @param id The UUID of the agency.
14585
+ * @returns Promise
14586
+ */
14587
+ MarketingAgencies.listInvites = function (id) {
14588
+ return Requests.processRoute(MarketingAgenciesRoute.routes.listInvites, {}, { id: id });
14589
+ };
14590
+ /**
14591
+ * Revoke a pending invitation.
14592
+ *
14593
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/deleteMarketing-agencies-id-invites-invite_id
14594
+ *
14595
+ * @param id The UUID of the agency.
14596
+ * @param invite_id The UUID of the invitation to revoke.
14597
+ * @returns Promise
14598
+ */
14599
+ MarketingAgencies.revokeInvite = function (id, invite_id) {
14600
+ return Requests.processRoute(MarketingAgenciesRoute.routes.revokeInvite, {}, { id: id, invite_id: invite_id });
14601
+ };
14602
+ /**
14603
+ * Get the details of a pending invitation using its token.
14604
+ *
14605
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/getMarketing-agencies-invites-details
14606
+ *
14607
+ * @param params An object containing the token.
14608
+ * @returns Promise
14609
+ */
14610
+ MarketingAgencies.getInviteDetails = function (params) {
14611
+ return Requests.processRoute(MarketingAgenciesRoute.routes.getInviteDetails, undefined, undefined, params);
14612
+ };
14613
+ /**
14614
+ * Accept an invitation to become an administrator.
14615
+ *
14616
+ * @see https://api.glitch.fun/api/documentation#/Marketing%20Agencies/postMarketing-agencies-invites-accept
14617
+ *
14618
+ * @param data The data containing the invitation token.
14619
+ * @returns Promise
14620
+ */
14621
+ MarketingAgencies.acceptInvite = function (data) {
14622
+ return Requests.processRoute(MarketingAgenciesRoute.routes.acceptInvite, data);
14623
+ };
14624
+ return MarketingAgencies;
14625
+ }());
14626
+
14388
14627
  var Parser = /** @class */ (function () {
14389
14628
  function Parser() {
14390
14629
  }
@@ -14909,7 +15148,8 @@ var Glitch = /** @class */ (function () {
14909
15148
  WebsiteAnalytics: WebsiteAnalytics,
14910
15149
  Fingerprinting: Fingerprinting,
14911
15150
  ShortLinks: ShortLinks,
14912
- AIUsage: AIUsage
15151
+ AIUsage: AIUsage,
15152
+ MarketingAgencies: MarketingAgencies
14913
15153
  };
14914
15154
  Glitch.util = {
14915
15155
  Requests: Requests,