Methods
(async, inner) fetchArtistBySlug(slug, brandopt) → {Promise.<(Artist|null)>}
- Description:
- Fetch a single artist by their Sanity ID.
- Source:
Example
fetchArtists('drumeo')
.then(artists => console.log(artists))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Description |
slug |
string
|
|
The name of the artist to fetch. |
brand |
Brands
|
string
|
<optional>
|
The brand for which to fetch the artist. |
Returns:
- A promise that resolves to an artist objects or null if not found.
-
Type
-
Promise.<(Artist|null)>
(async, inner) fetchArtistLessons(slug, brand, contentType, params) → {Promise.<ArtistLessons>}
- Description:
- Fetch the artist's lessons.
- Source:
Example
fetchArtistLessons('10 Years', '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 artist |
brand |
Brands
|
string
|
The brand for which to fetch lessons. |
contentType |
string
|
The type of the lessons we need to get from the artist. If not defined, groq will get lessons from all content types |
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']. |
progressId |
Array.<number>
|
<optional>
|
[]
|
The ids of the lessons that are in progress or completed |
|
Returns:
- The lessons for the artist
-
Type
-
Promise.<ArtistLessons>
(async, inner) fetchArtists(brand) → {Promise.<(Array.<Artist>|null)>}
- Description:
- Fetch all artists with lessons available for a specific brand.
- Source:
Example
fetchArtists('drumeo')
.then(artists => console.log(artists))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Description |
brand |
Brands
|
string
|
The brand for which to fetch artists. |
Returns:
- A promise that resolves to an array of artist objects or null if not found.
-
Type
-
Promise.<(Array.<Artist>|null)>