postiz 2.0.0 → 2.0.2
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 +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12513,7 +12513,14 @@ __name(createPost, "createPost");
|
|
|
12513
12513
|
async function listPosts(args) {
|
|
12514
12514
|
const config = getConfig();
|
|
12515
12515
|
const api = new PostizAPI(config);
|
|
12516
|
-
const
|
|
12516
|
+
const defaultStartDate = /* @__PURE__ */ new Date();
|
|
12517
|
+
defaultStartDate.setDate(defaultStartDate.getDate() - 30);
|
|
12518
|
+
const defaultEndDate = /* @__PURE__ */ new Date();
|
|
12519
|
+
defaultEndDate.setDate(defaultEndDate.getDate() + 30);
|
|
12520
|
+
const filters = {
|
|
12521
|
+
startDate: args.startDate || defaultStartDate.toISOString(),
|
|
12522
|
+
endDate: args.endDate || defaultEndDate.toISOString()
|
|
12523
|
+
};
|
|
12517
12524
|
if (args.page) filters.page = args.page;
|
|
12518
12525
|
if (args.limit) filters.limit = args.limit;
|
|
12519
12526
|
if (args.search) filters.search = args.search;
|
|
@@ -12632,7 +12639,13 @@ yargs_default(hideBin(process.argv)).scriptName("postiz").usage("$0 <command> [o
|
|
|
12632
12639
|
return true;
|
|
12633
12640
|
}).example('$0 posts:create -c "Hello World!" -i "twitter-123"', "Simple post").example('$0 posts:create -c "Main post" -m "img1.jpg,img2.jpg" -i "twitter-123"', "Post with multiple images").example('$0 posts:create -c "Main post" -m "img1.jpg" -c "First comment" -m "img2.jpg" -c "Second comment" -m "img3.jpg,img4.jpg" -i "twitter-123"', "Post with comments, each having their own media").example('$0 posts:create -c "Main" -c "Comment with semicolon; see?" -c "Another!" -i "twitter-123"', "Comments can contain semicolons").example('$0 posts:create -c "Thread 1/3" -c "Thread 2/3" -c "Thread 3/3" -d 2000 -i "twitter-123"', "Twitter thread with 2s delay").example("$0 posts:create --json ./post.json", "Complex post from JSON file").example(`$0 posts:create -c "Post to subreddit" -p reddit --settings '{"subreddit":[{"value":{"subreddit":"programming","title":"My Title","type":"text","url":"","is_flair_required":false}}]}' -i "reddit-123"`, "Reddit post with specific subreddit settings").example(`$0 posts:create -c "Video description" -p youtube --settings '{"title":"My Video","type":"public","tags":[{"value":"tech","label":"Tech"}]}' -i "youtube-123"`, "YouTube post with title and tags").example(`$0 posts:create -c "Tweet content" -p x --settings '{"who_can_reply_post":"everyone"}' -i "twitter-123"`, "X (Twitter) post with reply settings");
|
|
12634
12641
|
}, createPost).command("posts:list", "List all posts", (yargs) => {
|
|
12635
|
-
return yargs.option("
|
|
12642
|
+
return yargs.option("startDate", {
|
|
12643
|
+
describe: "Start date (ISO 8601 format). Default: 30 days ago",
|
|
12644
|
+
type: "string"
|
|
12645
|
+
}).option("endDate", {
|
|
12646
|
+
describe: "End date (ISO 8601 format). Default: 30 days from now",
|
|
12647
|
+
type: "string"
|
|
12648
|
+
}).option("page", {
|
|
12636
12649
|
alias: "p",
|
|
12637
12650
|
describe: "Page number",
|
|
12638
12651
|
type: "number",
|
|
@@ -12646,7 +12659,7 @@ yargs_default(hideBin(process.argv)).scriptName("postiz").usage("$0 <command> [o
|
|
|
12646
12659
|
alias: "s",
|
|
12647
12660
|
describe: "Search query",
|
|
12648
12661
|
type: "string"
|
|
12649
|
-
}).example("$0 posts:list", "List all posts").example("$0 posts:list -p 2 -l 20", "List posts with pagination").example('$0 posts:list -s "hello"', "Search posts");
|
|
12662
|
+
}).example("$0 posts:list", "List all posts (last 30 days to next 30 days)").example("$0 posts:list -p 2 -l 20", "List posts with pagination").example('$0 posts:list -s "hello"', "Search posts").example('$0 posts:list --startDate "2024-01-01T00:00:00Z" --endDate "2024-12-31T23:59:59Z"', "List posts for a specific date range");
|
|
12650
12663
|
}, listPosts).command("posts:delete <id>", "Delete a post", (yargs) => {
|
|
12651
12664
|
return yargs.positional("id", {
|
|
12652
12665
|
describe: "Post ID to delete",
|