Merge pull request #8 from ApexDevelopment/post-editing
commit
1c9328d7b6
14
README.md
14
README.md
|
@ -22,7 +22,7 @@ const cohost = require("cohost");
|
||||||
let [project] = await user.getProjects();
|
let [project] = await user.getProjects();
|
||||||
|
|
||||||
// Create Post
|
// Create Post
|
||||||
await cohost.Post.create(project, {
|
let myPostID = await cohost.Post.create(project, {
|
||||||
postState: 1,
|
postState: 1,
|
||||||
headline: "hello world from cohost.js",
|
headline: "hello world from cohost.js",
|
||||||
adultContent: false,
|
adultContent: false,
|
||||||
|
@ -31,6 +31,16 @@ const cohost = require("cohost");
|
||||||
tags: []
|
tags: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Edit Post
|
||||||
|
await cohost.Post.update(project, myPostID, {
|
||||||
|
postState: 1,
|
||||||
|
headline: "Hello world from cohost.js!",
|
||||||
|
adultContent: false,
|
||||||
|
blocks: [],
|
||||||
|
cws: [],
|
||||||
|
tags: ["cohost.js"]
|
||||||
|
});
|
||||||
|
|
||||||
// Get Posts of Project
|
// Get Posts of Project
|
||||||
let posts = await project.getPosts();
|
let posts = await project.getPosts();
|
||||||
|
|
||||||
|
@ -64,10 +74,10 @@ Works:
|
||||||
- Logging in
|
- Logging in
|
||||||
- Getting the posts of a project
|
- Getting the posts of a project
|
||||||
- Creating a post
|
- Creating a post
|
||||||
|
- Editing a post
|
||||||
|
|
||||||
Doesn't work:
|
Doesn't work:
|
||||||
|
|
||||||
- Editing a post: possible, haven't done it
|
|
||||||
- Sharing a post: possible, haven't done it
|
- Sharing a post: possible, haven't done it
|
||||||
- Liking a post: possible, haven't done it
|
- Liking a post: possible, haven't done it
|
||||||
- Getting notifications: possible, haven't done it
|
- Getting notifications: possible, haven't done it
|
||||||
|
|
7
lib.js
7
lib.js
|
@ -265,7 +265,12 @@ class Post {
|
||||||
return postId;
|
return postId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** see {@link create} */
|
/**
|
||||||
|
*
|
||||||
|
* @param {Project} project Project to post to
|
||||||
|
* @param {string} postId ID of the post to update
|
||||||
|
* @param {PostCreate} data
|
||||||
|
*/
|
||||||
static async update(project, postId, data) {
|
static async update(project, postId, data) {
|
||||||
await fetch(
|
await fetch(
|
||||||
"PUT",
|
"PUT",
|
||||||
|
|
Loading…
Reference in New Issue