GraphQL Schema
Query
Field | Argument | Type | Description |
---|---|---|---|
media | Media | Get the media object by the id. | |
id | String! | ||
task | Task | Get the generation task by the id. You can only get the task that you have permission to access. | |
id | ID! |
Mutation
Field | Argument | Type | Description |
---|---|---|---|
uploadMedia | UploadMediaRes! | 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. | |
input | UploadMediaInput! | ||
createGenerationTask | Task | Create a generation task. | |
parameters | JSONObject! | ||
cancelGenerationTask | Task | Cancel a queuing generation task. The reason field is optional. It will be saved in the task’s outputs field. | |
id | ID! | ||
reason | String | ||
rerunGenerationTask | Task | Rerun a failed generation task. | |
id | ID! | ||
deleteGenerationTask | Void | Delete a generation task. | |
id | ID! |
Objects
Events
A wide structure that includes all possible times.
It usually only returns one of the fields at a time.
Field | Argument | Type | Description |
---|---|---|---|
taskUpdated | Task | The task object has been updated. |
ImageUrl
Field | Argument | Type | Description |
---|---|---|---|
variant | ImageVariant | ||
url | String |
Media
The media type is a abstraction type for the images and videos.
Field | Argument | Type | Description |
---|---|---|---|
id | String! | ||
type | MediaType! | ||
width | Int | ||
height | Int | ||
urls | [ImageUrl!] | You can use can get the truly URL of the media by this field. | |
imageType | String |
Subscription
The websocket subscription for the client to listen to the server.
Field | Argument | Type | Description |
---|---|---|---|
personalEvents | Events | This field includes all events that related to the user account. |
Task
A generation task object.
Field | Argument | Type | Description |
---|---|---|---|
id | ID! | The unique identifier of the task. | |
userId | ID! | The user who created the task. | |
parameters | JSONObject | 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. | |
outputs | JSONObject | 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. | |
status | String | The status of the task. It’s a string value. The possible values are:
| |
startedAt | Date | The actual time when the task started to execute. | |
endAt | Date | The time when the task is completed. | |
createdAt | Date! | The time when the task is created. | |
updatedAt | Date! | The last modified time of the task object. | |
retryCount | Int! | The retry count of the task. |
UploadMediaRes
The response of uploading a media file.
Field | Argument | Type | Description |
---|---|---|---|
uploadUrl | String | ||
externalId | String | ||
mediaId | String | ||
media | Media |
Inputs
UploadMediaInput
The input for uploading a media file.
Field | Type | Description | |
---|---|---|---|
type | MediaType! | ||
externalId | String | ||
imageType | String | The mime type of the file. e.g: image/jpeg, image/png. | |
provider | MediaProvider |
Enums
ImageVariant
We provide some different variants of the image for different scenarios.
Value | Description |
---|---|
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.
Value | Description |
---|---|
S3 |
MediaType
The available media types.
Now we only support IMAGE for external users.
Value | Description |
---|---|
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.