Compare commits
2 commits
82bb4438a6
...
c38829a1b2
Author | SHA1 | Date | |
---|---|---|---|
|
c38829a1b2 | ||
|
616837db6d |
1 changed files with 9 additions and 19 deletions
|
@ -358,7 +358,7 @@ public class Pleroma
|
|||
/// <param name="mime">The MIME type of the file.</param>
|
||||
/// <param name="file">An array containing the file's contents.</param>
|
||||
/// <returns>A handle of the uploaded file, including its ID and URLs.</returns>
|
||||
public Task<Attachment> Upload(CommonMIMEs mime, byte[] file) => Upload(CommonMIMEString(mime), file);
|
||||
public Task<Attachment> Upload(CommonMIMEs mime, byte[] file, string name = "file") => Upload(CommonMIMEString(mime), file, name);
|
||||
|
||||
/// <summary>
|
||||
/// Uploads a file to the server. The resulting attachment can then be included in a status as an attachment.
|
||||
|
@ -366,7 +366,7 @@ public class Pleroma
|
|||
/// <param name="mime">The MIME type of the file.</param>
|
||||
/// <param name="file">An array containing the file's contents.</param>
|
||||
/// <returns>A handle of the uploaded file, including its ID and URLs.</returns>
|
||||
public Task<Attachment> Upload(string mime, byte[] file) => Upload(mime, new ByteArrayContent(file));
|
||||
public Task<Attachment> Upload(string mime, byte[] file, string name = "file") => Upload(mime, new ByteArrayContent(file), name);
|
||||
|
||||
/// <summary>
|
||||
/// Uploads a file to the server. The resulting attachment can then be included in a status as an attachment.
|
||||
|
@ -374,7 +374,7 @@ public class Pleroma
|
|||
/// <param name="mime">The MIME type of the file.</param>
|
||||
/// <param name="stream">A stream of the file's contents.</param>
|
||||
/// <returns>A handle of the uploaded file, including its ID and URLs.</returns>
|
||||
public Task<Attachment> Upload(CommonMIMEs mime, Stream stream) => Upload(CommonMIMEString(mime), stream);
|
||||
public Task<Attachment> Upload(CommonMIMEs mime, Stream stream, string name = "file") => Upload(CommonMIMEString(mime), stream, name);
|
||||
|
||||
/// <summary>
|
||||
/// Uploads a file to the server. The resulting attachment can then be included in a status as an attachment.
|
||||
|
@ -382,9 +382,9 @@ public class Pleroma
|
|||
/// <param name="mime">The MIME type of the file.</param>
|
||||
/// <param name="stream">A stream of the file's contents.</param>
|
||||
/// <returns>A handle of the uploaded file, including its ID and URLs.</returns>
|
||||
public Task<Attachment> Upload(string mime, Stream stream) => Upload(mime, new StreamContent(stream));
|
||||
public Task<Attachment> Upload(string mime, Stream stream, string name = "file") => Upload(mime, new StreamContent(stream), name);
|
||||
|
||||
async Task<Attachment> Upload(string mime, HttpContent content)
|
||||
async Task<Attachment> Upload(string mime, HttpContent content, string name)
|
||||
{
|
||||
return (await Retry<Attachment>(() =>
|
||||
{
|
||||
|
@ -392,7 +392,7 @@ public class Pleroma
|
|||
content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
|
||||
{
|
||||
Name = "\"file\"",
|
||||
FileName = $"\"{Random.Shared.NextInt64()}\"",
|
||||
FileName = $"\"{name}\"",
|
||||
};
|
||||
|
||||
MultipartFormDataContent form = [content];
|
||||
|
@ -772,22 +772,12 @@ public class Pleroma
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a unicode reaction to a status.
|
||||
/// Adds a reaction to a status.
|
||||
/// </summary>
|
||||
/// <param name="status">The status to react to.</param>
|
||||
/// <param name="emoji">The unicode emoji.</param>
|
||||
/// <param name="emoji">The unicode emoji or custom emoji.</param>
|
||||
/// <returns>The new state of the status, if it exists.</returns>
|
||||
public Task<Status?> React(StatusID status, char emoji) => ReactInline(status, emoji.ToString());
|
||||
|
||||
/// <summary>
|
||||
/// Adds a custom reaction to a status.
|
||||
/// </summary>
|
||||
/// <param name="status">The status to react to.</param>
|
||||
/// <param name="emojiName">The custom emoji's name.</param>
|
||||
/// <returns>The new state of the status, if it exists.</returns>
|
||||
public Task<Status?> React(StatusID status, string emojiName) => ReactInline(status, $":{emojiName}:");
|
||||
|
||||
Task<Status?> ReactInline(StatusID status, string emoji)
|
||||
public Task<Status?> React(StatusID status, string emoji)
|
||||
{
|
||||
return Retry<Status?>(() => new HttpRequestMessage(HttpMethod.Put, $"/api/v1/pleroma/statuses/{WebUtility.UrlEncode(status.ID)}/reactions/{WebUtility.UrlEncode(emoji)}"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue