Mastodot.MastodonClient.GetClient(string)

Here are the examples of the csharp api Mastodot.MastodonClient.GetClient(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

53 Examples 7

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Status> PostNewStatus(string status, int? inReplyToId = null, IEnumerable<int> mediaIds = null, bool? sensitive = default(bool?), string spoilerText = null, Enums.Visibility visibility = Enums.Visibility.Public)
        {
            var param = new Dictionary<string, object>
            {
                {"status", status},
                {"in_reply_to_id", inReplyToId.HasValue? (object)inReplyToId.Value: null},
                {"sensitive", sensitive.HasValue? (object)sensitive.Value: null},
                {"spoiler_text", spoilerText},
                {"visibility", visibility.ToString().ToLower()},
            }.Where(x => x.Value != null)
             .Select(x => new KeyValuePair<string, string>(x.Key, x.Value.ToString()))
             .ToList();

            if (mediaIds != null)
            {
                param.AddIntArrayParameter("media_ids", mediaIds);
            }

            return GetClient().Post<Status>(ApiMethods.PostNewStatus, param);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task DeleteStatus(int id)
        {
            return GetClient().Delete(string.Format(ApiMethods.DeleteStatus, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Status> Reblog(int id)
        {
            return GetClient().Post<Status>(string.Format(ApiMethods.ReblogStatus, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Status> Unreblog(int id)
        {
            return GetClient().Post<Status>(string.Format(ApiMethods.UnreblogStatus, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Status> Favourite(int id)
        {
            return GetClient().Post<Status>(string.Format(ApiMethods.FavouritingStatus, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Status> Unfavourite(int id)
        {
            return GetClient().Post<Status>(string.Format(ApiMethods.UnfavouritingStatus, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Status>> GetRecentHomeTimeline(int? maxId = default(int?), int? sinceId = default(int?)
                                                                      , int limit = 20)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Status>(FullUrl(ApiMethods.GetHomeTimeline, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Account> GetAccount(int id)
        {
            return GetClient().Get<Account>(string.Format(ApiMethods.GetAccount, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Account> GetCurrentAccount()
        {
            return GetClient().Get<Account>(ApiMethods.GetCurrentAccount);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Account> UpdateCurrentAccount(string displayName = null
                                                  , string note = null
                                                  , string avatar = null
                                                  , string header = null)
        {
            var body = new Dictionary<string, string>
            {
                {"display_name", displayName},
                {"note", note},
                {"avatar", avatar},
                {"header", header}
            }.Where(x => x.Value != null);

            return GetClient().Patch<Account>(ApiMethods.UpdateCurrentAccount, body);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> GetFollowers(int id
                                                       , int? maxId = default(int?), int? sinceId = default(int?)
                                                       , int limit = 40)
        {
            var query = new Dictionary<string, object>()
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(string.Format(ApiMethods.GetFollowers, id), query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> GetFollowing(int id
                                                       , int? maxId = default(int?), int? sinceId = default(int?)
                                                       , int limit = 40)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(string.Format(ApiMethods.GetFollowing, id), query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Status>> GetStatuses(int id
                                                     , bool? onlyMedia = default(bool?), bool? excludeReplies = default(bool?)
                                                     , int? maxId = default(int?), int? sinceId = default(int?)
                                                     , int limit = 20)
        {
            var query = new Dictionary<string, object>
            {
                {"only_media", onlyMedia},
                {"exclude_replies", excludeReplies},
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Status>(FullUrl(string.Format(ApiMethods.GetStatuses, id), query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> Follow(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.Follow, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> Unfollow(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.Unfollow, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> Block(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.Block, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> Unblock(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.Unblock, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> Mute(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.Mute, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> Unmute(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.Unmute, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> MuteBoosts(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.MuteBoosts, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Relationship> UnmuteBoosts(int id)
        {
            return GetClient().Post<Relationship>(string.Format(ApiMethods.UnmuteBoosts, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<IEnumerable<Relationship>> GetRelationships(IEnumerable<int> ids)
        {
            var query = new Dictionary<string, object>
            {
                {"id", ids}
            }.ToQueryString();

            return GetClient().Get<IEnumerable<Relationship>>(FullUrl(ApiMethods.GetRelationships, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> SearchAccount(string searchQuery
                                                        , int limit = 40)
        {
            var query = new Dictionary<string, object>
            {
                {"q", searchQuery},
                {"limit", limit}
            }.ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(ApiMethods.SearchForAccounts, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> GetBlockedUsers(int? maxId = default(int?), int? sinceId = default(int?)
                                                          , int limit = 40)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(ApiMethods.GetBlocks, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Status>> GetFavourites(int? maxId = default(int?), int? sinceId = default(int?)
                                                       , int limit = 20)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Status>(FullUrl(ApiMethods.GetFavourites, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> GetFollowRequests(int? maxId = default(int?), int? sinceId = default(int?)
                                                            , int limit = 40)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(ApiMethods.GetFollowRequests, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task AuthorizeFollowRequest(int id)
        {
            return GetClient().Post(string.Format(ApiMethods.AuthorizeFollowRequest, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task RejectFollowRequest(int id)
        {
            return GetClient().Post(string.Format(ApiMethods.RejectFollowRequest, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Account> RemoteFollow(string fullUserId)
        {
            var param = new Dictionary<string, object>
            {
                {"uri", fullUserId}
            }.Select(x => new KeyValuePair<string, string>(x.Key, x.Value.ToString()));

            return GetClient().Post<Account>(ApiMethods.RemoteFollow, param);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Instance> GetInstance()
        {
            return GetClient().Get<Instance>(ApiMethods.GetInstance);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Attachment> UploadMedia(string filePath)
        {
            return GetClient().PostWithMedia<Attachment>(ApiMethods.UploadMedia, filePath);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Attachment> UploadMedia(byte[] image)
        {
            return GetClient().PostWithMedia<Attachment>(ApiMethods.UploadMedia, image);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> GetMutes(int? maxId = default(int?), int? sinceId = default(int?)
                                                   , int limit = 40)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(ApiMethods.GetMutes, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Notification>> GetNotifications(int? maxId = default(int?), int? sinceId = default(int?)
                                                                , int limit = 15)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Notification>(FullUrl(ApiMethods.GetNotifications, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Notification> GetSingleNotification(int id)
        {
            return GetClient().Get<Notification>(string.Format(ApiMethods.GetSingleNotification, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task ClearNotifications()
        {
            return GetClient().Post(ApiMethods.ClearNotifications);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<IEnumerable<Report>> GetReports()
        {
            return GetClient().Get<IEnumerable<Report>>(ApiMethods.GetReports);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Report> ReportUser(int accountId, IEnumerable<int> statusIds, string comment)
        {
            var param = new Dictionary<string, object>
            {
                {"account_id", accountId},
                {"comment", comment}
            }.Select(x => new KeyValuePair<string, string>(x.Key, x.Value.ToString()))
            .ToList();
            param.AddIntArrayParameter("status_ids", statusIds);

            return GetClient().Post<Report>(ApiMethods.ReportUser, param);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Results> Search(string searchQuery, bool searchGlobal = false)
        {
            var query = new Dictionary<string, object>
            {
                {"q", searchQuery},
                {"resolve", searchGlobal},
            }.ToQueryString();

            return GetClient().Get<Results>(FullUrl(ApiMethods.Search, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Status> GetStatus(int id)
        {
            return GetClient().Get<Status>(string.Format(ApiMethods.GetStatus, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Status>> GetRecentPublicTimeline(bool? local = null
                                                                        , int? maxId = default(int?), int? sinceId = default(int?)
                                                                        , int limit = 20)
        {
            var query = new Dictionary<string, object>
            {
                {"local", local},
                {"limit", limit}
            }.AddRangeParameter(maxId, sinceId)
             .ToQueryString();

            return GetClient().GetCollection<Status>(FullUrl(ApiMethods.GetPublicTimeline, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public IObservable<IStreamEnreplacedy> GetObservableHomeTimeline(string host = null)
        {
            return GetClient(host).GetObservable(ApiMethods.GetUserStream);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public IObservable<IStreamEnreplacedy> GetObservablePublicTimeline(string host = null)
        {
            return GetClient(host).GetObservable(ApiMethods.GetPublicStream);
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public IObservable<IStreamEnreplacedy> GetObservableHashtagTimeline(string hashtag, string host = null)
        {
            var query = new Dictionary<string, object>
            {
                {"tag", hashtag},
            }.Where(x => !string.IsNullOrWhiteSpace(x.Value.ToString()))
             .Select(x => x.ToUrlFormattedQueryString())
             .Aggregate((x, y) => $"{x}&{y}");

            return GetClient(host).GetObservable(FullUrl(ApiMethods.GetPublicStream, query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<string> CustomGet(string type, IDictionary<string, object> param = null)
        {
            var query = (param as Dictionary<string, object>)?.ToQueryString();

            return GetClient().Get(FullUrl(string.Format(ApiMethods.APIBaseUrl, type), query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<T> CustomGet<T>(string type, IDictionary<string, object> param = null)
            where T : clreplaced
        {
            var query = (param as Dictionary<string, object>)?.ToQueryString();

            return GetClient().Get<T>(FullUrl(string.Format(ApiMethods.APIBaseUrl, type), query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Context> GetStausContext(int id)
        {
            return GetClient().Get<Context>(string.Format(ApiMethods.GetStatusContext, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<Card> GetStatusCard(int id)
        {
            return GetClient().Get<Card>(string.Format(ApiMethods.GetStatusCard, id));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> GetStatusRebloggedAccounts(int id
                                                                    , int? maxId = default(int?), int? sinceId = default(int?)
                                                                    , int limit = 40)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }
                .AddRangeParameter(maxId, sinceId)
                .ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(string.Format(ApiMethods.GetStatusRebloggedBy, id), query));
        }

19 Source : MastodonClient.cs
with MIT License
from yamachu

public Task<ResponseCollection<Account>> GetStatusFavouritedAccounts(int id
                                                                     , int? maxId = default(int?), int? sinceId = default(int?)
                                                                     , int limit = 40)
        {
            var query = new Dictionary<string, object>
            {
                {"limit", limit}
            }
                .AddRangeParameter(maxId, sinceId)
                .ToQueryString();

            return GetClient().GetCollection<Account>(FullUrl(string.Format(ApiMethods.GetStatusFavouritedBy, id), query));
        }

See More Examples