public static Auth ToMastodonAuth(this UserMastodonConnectionDetails connectionDetails) => new Auth { AccessToken = connectionDetails.ApiAccessToken, CreatedAt = connectionDetails.CreatedAt, Scope = connectionDetails.Scope, TokenType = connectionDetails.TokenType };
public MastodonApiWrapper(Registration registration, UserMastodonConnectionDetails userMastodonConnectionDetails, IAuthenticationClient authClient = null, IMastodonClient mastodonClient = null) { AppRegistration = registration; MastodonHostInstance = AppRegistration?.Instance; UserMastodonConnectionDetails = userMastodonConnectionDetails; _authClient = authClient; _mastodonClient = mastodonClient; }
public void UserMastodonConnectionDetailsTest() { var userMastodonConnectionDetails = new UserMastodonConnectionDetails(); var apiWrapper = new MastodonApiWrapper { UserMastodonConnectionDetails = userMastodonConnectionDetails }; Assert.Equal(userMastodonConnectionDetails, apiWrapper.UserMastodonConnectionDetails); }
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; }