/// <summary>
        /// Initializes a new instance of the
        /// <see cref="Cronofy.CronofyAccessTokenClient"/> class.
        /// </summary>
        /// <param name="accessToken">
        /// The access token for the OAuth authorization for the account, must
        /// not be empty.
        /// </param>
        /// <param name="dataCentre">
        /// The data centre to use.
        /// </param>
        /// <exception cref="System.ArgumentException">
        /// Thrown if <paramref name="accessToken"/> is <code>null</code> or
        /// empty.
        /// </exception>
        public CronofyAccessTokenClient(string accessToken, string dataCentre)
        {
            Preconditions.NotEmpty("accessToken", accessToken);

            this.AccessToken = accessToken;
            this.UrlProvider = UrlProviderFactory.GetProvider(dataCentre);
            this.HttpClient  = new ConcreteHttpClient();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="Cronofy.CronofyOAuthClient"/> class.
        /// </summary>
        /// <param name="clientId">
        /// Your OAuth client_id, must not be blank.
        /// </param>
        /// <param name="clientSecret">
        /// Your OAuth client_secret, must not be blank.
        /// </param>
        /// <param name="dataCentre">
        /// The data centre to use.
        /// </param>
        /// <exception cref="System.ArgumentException">
        /// Thrown if <paramref name="clientId"/> or
        /// <paramref name="clientSecret"/> are blank.
        /// </exception>
        public CronofyOAuthClient(string clientId, string clientSecret, string dataCentre)
        {
            Preconditions.NotBlank("clientId", clientId);
            Preconditions.NotBlank("clientSecret", clientSecret);

            this.clientId     = clientId;
            this.clientSecret = clientSecret;
            this.urlProvider  = UrlProviderFactory.GetProvider(dataCentre);
            this.HttpClient   = new ConcreteHttpClient();
        }