@anjir/app-novinhub
Version:
نوین هاب - پلتفرم کامل مدیریت شبکههای اجتماعی، دایرکت هوشمند، و خودکارسازی پیامرسانی
53 lines • 2.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.novinhubDeleteAccountGroupAction = void 0;
const apps_framework_1 = require("@anjir/apps-framework");
const apps_common_1 = require("@anjir/apps-common");
const index_1 = require("../../index");
const common_1 = require("../common");
exports.novinhubDeleteAccountGroupAction = (0, apps_framework_1.createAction)({
auth: index_1.novinhubAuth,
name: 'delete_account_group',
displayName: 'حذف گروه اکانت',
description: 'حذف یک گروه اکانت از نوین هاب',
props: {
accountGroupId: apps_framework_1.Property.Number({
displayName: 'شناسه گروه اکانت',
description: 'شناسه گروه اکانتی که میخواهید حذف کنید',
required: true,
}),
},
async run(ctx) {
const { accountGroupId } = ctx.propsValue;
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${ctx.auth.access_token}`,
};
const url = (0, common_1.buildApiUrl)(`/account-group/${accountGroupId}`);
try {
const response = await apps_common_1.httpClient.sendRequest({
method: apps_common_1.HttpMethod.DELETE,
url: url,
headers: headers,
});
if (response.status === 200) {
return {
success: true,
result: response.body,
message: 'گروه اکانت با موفقیت حذف شد',
};
}
else {
throw new Error(`خطا در حذف گروه اکانت: ${response.body?.message || `HTTP ${response.status}`}`);
}
}
catch (error) {
const errorMessage = error.message || error.toString() || 'خطا در حذف گروه اکانت';
return {
success: false,
error: errorMessage,
};
}
},
});
//# sourceMappingURL=delete-account-group.js.map