(title: string, htmlContent: string)
| 549 | } |
| 550 | |
| 551 | async createPage(title: string, htmlContent: string): Promise<{ url: string; path: string }> { |
| 552 | const token = await this.getAccessToken(); |
| 553 | |
| 554 | const response = await HttpClient.makeRequest('https://api.telegra.ph/createPage', { |
| 555 | method: 'POST', |
| 556 | data: { |
| 557 | access_token: token, |
| 558 | title, |
| 559 | content: [{ tag: 'div', children: [htmlContent] }] |
| 560 | } |
| 561 | }); |
| 562 | |
| 563 | if (response.status === 200 && response.data.ok) { |
| 564 | return { |
| 565 | url: response.data.result.url || '', |
| 566 | path: response.data.result.path || '' |
| 567 | }; |
| 568 | } |
| 569 | |
| 570 | throw new Error('Failed to create Telegraph page'); |
| 571 | } |
| 572 | |
| 573 | async editPage(path: string, title: string, htmlContent: string): Promise<boolean> { |
| 574 | try { |
nothing calls this directly
no test coverage detected