Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
[api] Rename ..Id -> ...ID
Browse files Browse the repository at this point in the history
  • Loading branch information
junhoyeo committed Jul 8, 2023
1 parent 2f5010c commit 94b61c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions threads-api/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@ program
.alias('id')
.description('get user ID from username')
.action(async (username: string) => {
const userId = await Threads.getUserIDfromUsername(username, { timeout: 10000 });
console.log(`User ID for ${username}: ${userId}`);
const userID = await Threads.getUserIDfromUsername(username, { timeout: 10000 });
console.log(`User ID for ${username}: ${userID}`);
});

program
.command('getUserProfile <username> <userId> [stringify]')
.command('getUserProfile <username> <userID> [stringify]')
.alias('userprofile')
.alias('uprof')
.alias('up')
.description('get user profile')
.action(async (username: string, userId: string, stringify?: boolean) => {
const userProfile = await Threads.getUserProfile(username, userId, { timeout: 10000 });
.action(async (username: string, userID: string, stringify?: boolean) => {
const userProfile = await Threads.getUserProfile(username, userID, { timeout: 10000 });
console.log(stringify ? JSON.stringify(userProfile, null, 5) : userProfile);
});

program
.command('getUserProfileThreads <username> <userId> [stringify]')
.command('getUserProfileThreads <username> <userID> [stringify]')
.alias('uthreads')
.alias('ut')
.description('get user profile threads')
.action(async (username: string, userId: string, stringify?: boolean) => {
const userProfileThreads = await Threads.getUserProfileThreads(username, userId, { timeout: 10000 });
.action(async (username: string, userID: string, stringify?: boolean) => {
const userProfileThreads = await Threads.getUserProfileThreads(username, userID, { timeout: 10000 });
console.log(stringify ? JSON.stringify(userProfileThreads, null, 5) : userProfileThreads);
});

program
.command('getUserProfileReplies <username> <userId> [stringify]')
.command('getUserProfileReplies <username> <userID> [stringify]')
.alias('userreplies')
.alias('ureplies')
.alias('ur')
.description('get user profile replies')
.action(async (username: string, userId: string, stringify?: boolean) => {
const userProfileReplies = await Threads.getUserProfileReplies(username, userId, { timeout: 10000 });
.action(async (username: string, userID: string, stringify?: boolean) => {
const userProfileReplies = await Threads.getUserProfileReplies(username, userID, { timeout: 10000 });
console.log(stringify ? JSON.stringify(userProfileReplies, null, 5) : userProfileReplies);
});

Expand All @@ -63,28 +63,28 @@ program
.alias('p')
.description('get post ID from URL')
.action(async (postURL: string) => {
const postId = await Threads.getPostIDfromURL(postURL, { timeout: 10000 });
console.log(`Post ID for ${postURL}: ${postId}`);
const postID = await Threads.getPostIDfromURL(postURL, { timeout: 10000 });
console.log(`Post ID for ${postURL}: ${postID}`);
});

program
.command('getThreads <postId> [stringify]')
.command('getThreads <postID> [stringify]')
.alias('threads')
.alias('t')
.description('get threads')
.action(async (postId: string, stringify?: boolean) => {
const threads = await Threads.getThreads(postId, { timeout: 10000 });
.action(async (postID: string, stringify?: boolean) => {
const threads = await Threads.getThreads(postID, { timeout: 10000 });
console.log(threads, stringify ? JSON.stringify(threads, null, 5) : threads);
});

program
.command('getThreadLikers <postId> [stringify]')
.command('getThreadLikers <postID> [stringify]')
.alias('threadlikers')
.alias('likers')
.alias('l')
.description('get thread likers')
.action(async (postId: string, stringify?: boolean) => {
const threadLikers = await Threads.getThreadLikers(postId, { timeout: 10000 });
.action(async (postID: string, stringify?: boolean) => {
const threadLikers = await Threads.getThreadLikers(postID, { timeout: 10000 });
console.log(stringify ? JSON.stringify(threadLikers, null, 5) : threadLikers);
});

Expand Down
4 changes: 2 additions & 2 deletions threads-api/src/threads-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export class ThreadsAPI {
}

const token = await this.getToken();
const userId = await this.getUserIDfromUsername(this.username);
const userID = await this.getUserIDfromUsername(this.username);

if (!token) {
return false;
Expand All @@ -367,7 +367,7 @@ export class ThreadsAPI {
text_post_app_info: '{"reply_control":0}',
timezone_offset: '-25200',
source_type: '4',
_uid: userId,
_uid: userID,
device_id: `${this.deviceID}`,
caption,
upload_id: new Date().getTime(),
Expand Down

0 comments on commit 94b61c7

Please sign in to comment.