コード例 #1
0
        /// <summary>
        /// Adds a required participant to the request.
        /// </summary>
        /// <param name="sub">
        /// The sub of the required participant, must not be blank.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="AvailabilityRequestBuilder"/>.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="sub"/> is blank.
        /// </exception>
        public AvailabilityRequestBuilder AddRequiredParticipant(string sub)
        {
            Preconditions.NotBlank("sub", sub);

            this.requiredSubs.Add(sub);

            return(this);
        }
コード例 #2
0
        /// <summary>
        /// Sets the hour format of the request.
        /// </summary>
        /// <param name="hourFormat">
        /// The hour format to use for the request, must not be blank.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="RealTimeSchedulingRequestBuilder"/>.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="hourFormat"/> is empty.
        /// </exception>
        public AddToCalendarRequestBuilder HourFormat(string hourFormat)
        {
            Preconditions.NotBlank("hourFormat", hourFormat);

            this.hourFormat = hourFormat;

            return(this);
        }
コード例 #3
0
        /// <summary>
        /// Sets the hour format of the request.
        /// </summary>
        /// <param name="hourFormat">
        /// The hour format to use for the request, must not be blank.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="RealTimeSchedulingRequestBuilder"/>.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="hourFormat"/> is empty.
        /// </exception>
        public RealTimeSchedulingRequestBuilder HourFormat(string hourFormat)
        {
            Preconditions.NotBlank("hourFormat", hourFormat);

            this.hourFormat = hourFormat;

            return(this);
        }
コード例 #4
0
        /// <summary>
        /// Sets the redirect url for this request.
        /// </summary>
        /// <param name="redirectUri">
        /// The redirect url to send the user to after granting permissions,
        ///  must not be blank.
        /// </param>
        /// <exception cref="ArgumentException">
        /// If <para>calendarId</para> or <para>permissionLevel</para> are blank.
        /// </exception>
        /// <returns>
        /// A reference to the modified builder.
        /// </returns>
        public ElevatedPermissionsBuilder RedirectUri(string redirectUri)
        {
            Preconditions.NotBlank("redirectUri", redirectUri);

            this.redirectUri = redirectUri;

            return(this);
        }
コード例 #5
0
        /// <summary>
        /// Sets the Timezone id of the request.
        /// </summary>
        /// <param name="tzid">
        /// The timezone to use for the request, must not be blank.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="RealTimeSchedulingRequestBuilder"/>.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="tzid"/> is empty.
        /// </exception>
        public RealTimeSchedulingRequestBuilder Timezone(string tzid)
        {
            Preconditions.NotBlank("tzid", tzid);

            this.tzid = tzid;

            return(this);
        }
コード例 #6
0
        /// <summary>
        /// Sets the sub of the member.
        /// </summary>
        /// <param name="sub">
        /// The sub of the member.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="AvailabilityMemberBuilder"/>.
        /// </returns>
        public AvailabilityMemberBuilder Sub(string sub)
        {
            Preconditions.NotBlank("sub", sub);

            this.sub = sub;

            return(this);
        }
コード例 #7
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>
        /// <exception cref="System.ArgumentException">
        /// Thrown if <paramref name="clientId"/> or
        /// <paramref name="clientSecret"/> are blank.
        /// </exception>
        public CronofyOAuthClient(string clientId, string clientSecret)
        {
            Preconditions.NotBlank("clientId", clientId);
            Preconditions.NotBlank("clientSecret", clientSecret);

            this.clientId     = clientId;
            this.clientSecret = clientSecret;
            this.HttpClient   = new ConcreteHttpClient();
        }
コード例 #8
0
            /// <summary>
            /// Initializes a new instance of the
            /// <see cref="AuthorizationUrlBuilder"/> class.
            /// </summary>
            /// <param name="clientId">
            /// The application's OAuth client_id, must not be blank.
            /// </param>
            /// <param name="redirectUri">
            /// The URI to redirect the user's response for the authorization
            /// request to, must not be empty.
            /// </param>
            /// <exception cref="System.ArgumentException">
            /// Thrown if <paramref name="clientId"/> is blank, or if
            /// <paramref name="redirectUri"/> is empty.
            /// </exception>
            internal AuthorizationUrlBuilder(string clientId, string redirectUri)
            {
                Preconditions.NotBlank("clientId", clientId);
                Preconditions.NotEmpty("redirectUri", redirectUri);

                this.clientId    = clientId;
                this.redirectUri = redirectUri;
                this.scope       = DefaultScopes;
            }
コード例 #9
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();
        }
コード例 #10
0
            /// <summary>
            /// Initializes a new instance of the
            /// <see cref="AuthorizationUrlBuilder"/> class.
            /// </summary>
            /// <param name="clientId">
            /// The application's OAuth client_id, must not be blank.
            /// </param>
            /// <param name="urlProvider">
            /// The URL provider for the current context, must not be
            /// <code>null</code>.
            /// </param>
            /// <param name="redirectUri">
            /// The URI to redirect the user's response for the authorization
            /// request to, must not be empty.
            /// </param>
            /// <exception cref="System.ArgumentException">
            /// Thrown if <paramref name="clientId"/> is blank,
            /// <paramref name="urlProvider"/> is <code>null</code>, or if
            /// <paramref name="redirectUri"/> is empty.
            /// </exception>
            internal AuthorizationUrlBuilder(string clientId, UrlProvider urlProvider, string redirectUri)
            {
                Preconditions.NotBlank("clientId", clientId);
                Preconditions.NotNull("urlProvider", urlProvider);
                Preconditions.NotEmpty("redirectUri", redirectUri);

                this.clientId               = clientId;
                this.urlProvider            = urlProvider;
                this.redirectUri            = redirectUri;
                this.scope                  = DefaultScopes;
                this.enterpriseConnectScope = DefaultEnterpriseConnectScopes;
            }
コード例 #11
0
        /// <summary>
        /// Adds a calendar a permission level to the request.
        /// </summary>
        /// <param name="calendarId">
        /// The calendar id to request permission for, must not be blank.
        /// </param>
        /// <param name="permissionLevel">
        /// The level of permission to request for the calendar id, must not be blank.
        /// </param>
        /// <exception cref="ArgumentException">
        /// If <para>calendarId</para> or <para>permissionLevel</para> are blank.
        /// </exception>
        /// <returns>
        /// A reference to the modified builder.
        /// </returns>
        public ElevatedPermissionsBuilder AddCalendarPermission(string calendarId, string permissionLevel)
        {
            Preconditions.NotBlank("calendarId", calendarId);
            Preconditions.NotBlank("permissionLevel", permissionLevel);

            this.calendarPermissions.Add(new CalendarPermission()
            {
                CalendarId      = calendarId,
                PermissionLevel = permissionLevel
            });

            return(this);
        }
コード例 #12
0
        /// <summary>
        /// Sets the OAuth details of the request.
        /// </summary>
        /// <param name="redirectUri">
        /// The redirect uri for the request's oauth details, must not be blank.
        /// </param>
        /// <param name="scope">
        /// The scope for the request's oauth details, must not be blank.
        /// </param>
        /// <param name="state">
        /// The state for the request's oauth details.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="RealTimeSchedulingRequestBuilder"/>.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="redirectUri"/> or <paramref name="scope"/> are empty.
        /// </exception>
        public RealTimeSchedulingRequestBuilder OAuthDetails(string redirectUri, string scope, string state)
        {
            Preconditions.NotBlank("redirectUri", redirectUri);
            Preconditions.NotBlank("scope", scope);

            var oauthDetails = new RealTimeSchedulingRequest.OAuthDetails
            {
                RedirectUri = redirectUri,
                Scope       = scope,
                State       = state
            };

            this.oauthBuilder = Builder.Wrap(oauthDetails);

            return(this);
        }
コード例 #13
0
        /// <summary>
        /// Adds a target calendar to the request.
        /// </summary>
        /// <param name="sub">
        /// The sub for the target calendar.
        /// </param>
        /// <param name="calendarId">
        /// The target calendar's id.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="RealTimeSchedulingRequestBuilder"/>.
        /// </returns>
        public RealTimeSchedulingRequestBuilder AddTargetCalendar(string sub, string calendarId)
        {
            Preconditions.NotBlank("sub", sub);
            Preconditions.NotBlank("calendarId", calendarId);

            if (this.targetCalendars == null)
            {
                this.targetCalendars = new List <RealTimeSchedulingRequest.TargetCalendar>();
            }

            this.targetCalendars.Add(new RealTimeSchedulingRequest.TargetCalendar
            {
                Sub        = sub,
                CalendarId = calendarId
            });

            return(this);
        }
コード例 #14
0
        /// <summary>
        /// Adds a member to the group.
        /// </summary>
        /// <param name="sub">
        /// The sub of the member, must not be blank.
        /// </param>
        /// <returns>
        /// A reference to the <see cref="ParticipantGroupBuilder"/>.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown if <paramref name="sub"/> is blank.
        /// </exception>
        public ParticipantGroupBuilder AddMember(string sub)
        {
            Preconditions.NotBlank("sub", sub);

            return(this.AddMember(new AvailabilityMemberBuilder().Sub(sub)));
        }
コード例 #15
0
 /// <summary>
 /// Sets the state of the request.
 /// </summary>
 /// <param name="state">
 /// The state for the request, must not be blank.
 /// </param>
 /// <returns>
 /// A reference to the <see cref="OAuthDetailsBuilder"/>.
 /// </returns>
 public IBuilder <AddToCalendarRequest.OAuthDetails> State(string state)
 {
     Preconditions.NotBlank("state", state);
     this.state = state;
     return(this);
 }
コード例 #16
0
 /// <summary>
 /// Sets the scope of the request.
 /// </summary>
 /// <param name="scope">
 /// The scope for the request, must not be blank.
 /// </param>
 /// <returns>
 /// A reference to the <see cref="OAuthDetailsBuilder"/>.
 /// </returns>
 public IBuilder <AddToCalendarRequest.OAuthDetails> Scope(string scope)
 {
     Preconditions.NotBlank("scope", scope);
     this.scope = scope;
     return(this);
 }
コード例 #17
0
 /// <summary>
 /// Sets the redirect Uri of the request.
 /// </summary>
 /// <param name="redirectUri">
 /// The redirectUri for the request, must not be blank.
 /// </param>
 /// <returns>
 /// A reference to the <see cref="OAuthDetailsBuilder"/>.
 /// </returns>
 public IBuilder <AddToCalendarRequest.OAuthDetails> RedirectUri(string redirectUri)
 {
     Preconditions.NotBlank("redirectUri", redirectUri);
     this.redirectUri = redirectUri;
     return(this);
 }