After you generate a pre-signed URL from the function, and successfully uploaded the file to the uploadUrl , you can now save the url as a file in your Warpgate database.
Warpgate will automatically read the file's content type and file size when you save your file through the createFile function.
Create a system level file
Query
mutation CreateFile($input: FileInput!) {
tenant {
createFile(input: $input) {
id
url
name
size
type
caption
}
}
}
Variables
{
"input": {
"url": "https://cdn.warpgate.tech/...",
"name": "Server.png",
"caption": "Best server in the world"
}
}
Response
{
"data": {
"tenant": {
"createFile": {
"caption": "Best server in the world",
"id": "2",
"name": "Server.png",
"size": 42405,
"type": "image/png",
"url": "https://cdn.warpgate.tech/..."
}
}
}
}
Create a user file
If you need to associate a file to a user, you can specify an optional userId in the variables.
Query
mutation CreateFile($userId: ID!, $input: FileInput!) {
tenant {
createFile(userId: $userId, input: $input) {
id
url
name
size
type
caption
user {
id
username
}
}
}
}
Variables
{
"userId": 1,
"input": {
"url": "https://cdn.warpgate.tech/...",
"name": "Server.png",
"caption": "Best server in the world"
}
}