Skip to content

Commit df76674

Browse files
committed
refactor: rename add method of managers to _add
1 parent 888087b commit df76674

16 files changed

+26
-26
lines changed

src/books/BlocksBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class BlocksBook extends BaseBook {
101101
const rawUsers = data.data;
102102
const rawIncludes = data.includes;
103103
for (const rawUser of rawUsers) {
104-
const user = this.client.users.add(rawUser.id, { data: rawUser, includes: rawIncludes }, false);
104+
const user = this.client.users._add(rawUser.id, { data: rawUser, includes: rawIncludes }, false);
105105
blockedUsersCollection.set(user.id, user);
106106
}
107107
return blockedUsersCollection;

src/books/ComposedTweetsBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class ComposedTweetsBook extends BaseBook {
144144
const rawTweets = data.data;
145145
const rawIncludes = data.includes;
146146
for (const rawTweet of rawTweets) {
147-
const tweet = this.client.tweets.add(rawTweet.id, { data: rawTweet, includes: rawIncludes }, false);
147+
const tweet = this.client.tweets._add(rawTweet.id, { data: rawTweet, includes: rawIncludes }, false);
148148
tweetsCollection.set(tweet.id, tweet);
149149
}
150150
return tweetsCollection;

src/books/FollowersBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class FollowersBook extends BaseBook {
102102
const rawUsers = data.data;
103103
const rawIncludes = data.includes;
104104
for (const rawUser of rawUsers) {
105-
const user = this.client.users.add(rawUser.id, { data: rawUser, includes: rawIncludes });
105+
const user = this.client.users._add(rawUser.id, { data: rawUser, includes: rawIncludes });
106106
followersCollection.set(user.id, user);
107107
}
108108
return followersCollection;

src/books/FollowingsBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class FollowingsBook extends BaseBook {
102102
const rawUsers = data.data;
103103
const rawIncludes = data.includes;
104104
for (const rawUser of rawUsers) {
105-
const user = this.client.users.add(rawUser.id, { data: rawUser, includes: rawIncludes });
105+
const user = this.client.users._add(rawUser.id, { data: rawUser, includes: rawIncludes });
106106
followingsCollection.set(user.id, user);
107107
}
108108
return followingsCollection;

src/books/LikedTweetsBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class LikedTweetsBook extends BaseBook {
105105
const rawTweets = data.data;
106106
const rawIncludes = data.includes;
107107
for (const rawTweet of rawTweets) {
108-
const tweet = this.client.tweets.add(rawTweet.id, { data: rawTweet, includes: rawIncludes });
108+
const tweet = this.client.tweets._add(rawTweet.id, { data: rawTweet, includes: rawIncludes });
109109
likedTweetsCollection.set(tweet.id, tweet);
110110
}
111111
return likedTweetsCollection;

src/books/MentionsBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class MentionsBook extends BaseBook {
132132
const rawTweets = data.data;
133133
const rawIncludes = data.includes;
134134
for (const rawTweet of rawTweets) {
135-
const tweet = this.client.tweets.add(rawTweet.id, { data: rawTweet, includes: rawIncludes });
135+
const tweet = this.client.tweets._add(rawTweet.id, { data: rawTweet, includes: rawIncludes });
136136
mentioningTweetsCollection.set(tweet.id, tweet);
137137
}
138138
return mentioningTweetsCollection;

src/books/MutesBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class MutesBook extends BaseBook {
101101
const rawUsers = data.data;
102102
const rawIncludes = data.includes;
103103
for (const rawUser of rawUsers) {
104-
const user = this.client.users.add(rawUser.id, { data: rawUser, includes: rawIncludes }, false);
104+
const user = this.client.users._add(rawUser.id, { data: rawUser, includes: rawIncludes }, false);
105105
mutedUsersCollection.set(user.id, user);
106106
}
107107
return mutedUsersCollection;

src/books/SearchTweetsBook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class SearchTweetsBook extends BaseBook {
118118
const rawTweets = data.data;
119119
const rawIncludes = data.includes;
120120
for (const rawTweet of rawTweets) {
121-
const tweet = this.client.tweets.add(rawTweet.id, { data: rawTweet, includes: rawIncludes });
121+
const tweet = this.client.tweets._add(rawTweet.id, { data: rawTweet, includes: rawIncludes });
122122
tweetsCollection.set(tweet.id, tweet);
123123
}
124124
return tweetsCollection;

src/client/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class Client extends BaseClient {
204204
}
205205
try {
206206
const rawData: GetFilteredTweetStreamResponse = JSON.parse(data);
207-
const tweet = this.tweets.add(rawData.data.id, rawData, false);
207+
const tweet = this.tweets._add(rawData.data.id, rawData, false);
208208
const matchingRules = rawData.matching_rules.reduce((col, rule) => {
209209
col.set(rule.id, new MatchingRule(rule));
210210
return col;
@@ -245,7 +245,7 @@ export class Client extends BaseClient {
245245
}
246246
try {
247247
const rawTweet: GetSampledTweetStreamResponse = JSON.parse(data);
248-
const tweet = this.tweets.add(rawTweet.data.id, rawTweet, false);
248+
const tweet = this.tweets._add(rawTweet.data.id, rawTweet, false);
249249
this.emit(ClientEvents.SAMPLED_TWEET_CREATE, tweet);
250250
} catch (error) {
251251
// twitter sends corrupted data sometimes that throws error while parsing it

src/managers/BaseManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class BaseManager<K extends string, R, T extends { id: K }> {
6262
* @param data The raw data returned by the API for this structure
6363
* @param cacheAfterFetching Whether to store the structure in the manager's cache
6464
*/
65-
add<RawData>(id: K, data: RawData, cacheAfterFetching = true): T {
65+
_add<RawData>(id: K, data: RawData, cacheAfterFetching = true): T {
6666
const entry = new this._holds(this.client, data);
6767
if (cacheAfterFetching) this.cache.set(id, entry);
6868
return entry;

0 commit comments

Comments
 (0)