/// <summary>
        /// Creates the app on Mastodon instance.
        /// </summary>
        /// <returns>MastodonApp.</returns>
        /// <param name="clientName">Client name.</param>
        /// <param name="redirectUris">Redirect uris.</param>
        /// <param name="scope">Scope.</param>
        /// <param name="token">Token.</param>
        public async Task <MastodonApp> CreateApp(string clientName, Uri redirectUris, OAuthAccessScope scope, CancellationToken?token = null)
        {
            var data = new Dictionary <string, string> {
                { "client_name", clientName },
                { "redirect_uris", redirectUris.AbsoluteUri },
                { "scope", scope.Value },
            };
            var response = await apiBase.PostAsync("/api/v1/apps", data, null, token);

            return(await response
                   .Content.ReadAsStringAsync()
                   .ContinueWith((task) => JsonConvert.DeserializeObject <MastodonApp>(task.Result)));
        }
Пример #2
0
        public async Task <Relationship> Follow(string id, CancellationToken?token = null)
        {
            var path     = $"/api/v1/accounts/{id}/follow";
            var response = await apiBase.PostAsync(path, null, authorizationHeader, token);

            return(await response
                   .Content.ReadAsStringAsync()
                   .ContinueWith((task) => JsonConvert.DeserializeObject <Relationship>(task.Result)));
        }