예제 #1
0
 public static Auth ToMastodonAuth(this UserMastodonConnectionDetails connectionDetails) => new Auth
 {
     AccessToken = connectionDetails.ApiAccessToken,
     CreatedAt   = connectionDetails.CreatedAt,
     Scope       = connectionDetails.Scope,
     TokenType   = connectionDetails.TokenType
 };
예제 #2
0
 public MastodonApiWrapper(Registration registration, UserMastodonConnectionDetails userMastodonConnectionDetails, IAuthenticationClient authClient = null, IMastodonClient mastodonClient = null)
 {
     AppRegistration = registration;
     MastodonHostInstance = AppRegistration?.Instance;
     UserMastodonConnectionDetails = userMastodonConnectionDetails;
     _authClient = authClient;
     _mastodonClient = mastodonClient;
 }
예제 #3
0
        public void UserMastodonConnectionDetailsTest()
        {
            var userMastodonConnectionDetails = new UserMastodonConnectionDetails();
            var apiWrapper = new MastodonApiWrapper {
                UserMastodonConnectionDetails = userMastodonConnectionDetails
            };

            Assert.Equal(userMastodonConnectionDetails, apiWrapper.UserMastodonConnectionDetails);
        }
예제 #4
0
 public async Task<UserMastodonConnectionDetails> Connect(string token)
 {
     UserMastodonConnectionDetails = (await BuildMastodonAuthenticationClient().ConnectWithCode(token)).ToHerdConnectionDetails(AppRegistration.ID, "-1");
     UserMastodonConnectionDetails.MastodonUserID = (await GetOrCreateMastodonClient().GetCurrentUser()).Id.ToString();
     return UserMastodonConnectionDetails;
 }