コード例 #1
0
        public static ApiEnvironmentType DetermineEnvironmentType(string[] args)
        {
            new OptionSet
            {
                { OptionProduction, v => _environmentType = ApiEnvironmentType.PRODUCTION }
            }.Parse(args);

            return(_environmentType);
        }
コード例 #2
0
ファイル: Bunq.cs プロジェクト: SvenHamers/HueBunq
        public Bunq(string ApiKey, bool SandBox, PHue.Hue hueCommands)
        {
            ApiEnvironmentType EnvType = ApiEnvironmentType.PRODUCTION;

            if (SandBox)
            {
                EnvType = ApiEnvironmentType.SANDBOX;
            }

            _bunqApi = ApiContext.Create(EnvType, ApiKey, "BunqHue");
            BunqContext.LoadApiContext(_bunqApi);
            //Every minut
            _bunqUpdateTimer = new System.Timers.Timer(10000);
            _hueCommands     = hueCommands;
        }
コード例 #3
0
        protected virtual string GetApiEndPoint(ApiEnvironmentType apiEnvironment, ApiCredentialType apiCredentialType, ApiProtocol apiProtocol)
        {
            if (apiEnvironment != ApiEnvironmentType.Sandbox && apiEnvironment != ApiEnvironmentType.Production)
            {
                throw new Exception(string.Format("Invalid value of apiEnvironment: {0}", apiEnvironment));
            }

            if (apiCredentialType != ApiCredentialType.Signature && apiCredentialType != ApiCredentialType.Certificate)
            {
                throw new Exception(string.Format("Invalid value of apiCredentialType: {0}", apiCredentialType));
            }

            if (apiProtocol != ApiProtocol.NVP && apiProtocol != ApiProtocol.SOAP)
            {
                throw new Exception(string.Format("Invalid value of apiProtocol: {0}", apiProtocol));
            }

            return(string.Format(SignatureApiUrl,
                                 apiEnvironment == ApiEnvironmentType.Sandbox ? Sandbox : Production,
                                 apiCredentialType == ApiCredentialType.Signature ? Signature : Certificate,
                                 apiProtocol == ApiProtocol.NVP ? NVP : SOAP));
        }
コード例 #4
0
 public BunqLib(ApiEnvironmentType environmentType)
 {
     EnvironmentType = environmentType;
     SetupContext();
 }
コード例 #5
0
 public BunqLib(ApiEnvironmentType environmentType)
 {
     EnvironmentType = environmentType;
     SetupContext();
     RequestSpendingMoneyIfNeeded();
 }
コード例 #6
0
 protected virtual string GetExpressCheckoutRedirectUrl(ApiEnvironmentType apiEnvironment, string token)
 {
     return(string.Format(RedirectToUrl,
                          apiEnvironment == ApiEnvironmentType.Sandbox ? Sandbox : Production,
                          string.Format("cmd=_express-checkout&token={0}", token)));
 }
コード例 #7
0
ファイル: TestOauth.cs プロジェクト: bunq/tinker_csharp
 private static ApiContext CreateApiContextByOauthToken(OauthAccessToken token, ApiEnvironmentType environmentType)
 {
     return(ApiContext.Create(
                environmentType,
                token.Token,
                API_DEVICE_DESCRIPTION
                ));
 }