Posting a new status

The example below creates a new MastodonHttpService instance from an access token and for the umbracocommunity.social server, and then attempts to post a new statuses:

@using Skybrud.Social.Mastodon
@using Skybrud.Social.Mastodon.Exceptions
@using Skybrud.Social.Mastodon.Models.Statuses
@using Skybrud.Social.Mastodon.Options.Statuses
@using Skybrud.Social.Mastodon.Responses.Statuses

@{

    // Initialize a new HTTP service (basically the API wrapper)
    MastodonHttpService mastodon = MastodonHttpService
        .CreateFromAccessToken("umbracocommunity.social", "Your access token");

    <h3>Created status message</h3>

    try {

        // Make the request to the API
        MastodonStatusResponse response = await mastodon.Statuses.PostStatusAsync(new MastodonPostStatusOptions {
            Status = "Hello world! #test"
        });

        // Get the status message from the response body
        MastodonStatus status = response.Body;

        // Print some information about the status
        <pre>ID: @status.Id</pre>
        <pre>Content: @status.Content</pre>

        // Print the JSON object representing the status message
        <pre>@status.JObject</pre>

    } catch (MastodonHttpException ex) {

        <pre>@ex</pre>
        <pre>@ex.Error</pre>
        <pre>@ex.Response.Body</pre>

        return;

    } catch (Exception ex) {

        <pre>@ex</pre>

        return;

    }

}