MastodonAliases.

MastodonSendToot(ICakeContext, string, string, string, string, TootVisibility) Method

Summary

Send a Toot using the "Mastodon" REST API.
Assembly
Cake.Mastodon.dll
Namespace
Cake.Mastodon
Containing Type
MastodonAliases

Syntax

public static TootResponse MastodonSendToot(this ICakeContext context, string hostName, string accessToken, string text, string idempotencyKey = null, TootVisibility visibility = 0)

Examples

    string accessToken = EnvironmentVariable("MASTODON_ACCESS_TOKEN")

    var result = MastodonSendToot("https://botsin.space", accessToken, "Merely testing three", "I1");
    Information($"Success: {result.IsSuccess} Code: {result.StatusCode} Phrase: {result.ReasonPhrase} Body: {result.Body}");

Attributes

Type Description
CakeMethodAliasAttribute
CakeNamespaceImportAttribute

Parameters

Name Type Description
context ICakeContext The Cake Context.
hostName string Hostname where you Mastodon account lives, i.e. https://botsin.space.
accessToken string You app's access token - don't share this.
text string Text content of the status.
idempotencyKey string Prevent duplicate submissions of the same status. Idempotency keys are stored for up to 1 hour, and can be any arbitrary string. Consider using a hash or UUID generated client-side.
visibility TootVisibility Visibility of the posted status.

Return Value

Type Description
TootResponse