Skip to content

Commit

Permalink
Merge pull request #127 from Rishikant181/dev
Browse files Browse the repository at this point in the history
v3.4.0
  • Loading branch information
Rishikant181 authored Feb 26, 2024
2 parents db94d58 + e9a12d9 commit 90ad66f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Documentation
run-name: Building the documentation for the release

on:
push:
branches: release
release:
types: [released]

jobs:
# Builds and packages the documentation
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rettiwt-core",
"version": "3.3.2",
"version": "3.4.0",
"description": "The core library for the reverse-engineered Twitter API",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/models/args/FetchArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export class FetchArgs {
*
* @remarks
* - Works only for cursored resources.
* - Has no effect for {@link EResourceType.TWEET_REPLIES}
* - Must be \<= 20 for {@link EResourceType.TWEET_SEARCH} and {@link EResourceType.USER_TWEETS}.
* - Must be \<= 100 for all other cursored resources.
*
Expand Down
6 changes: 6 additions & 0 deletions src/models/args/PostArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,18 @@ export class TweetArgs {
@IsObject({ each: true })
public media?: MediaArgs[];

/** The id of the Tweet to which the given Tweet must be a reply. */
@IsOptional()
@IsNumberString()
public replyTo?: string;

/**
* @param args - The additional user-defined arguments for posting the resource.
*/
public constructor(args: TweetArgs) {
this.text = args.text;
this.media = args.media ? args.media.map((item) => new MediaArgs(item)) : undefined;
this.replyTo = args.replyTo;

// Validating this object
const validationResult = validateSync(this);
Expand Down
29 changes: 26 additions & 3 deletions src/models/payloads/Variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export class Variables {
public screen_name?: string;
public count?: number;
public cursor?: string;
public controller_data?: string;
public rawQuery?: string;
public tweet_text?: string;
public media?: MediaVariable;
public reply?: ReplyVariable;
public product?: string;
public includePromotedContent?: boolean;
public isMetatagsQuery?: boolean;
Expand All @@ -41,6 +43,7 @@ export class Variables {
if (resourceType == EResourceType.CREATE_TWEET) {
this.tweet_text = args.tweet?.text;
this.media = args.tweet?.media ? new MediaVariable(args.tweet.media) : undefined;
this.reply = args.tweet?.replyTo ? new ReplyVariable(args.tweet.replyTo) : undefined;
} else if (resourceType == EResourceType.CREATE_RETWEET || resourceType == EResourceType.FAVORITE_TWEET) {
this.tweet_id = args.id;
} else if (resourceType == EResourceType.LIST_DETAILS) {
Expand Down Expand Up @@ -106,15 +109,15 @@ export class Variables {
*/
export class MediaVariable {
/* eslint-disable @typescript-eslint/naming-convention */
public media_entities: MediaVariableEntity[];
public media_entities: MediaEntityVariable[];
public possibly_sensitive: boolean;
/* eslint-enable @typescript-eslint/naming-convention */

/**
* @param media - The list of MediaArgs objects specifying the media items to be sent in the Tweet.
*/
public constructor(media: MediaArgs[]) {
this.media_entities = media.map((item) => new MediaVariableEntity(item));
this.media_entities = media.map((item) => new MediaEntityVariable(item));
this.possibly_sensitive = false;
}
}
Expand All @@ -124,7 +127,7 @@ export class MediaVariable {
*
* @public
*/
export class MediaVariableEntity {
export class MediaEntityVariable {
/* eslint-disable @typescript-eslint/naming-convention */
public media_id: string;
public tagged_users: string[];
Expand All @@ -138,3 +141,23 @@ export class MediaVariableEntity {
this.tagged_users = media.tags ?? [];
}
}

/**
* Reply specific details to be sent in payload.
*
* @public
*/
export class ReplyVariable {
/* eslint-disable @typescript-eslint/naming-convention */
public in_reply_to_tweet_id: string;
public exclude_reply_user_ids: string[];
/* eslint-enable @typescript-eslint/naming-convention */

/**
* @param replyTo - The id of the Tweet to which this Tweet is a reply.
*/
public constructor(replyTo: string) {
this.in_reply_to_tweet_id = replyTo;
this.exclude_reply_user_ids = [];
}
}

0 comments on commit 90ad66f

Please sign in to comment.