Skip to content

Commit

Permalink
feat: Added Webstore Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynopia committed Oct 16, 2024
1 parent e6535f8 commit 8d097bc
Show file tree
Hide file tree
Showing 3 changed files with 4,468 additions and 1,891 deletions.
49 changes: 49 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,36 @@ export type Webstore = {
created_at: string;
}

/**
* @type {Page}
* @description The page object returned from the Tebex Headless API
*
* @param {number} id The ID of the page
* @param {string} created_at The date the page was created
* @param {string} updated_at The date the page was updated
* @param {number} account_id The ID of the account
* @param {string} title The title of the page
* @param {string} slug The slug of the page
* @param {boolean} private Whether the page is private
* @param {boolean} hidden Whether the page is hidden
* @param {boolean} disabled Whether the page is disabled
* @param {boolean} sequence Whether the page is in a sequence
* @param {string} content The content of the page
*/
export type Page = {
id: number;
created_at: string;
updated_at: string;
account_id: number;
title: string;
slug: string;
private: boolean;
hidden: boolean;
disabled: boolean;
sequence: boolean;
content: string;
}

export class TebexHeadless {
constructor(
/**
Expand Down Expand Up @@ -896,6 +926,25 @@ export class TebexHeadless {
return data;
}

/**
* @function getPages
* @description A function to get the pages from the Tebex Headless API
*
* @returns {Promise<Page>}
*/
async getPages(): Promise<Array<Page>> {
const { data }: Data<Array<Page>> = await Request(
this.webstoreIdentifier,
this.privateKey,
"get",
this.webstoreIdentifier,
"accounts",
"/pages"
);

return data;
}

/**
* @function updateTier
* @description Update an tier of an package
Expand Down
Loading

0 comments on commit 8d097bc

Please sign in to comment.