Genre

Methods

(async, inner) fetchGenreBySlug(slug, brandopt) → {Promise.<(Genre|null)>}

Description:
  • Fetch a single genre by their slug and brand
Source:
Example
fetchGenreBySlug('drumeo')
  .then(genres => console.log(genres))
  .catch(error => console.error(error));
Parameters:
Name Type Attributes Description
slug string The slug of the genre to fetch.
brand Brands | string <optional>
The brand for which to fetch the genre. Lesson count will be filtered by this brand if provided.
Returns:
- A promise that resolves to an genre object or null if not found.
Type
Promise.<(Genre|null)>

(async, inner) fetchGenreLessons(slug, brand, params) → {Promise.<(GenreLessons|null)>}

Description:
  • Fetch the genre's lessons.
Source:
Example
fetchGenreLessons('Blues', 'drumeo', 'song', {'-published_on', '', 1, 10, ["difficulty,Intermediate"], [232168, 232824, 303375, 232194, 393125]})
  .then(lessons => console.log(lessons))
  .catch(error => console.error(error));
Parameters:
Name Type Description
slug string The slug of the genre
brand Brands | string The brand for which to fetch lessons.
params Object Parameters for sorting, searching, pagination and filtering.
Properties
Name Type Attributes Default Description
sort string <optional>
"-published_on" The field to sort the lessons by.
searchTerm string <optional>
"" The search term to filter the lessons.
page number <optional>
1 The page number for pagination.
limit number <optional>
10 The number of items per page.
includedFields Array.<string> <optional>
[] Additional filters to apply to the query in the format of a key,value array. eg. ['difficulty,Intermediate', 'genre,rock'].
progressIds Array.<number> <optional>
[] The ids of the lessons that are in progress or completed
Returns:
- The lessons for the genre
Type
Promise.<(GenreLessons|null)>

(async, inner) fetchGenres(brandopt) → {Promise.<Array.<Genre>>}

Description:
  • Fetch all genres with lessons available for a specific brand.
Source:
Example
fetchGenres('drumeo')
  .then(genres => console.log(genres))
  .catch(error => console.error(error));
Parameters:
Name Type Attributes Description
brand Brands | string <optional>
The brand for which to fetch the genre for. Lesson count will be filtered by this brand if provided.
Returns:
- A promise that resolves to an genre object or null if not found.
Type
Promise.<Array.<Genre>>