Ejemplo n.º 1
0
        public IUriBuilder AddCredentials(SCCredentials credentials, SCAccessToken accessToken)
        {
            if (credentials == null)
                return this;

            if (accessToken != null)
            {
                AddToken(accessToken.AccessToken);
            }

            return AddClientId(credentials.ClientId);
        }
        public IUnauthorizedSoundCloudClient UnauthorizedConnect(string clientId, string clientSecret)
        {
            var credentials = new SCCredentials
            {
                ClientId = clientId,
                ClientSecret = clientSecret
            };

            var soundCloudRawClient = soundCloudRawClientFactory.Create(credentials);
            var soundCloudClient = soundCloudClientBuilder.CreateUnauthorized(soundCloudRawClient);

            return soundCloudClient;
        }
        public override void SetUp()
        {
            base.SetUp();

            scCredentials = new SCCredentials
            {
                ClientId = clientId,
                ClientSecret = clientSecret
            };

            uriBuilderFactory = NewMock<IUriBuilderFactory>();
            webGateway = NewMock<IWebGateway>();
            serializer = NewMock<ISerializer>();
        }
        public ISoundCloudClient Connect(string clientId, string clientSecret, string code, string redirectUri)
        {
            var credentials = new SCCredentials
            {
                ClientId = clientId,
                ClientSecret = clientSecret
            };

            var soundCloudRawClient = soundCloudRawClientFactory.Create(credentials);

            IAuthApi authApi = CreateAuthApi(soundCloudRawClient);
            var accessToken = authApi.AuthorizeByCode(code, redirectUri);

            soundCloudRawClient.AccessToken = accessToken;

            var soundCloudClient = soundCloudClientBuilder.Build(soundCloudRawClient);
            return soundCloudClient;
        }
        public ISoundCloudClient DirectConnect(string clientId, string clientSecret, string userName, string password)
        {
            var credentials = new SCCredentials
            {
                ClientId = clientId,
                ClientSecret = clientSecret
            };

            var soundCloudRawClient = soundCloudRawClientFactory.Create(credentials);

            IAuthApi authApi = CreateAuthApi(soundCloudRawClient);
            var accessToken = authApi.AuthorizeByPassword(userName, password);

            soundCloudRawClient.AccessToken = accessToken;

            var soundCloudClient = soundCloudClientBuilder.Build(soundCloudRawClient);
            return soundCloudClient;
        }
 public ISoundCloudRawClient Create(SCCredentials credentials)
 {
     return new SoundCloudRawClient(credentials, uriBuilderFactory, webGateway, serializer);
 }
        public ISoundCloudClient Connect(SCAccessToken accessToken)
        {
            var credentials = new SCCredentials();

            var soundCloudRawClient = soundCloudRawClientFactory.Create(credentials);

            soundCloudRawClient.AccessToken = accessToken;

            var soundCloudClient = soundCloudClientBuilder.Build(soundCloudRawClient);
            return soundCloudClient;
        }
        public SCAccessToken RefreshToken(string clientId, string clientSecret, string token)
        {
            var credentials = new SCCredentials
            {
                ClientId = clientId,
                ClientSecret = clientSecret
            };

            var soundCloudRawClient = soundCloudRawClientFactory.Create(credentials);
            IAuthApi authApi = CreateAuthApi(soundCloudRawClient);
            return authApi.RefreshToken(token);
        }
        public Uri GetRequestTokenUri(string clientId, string redirectUri, SCResponseType responseType, SCScope scope, SCDisplay display, string state)
        {
            var credentials = new SCCredentials
            {
                ClientId = clientId
            };

            var soundCloudRawClient = soundCloudRawClientFactory.Create(credentials);
            IAuthApi authApi = CreateAuthApi(soundCloudRawClient);
            var requestTokenUri = authApi.GetRequestTokenUri(redirectUri, responseType, scope, display, state);
            return requestTokenUri;
        }