postiz 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12433,6 +12433,15 @@ var _PostizAPI = class _PostizAPI {
|
|
|
12433
12433
|
method: "GET"
|
|
12434
12434
|
});
|
|
12435
12435
|
}
|
|
12436
|
+
async triggerIntegrationTool(integrationId, methodName, data) {
|
|
12437
|
+
return this.request(`/public/v1/integration-trigger/${integrationId}`, {
|
|
12438
|
+
method: "POST",
|
|
12439
|
+
body: JSON.stringify({
|
|
12440
|
+
methodName,
|
|
12441
|
+
data
|
|
12442
|
+
})
|
|
12443
|
+
});
|
|
12444
|
+
}
|
|
12436
12445
|
};
|
|
12437
12446
|
__name(_PostizAPI, "PostizAPI");
|
|
12438
12447
|
var PostizAPI = _PostizAPI;
|
|
@@ -12625,6 +12634,37 @@ async function getIntegrationSettings(args) {
|
|
|
12625
12634
|
}
|
|
12626
12635
|
}
|
|
12627
12636
|
__name(getIntegrationSettings, "getIntegrationSettings");
|
|
12637
|
+
async function triggerIntegrationTool(args) {
|
|
12638
|
+
const config = getConfig();
|
|
12639
|
+
const api = new PostizAPI(config);
|
|
12640
|
+
if (!args.id) {
|
|
12641
|
+
console.error("\u274C Integration ID is required");
|
|
12642
|
+
process.exit(1);
|
|
12643
|
+
}
|
|
12644
|
+
if (!args.method) {
|
|
12645
|
+
console.error("\u274C Method name is required");
|
|
12646
|
+
process.exit(1);
|
|
12647
|
+
}
|
|
12648
|
+
let data = {};
|
|
12649
|
+
if (args.data) {
|
|
12650
|
+
try {
|
|
12651
|
+
data = JSON.parse(args.data);
|
|
12652
|
+
} catch (error) {
|
|
12653
|
+
console.error("\u274C Failed to parse data JSON:", error.message);
|
|
12654
|
+
process.exit(1);
|
|
12655
|
+
}
|
|
12656
|
+
}
|
|
12657
|
+
try {
|
|
12658
|
+
const result = await api.triggerIntegrationTool(args.id, args.method, data);
|
|
12659
|
+
console.log(`\u{1F527} Tool result for ${args.method}:`);
|
|
12660
|
+
console.log(JSON.stringify(result, null, 2));
|
|
12661
|
+
return result;
|
|
12662
|
+
} catch (error) {
|
|
12663
|
+
console.error("\u274C Failed to trigger tool:", error.message);
|
|
12664
|
+
process.exit(1);
|
|
12665
|
+
}
|
|
12666
|
+
}
|
|
12667
|
+
__name(triggerIntegrationTool, "triggerIntegrationTool");
|
|
12628
12668
|
|
|
12629
12669
|
// src/commands/upload.ts
|
|
12630
12670
|
var import_fs6 = require("fs");
|
|
@@ -12717,7 +12757,19 @@ yargs_default(hideBin(process.argv)).scriptName("postiz").usage("$0 <command> [o
|
|
|
12717
12757
|
describe: "Integration ID",
|
|
12718
12758
|
type: "string"
|
|
12719
12759
|
}).example("$0 integrations:settings reddit-123", "Get settings schema for Reddit integration").example("$0 integrations:settings youtube-456", "Get settings schema for YouTube integration");
|
|
12720
|
-
}, getIntegrationSettings).command("
|
|
12760
|
+
}, getIntegrationSettings).command("integrations:trigger <id> <method>", "Trigger an integration tool to fetch additional data", (yargs) => {
|
|
12761
|
+
return yargs.positional("id", {
|
|
12762
|
+
describe: "Integration ID",
|
|
12763
|
+
type: "string"
|
|
12764
|
+
}).positional("method", {
|
|
12765
|
+
describe: "Method name from the integration tools",
|
|
12766
|
+
type: "string"
|
|
12767
|
+
}).option("data", {
|
|
12768
|
+
alias: "d",
|
|
12769
|
+
describe: "Data to pass to the tool as JSON string",
|
|
12770
|
+
type: "string"
|
|
12771
|
+
}).example("$0 integrations:trigger reddit-123 getSubreddits", "Get list of subreddits").example(`$0 integrations:trigger reddit-123 searchSubreddits -d '{"query":"programming"}'`, "Search for subreddits").example("$0 integrations:trigger youtube-123 getPlaylists", "Get YouTube playlists");
|
|
12772
|
+
}, triggerIntegrationTool).command("upload <file>", "Upload a file", (yargs) => {
|
|
12721
12773
|
return yargs.positional("file", {
|
|
12722
12774
|
describe: "File path to upload",
|
|
12723
12775
|
type: "string"
|