Methods
(static) getContentRows(brand, pageName, contentRowSlug, params) → {Promise.<Object>}
- Description:
- Fetches content rows for a given brand and page with optional filtering by content row slug.
- Source:
Example
getContentRows('drumeo', 'lessons', 'Your-Daily-Warmup', {
page: 1,
limit: 5
})
.then(content => console.log(content))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Description |
brand |
string
|
The brand for which to fetch content rows. |
pageName |
string
|
The page name (e.g., 'lessons', 'songs'). |
contentRowSlug |
string
|
null
|
The specific content row ID to fetch. |
params |
Object
|
Parameters for pagination.
Properties
| Name |
Type |
Attributes |
Default |
Description |
page |
number
|
<optional>
|
1
|
The page number for pagination. |
limit |
number
|
<optional>
|
10
|
The maximum number of content items per row. |
|
Returns:
- The fetched content rows with complete Sanity data instead of just content IDs.
When contentRowId is provided, returns an object with type, data, and meta properties.
-
Type
-
Promise.<Object>
(static) getLegacyMethods(brand) → {Promise.<Object>}
- Description:
- Fetches legacy methods for a given brand by permission.
- Source:
Example
// Fetch legacy methods for a brand by permission
getLegacyMethods('drumeo')
.then(content => console.log(content))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Description |
brand |
string
|
The brand for which to fetch legacy methods. |
Returns:
- A promise that resolves to an object containing legacy methods.
-
Type
-
Promise.<Object>
(static) getNewAndUpcoming(brand, paramsopt) → {Promise.<({data: Array.<Object>}|null)>}
- Description:
- Fetches new and upcoming releases for a given brand with pagination options.
- Source:
Examples
// Fetch the first page with 10 results
getNewAndUpcoming('drumeo')
.then(response => console.log(response))
.catch(error => console.error(error));
// Fetch the second page with 20 results
getNewAndUpcoming('drumeo', { page: 2, limit: 20 })
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
brand |
string
|
|
|
The brand for which to fetch new and upcoming releases. |
params |
Object
|
<optional>
|
{}
|
Pagination parameters.
Properties
| Name |
Type |
Attributes |
Default |
Description |
page |
number
|
<optional>
|
1
|
The page number for pagination. |
limit |
number
|
<optional>
|
10
|
The maximum number of content items to fetch. |
|
Returns:
- A promise that resolves to the fetched content data or `null` if no data is found.
-
Type
-
Promise.<({data: Array.<Object>}|null)>
(static) getOwnedContent(brand, paramsopt) → {Promise.<Object>}
- Description:
- Fetches content owned by the user (excluding membership content).
Shows only content accessible through purchases/entitlements, not through membership.
- Source:
Examples
// Fetch all owned content with default pagination
getOwnedContent('drumeo')
.then(content => console.log(content))
.catch(error => console.error(error));
// Fetch owned content with custom pagination and sorting
getOwnedContent('drumeo', {
page: 2,
limit: 20,
sort: '-published_on'
})
.then(content => console.log(content))
.catch(error => console.error(error));
// Fetch owned content filtered by types
getOwnedContent('drumeo', {
type: ['course', 'course-collection'],
page: 1,
limit: 10
})
.then(content => console.log(content))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
brand |
string
|
|
|
The brand for which to fetch owned content. |
params |
Object
|
<optional>
|
{}
|
Parameters for pagination and sorting.
Properties
| Name |
Type |
Attributes |
Default |
Description |
type |
Array.<string>
|
<optional>
|
[]
|
Content type(s) to filter (optional array). |
page |
number
|
<optional>
|
1
|
The page number for pagination. |
limit |
number
|
<optional>
|
10
|
The number of items per page. |
sort |
string
|
<optional>
|
'-published_on'
|
The field to sort the data by. |
|
Returns:
- The fetched owned content with entity array and total count.
-
Type
-
Promise.<Object>
(static) getRecent(brand, pageName, tabNameopt, params) → {Promise.<Object>}
- Description:
- Fetches recent content for a given brand and page with pagination.
- Source:
Example
getRecent('drumeo', 'lessons', 'all', {
page: 2,
limit: 15,
sort: '-popularity'
})
.then(content => console.log(content))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
brand |
string
|
|
|
The brand for which to fetch data. |
pageName |
string
|
|
|
The page name (e.g., 'all', 'incomplete', 'completed'). |
tabName |
string
|
<optional>
|
'all'
|
The tab name (defaults to 'all' for recent content). |
params |
Object
|
|
|
Parameters for pagination and sorting.
Properties
| Name |
Type |
Attributes |
Default |
Description |
page |
number
|
<optional>
|
1
|
The page number for pagination. |
limit |
number
|
<optional>
|
10
|
The number of items per page. |
sort |
string
|
<optional>
|
"-published_on"
|
The field to sort the data by. |
|
Returns:
- The fetched content data.
-
Type
-
Promise.<Object>
(static) getRecommendedForYou(brand, paramsopt) → {Promise.<Object>}
- Description:
- Fetches recommended content for a given brand with pagination support.
- Source:
Examples
// Fetch recommended content for a brand with default pagination
getRecommendedForYou('drumeo')
.then(content => console.log(content))
.catch(error => console.error(error));
// Fetch recommended content for a brand with custom pagination
getRecommendedForYou('drumeo', { page: 2, limit: 5 })
.then(content => console.log(content))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
brand |
string
|
|
|
The brand for which to fetch recommended content. |
params |
Object
|
<optional>
|
{}
|
Pagination parameters.
Properties
| Name |
Type |
Attributes |
Default |
Description |
page |
number
|
<optional>
|
1
|
The page number for pagination. |
limit |
number
|
<optional>
|
10
|
The maximum number of recommended content items per page. |
|
Returns:
- A promise that resolves to an object containing recommended content.
-
Type
-
Promise.<Object>
(static) getScheduleContentRows(brand, contentRowIdopt, paramsopt) → {Promise.<Object>}
- Description:
- Fetches scheduled content rows for a given brand with optional filtering by content row ID.
- Source:
Examples
// Fetch all sections with default pagination
getScheduleContentRows('drumeo')
.then(content => console.log(content))
.catch(error => console.error(error));
// Fetch only the 'New-Releases' section with custom pagination
getScheduleContentRows('drumeo', 'New-Releases', { page: 1, limit: 30 })
.then(content => console.log(content))
.catch(error => console.error(error));
// Fetch only the 'Live-Streams' section with unlimited results
getScheduleContentRows('drumeo', 'Live-Streams')
.then(content => console.log(content))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
brand |
string
|
|
|
The brand for which to fetch content rows. |
contentRowId |
string
|
<optional>
|
null
|
The specific content row ID to fetch (optional). |
params |
Object
|
<optional>
|
{}
|
Pagination parameters.
Properties
| Name |
Type |
Attributes |
Default |
Description |
page |
number
|
<optional>
|
1
|
The page number for pagination. |
limit |
number
|
<optional>
|
10
|
The maximum number of content items per row. |
|
Returns:
- A promise that resolves to the fetched content rows.
-
Type
-
Promise.<Object>
(static) getTabResults(brand, pageName, tabName, params) → {Promise.<(Object|null)>}
- Description:
- Get data that should be displayed for a specific tab with pagination
- Source:
Example
getTabResults('drumeo', 'lessons','Singles', {
page: 2,
limit: 20,
sort: '-popularity',
includedFields: ['difficulty,Intermediate'],
})
.then(content => console.log(content))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Description |
brand |
string
|
The brand for which to fetch data. |
pageName |
string
|
The page name (e.g., 'lessons', 'songs'). |
tabName |
string
|
The name for the selected tab. Should be same name received from fetchMetadata (e.g., 'Individuals', 'Collections','For You'). |
params |
Object
|
Parameters for pagination, sorting, and filter.
Properties
| Name |
Type |
Attributes |
Default |
Description |
page |
number
|
<optional>
|
1
|
The page number for pagination. |
limit |
number
|
<optional>
|
10
|
The number of items per page. |
sort |
string
|
<optional>
|
"-published_on"
|
The field to sort the data by. |
selectedFilters |
Array.<string>
|
<optional>
|
[]
|
The selected filter. |
|
Returns:
- The fetched content data or null if not found.
-
Type
-
Promise.<(Object|null)>