-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-folder.ts
More file actions
42 lines (38 loc) · 820 Bytes
/
Copy pathcreate-folder.ts
File metadata and controls
42 lines (38 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { gql } from '@urql/core';
import client from './client'
const FOLDER_ID = null; // ''/null/undefined => without folder; ID => inside that folder
const NAME = 'example folders'
const DESCRIPTION = 'I am a small description'
const LABELS = ['P1234']
const CREATE_FOLDER = gql`
mutation CreateFolder(
$name: String!
$labels: [String]
$description: String
$folderId: String
) {
createFolder(
input: {
description: $description
parentId: $folderId
name: $name
labels: $labels
}
) {
id
name
description
labels
}
}
`;
async function run() {
const resp = await client.mutation(CREATE_FOLDER, {
folderId: FOLDER_ID,
name: NAME,
labels: LABELS,
description: DESCRIPTION
}).toPromise()
console.debug(resp.data?.createFolder)
}
run()