Last active
April 6, 2021 14:52
-
-
Save zefhemel/cdfddf3276524dc2cf18b9d133734e83 to your computer and use it in GitHub Desktop.
Focalboard Deno API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Focalboard { | |
constructor(url, token, workspaceId) { | |
this.url = url; | |
this.token = token; | |
this.workspaceId = workspaceId; | |
} | |
async allBlocks() { | |
let result = await fetch(`${this.url}/api/v1/workspaces/${this.workspaceId}/blocks?type=view`, { | |
headers: { | |
"accept": "application/json", | |
"authorization": `Bearer ${this.token}`, | |
"x-requested-with": "XMLHttpRequest" | |
}, | |
"method": "GET", | |
}); | |
return await result.json(); | |
} | |
async addBlock(blocks) { | |
let result = fetch(`${this.url}/api/v1/workspaces/${this.workspaceId}/blocks`, { | |
"headers": { | |
"accept": "application/json", | |
"authorization": `Bearer ${this.token}`, | |
"content-type": "application/json", | |
"x-requested-with": "XMLHttpRequest" | |
}, | |
"body": JSON.stringify(blocks), | |
"method": "POST", | |
}); | |
return await result.json(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment