Skip to content

GraphQL Schema

Query

FieldArgumentTypeDescription
mediaMedia

Get the media object by the id.

idString!
taskTask

Get the generation task by the id.

You can only get the task that you have permission to access.

idID!

Mutation

FieldArgumentTypeDescription
uploadMediaUploadMediaRes!

Upload a media file to our storage. It’s convenient for some clients who don’t have their own storage.

Please read our storage document for more details.

inputUploadMediaInput!
createGenerationTaskTask

Create a generation task.

parametersJSONObject!
cancelGenerationTaskTask

Cancel a queuing generation task.

The reason field is optional. It will be saved in the task’s outputs field.

idID!
reasonString
rerunGenerationTaskTask

Rerun a failed generation task.

idID!
deleteGenerationTaskVoid

Delete a generation task.

idID!

Objects

Events

A wide structure that includes all possible times.

It usually only returns one of the fields at a time.

FieldArgumentTypeDescription
taskUpdatedTask

The task object has been updated.

ImageUrl

FieldArgumentTypeDescription
variantImageVariant
urlString

Media

The media type is a abstraction type for the images and videos.

FieldArgumentTypeDescription
idString!
typeMediaType!
widthInt
heightInt
urls[ImageUrl!]

You can use can get the truly URL of the media by this field.

imageTypeString

Subscription

The websocket subscription for the client to listen to the server.

FieldArgumentTypeDescription
personalEventsEvents

This field includes all events that related to the user account.

Task

A generation task object.

FieldArgumentTypeDescription
idID!

The unique identifier of the task.

userIdID!

The user who created the task.

parametersJSONObject

The parameters of the task.

Because we often change the fields of the parameters, we use a JSON object to represent it in GraphQL. But you can learn the detail structure of the parameters document.

outputsJSONObject

The outputs of the task.

Similar with the parameters field. It’s also changed frequently In order to iterate our reasoning services more quickly. You can learn the detail structure from the task output document.

statusString

The status of the task.

It’s a string value. The possible values are:

  • waiting: The task is waiting for a runner to execute.
  • running: The task is running.
  • completed: The task is completed.
  • cancelled: The task is cancelled for some reasons.
  • failed: The task is failed to execute by the runner.
startedAtDate

The actual time when the task started to execute.

endAtDate

The time when the task is completed.

createdAtDate!

The time when the task is created.

updatedAtDate!

The last modified time of the task object.

retryCountInt!

The retry count of the task.

UploadMediaRes

The response of uploading a media file.

FieldArgumentTypeDescription
uploadUrlString
externalIdString
mediaIdString
mediaMedia

Inputs

UploadMediaInput

The input for uploading a media file.

FieldTypeDescription
typeMediaType!
externalIdString
imageTypeString

The mime type of the file. e.g: image/jpeg, image/png.

providerMediaProvider

Enums

ImageVariant

We provide some different variants of the image for different scenarios.

ValueDescription
PUBLIC

The original image.

THUMBNAIL

Can be used to obtain images of a certain size within a certain dimension.

STILL_THUMBNAIL

For gif images or videos. This will be a fixed image.

MediaProvider

The storage provider for uploading media files.

Now we only support S3 for external users.

ValueDescription
S3

MediaType

The available media types.

Now we only support IMAGE for external users.

ValueDescription
IMAGE

Scalars

Boolean

The Boolean scalar type represents true or false.

Date

Time information represented in ISO8601 format string.

ID

The ID scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.

Int

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

JSON

Any forms of valid JSON value.

JSONObject

Similar with JSON but only accept object type.

String

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Void

A scalar that represents an empty response.

You can don’t care about the response of a mutation.

It is usually be returned as null value.