glitch-javascript-sdk 1.9.0 → 1.9.2

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
@@ -927,9 +927,12 @@ declare class Ads {
927
927
  static viewFacebookAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
928
928
  static updateFacebookAdPost<T>(post_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
929
929
  static deleteFacebookAdPost<T>(post_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
930
- static tiktokUploadImage<T>(data: FormData, params?: Record<string, any>): AxiosPromise<Response<T>>;
931
- static tiktokUploadVideo<T>(data: FormData, params?: Record<string, any>): AxiosPromise<Response<T>>;
932
- static tiktokUploadMusic<T>(data: FormData, params?: Record<string, any>): AxiosPromise<Response<T>>;
930
+ static tiktokUploadImageFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
931
+ static tiktokUploadVideoFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
932
+ static tiktokUploadMusicFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
933
+ static tiktokUploadImageBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
934
+ static tiktokUploadVideoBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
935
+ static tiktokUploadMusicBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
933
936
  static tiktokGetMediaInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
934
937
  /**
935
938
  * Sync an Ad with the remote platform.
@@ -975,6 +978,21 @@ declare class Ads {
975
978
  static tiktokListActionCategories<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
976
979
  static tiktokListContentExclusions<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
977
980
  static tiktokListRegions<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
981
+ static tiktokGetTargetingInfo<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
982
+ static tiktokListLanguages<T>(advertiser_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
983
+ static tiktokRecommendInterestKeywords<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
984
+ /**
985
+ * GET /ads/tiktok/targeting/hashtag_info
986
+ */
987
+ static tiktokHashtagInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
988
+ /**
989
+ * GET /ads/tiktok/targeting/contextual_tag_info
990
+ */
991
+ static tiktokContextualTagInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
992
+ /**
993
+ * GET /ads/tiktok/targeting/content_exclusion_info
994
+ */
995
+ static tiktokContentExclusionInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>>;
978
996
  static listTwitterTargetingCriteria<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
979
997
  static getTwitterTargetingCriterion<T>(criterion_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
980
998
  static createTwitterTargetingCriterion<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Ads.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import AdsRoute from "../routes/AdsRoute";
2
2
  import Requests from "../util/Requests";
3
3
  import Response from "../util/Response";
4
- import { AxiosPromise } from "axios";
4
+ import { AxiosPromise, AxiosProgressEvent } from "axios";
5
+
5
6
 
6
7
  class Ads {
7
8
  // ----------------------------------------------------------------------
@@ -742,41 +743,61 @@ class Ads {
742
743
  );
743
744
  }
744
745
 
745
- public static tiktokUploadImage<T>(
746
- data: FormData,
747
- params?: Record<string, any>
748
- ): AxiosPromise<Response<T>> {
749
- return Requests.processRoute(
750
- AdsRoute.routes.tiktokUploadImage,
751
- data,
752
- {},
753
- params
754
- );
755
- }
746
+ // TikTok Uploads: FILE
747
+ public static tiktokUploadImageFile<T>(
748
+ file: File,
749
+ data?: object,
750
+ params?: Record<string, any>,
751
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
752
+ ): AxiosPromise<Response<T>> {
753
+ return Requests.uploadFile(AdsRoute.routes.tiktokUploadImage.url, 'image_file', file, data, params, onUploadProgress);
754
+ }
756
755
 
757
- public static tiktokUploadVideo<T>(
758
- data: FormData,
759
- params?: Record<string, any>
760
- ): AxiosPromise<Response<T>> {
761
- return Requests.processRoute(
762
- AdsRoute.routes.tiktokUploadVideo,
763
- data,
764
- {},
765
- params
766
- );
767
- }
756
+ public static tiktokUploadVideoFile<T>(
757
+ file: File,
758
+ data?: object,
759
+ params?: Record<string, any>,
760
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
761
+ ): AxiosPromise<Response<T>> {
762
+ return Requests.uploadFile(AdsRoute.routes.tiktokUploadVideo.url, 'video_file', file, data, params, onUploadProgress);
763
+ }
768
764
 
769
- public static tiktokUploadMusic<T>(
770
- data: FormData,
771
- params?: Record<string, any>
772
- ): AxiosPromise<Response<T>> {
773
- return Requests.processRoute(
774
- AdsRoute.routes.tiktokUploadMusic,
775
- data,
776
- {},
777
- params
778
- );
779
- }
765
+ public static tiktokUploadMusicFile<T>(
766
+ file: File,
767
+ data?: object,
768
+ params?: Record<string, any>,
769
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
770
+ ): AxiosPromise<Response<T>> {
771
+ return Requests.uploadFile(AdsRoute.routes.tiktokUploadMusic.url, 'music_file', file, data, params, onUploadProgress);
772
+ }
773
+
774
+ // TikTok Uploads: BLOB
775
+ public static tiktokUploadImageBlob<T>(
776
+ blob: Blob,
777
+ data?: object,
778
+ params?: Record<string, any>,
779
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
780
+ ): AxiosPromise<Response<T>> {
781
+ return Requests.uploadBlob(AdsRoute.routes.tiktokUploadImage.url, 'image_file', blob, data, params, onUploadProgress);
782
+ }
783
+
784
+ public static tiktokUploadVideoBlob<T>(
785
+ blob: Blob,
786
+ data?: object,
787
+ params?: Record<string, any>,
788
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
789
+ ): AxiosPromise<Response<T>> {
790
+ return Requests.uploadBlob(AdsRoute.routes.tiktokUploadVideo.url, 'video_file', blob, data, params, onUploadProgress);
791
+ }
792
+
793
+ public static tiktokUploadMusicBlob<T>(
794
+ blob: Blob,
795
+ data?: object,
796
+ params?: Record<string, any>,
797
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void
798
+ ): AxiosPromise<Response<T>> {
799
+ return Requests.uploadBlob(AdsRoute.routes.tiktokUploadMusic.url, 'music_file', blob, data, params, onUploadProgress);
800
+ }
780
801
 
781
802
  public static tiktokGetMediaInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
782
803
  return Requests.processRoute(
@@ -867,64 +888,108 @@ class Ads {
867
888
  public static tiktokTargetingSearch<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
868
889
  return Requests.processRoute(AdsRoute.routes.tiktokTargetingSearch, data, {}, params);
869
890
  }
870
-
891
+
871
892
  public static tiktokContextualTags<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
872
893
  return Requests.processRoute(AdsRoute.routes.tiktokContextualTags, undefined, undefined, params);
873
894
  }
874
-
895
+
875
896
  public static tiktokRecommendHashtags<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
876
897
  return Requests.processRoute(AdsRoute.routes.tiktokRecommendHashtags, undefined, undefined, params);
877
898
  }
878
-
899
+
879
900
  public static tiktokListCarriers<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
880
901
  return Requests.processRoute(AdsRoute.routes.tiktokCarriers, undefined, undefined, params);
881
902
  }
882
-
903
+
883
904
  public static tiktokListInterestCategories<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
884
905
  return Requests.processRoute(AdsRoute.routes.tiktokInterestCategories, undefined, undefined, params);
885
906
  }
886
-
907
+
887
908
  public static tiktokListActionCategories<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
888
909
  return Requests.processRoute(AdsRoute.routes.tiktokActionCategories, undefined, undefined, params);
889
910
  }
890
-
911
+
891
912
  public static tiktokListContentExclusions<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
892
913
  return Requests.processRoute(AdsRoute.routes.tiktokContentExclusions, undefined, undefined, params);
893
914
  }
894
-
915
+
895
916
  public static tiktokListRegions<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
896
917
  return Requests.processRoute(AdsRoute.routes.tiktokRegions, undefined, undefined, params);
897
918
  }
898
919
 
920
+ public static tiktokGetTargetingInfo<T>(
921
+ data: object,
922
+ params?: Record<string, any>
923
+ ): AxiosPromise<Response<T>> {
924
+ return Requests.processRoute(AdsRoute.routes.tiktokTargetingInfo, data, {}, params);
925
+ }
926
+
927
+ public static tiktokListLanguages<T>(
928
+ advertiser_id: string,
929
+ params?: Record<string, any>
930
+ ): AxiosPromise<Response<T>> {
931
+ const mergedParams = { ...params, advertiser_id };
932
+ return Requests.processRoute(AdsRoute.routes.tiktokLanguages, undefined, undefined, mergedParams);
933
+ }
934
+
935
+ public static tiktokRecommendInterestKeywords<T>(
936
+ params: Record<string, any>
937
+ ): AxiosPromise<Response<T>> {
938
+ return Requests.processRoute(AdsRoute.routes.tiktokInterestKeywordRecommend, undefined, undefined, params);
939
+ }
940
+
941
+ /**
942
+ * GET /ads/tiktok/targeting/hashtag_info
943
+ */
944
+ public static tiktokHashtagInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
945
+ return Requests.processRoute(AdsRoute.routes.tiktokHashtagInfo, undefined, undefined, params);
946
+ }
947
+
948
+ /**
949
+ * GET /ads/tiktok/targeting/contextual_tag_info
950
+ */
951
+ public static tiktokContextualTagInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
952
+ return Requests.processRoute(AdsRoute.routes.tiktokContextualTagInfo, undefined, undefined, params);
953
+ }
954
+
955
+ /**
956
+ * GET /ads/tiktok/targeting/content_exclusion_info
957
+ */
958
+ public static tiktokContentExclusionInfo<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
959
+ return Requests.processRoute(AdsRoute.routes.tiktokContentExclusionInfo, undefined, undefined, params);
960
+ }
961
+
962
+
963
+
899
964
  public static listTwitterTargetingCriteria<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
900
965
  return Requests.processRoute(AdsRoute.routes.twitterListTargetingCriteria, undefined, undefined, params);
901
966
  }
902
-
967
+
903
968
  public static getTwitterTargetingCriterion<T>(criterion_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
904
969
  return Requests.processRoute(AdsRoute.routes.twitterGetTargetingCriterion, undefined, { criterion_id }, params);
905
970
  }
906
-
971
+
907
972
  public static createTwitterTargetingCriterion<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
908
973
  return Requests.processRoute(AdsRoute.routes.twitterCreateTargetingCriterion, data, {}, params);
909
974
  }
910
-
975
+
911
976
  public static deleteTwitterTargetingCriterion<T>(criterion_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
912
977
  return Requests.processRoute(AdsRoute.routes.twitterDeleteTargetingCriterion, undefined, { criterion_id }, params);
913
978
  }
914
-
979
+
915
980
  public static twitterBatchTargetingCriteria<T>(data: object[], params?: Record<string, any>): AxiosPromise<Response<T>> {
916
981
  return Requests.processRoute(AdsRoute.routes.twitterBatchTargetingCriteria, data, {}, params);
917
982
  }
918
-
983
+
919
984
  public static lookupTwitterTargeting<T>(resource: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
920
985
  return Requests.processRoute(AdsRoute.routes.twitterTargetingDiscovery, undefined, { resource }, params);
921
986
  }
922
-
987
+
923
988
  public static twitterTargetingSuggestions<T>(params: Record<string, any>): AxiosPromise<Response<T>> {
924
989
  return Requests.processRoute(AdsRoute.routes.twitterTargetingSuggestions, undefined, undefined, params);
925
990
  }
926
-
927
-
991
+
992
+
928
993
 
929
994
  }
930
995
 
@@ -313,6 +313,30 @@ class AdsRoute {
313
313
  url: "/ads/tiktok/targeting/regions",
314
314
  method: HTTP_METHODS.GET,
315
315
  },
316
+ tiktokTargetingInfo: {
317
+ url: "/ads/tiktok/targeting/info",
318
+ method: HTTP_METHODS.POST,
319
+ },
320
+ tiktokLanguages: {
321
+ url: "/ads/tiktok/targeting/languages",
322
+ method: HTTP_METHODS.GET,
323
+ },
324
+ tiktokHashtagInfo: {
325
+ url: "/ads/tiktok/targeting/hashtag_info",
326
+ method: HTTP_METHODS.GET,
327
+ },
328
+ tiktokContextualTagInfo: {
329
+ url: "/ads/tiktok/targeting/contextual_tag_info",
330
+ method: HTTP_METHODS.GET,
331
+ },
332
+ tiktokContentExclusionInfo: {
333
+ url: "/ads/tiktok/targeting/content_exclusion_info",
334
+ method: HTTP_METHODS.GET,
335
+ },
336
+ tiktokInterestKeywordRecommend: {
337
+ url: "/ads/tiktok/targeting/interest_keywords",
338
+ method: HTTP_METHODS.GET,
339
+ },
316
340
  twitterListTargetingCriteria: {
317
341
  url: "/ads/twitter/targeting/criteria",
318
342
  method: HTTP_METHODS.GET,