Skip to content

Commit

Permalink
refactor(BREAKING CHANGE): removed hasReachedUploadLimits
Browse files Browse the repository at this point in the history
  • Loading branch information
madkarmaa committed Jan 31, 2024
1 parent 1cdb971 commit e11c5de
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,6 @@ class StreamableClient {
return (await axios.get(endpoints.VIDEO(shortcode), { headers: this.#headers })).data;
}

/**
* Check if the user has reached the current plan's upload limits
* @returns {Promise<boolean>}
*/
async hasReachedUploadLimits() {
if (!(await this.isLoggedIn())) return console.error('You must be logged in to use this method!');

const { limits: { storage: { exceeded } } } = await this.getPlanData(); // prettier-ignore

const { plan_max_length, plan_max_size } = await this.getUserData();

const videosData = await this.getAllVideosData();

const totalVideosSeconds = videosData.reduce((total, v) => total + v.duration, 0);
const totalVideosSize = videosData.reduce((total, v) => total + convert(v.size).from('b').to('Gb'), 0);

return exceeded || totalVideosSeconds > plan_max_length || totalVideosSize > plan_max_size;
}

async #willReachUploadLimits(video_size) {
if (!(await this.isLoggedIn())) return console.error('You must be logged in to use this method!');
}
Expand Down

0 comments on commit e11c5de

Please sign in to comment.