glitch-javascript-sdk 1.7.7 → 1.7.9

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.
@@ -0,0 +1,14 @@
1
+ import Route from "./interface";
2
+ /**
3
+ * AdsRoute holds all the endpoint definitions for:
4
+ * - Ad Campaigns
5
+ * - Ad Groups (Ad Sets)
6
+ * - Ads (Creatives)
7
+ * - Ad Group Triggers
8
+ */
9
+ declare class AdsRoute {
10
+ static routes: {
11
+ [key: string]: Route;
12
+ };
13
+ }
14
+ export default AdsRoute;
package/dist/index.d.ts CHANGED
@@ -642,6 +642,228 @@ declare class Competitions {
642
642
  static me<T>(competition_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
643
643
  }
644
644
 
645
+ declare class Ads {
646
+ /**
647
+ * List Ad Campaigns.
648
+ *
649
+ * Example usage:
650
+ * Ads.listCampaigns({ community: 'uuid-of-community', platform: 'tiktok' })
651
+ *
652
+ * @param params Query parameters (e.g. community, platform, advertiser_id, etc.)
653
+ * @returns A paginated list of AdCampaign resources
654
+ */
655
+ static listCampaigns<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
656
+ /**
657
+ * Create a new Ad Campaign.
658
+ *
659
+ * @param data The Ad Campaign payload (JSON) to create
660
+ * @param params Optional query parameters
661
+ * @returns The newly created AdCampaign resource
662
+ */
663
+ static createCampaign<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
664
+ /**
665
+ * Retrieve a single Ad Campaign by ID.
666
+ *
667
+ * @param campaign_id The UUID of the campaign to fetch
668
+ * @param params Optional query parameters
669
+ * @returns The requested AdCampaign resource
670
+ */
671
+ static viewCampaign<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
672
+ /**
673
+ * Update an existing Ad Campaign by ID.
674
+ *
675
+ * @param campaign_id The UUID of the campaign to update
676
+ * @param data The partial or full updated AdCampaign payload
677
+ * @param params Optional query parameters
678
+ * @returns The updated AdCampaign resource
679
+ */
680
+ static updateCampaign<T>(campaign_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
681
+ /**
682
+ * Delete an Ad Campaign by ID.
683
+ *
684
+ * @param campaign_id The UUID of the campaign to delete
685
+ * @param params Optional query parameters
686
+ * @returns A 204 No Content response on success
687
+ */
688
+ static deleteCampaign<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
689
+ /**
690
+ * List Ad Groups (ad sets) for a specific campaign.
691
+ *
692
+ * Example usage:
693
+ * Ads.listGroups('some-campaign-uuid', { promotion_type: 'WEBSITE' })
694
+ *
695
+ * @param campaign_id The UUID of the parent Ad Campaign
696
+ * @param params Optional query parameters (e.g. promotion_type, operation_status, etc.)
697
+ * @returns A paginated list of AdGroup resources
698
+ */
699
+ static listGroups<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
700
+ /**
701
+ * Create a new Ad Group (ad set) under a specific campaign.
702
+ *
703
+ * @param campaign_id The UUID of the parent Ad Campaign
704
+ * @param data The AdGroup creation payload
705
+ * @param params Optional query parameters
706
+ * @returns The newly created AdGroup resource
707
+ */
708
+ static createGroup<T>(campaign_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
709
+ /**
710
+ * Retrieve a single Ad Group by ID, under a specific campaign.
711
+ *
712
+ * @param campaign_id The UUID of the parent Ad Campaign
713
+ * @param group_id The UUID of the AdGroup to fetch
714
+ * @param params Optional query parameters
715
+ * @returns The requested AdGroup resource
716
+ */
717
+ static viewGroup<T>(campaign_id: string, group_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
718
+ /**
719
+ * Update an Ad Group (ad set) by ID.
720
+ *
721
+ * @param campaign_id The UUID of the parent Ad Campaign
722
+ * @param group_id The UUID of the AdGroup to update
723
+ * @param data Updated fields for the AdGroup
724
+ * @param params Optional query parameters
725
+ * @returns The updated AdGroup resource
726
+ */
727
+ static updateGroup<T>(campaign_id: string, group_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
728
+ /**
729
+ * Delete an Ad Group (ad set) by ID, under a specific campaign.
730
+ *
731
+ * @param campaign_id The UUID of the parent Ad Campaign
732
+ * @param group_id The UUID of the AdGroup to delete
733
+ * @param params Optional query parameters
734
+ * @returns A 204 No Content response on success
735
+ */
736
+ static deleteGroup<T>(campaign_id: string, group_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
737
+ /**
738
+ * List Ads (creatives).
739
+ *
740
+ * Supports filtering by ad_group_id, social_media_post_id, operation_status, etc.
741
+ *
742
+ * @param params Optional query parameters for filtering/sorting
743
+ * @returns A paginated list of Ad resources
744
+ */
745
+ static listAds<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
746
+ /**
747
+ * Create a new Ad (creative).
748
+ *
749
+ * @param data The Ad creation payload
750
+ * @param params Optional query parameters
751
+ * @returns The newly created Ad resource
752
+ */
753
+ static createAd<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
754
+ /**
755
+ * Retrieve a single Ad by ID.
756
+ *
757
+ * @param ad_id The UUID of the Ad to fetch
758
+ * @param params Optional query parameters
759
+ * @returns The requested Ad resource
760
+ */
761
+ static viewAd<T>(ad_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
762
+ /**
763
+ * Update an existing Ad by ID.
764
+ *
765
+ * @param ad_id The UUID of the Ad to update
766
+ * @param data The partial or full Ad payload
767
+ * @param params Optional query parameters
768
+ * @returns The updated Ad resource
769
+ */
770
+ static updateAd<T>(ad_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
771
+ /**
772
+ * Delete an Ad by ID.
773
+ *
774
+ * @param ad_id The UUID of the Ad to delete
775
+ * @param params Optional query parameters
776
+ * @returns A 204 No Content response on success
777
+ */
778
+ static deleteAd<T>(ad_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
779
+ /**
780
+ * List triggers defined for a given Ad Group.
781
+ *
782
+ * @param campaign_id The UUID of the parent Ad Campaign
783
+ * @param group_id The UUID of the Ad Group
784
+ * @param params Optional query parameters (pagination, etc.)
785
+ * @returns A paginated list of AdGroupTrigger resources
786
+ */
787
+ static listTriggers<T>(campaign_id: string, group_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
788
+ /**
789
+ * Create a new Ad Group Trigger.
790
+ *
791
+ * @param campaign_id The UUID of the parent Ad Campaign
792
+ * @param group_id The UUID of the Ad Group
793
+ * @param data The trigger creation payload
794
+ * @param params Optional query parameters
795
+ * @returns The newly created AdGroupTrigger resource
796
+ */
797
+ static createTrigger<T>(campaign_id: string, group_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
798
+ /**
799
+ * Retrieve a single Ad Group Trigger by ID.
800
+ *
801
+ * @param campaign_id The UUID of the parent Ad Campaign
802
+ * @param group_id The UUID of the Ad Group
803
+ * @param trigger_id The UUID of the trigger
804
+ * @param params Optional query parameters
805
+ * @returns The requested AdGroupTrigger resource
806
+ */
807
+ static viewTrigger<T>(campaign_id: string, group_id: string, trigger_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
808
+ /**
809
+ * Update an existing Ad Group Trigger by ID.
810
+ *
811
+ * @param campaign_id The UUID of the parent Ad Campaign
812
+ * @param group_id The UUID of the Ad Group
813
+ * @param trigger_id The UUID of the trigger to update
814
+ * @param data Updated trigger fields
815
+ * @param params Optional query parameters
816
+ * @returns The updated AdGroupTrigger resource
817
+ */
818
+ static updateTrigger<T>(campaign_id: string, group_id: string, trigger_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
819
+ /**
820
+ * Delete an Ad Group Trigger by ID.
821
+ *
822
+ * @param campaign_id The UUID of the parent Ad Campaign
823
+ * @param group_id The UUID of the Ad Group
824
+ * @param trigger_id The UUID of the trigger
825
+ * @param params Optional query parameters
826
+ * @returns A 204 No Content response on success
827
+ */
828
+ static deleteTrigger<T>(campaign_id: string, group_id: string, trigger_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
829
+ /**
830
+ * List platform-level businesses for the given campaign ID,
831
+ * as defined by /ads/campaigns/{id}/businesses on the backend.
832
+ *
833
+ * Typically relevant for Reddit (list businesses), or might return a
834
+ * "not supported" message for Meta/TikTok.
835
+ *
836
+ * @param campaign_id The UUID of the Ad Campaign
837
+ * @param params Optional query parameters, e.g. page.size, etc.
838
+ * @returns A response object with data (business list or messages)
839
+ */
840
+ static listCampaignBusinesses<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
841
+ /**
842
+ * List Ad Accounts for the given campaign ID,
843
+ * as defined by /ads/campaigns/{id}/ad_accounts on the backend.
844
+ *
845
+ * E.g. for Reddit, you can pass ?business_id= to get business-level ad accounts,
846
+ * or for Twitter, it might just return a user’s ad accounts, etc.
847
+ *
848
+ * @param campaign_id The UUID of the Ad Campaign
849
+ * @param params Optional query parameters, e.g. business_id, page.size, etc.
850
+ * @returns A response object with data (ad account list)
851
+ */
852
+ static listCampaignAdAccounts<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
853
+ /**
854
+ * List funding instruments for the given campaign ID,
855
+ * as defined by /ads/campaigns/{id}/funding_instruments on the backend.
856
+ *
857
+ * For Twitter, pass ?account_id=...
858
+ * For Reddit, pass ?ad_account_id=... or ?business_id=...
859
+ *
860
+ * @param campaign_id The UUID of the Ad Campaign
861
+ * @param params Optional query parameters
862
+ * @returns A response object with data (funding instruments)
863
+ */
864
+ static listCampaignFundingInstruments<T>(campaign_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
865
+ }
866
+
645
867
  declare class Communities {
646
868
  /**
647
869
  * List all the communities.
@@ -4967,6 +5189,7 @@ declare class Glitch {
4967
5189
  Config: typeof Config;
4968
5190
  };
4969
5191
  static api: {
5192
+ Ads: typeof Ads;
4970
5193
  Auth: typeof Auth;
4971
5194
  Campaigns: typeof Campaigns;
4972
5195
  Competitions: typeof Competitions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",