-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1694 from h3poteto/feat/scheduled
Fix ScheduledStatus entity
- Loading branch information
Showing
15 changed files
with
118 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
example/typescript/src/mastodon/post_status_with_schedule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as readline from 'readline' | ||
import generator, { Entity, Response } from 'megalodon' | ||
|
||
const rl: readline.ReadLine = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}) | ||
|
||
const BASE_URL: string = process.env.MASTODON_URL as string | ||
|
||
const access_token: string = process.env.MASTODON_ACCESS_TOKEN as string | ||
|
||
const client = generator('mastodon', BASE_URL, access_token) | ||
|
||
new Promise(resolve => { | ||
rl.question('Toot: ', status => { | ||
let now = new Date() | ||
now.setMinutes(now.getMinutes() + 6) | ||
client | ||
.postStatus(status, { | ||
scheduled_at: now.toISOString(), | ||
visibility: 'private' | ||
}) | ||
.then((res: Response<Entity.Status | Entity.ScheduledStatus>) => { | ||
console.log(res) | ||
rl.close() | ||
resolve(res) | ||
}) | ||
.catch(err => { | ||
console.error(err) | ||
rl.close() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
example/typescript/src/pleroma/post_status_with_schedule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as readline from 'readline' | ||
import generator, { Entity, Response } from 'megalodon' | ||
|
||
const rl: readline.ReadLine = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}) | ||
|
||
const BASE_URL: string = process.env.PLEROMA_URL as string | ||
|
||
const access_token: string = process.env.PLEROMA_ACCESS_TOKEN as string | ||
|
||
const client = generator('pleroma', BASE_URL, access_token) | ||
|
||
new Promise(resolve => { | ||
rl.question('Toot: ', status => { | ||
let now = new Date() | ||
now.setMinutes(now.getMinutes() + 6) | ||
client | ||
.postStatus(status, { | ||
scheduled_at: now.toISOString(), | ||
visibility: 'private' | ||
}) | ||
.then((res: Response<Entity.Status | Entity.ScheduledStatus>) => { | ||
console.log(res) | ||
rl.close() | ||
resolve(res) | ||
}) | ||
.catch(err => { | ||
console.error(err) | ||
rl.close() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters