Skip to content

Latest commit

 

History

History
875 lines (669 loc) · 17.6 KB

api.md

File metadata and controls

875 lines (669 loc) · 17.6 KB

Media Service API

Table of Contents

Query

Field Argument Type Description
mediaRecordsByIds [MediaRecord!]!

Returns the media records with the given IDs. Throws an error if a MediaRecord corresponding to a given ID cannot be found. 🔒 If the mediaRecord is associated with coursed the user must be a member of at least one of the courses.

ids [UUID!]!
findMediaRecordsByIds [MediaRecord]!

Like mediaRecordsByIds() returns the media records with the given IDs, but instead of throwing an error if an ID cannot be found, it instead returns NULL for that media record. 🔒 If the mediaRecord is associated with coursed the user must be a member of at least one of the courses.

ids [UUID!]!
mediaRecords ⚠️ [MediaRecord!]!

Returns all media records of the system. 🔒 The user must be a super-user, otherwise an exception is thrown.

⚠️ DEPRECATED

In production there should probably be no way to get all media records of the system.

userMediaRecords [MediaRecord!]!

Returns all media records which the current user created. 🔒 If the mediaRecord is associated with coursed the user must be a member of at least one of the courses.

mediaRecordsByContentIds [[MediaRecord!]!]!

Returns the media records associated the given content IDs as a list of lists where each sublist contains the media records associated with the content ID at the same index in the input list 🔒 If the mediaRecord is associated with coursed the user must be a member of at least one of the courses.

contentIds [UUID!]!
mediaRecordsForCourses [[MediaRecord!]!]!

Returns all media records for the given CourseIds 🔒 If the mediaRecord is associated with coursed the user must be a member of at least one of the courses.

courseIds [UUID!]!
mediaRecordsForUsers [[MediaRecord!]!]!

Returns all media records which were created by the users.

userIds [UUID!]!

Mutation

Field Argument Type Description
createMediaRecord MediaRecord!

Creates a new media record 🔒 The user must have the "course-creator" role to perform this action. 🔒 If the mediaRecord is associated with courses the user must be an administrator of all courses or a super-user.

input CreateMediaRecordInput!
updateMediaRecord MediaRecord!

Updates an existing media record with the given UUID 🔒 If the mediaRecord is associated with courses the user must be an administrator of at least one of the courses.

input UpdateMediaRecordInput!
deleteMediaRecord UUID!

Deletes the media record with the given UUID 🔒 If the mediaRecord is associated with courses the user must be an administrator of at least one of the courses.

id UUID!
setLinkedMediaRecordsForContent [MediaRecord!]!

For a given MediaContent, sets the linked media records of it to the ones with the given UUIDs. This means that for the content, all already linked media records are removed and replaced by the given ones. 🔒 If the mediaRecord is associated with courses the user must be an administrator of at least one of the courses.

contentId UUID!
mediaRecordIds [UUID!]!
logMediaRecordWorkedOn MediaRecord!
Logs that a media has been worked on by the current user.
See https://meitrex.readthedocs.io/en/latest/dev-manuals/gamification/userProgress.html

Possible side effects:
When all media records of a content have been worked on by a user,
a user-progress event is emitted for the content.
🔒 If the mediaRecord is associated with courses the user must be a member of at least one of the courses.
mediaRecordId UUID!
setMediaRecordsForCourse [MediaRecord!]!

Add the MediaRecords with the given UUIDS to the Course with the given UUID. 🔒 If the mediaRecord is associated with courses the user must be an administrator of at least one of the courses.

courseId UUID!
mediaRecordIds [UUID!]!

Objects

MediaRecord

schema file of the microservice defines data types, queries and mutations this can be done in a separate files as long as they are in this folder and end with .graphqls

Field Argument Type Description
id UUID!

ID of the media record

courseIds [UUID!]!

Ids of the courses this MediaRecord is associated with

name String!

Name of the media record

creatorId UUID!

User ID of the creator of the media record.

type MediaType!

Type of the media record

contentIds [UUID!]!

IDs of the MediaContents this media record is associated with

uploadUrl String!

Temporary upload url for the media record

downloadUrl String!

Temporary download url for the media record

userProgressData MediaRecordProgressData!

The progress data of the given user for this medium.

MediaRecordProgressData

Field Argument Type Description
workedOn Boolean!

Whether the medium has been worked on by the user.

dateWorkedOn DateTime

Date on which the medium was worked on by the user. This is null if the medium has not been worked on by the user.

PaginationInfo

Return type for information about paginated results.

Field Argument Type Description
page Int!

The current page number.

size Int!

The number of elements per page.

totalElements Int!

The total number of elements across all pages.

totalPages Int!

The total number of pages.

hasNext Boolean!

Whether there is a next page.

Inputs

CreateMediaRecordInput

Field Type Description
name String!

Name of the media record. Cannot be blank, maximum length 255 characters.

type MediaType!

Type of the media record.

contentIds [UUID!]!

IDs of the MediaContents this media record is associated with

DateTimeFilter

Filter for date values. If multiple filters are specified, they are combined with AND.

Field Type Description
after DateTime

If specified, filters for dates after the specified value.

before DateTime

If specified, filters for dates before the specified value.

IntFilter

Filter for integer values. If multiple filters are specified, they are combined with AND.

Field Type Description
equals Int

An integer value to match exactly.

greaterThan Int

If specified, filters for values greater than to the specified value.

lessThan Int

If specified, filters for values less than to the specified value.

Pagination

Specifies the page size and page number for paginated results.

Field Type Description
page Int!

The page number, starting at 0. If not specified, the default value is 0. For values greater than 0, the page size must be specified. If this value is larger than the number of pages, an empty page is returned.

size Int!

The number of elements per page.

StringFilter

Filter for string values. If multiple filters are specified, they are combined with AND.

Field Type Description
equals String

A string value to match exactly.

contains String

A string value that must be contained in the field that is being filtered.

ignoreCase Boolean!

If true, the filter is case-insensitive.

UpdateMediaRecordInput

Field Type Description
id UUID!

ID of the media record which should be updated

name String!

New name of the media record. Cannot be blank, maximum length 255 characters.

type MediaType!

New type of the media record.

contentIds [UUID!]!

IDs of the MediaContents this media record is associated with

Enums

MediaType

The type of the media record

Value Description
VIDEO
AUDIO
IMAGE
PRESENTATION
DOCUMENT
URL

SortDirection

Specifies the sort direction, either ascending or descending.

Value Description
ASC
DESC

Scalars

Boolean

Built-in Boolean

Date

An RFC-3339 compliant Full Date Scalar

DateTime

A slightly refined version of RFC-3339 compliant DateTime Scalar

Int

Built-in Int

LocalTime

24-hour clock time value string in the format hh:mm:ss or hh:mm:ss.sss.

String

Built-in String

Time

An RFC-3339 compliant Full Time Scalar

UUID

A universally unique identifier compliant UUID Scalar

Url

A Url scalar