Methods
(async, inner) fetchInstructorBySlug(slug, brandopt) → {Promise.<(Instructor|null)>}
- Description:
- Fetch a single instructor by their name
- Source:
Example
fetchInstructorBySlug('66samus', 'drumeo')
.then(instructor => console.log(instructor))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Description |
slug |
string
|
|
The slug of the instructor to fetch. |
brand |
Brands
|
string
|
<optional>
|
The brand for which to fetch the instructor. Lesson count will be filtered by this brand if provided. |
Returns:
- A promise that resolves to an instructor object or null if not found.
-
Type
-
Promise.<(Instructor|null)>
(async, inner) fetchInstructorLessons(slug, brand, contentTypeopt, options) → {Promise.<InstructorLessons>}
- Description:
- Fetch the data needed for the instructor screen.
- Source:
Example
fetchInstructorLessons('instructor123')
.then(lessons => console.log(lessons))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Description |
slug |
string
|
|
The slug of the instructor |
brand |
Brands
|
string
|
|
The brand for which to fetch instructor lessons |
contentType |
string
|
null
|
<optional>
|
The content type to filter lessons by (e.g., 'lesson', 'course'). |
options |
FetchInstructorLessonsOptions
|
|
Parameters for pagination, filtering and sorting.
Properties
| Name |
Type |
Attributes |
Default |
Description |
sortOrder |
string
|
<optional>
|
"-published_on"
|
The field to sort the lessons by. |
searchTerm |
string
|
<optional>
|
""
|
The search term to filter content by title. |
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']. |
|
Returns:
- The lessons for the instructor or null if not found.
-
Type
-
Promise.<InstructorLessons>
(async, inner) fetchInstructors(brand) → {Promise.<Instructors>}
- Description:
- Fetch all instructor with lessons available for a specific brand.
- Source:
Example
fetchInstructors('drumeo')
.then(instructors => console.log(instructors))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Description |
brand |
Brands
|
string
|
The brand for which to fetch instructors. |
Returns:
- A promise that resolves to an array of instructor objects.
-
Type
-
Promise.<Instructors>