scavio 0.8.0 → 0.9.0

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.cts CHANGED
@@ -624,6 +624,169 @@ declare class TikTokNamespace {
624
624
  userFollowings(options: TikTokUserFollowingsOptions): Promise<Record<string, unknown>>;
625
625
  }
626
626
 
627
+ /** Marketplace regions served by suggestions, product, reviews, and shop products. */
628
+ type TikTokShopRegion = "US" | "GB" | "SG" | "MY" | "PH" | "TH" | "VN" | "ID";
629
+ /** Marketplace regions served by category listings. */
630
+ type TikTokShopListingRegion = "US" | "GB";
631
+ /** Review ordering: 'relevant' is text-complete and image-heavy, 'recent' is fresher but text-sparse. */
632
+ type TikTokShopReviewSort = "relevant" | "recent";
633
+ interface TikTokShopSearchOptions {
634
+ /** Search query (1-200 characters). US catalog only. */
635
+ search: string;
636
+ /** Opaque cursor from a prior response's next_cursor. */
637
+ cursor?: string;
638
+ [key: string]: unknown;
639
+ }
640
+ interface TikTokShopSuggestionsOptions {
641
+ /** Partial query to expand (1-100 characters). */
642
+ search: string;
643
+ /** Marketplace region (default 'US'). */
644
+ region?: TikTokShopRegion;
645
+ [key: string]: unknown;
646
+ }
647
+ interface TikTokShopProductOptions {
648
+ /** TikTok Shop product id (6-25 digits). */
649
+ product_id: string;
650
+ /** Marketplace region (default 'US'). */
651
+ region?: TikTokShopRegion;
652
+ [key: string]: unknown;
653
+ }
654
+ interface TikTokShopProductReviewsOptions {
655
+ /** TikTok Shop product id (6-25 digits). */
656
+ product_id: string;
657
+ /** 1-based page number (1-500, default 1). */
658
+ page?: number;
659
+ /** Reviews per page (1-200, default 20). */
660
+ page_size?: number;
661
+ /** 'relevant' (default) is text-complete and image-heavy; 'recent' is fresher but far more text-sparse. */
662
+ sort?: TikTokShopReviewSort;
663
+ /** Only reviews with this star rating (1-5). */
664
+ rating?: number;
665
+ /** Only reviews with a photo or video (default false). */
666
+ has_media?: boolean;
667
+ /** Only verified purchases (default false). */
668
+ verified_only?: boolean;
669
+ /** Marketplace region (default 'US'). */
670
+ region?: TikTokShopRegion;
671
+ [key: string]: unknown;
672
+ }
673
+ interface TikTokShopCategoryProductsOptions {
674
+ /** Category id from tiktokShop.categories(); level 1 or 2 both work. */
675
+ category_id: string;
676
+ /** Opaque cursor from a prior response's next_cursor. */
677
+ cursor?: string;
678
+ /** Marketplace region, 'US' or 'GB' only (default 'US'). */
679
+ region?: TikTokShopListingRegion;
680
+ [key: string]: unknown;
681
+ }
682
+ interface TikTokShopShopProductsOptions {
683
+ /** TikTok Shop seller id (also called seller_id elsewhere on TikTok). */
684
+ shop_id: string;
685
+ /** Opaque cursor from a prior response's next_cursor. */
686
+ cursor?: string;
687
+ /** Marketplace region (default 'US'). */
688
+ region?: TikTokShopRegion;
689
+ [key: string]: unknown;
690
+ }
691
+ interface TikTokShopResolveOptions {
692
+ /** A TikTok Shop product or store URL, affiliate share link, or vt.tiktok.com short link. */
693
+ url: string;
694
+ [key: string]: unknown;
695
+ }
696
+ declare class TikTokShopNamespace {
697
+ private client;
698
+ constructor(client: Scavio);
699
+ /**
700
+ * Search TikTok Shop products by keyword (US catalog), up to 30 per page with
701
+ * exact prices, ratings, and shop details. Paginate with next_cursor and dedupe
702
+ * by product_id across pages.
703
+ *
704
+ * This is one of the three endpoints that return exact prices; tiktokShop.product()
705
+ * does not return a price. A product_id returned here is not guaranteed to resolve
706
+ * on tiktokShop.product() - only about 44% do.
707
+ */
708
+ search(options: TikTokShopSearchOptions): Promise<Record<string, unknown>>;
709
+ /**
710
+ * Keyword autocomplete and expansion for a partial query, across 8 marketplace
711
+ * regions. Suggestions are not guaranteed prefix matches: a misspelling returns
712
+ * typo corrections, and results can include brand and shop names.
713
+ */
714
+ searchSuggestions(options: TikTokShopSuggestionsOptions): Promise<Record<string, unknown>>;
715
+ /**
716
+ * Full product detail: description, images, variants with stock, shipping, shop
717
+ * profile, category path, and top reviews.
718
+ *
719
+ * Two limits worth knowing before you build on this:
720
+ *
721
+ * 1. It resolves only about 44% of the product ids returned by tiktokShop.search().
722
+ * Upstream has no detail data for the rest, so an HTTP 404 is a normal outcome,
723
+ * not an error. Skip the item rather than retrying - retries do not help and no
724
+ * other region carries it. Search to product is not a reliable pipeline.
725
+ *
726
+ * This method throws `NotFoundError` on that 404 (there is no `data` field in
727
+ * the response body to test), so a loop over search ids must catch it or it
728
+ * dies on the first miss:
729
+ *
730
+ * ```ts
731
+ * import { NotFoundError } from "scavio";
732
+ *
733
+ * for (const productId of productIds) {
734
+ * try {
735
+ * const detail = await client.tiktokShop.product({ product_id: productId });
736
+ * } catch (e) {
737
+ * if (e instanceof NotFoundError) continue; // no detail upstream; skip
738
+ * throw e;
739
+ * }
740
+ * }
741
+ * ```
742
+ *
743
+ * tiktokShop.productReviews() often works for ids product() cannot resolve: of
744
+ * 8 such ids tested, 8 returned HTTP 200 and 7 carried at least one review, so
745
+ * it is a useful fallback source of product detail.
746
+ * 2. It does NOT return a price. Upstream masks the price on the product page.
747
+ * Exact prices come from tiktokShop.search(), tiktokShop.shopProducts(), and
748
+ * tiktokShop.categoryProducts().
749
+ */
750
+ product(options: TikTokShopProductOptions): Promise<Record<string, unknown>>;
751
+ /**
752
+ * Paginated product reviews with text, images, star histogram, and
753
+ * verified-purchase flags, up to 200 per call. total_reviews drifts between calls
754
+ * and must not be used to compute a page count; page with has_more instead.
755
+ */
756
+ productReviews(options: TikTokShopProductReviewsOptions): Promise<Record<string, unknown>>;
757
+ /**
758
+ * The global TikTok Shop category tree: 28 top-level categories, 240 nodes, two
759
+ * levels deep. Category ids are identical in every region and names are always
760
+ * English.
761
+ */
762
+ categories(): Promise<Record<string, unknown>>;
763
+ /**
764
+ * Products listed under a category id from tiktokShop.categories(), with exact
765
+ * prices. Page size is inconsistent upstream (15 to 20 per page), so always
766
+ * paginate with next_cursor rather than assuming a fixed page size. Category
767
+ * listings are shallow: after a few pages the source stops returning new products
768
+ * and has_more turns false, which is the end of the listing rather than an error.
769
+ */
770
+ categoryProducts(options: TikTokShopCategoryProductsOptions): Promise<Record<string, unknown>>;
771
+ /**
772
+ * A shop's product catalog, 30 per page, with exact prices. Shop follower count,
773
+ * location, and shop-level rating are not available here; call
774
+ * tiktokShop.product() for the full shop profile.
775
+ */
776
+ shopProducts(options: TikTokShopShopProductsOptions): Promise<Record<string, unknown>>;
777
+ /**
778
+ * Resolve any TikTok Shop URL or share link to a product_id or shop_id, ready to
779
+ * pass to the other methods. Accepts canonical product and store pages,
780
+ * tiktok.com/view links, affiliate share links, and vt.tiktok.com short links.
781
+ */
782
+ resolve(options: TikTokShopResolveOptions): Promise<Record<string, unknown>>;
783
+ }
784
+
785
+ /**
786
+ * Instagram endpoints (/api/v1/instagram). Credit cost varies by endpoint:
787
+ * `userPosts` costs 2 credits, every other endpoint costs 8.
788
+ * See https://scavio.dev/docs/instagram-api.
789
+ */
627
790
  interface InstagramProfileOptions {
628
791
  /** Instagram username (without the @). */
629
792
  username?: string;
@@ -1152,6 +1315,7 @@ declare class Scavio {
1152
1315
  readonly youtube: YouTubeNamespace;
1153
1316
  readonly reddit: RedditNamespace;
1154
1317
  readonly tiktok: TikTokNamespace;
1318
+ readonly tiktokShop: TikTokShopNamespace;
1155
1319
  readonly instagram: InstagramNamespace;
1156
1320
  readonly x: XNamespace;
1157
1321
  readonly linkedin: LinkedInNamespace;
@@ -1214,4 +1378,4 @@ declare class ScavioAPIError extends ScavioError {
1214
1378
  constructor(statusCode: number, message: string, responseBody?: Record<string, unknown>);
1215
1379
  }
1216
1380
 
1217
- export { type AmazonProductOptions, type AmazonSearchOptions, BadRequestError, type GoogleAiModeOptions, type GoogleFlightsOptions, type GoogleHotelsDetailOptions, type GoogleHotelsOptions, type GoogleMapsPlaceOptions, type GoogleMapsReviewsOptions, type GoogleMapsSearchOptions, type GoogleNewsOptions, type GoogleSearchOptions, type GoogleShoppingOptions, type GoogleShoppingProductOptions, type GoogleShoppingStoresOptions, type GoogleTrendingOptions, type GoogleTrendsOptions, type InstagramCommentRepliesOptions, type InstagramFollowOptions, type InstagramPostCommentsOptions, type InstagramPostOptions, type InstagramProfileOptions, type InstagramSearchOptions, type InstagramStoriesOptions, type InstagramUserFeedOptions, InsufficientCreditsError, InvalidAPIKeyError, type LinkedInCompanyOptions, type LinkedInCompanyPostsOptions, type LinkedInCompanyRefOptions, type LinkedInJobOptions, type LinkedInPersonContactOptions, type LinkedInPersonOptions, type LinkedInPersonPostsOptions, type LinkedInPersonRefOptions, type LinkedInPostCommentsOptions, type LinkedInPostOptions, type LinkedInSearchJobsOptions, type LinkedInSearchPeopleOptions, type LinkedInSearchPostsOptions, MissingAPIKeyError, NotFoundError, RateLimitError, type RedditCommentRepliesOptions, type RedditFeedSort, type RedditPopularOptions, type RedditPostCommentsOptions, type RedditPostOptions, type RedditSearchOptions, type RedditSearchSuggestionsOptions, type RedditSort, type RedditSubredditOptions, type RedditSubredditPostsOptions, type RedditUserFeedOptions, type RedditUserOptions, Scavio, ScavioAPIError, type ScavioConfig, ScavioConnectionError, ScavioError, ScavioTimeoutError, type TikTokCommentRepliesOptions, type TikTokHashtagOptions, type TikTokHashtagVideosOptions, type TikTokProfileOptions, type TikTokSearchUsersOptions, type TikTokSearchVideosOptions, type TikTokUserFollowersOptions, type TikTokUserFollowingsOptions, type TikTokUserPostsOptions, type TikTokVideoCommentsOptions, type TikTokVideoOptions, type WalmartProductOptions, type WalmartSearchOptions, type XSearchOptions, type XTrendingOptions, type XTweetCommentsOptions, type XTweetOptions, type XTweetRetweetersOptions, type XUserFeedOptions, type XUserOptions, type YouTubeChannelCommunityOptions, type YouTubeChannelOptions, type YouTubeChannelResolveOptions, type YouTubeChannelSearchOptions, type YouTubeChannelShortsOptions, type YouTubeChannelVideosOptions, type YouTubeCommentRepliesOptions, type YouTubeCommentsOptions, type YouTubeMetadataOptions, type YouTubeRelatedOptions, type YouTubeSearchOptions, type YouTubeShortsOptions, type YouTubeStreamsOptions, type YouTubeSuggestionsOptions, type YouTubeTranscriptOptions, type YouTubeVideoOptions };
1381
+ export { type AmazonProductOptions, type AmazonSearchOptions, BadRequestError, type GoogleAiModeOptions, type GoogleFlightsOptions, type GoogleHotelsDetailOptions, type GoogleHotelsOptions, type GoogleMapsPlaceOptions, type GoogleMapsReviewsOptions, type GoogleMapsSearchOptions, type GoogleNewsOptions, type GoogleSearchOptions, type GoogleShoppingOptions, type GoogleShoppingProductOptions, type GoogleShoppingStoresOptions, type GoogleTrendingOptions, type GoogleTrendsOptions, type InstagramCommentRepliesOptions, type InstagramFollowOptions, type InstagramPostCommentsOptions, type InstagramPostOptions, type InstagramProfileOptions, type InstagramSearchOptions, type InstagramStoriesOptions, type InstagramUserFeedOptions, InsufficientCreditsError, InvalidAPIKeyError, type LinkedInCompanyOptions, type LinkedInCompanyPostsOptions, type LinkedInCompanyRefOptions, type LinkedInJobOptions, type LinkedInPersonContactOptions, type LinkedInPersonOptions, type LinkedInPersonPostsOptions, type LinkedInPersonRefOptions, type LinkedInPostCommentsOptions, type LinkedInPostOptions, type LinkedInSearchJobsOptions, type LinkedInSearchPeopleOptions, type LinkedInSearchPostsOptions, MissingAPIKeyError, NotFoundError, RateLimitError, type RedditCommentRepliesOptions, type RedditFeedSort, type RedditPopularOptions, type RedditPostCommentsOptions, type RedditPostOptions, type RedditSearchOptions, type RedditSearchSuggestionsOptions, type RedditSort, type RedditSubredditOptions, type RedditSubredditPostsOptions, type RedditUserFeedOptions, type RedditUserOptions, Scavio, ScavioAPIError, type ScavioConfig, ScavioConnectionError, ScavioError, ScavioTimeoutError, type TikTokCommentRepliesOptions, type TikTokHashtagOptions, type TikTokHashtagVideosOptions, type TikTokProfileOptions, type TikTokSearchUsersOptions, type TikTokSearchVideosOptions, type TikTokShopCategoryProductsOptions, type TikTokShopListingRegion, type TikTokShopProductOptions, type TikTokShopProductReviewsOptions, type TikTokShopRegion, type TikTokShopResolveOptions, type TikTokShopReviewSort, type TikTokShopSearchOptions, type TikTokShopShopProductsOptions, type TikTokShopSuggestionsOptions, type TikTokUserFollowersOptions, type TikTokUserFollowingsOptions, type TikTokUserPostsOptions, type TikTokVideoCommentsOptions, type TikTokVideoOptions, type WalmartProductOptions, type WalmartSearchOptions, type XSearchOptions, type XTrendingOptions, type XTweetCommentsOptions, type XTweetOptions, type XTweetRetweetersOptions, type XUserFeedOptions, type XUserOptions, type YouTubeChannelCommunityOptions, type YouTubeChannelOptions, type YouTubeChannelResolveOptions, type YouTubeChannelSearchOptions, type YouTubeChannelShortsOptions, type YouTubeChannelVideosOptions, type YouTubeCommentRepliesOptions, type YouTubeCommentsOptions, type YouTubeMetadataOptions, type YouTubeRelatedOptions, type YouTubeSearchOptions, type YouTubeShortsOptions, type YouTubeStreamsOptions, type YouTubeSuggestionsOptions, type YouTubeTranscriptOptions, type YouTubeVideoOptions };
package/dist/index.d.ts CHANGED
@@ -624,6 +624,169 @@ declare class TikTokNamespace {
624
624
  userFollowings(options: TikTokUserFollowingsOptions): Promise<Record<string, unknown>>;
625
625
  }
626
626
 
627
+ /** Marketplace regions served by suggestions, product, reviews, and shop products. */
628
+ type TikTokShopRegion = "US" | "GB" | "SG" | "MY" | "PH" | "TH" | "VN" | "ID";
629
+ /** Marketplace regions served by category listings. */
630
+ type TikTokShopListingRegion = "US" | "GB";
631
+ /** Review ordering: 'relevant' is text-complete and image-heavy, 'recent' is fresher but text-sparse. */
632
+ type TikTokShopReviewSort = "relevant" | "recent";
633
+ interface TikTokShopSearchOptions {
634
+ /** Search query (1-200 characters). US catalog only. */
635
+ search: string;
636
+ /** Opaque cursor from a prior response's next_cursor. */
637
+ cursor?: string;
638
+ [key: string]: unknown;
639
+ }
640
+ interface TikTokShopSuggestionsOptions {
641
+ /** Partial query to expand (1-100 characters). */
642
+ search: string;
643
+ /** Marketplace region (default 'US'). */
644
+ region?: TikTokShopRegion;
645
+ [key: string]: unknown;
646
+ }
647
+ interface TikTokShopProductOptions {
648
+ /** TikTok Shop product id (6-25 digits). */
649
+ product_id: string;
650
+ /** Marketplace region (default 'US'). */
651
+ region?: TikTokShopRegion;
652
+ [key: string]: unknown;
653
+ }
654
+ interface TikTokShopProductReviewsOptions {
655
+ /** TikTok Shop product id (6-25 digits). */
656
+ product_id: string;
657
+ /** 1-based page number (1-500, default 1). */
658
+ page?: number;
659
+ /** Reviews per page (1-200, default 20). */
660
+ page_size?: number;
661
+ /** 'relevant' (default) is text-complete and image-heavy; 'recent' is fresher but far more text-sparse. */
662
+ sort?: TikTokShopReviewSort;
663
+ /** Only reviews with this star rating (1-5). */
664
+ rating?: number;
665
+ /** Only reviews with a photo or video (default false). */
666
+ has_media?: boolean;
667
+ /** Only verified purchases (default false). */
668
+ verified_only?: boolean;
669
+ /** Marketplace region (default 'US'). */
670
+ region?: TikTokShopRegion;
671
+ [key: string]: unknown;
672
+ }
673
+ interface TikTokShopCategoryProductsOptions {
674
+ /** Category id from tiktokShop.categories(); level 1 or 2 both work. */
675
+ category_id: string;
676
+ /** Opaque cursor from a prior response's next_cursor. */
677
+ cursor?: string;
678
+ /** Marketplace region, 'US' or 'GB' only (default 'US'). */
679
+ region?: TikTokShopListingRegion;
680
+ [key: string]: unknown;
681
+ }
682
+ interface TikTokShopShopProductsOptions {
683
+ /** TikTok Shop seller id (also called seller_id elsewhere on TikTok). */
684
+ shop_id: string;
685
+ /** Opaque cursor from a prior response's next_cursor. */
686
+ cursor?: string;
687
+ /** Marketplace region (default 'US'). */
688
+ region?: TikTokShopRegion;
689
+ [key: string]: unknown;
690
+ }
691
+ interface TikTokShopResolveOptions {
692
+ /** A TikTok Shop product or store URL, affiliate share link, or vt.tiktok.com short link. */
693
+ url: string;
694
+ [key: string]: unknown;
695
+ }
696
+ declare class TikTokShopNamespace {
697
+ private client;
698
+ constructor(client: Scavio);
699
+ /**
700
+ * Search TikTok Shop products by keyword (US catalog), up to 30 per page with
701
+ * exact prices, ratings, and shop details. Paginate with next_cursor and dedupe
702
+ * by product_id across pages.
703
+ *
704
+ * This is one of the three endpoints that return exact prices; tiktokShop.product()
705
+ * does not return a price. A product_id returned here is not guaranteed to resolve
706
+ * on tiktokShop.product() - only about 44% do.
707
+ */
708
+ search(options: TikTokShopSearchOptions): Promise<Record<string, unknown>>;
709
+ /**
710
+ * Keyword autocomplete and expansion for a partial query, across 8 marketplace
711
+ * regions. Suggestions are not guaranteed prefix matches: a misspelling returns
712
+ * typo corrections, and results can include brand and shop names.
713
+ */
714
+ searchSuggestions(options: TikTokShopSuggestionsOptions): Promise<Record<string, unknown>>;
715
+ /**
716
+ * Full product detail: description, images, variants with stock, shipping, shop
717
+ * profile, category path, and top reviews.
718
+ *
719
+ * Two limits worth knowing before you build on this:
720
+ *
721
+ * 1. It resolves only about 44% of the product ids returned by tiktokShop.search().
722
+ * Upstream has no detail data for the rest, so an HTTP 404 is a normal outcome,
723
+ * not an error. Skip the item rather than retrying - retries do not help and no
724
+ * other region carries it. Search to product is not a reliable pipeline.
725
+ *
726
+ * This method throws `NotFoundError` on that 404 (there is no `data` field in
727
+ * the response body to test), so a loop over search ids must catch it or it
728
+ * dies on the first miss:
729
+ *
730
+ * ```ts
731
+ * import { NotFoundError } from "scavio";
732
+ *
733
+ * for (const productId of productIds) {
734
+ * try {
735
+ * const detail = await client.tiktokShop.product({ product_id: productId });
736
+ * } catch (e) {
737
+ * if (e instanceof NotFoundError) continue; // no detail upstream; skip
738
+ * throw e;
739
+ * }
740
+ * }
741
+ * ```
742
+ *
743
+ * tiktokShop.productReviews() often works for ids product() cannot resolve: of
744
+ * 8 such ids tested, 8 returned HTTP 200 and 7 carried at least one review, so
745
+ * it is a useful fallback source of product detail.
746
+ * 2. It does NOT return a price. Upstream masks the price on the product page.
747
+ * Exact prices come from tiktokShop.search(), tiktokShop.shopProducts(), and
748
+ * tiktokShop.categoryProducts().
749
+ */
750
+ product(options: TikTokShopProductOptions): Promise<Record<string, unknown>>;
751
+ /**
752
+ * Paginated product reviews with text, images, star histogram, and
753
+ * verified-purchase flags, up to 200 per call. total_reviews drifts between calls
754
+ * and must not be used to compute a page count; page with has_more instead.
755
+ */
756
+ productReviews(options: TikTokShopProductReviewsOptions): Promise<Record<string, unknown>>;
757
+ /**
758
+ * The global TikTok Shop category tree: 28 top-level categories, 240 nodes, two
759
+ * levels deep. Category ids are identical in every region and names are always
760
+ * English.
761
+ */
762
+ categories(): Promise<Record<string, unknown>>;
763
+ /**
764
+ * Products listed under a category id from tiktokShop.categories(), with exact
765
+ * prices. Page size is inconsistent upstream (15 to 20 per page), so always
766
+ * paginate with next_cursor rather than assuming a fixed page size. Category
767
+ * listings are shallow: after a few pages the source stops returning new products
768
+ * and has_more turns false, which is the end of the listing rather than an error.
769
+ */
770
+ categoryProducts(options: TikTokShopCategoryProductsOptions): Promise<Record<string, unknown>>;
771
+ /**
772
+ * A shop's product catalog, 30 per page, with exact prices. Shop follower count,
773
+ * location, and shop-level rating are not available here; call
774
+ * tiktokShop.product() for the full shop profile.
775
+ */
776
+ shopProducts(options: TikTokShopShopProductsOptions): Promise<Record<string, unknown>>;
777
+ /**
778
+ * Resolve any TikTok Shop URL or share link to a product_id or shop_id, ready to
779
+ * pass to the other methods. Accepts canonical product and store pages,
780
+ * tiktok.com/view links, affiliate share links, and vt.tiktok.com short links.
781
+ */
782
+ resolve(options: TikTokShopResolveOptions): Promise<Record<string, unknown>>;
783
+ }
784
+
785
+ /**
786
+ * Instagram endpoints (/api/v1/instagram). Credit cost varies by endpoint:
787
+ * `userPosts` costs 2 credits, every other endpoint costs 8.
788
+ * See https://scavio.dev/docs/instagram-api.
789
+ */
627
790
  interface InstagramProfileOptions {
628
791
  /** Instagram username (without the @). */
629
792
  username?: string;
@@ -1152,6 +1315,7 @@ declare class Scavio {
1152
1315
  readonly youtube: YouTubeNamespace;
1153
1316
  readonly reddit: RedditNamespace;
1154
1317
  readonly tiktok: TikTokNamespace;
1318
+ readonly tiktokShop: TikTokShopNamespace;
1155
1319
  readonly instagram: InstagramNamespace;
1156
1320
  readonly x: XNamespace;
1157
1321
  readonly linkedin: LinkedInNamespace;
@@ -1214,4 +1378,4 @@ declare class ScavioAPIError extends ScavioError {
1214
1378
  constructor(statusCode: number, message: string, responseBody?: Record<string, unknown>);
1215
1379
  }
1216
1380
 
1217
- export { type AmazonProductOptions, type AmazonSearchOptions, BadRequestError, type GoogleAiModeOptions, type GoogleFlightsOptions, type GoogleHotelsDetailOptions, type GoogleHotelsOptions, type GoogleMapsPlaceOptions, type GoogleMapsReviewsOptions, type GoogleMapsSearchOptions, type GoogleNewsOptions, type GoogleSearchOptions, type GoogleShoppingOptions, type GoogleShoppingProductOptions, type GoogleShoppingStoresOptions, type GoogleTrendingOptions, type GoogleTrendsOptions, type InstagramCommentRepliesOptions, type InstagramFollowOptions, type InstagramPostCommentsOptions, type InstagramPostOptions, type InstagramProfileOptions, type InstagramSearchOptions, type InstagramStoriesOptions, type InstagramUserFeedOptions, InsufficientCreditsError, InvalidAPIKeyError, type LinkedInCompanyOptions, type LinkedInCompanyPostsOptions, type LinkedInCompanyRefOptions, type LinkedInJobOptions, type LinkedInPersonContactOptions, type LinkedInPersonOptions, type LinkedInPersonPostsOptions, type LinkedInPersonRefOptions, type LinkedInPostCommentsOptions, type LinkedInPostOptions, type LinkedInSearchJobsOptions, type LinkedInSearchPeopleOptions, type LinkedInSearchPostsOptions, MissingAPIKeyError, NotFoundError, RateLimitError, type RedditCommentRepliesOptions, type RedditFeedSort, type RedditPopularOptions, type RedditPostCommentsOptions, type RedditPostOptions, type RedditSearchOptions, type RedditSearchSuggestionsOptions, type RedditSort, type RedditSubredditOptions, type RedditSubredditPostsOptions, type RedditUserFeedOptions, type RedditUserOptions, Scavio, ScavioAPIError, type ScavioConfig, ScavioConnectionError, ScavioError, ScavioTimeoutError, type TikTokCommentRepliesOptions, type TikTokHashtagOptions, type TikTokHashtagVideosOptions, type TikTokProfileOptions, type TikTokSearchUsersOptions, type TikTokSearchVideosOptions, type TikTokUserFollowersOptions, type TikTokUserFollowingsOptions, type TikTokUserPostsOptions, type TikTokVideoCommentsOptions, type TikTokVideoOptions, type WalmartProductOptions, type WalmartSearchOptions, type XSearchOptions, type XTrendingOptions, type XTweetCommentsOptions, type XTweetOptions, type XTweetRetweetersOptions, type XUserFeedOptions, type XUserOptions, type YouTubeChannelCommunityOptions, type YouTubeChannelOptions, type YouTubeChannelResolveOptions, type YouTubeChannelSearchOptions, type YouTubeChannelShortsOptions, type YouTubeChannelVideosOptions, type YouTubeCommentRepliesOptions, type YouTubeCommentsOptions, type YouTubeMetadataOptions, type YouTubeRelatedOptions, type YouTubeSearchOptions, type YouTubeShortsOptions, type YouTubeStreamsOptions, type YouTubeSuggestionsOptions, type YouTubeTranscriptOptions, type YouTubeVideoOptions };
1381
+ export { type AmazonProductOptions, type AmazonSearchOptions, BadRequestError, type GoogleAiModeOptions, type GoogleFlightsOptions, type GoogleHotelsDetailOptions, type GoogleHotelsOptions, type GoogleMapsPlaceOptions, type GoogleMapsReviewsOptions, type GoogleMapsSearchOptions, type GoogleNewsOptions, type GoogleSearchOptions, type GoogleShoppingOptions, type GoogleShoppingProductOptions, type GoogleShoppingStoresOptions, type GoogleTrendingOptions, type GoogleTrendsOptions, type InstagramCommentRepliesOptions, type InstagramFollowOptions, type InstagramPostCommentsOptions, type InstagramPostOptions, type InstagramProfileOptions, type InstagramSearchOptions, type InstagramStoriesOptions, type InstagramUserFeedOptions, InsufficientCreditsError, InvalidAPIKeyError, type LinkedInCompanyOptions, type LinkedInCompanyPostsOptions, type LinkedInCompanyRefOptions, type LinkedInJobOptions, type LinkedInPersonContactOptions, type LinkedInPersonOptions, type LinkedInPersonPostsOptions, type LinkedInPersonRefOptions, type LinkedInPostCommentsOptions, type LinkedInPostOptions, type LinkedInSearchJobsOptions, type LinkedInSearchPeopleOptions, type LinkedInSearchPostsOptions, MissingAPIKeyError, NotFoundError, RateLimitError, type RedditCommentRepliesOptions, type RedditFeedSort, type RedditPopularOptions, type RedditPostCommentsOptions, type RedditPostOptions, type RedditSearchOptions, type RedditSearchSuggestionsOptions, type RedditSort, type RedditSubredditOptions, type RedditSubredditPostsOptions, type RedditUserFeedOptions, type RedditUserOptions, Scavio, ScavioAPIError, type ScavioConfig, ScavioConnectionError, ScavioError, ScavioTimeoutError, type TikTokCommentRepliesOptions, type TikTokHashtagOptions, type TikTokHashtagVideosOptions, type TikTokProfileOptions, type TikTokSearchUsersOptions, type TikTokSearchVideosOptions, type TikTokShopCategoryProductsOptions, type TikTokShopListingRegion, type TikTokShopProductOptions, type TikTokShopProductReviewsOptions, type TikTokShopRegion, type TikTokShopResolveOptions, type TikTokShopReviewSort, type TikTokShopSearchOptions, type TikTokShopShopProductsOptions, type TikTokShopSuggestionsOptions, type TikTokUserFollowersOptions, type TikTokUserFollowingsOptions, type TikTokUserPostsOptions, type TikTokVideoCommentsOptions, type TikTokVideoOptions, type WalmartProductOptions, type WalmartSearchOptions, type XSearchOptions, type XTrendingOptions, type XTweetCommentsOptions, type XTweetOptions, type XTweetRetweetersOptions, type XUserFeedOptions, type XUserOptions, type YouTubeChannelCommunityOptions, type YouTubeChannelOptions, type YouTubeChannelResolveOptions, type YouTubeChannelSearchOptions, type YouTubeChannelShortsOptions, type YouTubeChannelVideosOptions, type YouTubeCommentRepliesOptions, type YouTubeCommentsOptions, type YouTubeMetadataOptions, type YouTubeRelatedOptions, type YouTubeSearchOptions, type YouTubeShortsOptions, type YouTubeStreamsOptions, type YouTubeSuggestionsOptions, type YouTubeTranscriptOptions, type YouTubeVideoOptions };
package/dist/index.js CHANGED
@@ -430,6 +430,114 @@ var TikTokNamespace = class {
430
430
  }
431
431
  };
432
432
 
433
+ // src/namespaces/tiktok-shop.ts
434
+ var TikTokShopNamespace = class {
435
+ constructor(client) {
436
+ this.client = client;
437
+ }
438
+ client;
439
+ /**
440
+ * Search TikTok Shop products by keyword (US catalog), up to 30 per page with
441
+ * exact prices, ratings, and shop details. Paginate with next_cursor and dedupe
442
+ * by product_id across pages.
443
+ *
444
+ * This is one of the three endpoints that return exact prices; tiktokShop.product()
445
+ * does not return a price. A product_id returned here is not guaranteed to resolve
446
+ * on tiktokShop.product() - only about 44% do.
447
+ */
448
+ async search(options) {
449
+ return this.client._post("/api/v1/tiktok-shop/search", options);
450
+ }
451
+ /**
452
+ * Keyword autocomplete and expansion for a partial query, across 8 marketplace
453
+ * regions. Suggestions are not guaranteed prefix matches: a misspelling returns
454
+ * typo corrections, and results can include brand and shop names.
455
+ */
456
+ async searchSuggestions(options) {
457
+ return this.client._post("/api/v1/tiktok-shop/search/suggestions", options);
458
+ }
459
+ /**
460
+ * Full product detail: description, images, variants with stock, shipping, shop
461
+ * profile, category path, and top reviews.
462
+ *
463
+ * Two limits worth knowing before you build on this:
464
+ *
465
+ * 1. It resolves only about 44% of the product ids returned by tiktokShop.search().
466
+ * Upstream has no detail data for the rest, so an HTTP 404 is a normal outcome,
467
+ * not an error. Skip the item rather than retrying - retries do not help and no
468
+ * other region carries it. Search to product is not a reliable pipeline.
469
+ *
470
+ * This method throws `NotFoundError` on that 404 (there is no `data` field in
471
+ * the response body to test), so a loop over search ids must catch it or it
472
+ * dies on the first miss:
473
+ *
474
+ * ```ts
475
+ * import { NotFoundError } from "scavio";
476
+ *
477
+ * for (const productId of productIds) {
478
+ * try {
479
+ * const detail = await client.tiktokShop.product({ product_id: productId });
480
+ * } catch (e) {
481
+ * if (e instanceof NotFoundError) continue; // no detail upstream; skip
482
+ * throw e;
483
+ * }
484
+ * }
485
+ * ```
486
+ *
487
+ * tiktokShop.productReviews() often works for ids product() cannot resolve: of
488
+ * 8 such ids tested, 8 returned HTTP 200 and 7 carried at least one review, so
489
+ * it is a useful fallback source of product detail.
490
+ * 2. It does NOT return a price. Upstream masks the price on the product page.
491
+ * Exact prices come from tiktokShop.search(), tiktokShop.shopProducts(), and
492
+ * tiktokShop.categoryProducts().
493
+ */
494
+ async product(options) {
495
+ return this.client._post("/api/v1/tiktok-shop/product", options);
496
+ }
497
+ /**
498
+ * Paginated product reviews with text, images, star histogram, and
499
+ * verified-purchase flags, up to 200 per call. total_reviews drifts between calls
500
+ * and must not be used to compute a page count; page with has_more instead.
501
+ */
502
+ async productReviews(options) {
503
+ return this.client._post("/api/v1/tiktok-shop/product/reviews", options);
504
+ }
505
+ /**
506
+ * The global TikTok Shop category tree: 28 top-level categories, 240 nodes, two
507
+ * levels deep. Category ids are identical in every region and names are always
508
+ * English.
509
+ */
510
+ async categories() {
511
+ return this.client._post("/api/v1/tiktok-shop/categories", {});
512
+ }
513
+ /**
514
+ * Products listed under a category id from tiktokShop.categories(), with exact
515
+ * prices. Page size is inconsistent upstream (15 to 20 per page), so always
516
+ * paginate with next_cursor rather than assuming a fixed page size. Category
517
+ * listings are shallow: after a few pages the source stops returning new products
518
+ * and has_more turns false, which is the end of the listing rather than an error.
519
+ */
520
+ async categoryProducts(options) {
521
+ return this.client._post("/api/v1/tiktok-shop/category/products", options);
522
+ }
523
+ /**
524
+ * A shop's product catalog, 30 per page, with exact prices. Shop follower count,
525
+ * location, and shop-level rating are not available here; call
526
+ * tiktokShop.product() for the full shop profile.
527
+ */
528
+ async shopProducts(options) {
529
+ return this.client._post("/api/v1/tiktok-shop/shop/products", options);
530
+ }
531
+ /**
532
+ * Resolve any TikTok Shop URL or share link to a product_id or shop_id, ready to
533
+ * pass to the other methods. Accepts canonical product and store pages,
534
+ * tiktok.com/view links, affiliate share links, and vt.tiktok.com short links.
535
+ */
536
+ async resolve(options) {
537
+ return this.client._post("/api/v1/tiktok-shop/resolve", options);
538
+ }
539
+ };
540
+
433
541
  // src/namespaces/instagram.ts
434
542
  var InstagramNamespace = class {
435
543
  constructor(client) {
@@ -664,6 +772,7 @@ var Scavio = class {
664
772
  youtube;
665
773
  reddit;
666
774
  tiktok;
775
+ tiktokShop;
667
776
  instagram;
668
777
  x;
669
778
  linkedin;
@@ -691,6 +800,7 @@ var Scavio = class {
691
800
  this.youtube = new YouTubeNamespace(this);
692
801
  this.reddit = new RedditNamespace(this);
693
802
  this.tiktok = new TikTokNamespace(this);
803
+ this.tiktokShop = new TikTokShopNamespace(this);
694
804
  this.instagram = new InstagramNamespace(this);
695
805
  this.x = new XNamespace(this);
696
806
  this.linkedin = new LinkedInNamespace(this);