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); }
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; }
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; }
public OAuthHandler(OAuthConfig config) { if (config == null) throw new ArgumentException("Config is required."); this.Config = config; }
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; }