UNPKG

@memberjunction/actions-bizapps-social

Version:

Social Media Actions for MemberJunction - Twitter, LinkedIn, Facebook, Instagram, TikTok, YouTube, HootSuite, Buffer

51 lines 2.5 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { RegisterClass } from '@memberjunction/global'; import { BufferBaseAction } from '../buffer-base.action.js'; import { BaseAction } from '@memberjunction/actions'; /** * Deletes a post from Buffer via the GraphQL deletePost mutation. */ let BufferDeletePostAction = class BufferDeletePostAction extends BufferBaseAction { async InternalRunAction(params) { const { Params } = params; try { const authError = await this.ensureAuthenticated(params); if (authError) return authError; const postId = this.getParamValue(Params, 'PostID'); if (!postId) throw new Error('PostID is required'); const success = await this.deleteBufferPost(postId); this.setOutputParam(Params, 'Deleted', success); this.setOutputParam(Params, 'Summary', { postId, deleted: success, deletedAt: new Date().toISOString() }); if (success) { return { Success: true, ResultCode: 'SUCCESS', Message: `Successfully deleted Buffer post ${postId}`, Params }; } return { Success: false, ResultCode: 'DELETE_FAILED', Message: `Failed to delete Buffer post ${postId}`, Params }; } catch (error) { return this.buildErrorResult(error, 'delete post', Params); } } get Params() { return [ ...this.bufferCommonParams, { Name: 'PostID', Type: 'Input', Value: null }, { Name: 'Deleted', Type: 'Output', Value: false }, { Name: 'Summary', Type: 'Output', Value: null }, ]; } get Description() { return 'Deletes a pending or sent post from Buffer'; } }; BufferDeletePostAction = __decorate([ RegisterClass(BaseAction, 'BufferDeletePostAction') ], BufferDeletePostAction); export { BufferDeletePostAction }; //# sourceMappingURL=delete-post.action.js.map