onPostPublish
Letsetsa ho amohela data e phatlalalitsoeng ho tsoa ho mohlophisi. Callback ena e fumaneha ka bobeli createPost 'me editPost mekhoa mme e hlahisoa ha mosebelisi a tobetsa konopo ea "Publish" ka har'a sebopeho sa mohlophisi.
tšebeliso
Ka createPost:
predis.createPost({
onPostPublish: function (error, data) {
if (error) {
console.error("Error publishing new post:", error);
} else {
console.log("New post published successfully:", data);
}
},
});
Ka editPost:
predis.editPost({
post_id: "YOUR_POST_ID",
onPostPublish: function (error, data) {
if (error) {
console.error("Error publishing edited post:", error);
} else {
console.log("Edited post published successfully:", data);
}
},
});
entsprechen
| lebitso | Tlhaloso | Type | hlokehang |
|---|---|---|---|
error | Phoso e hlahile ha poso e hloleha ho phatlalatsa ka tsela e 'ngoe null | phosong | e |
data | Lintlha tsa poso e hatisitsoeng ka mokhoa o fanoeng ka tlase. | Sepheo | e |
data.media_url | Sehlopha se nang le li-URL tsa litaba tse phatlalalitsoeng. Ena e ka ba URL bakeng sa a jpeg or mp4 faele.Tabeng eo neng data.media_type is single_image or video sehlopha se tla ba le ntho e le 'ngoe feela, ha ho ntse ho le joalo carousel e ka ba le lintho tse ngata. | drive | e |
data.post_id | ID e ikhethang ea ho khetholla poso e hatisitsoeng. | khoele | e |
data.thumb_url | URL bakeng sa linepe tsa mecha ea litaba e hatisitsoeng. | khoele | e |
data.media_type | Mofuta oa mecha ea phatlalatso ea mecha ea phatlalatso. E ka ba e 'ngoe ea single_image, carousel or video | khoele | e |
data.caption | Tlhaloso ea litaba tse hlahisitsoeng. | khoele | e |