public async Task OAuth2_RefreshToken() { var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var loginCredentials = new Credentials(); loginCredentials.ClientId = Settings.ClientId; loginCredentials.ClientSecret = Settings.ClientSecret; loginCredentials.Username = Settings.Username; loginCredentials.Password = Settings.Password; var loginResult = await client.OAuth2.LoginAsync(loginCredentials); Assert.That(loginResult.AccessToken, Is.Not.Empty); var credentials = new Credentials(); credentials.ClientId = Settings.ClientId; credentials.ClientSecret = Settings.ClientSecret; credentials.RefreshToken = loginResult.RefreshToken; var refreshResult = await client.OAuth2.RefreshTokenAsync(credentials); Assert.That(refreshResult.AccessToken, Is.Not.Empty); Assert.That(refreshResult.RefreshToken, Is.Not.Empty); Assert.That(refreshResult.ExpiresIn, Is.Not.Null); }
/// <summary> /// Initialize SoundCloud API with the provided ClientID. /// </summary> protected async Task init() { client = SoundCloudClient.CreateUnauthorized(clientId); var entity = await client.Resolve.GetEntityAsync("https://soundcloud.com/" + username); user = entity as User; }
public void Test_OAuth() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var oAuth2 = client.OAuth2; Assert.That(oAuth2, Is.Not.Null); }
public void Test_Track() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var tracks = client.Tracks; Assert.That(tracks, Is.Not.Null); }
public void Test_Me() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var me = client.Me; Assert.That(me, Is.Not.Null); }
public async Task Test_Comment_Get() { var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var result = await client.Comments.GetAsync(256985338); Assert.That(result.Body, Does.Contain("TestComment")); }
public void Test_Apps() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var apps = client.Apps; Assert.That(apps, Is.Not.Null); }
public void Test_Comments() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var comments = client.Comments; Assert.That(comments, Is.Not.Null); }
public void Test_User() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var user = client.Users; Assert.That(user, Is.Not.Null); }
public void Test_Groups_Get() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var groups = client.Groups.Get(GroupId); Assert.That(groups.name, Is.EqualTo(SharpSoundGroupName)); }
public void Resolve_GetUrl_Wrong_Url() { var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var exception = Assert.ThrowsAsync <SoundCloudApiException>(async() => await client.Resolve.GetEntityAsync("https://soundcloud.com/sharpsound-12345")); Assert.That(exception.HttpStatusCode, Is.EqualTo(HttpStatusCode.NotFound)); }
public void Test_Tracks_GetList() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var tracks = client.Tracks.Get().Take(150).ToList(); Assert.That(tracks.Count, Is.EqualTo(150)); }
public SoundCloud(string username, string clientid) { this.username = username; client = SoundCloudClient.CreateUnauthorized(clientid); var entity = client.Resolve.GetEntityAsync("https://soundcloud.com/" + username).GetAwaiter().GetResult(); user = entity as User; }
public void Test_Resolve_GetUrl_Wrong_Url() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var result = client.Resolve.GetEntity("https://soundcloud.com/sharpsound-12345"); Assert.That(result, Is.Null); }
public void Test_Resolve() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var resolve = client.Resolve; Assert.That(resolve, Is.Not.Null); }
public void Test_Playlist() { var client = SoundCloudClient.CreateUnauthorized(ClientId); var playlists = client.Playlists; Assert.That(playlists, Is.Not.Null); }
public async Task Users_Get() { var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var user = await client.Users.GetAsync(UserId); Assert.That(user, Is.Not.Null); Assert.That(user.Username, Is.EqualTo("sharpsound")); }
public void Test_Users_Get() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var user = client.Users.Get(UserId); Assert.That(user, Is.Not.Null); Assert.That(user.username, Is.EqualTo("sharpsound")); }
public void Test_Resolve_GetUrl() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var result = client.Resolve.GetEntity("https://soundcloud.com/sharpsound-2"); Assert.That(result.kind, Is.EqualTo(Kind.User)); Assert.That(result, Is.TypeOf <User>()); }
public async Task Resolve_GetUrl() { var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var result = await client.Resolve.GetEntityAsync("https://soundcloud.com/sharpsound-2"); Assert.That(result.Kind, Is.EqualTo(Kind.User)); Assert.That(result, Is.TypeOf <User>()); }
public async Task Tracks_Get() { var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var tracks = await client.Tracks.GetAsync(TrackId); Assert.That(tracks, Is.Not.Null); Assert.That(tracks.Genre, Is.EqualTo("Sample")); Assert.That(tracks.PlaybackCount, Is.GreaterThan(0)); }
public void Test_Playlists_GetList() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var builder = new PlaylistQueryBuilder("diplo"); builder.Representation = RepresentationMode.Compact; var playlist = client.Playlists.Get(builder).Take(10).ToList(); Assert.That(playlist.Count, Is.EqualTo(10)); }
public void Test_Users_GetWebProfiles() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var user = new User(); user.id = UserId; var groups = client.Users.GetWebProfiles(user).ToList(); Assert.That(groups.Any(), Is.True); }
public void Test_Tracks_GetFavoriters() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var track = new Track(); track.id = Track2Id; var users = client.Tracks.GetFavoriters(track); Assert.That(users.Any(), Is.True); }
public void Test_Groups_GetModerators() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var group = new Group(); group.id = GroupId; var moderators = client.Groups.GetModerators(group).Take(100).ToList(); Assert.That(moderators.Count, Is.GreaterThan(0)); }
public void Test_Users_GetFollowings() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var user = new User(); user.id = UserId; var followings = client.Users.GetFollowings(user); Assert.That(followings.Any(), Is.True); }
public void Test_Groups_GetMembers() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var group = new Group(); group.id = GroupId; var members = client.Groups.GetMembers(group).Take(100).ToList(); Assert.That(members.Count, Is.GreaterThan(0)); Assert.That(members.Any(x => x.id == UserId), Is.True); }
public async Task OAuth2_ClientCredentials() { var credentials = new Credentials(); credentials.ClientId = Settings.ClientId; credentials.ClientSecret = Settings.ClientSecret; var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var postedCredentials = await client.OAuth2.ClientCredentialsAsync(credentials); Assert.That(postedCredentials.AccessToken, Is.Not.Empty); Assert.That(postedCredentials.RefreshToken, Is.Not.Empty); Assert.That(postedCredentials.ExpiresIn, Is.Not.Null); }
public void Test_Users_GetGroups() { var client = SoundCloudClient.CreateUnauthorized(_settings.ClientId); var user = new User(); user.id = UserId; var groups = client.Users.GetGroups(user).ToList(); Assert.That(groups.Any(), Is.True); var sampleGroup = groups.FirstOrDefault(x => x.name == SharpSoundGroupName); Assert.That(sampleGroup, Is.Not.Null); }
public async Task Tracks_GetList() { var client = SoundCloudClient.CreateUnauthorized(Settings.ClientId); var result = await client.Tracks.GetAllAsync(); Assert.That(result.Any(), Is.True); if (result.HasNextPage) { var nextResult = await result.GetNextPageAsync(); Assert.That(nextResult.Any(), Is.True); Assert.That(result.First().Id, Is.Not.EqualTo(nextResult.First().Id)); } }