-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
317 changed files
with
1,165 additions
and
3,056 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
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,33 @@ | ||
# Disboard.Misskey | ||
|
||
Disboard.Misskey は、 Disboard の Misskey 拡張です。 | ||
REST 形式 API と Streaming (WebSocket) 形式 API の両方をサポートしています。 | ||
|
||
なお、一部の特権権限な必要な API と、リバーシ (およびゲーム) の API には対応していません。 | ||
|
||
|
||
## REST 形式 API | ||
|
||
Disboard では、 Streaming を除く全ての API に対して、 REST での呼び出しが可能です。 | ||
REST 形式の API は、`~Async()` なメソッドで提供しており、認証情報さえあれば呼び出しが可能です。 | ||
|
||
|
||
## Streaming (WebSocket) 形式 API | ||
|
||
Misskey では、 REST の他に、すでに接続している WebSocket にリクエストをのせて API の呼び出しが可能です。 | ||
Disboard ではこの形式の API 呼び出しにも対応しています。 | ||
|
||
Streaming (WebSocket) 形式での呼び出しには、予め WebSocket コネクションを開いておく必要があります。 | ||
|
||
```csharp | ||
await misskey.Streaming.ConnectAsync(); | ||
``` | ||
|
||
コネクションを開いたら、 `~WsAsync()` なメソッドを呼び出すことで、 WebSocket コネクションを使ってリクエストを行えます。 | ||
ただし、全ての API がサポートされているわけではなく、一部対象外となっている API もあります。 | ||
|
||
WebSocket コネクションを閉じるには、 `Disconnect()` を呼び出します。 | ||
|
||
```csharp | ||
misskey.Disconnect(); | ||
``` |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
- name: Introduction | ||
href: intro.md | ||
- name: Extend Disboard | ||
href: extend.md | ||
href: extend.md | ||
- name: Misskey | ||
href: misskey.md |
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
37 changes: 37 additions & 0 deletions
37
Source/Disboard.Mastodon/Clients/ScheduledStatusesClient.cs
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,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
using Disboard.Clients; | ||
using Disboard.Extensions; | ||
using Disboard.Mastodon.Models; | ||
|
||
namespace Disboard.Mastodon.Clients | ||
{ | ||
public class ScheduledStatusesClient : ApiClient<MastodonClient> | ||
{ | ||
protected internal ScheduledStatusesClient(MastodonClient client) : base(client, "/api/v1/scheduled_statuses") { } | ||
|
||
public async Task<List<ScheduledStatus>> ListAsync() | ||
{ | ||
return await GetAsync<List<ScheduledStatus>>().Stay(); | ||
} | ||
|
||
public async Task<ScheduledStatus> ShowAsync(long id) | ||
{ | ||
return await GetAsync<ScheduledStatus>($"/{id}").Stay(); | ||
} | ||
|
||
public async Task<ScheduledStatus> UpdateAsync(long id, DateTime scheduledAt) | ||
{ | ||
var parameters = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>("scheduled_at", scheduledAt.ToString("O")) }; // ISO 8601} | ||
|
||
return await PutAsync<ScheduledStatus>($"/{id}", parameters).Stay(); | ||
} | ||
|
||
public async Task DeleteAsync(long id) | ||
{ | ||
await DeleteAsync($"/{id}").Stay(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
using Disboard.Models; | ||
|
||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Disboard.Mastodon.Models | ||
{ | ||
public class ScheduledStatus : ApiResponse | ||
{ | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
[JsonProperty("scheduled_at")] | ||
[JsonConverter(typeof(IsoDateTimeConverter))] | ||
public DateTime ScheduledAt { get; set; } | ||
|
||
[JsonProperty("params")] | ||
public StatusParams Params { get; set; } | ||
|
||
[JsonProperty("media_attachments")] | ||
public List<Attachment> MediaAttachments { get; set; } | ||
} | ||
} |
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,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
using Disboard.Mastodon.Enums; | ||
using Disboard.Models; | ||
|
||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Disboard.Mastodon.Models | ||
{ | ||
public class StatusParams : ApiResponse | ||
{ | ||
[JsonProperty("text")] | ||
public string Text { get; set; } | ||
|
||
[JsonProperty("in_reply_to_id")] | ||
public string InReplyToId { get; set; } | ||
|
||
[JsonProperty("media_ids")] | ||
public List<string> MediaIds { get; set; } | ||
|
||
[JsonProperty("sensitive")] | ||
public bool? IsSensitive { get; set; } | ||
|
||
[JsonProperty("spoiler_text")] | ||
public string SpoilerText { get; set; } | ||
|
||
[JsonProperty("visibility")] | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public VisibilityType? Visibility { get; set; } | ||
|
||
[JsonProperty("scheduled_at")] | ||
[JsonConverter(typeof(IsoDateTimeConverter))] | ||
public DateTime? ScheduledAt { get; set; } | ||
|
||
[JsonProperty("application_id")] | ||
public string ApplicationId { get; set; } | ||
|
||
[JsonProperty("idempotency")] | ||
public string Idempotency { get; set; } | ||
} | ||
} |
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
Oops, something went wrong.