コード例 #1
0
ファイル: NetflixHandler.cs プロジェクト: ebouwsema/quikpix
        public NetflixHandler(string userToken, string userSecret, string userID)
        {
            this.Config = new NetflixConfig()
            {
                UserToken = (userToken ?? ""),
                UserSecret = (userSecret ?? ""),
                UserID = (userID ?? "")
            };

            var oauthConfig = new OAuthConfig()
            {
                OAuthConsumerKey = NetflixConfig.CONSUMER_KEY,
                OAuthConsumerSecret = NetflixConfig.CONSUMER_SECRET,
                OAuthToken = this.Config.UserToken,
                OAuthTokenSecret = this.Config.UserSecret,

                RequestTokenUri = new Uri(NetflixConfig.REQUEST_TOKEN_URL),
                AccessTokenUri = new Uri(NetflixConfig.ACCESS_TOKEN_URL)
            };

            this.oauthHandler = new OAuthHandler(oauthConfig);

            this.Users = new NetflixUserHandler(this);
            this.Catalog = new NetflixCatalogHandler(this);
        }
コード例 #2
0
ファイル: OAuthRequest.cs プロジェクト: ebouwsema/quikpix
        public static OAuthRequest GenerateConsumerRequest(OAuthConfig config, Uri requestUri, NameValueCollection requestParams, HttpMethods httpMethod)
        {
            if (config == null)
                throw new ArgumentNullException("config");
            if (requestUri == null)
                throw new ArgumentNullException("requestUri");
            if (requestParams == null)
                requestParams = new NameValueCollection();

            var request = new OAuthRequest();
            request.requestUri = requestUri;
            request.config = config;
            request.httpMethod = httpMethod;
            request.requestType = RequestTypes.ConsumerRequest;

            // Parse any existing URI Params
            request.ParseUriParams(requestUri, requestParams);

            // Assign request params
            request.requestParams = requestParams;

            // Setup required params
            request.requestParams[config.OAuthConsumerKeyKey] = config.OAuthConsumerKey;

            return request;
        }
コード例 #3
0
ファイル: OAuthRequest.cs プロジェクト: ebouwsema/quikpix
        public static OAuthRequest GenerateProtectedRequest(OAuthConfig config, Uri requestUri, NameValueCollection requestParams, HttpMethods httpMethod)
        {
            var request = GenerateSignedRequest(config, requestUri, requestParams, httpMethod);

            request.requestParams[config.OAuthTokenKey] = config.OAuthToken;

            request.requestType = RequestTypes.ProtectedRequest;

            return request;
        }
コード例 #4
0
ファイル: OAuthHandler.cs プロジェクト: ebouwsema/quikpix
 public OAuthHandler(OAuthConfig config)
 {
     if (config == null)
         throw new ArgumentException("Config is required.");
     this.Config = config;
 }
コード例 #5
0
ファイル: OAuthRequest.cs プロジェクト: ebouwsema/quikpix
        public static OAuthRequest GenerateSignedRequest(OAuthConfig config, Uri requestUri, NameValueCollection requestParams, HttpMethods httpMethod)
        {
            var request = GenerateConsumerRequest(config, requestUri, requestParams, httpMethod);

            request.requestParams[config.OAuthVersionKey] = config.OAuthVersion;
            request.requestParams[config.OAuthNonceKey] = request.GenerateNonce();
            request.requestParams[config.OAuthTimeStampKey] = request.GenerateTimeStamp();
            request.requestParams[config.OAuthSignatureMethodKey] = config.OAuthSignatureMethod;

            request.requestType = RequestTypes.SignedRequest;

            return request;
        }