@@ -25,34 +25,13 @@ Module system
2525
2626It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via ` package.json ` . ([ Reference] ( http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html ) )
2727
28- ### Building
28+ ### Installation
2929
3030To build and compile the typescript sources to javascript use:
31- ```
32- npm install
33- npm run build
34- ```
35-
36- ### Publishing
37-
38- First build the package then run ``` npm publish ```
39-
40- ### Consuming
41-
42- navigate to the folder of your consuming project and run one of the following commands.
43-
44- _ published:_
45-
4631```
4732npm install @tikhub/[email protected] --save 4833```
4934
50- _ unPublished (not recommended):_
51-
52- ```
53- npm install PATH_TO_GENERATED_PACKAGE --save
54- ```
55-
5635## ** 🌟 Features**
5736
5837- 🚀 ** Fully Typed TypeScript SDK** – Provides complete type definitions.
@@ -77,18 +56,15 @@ npm install @tikhub/tikhub-api-ts-sdk --save
7756Before making API requests, configure the ** API Client** with your ** API Key** and ** Base URL** .
7857
7958``` ts
80- import { Configuration , ApiClient } from " @tikhub /tikhub-api-ts-sdk" ;
59+ import { Configuration } from " @tikhubio /tikhub-api-ts-sdk" ;
8160
8261// Create an API configuration instance
8362const config = new Configuration ({
8463 basePath: " https://api.tikhub.io" , // ✅ Set API base URL
85- apiKey : " YOUR_API_KEY" , // ✅ Set API Key for authentication
64+ accessToken : " YOUR_API_KEY" , // ✅ Set API Key for authentication
8665});
8766
88- // Create the API client instance
89- const client = new ApiClient (config );
90-
91- console .log (" TikHub API Client initialized!" );
67+ console .log (" TikHub API Client Config initialized!" );
9268```
9369
9470📌 ** Replace ` YOUR_API_KEY ` ** with your actual API key.
@@ -102,27 +78,27 @@ console.log("TikHub API Client initialized!");
10278Fetch videos associated with a given hashtag.
10379
10480``` typescript
105- import { TikTokAppV3APIApi } from ' tikhub-api-sdk' ;
81+ import { TikTokAppV3APIApi } from ' @tikhubio/ tikhub-api-ts -sdk' ;
10682
10783const api = new TikTokAppV3APIApi (config );
10884
109- async function fetchHashtagVideos () {
110- try {
111- const response = await api .fetchHashtagVideoListApiV1TiktokAppV3FetchHashtagVideoListGet ( ' dance ' , 0 , 10 );
112- console .log (' Hashtag Video List :' , response .data );
113- } catch (error ) {
114- console .error (' Error fetching hashtag videos :' , error );
115- }
85+ async function fetchUserProfile () {
86+ try {
87+ const response = await api .handlerUserProfileApiV1TiktokAppV3HandlerUserProfileGet_52 ( ' ' , ' MS4wLjABAAAAv7iSuuXDJGDvJkmH_vz1qkDZYo1apxgzaxdBSeIuPiM ' , ' ' , ' ' );
88+ console .log (' User Profile Info :' , response .data );
89+ } catch (error ) {
90+ console .error (' Error fetching User profile info :' , error );
91+ };
11692}
11793
118- fetchHashtagVideos ();
94+ fetchUserProfile ();
11995```
12096
12197🔹 ** Parameters:**
12298
123- * ` chId ` : Hashtag ID (string)
124- * ` cursor ` : Pagination cursor (default: ` 0 ` )
125- * ` count ` : Number of results to fetch (default: ` 10 ` )
99+ * ` userId ` : User ID (string) Optional
100+ * ` secUserId ` : Secondary User ID (string) Optional
101+ * ` uniqueId ` : Unique ID (string) Optional
126102
127103---
128104
@@ -131,20 +107,20 @@ fetchHashtagVideos();
131107Retrieve TikTok's recommended videos based on cookies.
132108
133109``` typescript
134- import { TikTokAppV3APIApi , TikTokAppV3HomeFeed } from ' tikhub-api-sdk' ;
110+ import { TikTokAppV3APIApi , TikTokAppV3HomeFeed } from ' @tikhubio/ tikhub-api-ts -sdk' ;
135111
136112const api = new TikTokAppV3APIApi (config );
137113
138114async function fetchHomeFeed() {
139- try {
140- const requestBody : TikTokAppV3HomeFeed = {
141- cookie: ' your_tiktok_cookie_here' ,
142- };
143- const response = await api .fetchHomeFeedApiV1TiktokAppV3FetchHomeFeedPost (requestBody );
144- console .log (' Home Feed:' , response .data );
145- } catch (error ) {
146- console .error (' Error fetching home feed:' , error );
147- }
115+ try {
116+ const TikTokAppV3HomeFeed = {
117+ cookie: ' your_tiktok_cookie_here' ,
118+ };
119+ const response = await api .fetchHomeFeedApiV1TiktokAppV3FetchHomeFeedPost (TikTokAppV3HomeFeed );
120+ console .log (' Home Feed:' , response .data );
121+ } catch (error ) {
122+ console .error (' Error fetching home feed:' , error );
123+ }
148124}
149125
150126fetchHomeFeed ();
@@ -161,7 +137,7 @@ fetchHomeFeed();
161137Retrieve TikTok user profile information.
162138
163139``` typescript
164- import { TikTokAppV3APIApi } from ' tikhub-api-sdk' ;
140+ import { TikTokAppV3APIApi } from ' @tikhubio/ tikhub-api-ts -sdk' ;
165141
166142const api = new TikTokAppV3APIApi (config );
167143
0 commit comments