예제 #1
0
        /// <summary>
        /// A method used by the base class to construct a request class instance.
        /// </summary>
        /// <param name="functionUrl">The request URL to </param>
        /// <param name="options">The query and header options for the request.</param>
        /// <returns>An instance of a specific request class.</returns>
        protected override IDriveItemCreateLinkRequest CreateRequest(string functionUrl, IEnumerable <Option> options)
        {
            var request = new DriveItemCreateLinkRequest(functionUrl, this.Client, options);

            if (this.HasParameter("type"))
            {
                request.RequestBody.Type = this.GetParameter <string>("type");
            }

            if (this.HasParameter("scope"))
            {
                request.RequestBody.Scope = this.GetParameter <string>("scope");
            }

            if (this.HasParameter("expirationDateTime"))
            {
                request.RequestBody.ExpirationDateTime = this.GetParameter <DateTimeOffset?>("expirationDateTime");
            }

            if (this.HasParameter("password"))
            {
                request.RequestBody.Password = this.GetParameter <string>("password");
            }

            if (this.HasParameter("message"))
            {
                request.RequestBody.Message = this.GetParameter <string>("message");
            }

            return(request);
        }
        /// <summary>
        /// A method used by the base class to construct a request class instance.
        /// </summary>
        /// <param name="functionUrl">The request URL to </param>
        /// <param name="options">The query and header options for the request.</param>
        /// <returns>An instance of a specific request class.</returns>
        protected override IDriveItemCreateLinkRequest CreateRequest(string functionUrl, IEnumerable <Option> options)
        {
            var request = new DriveItemCreateLinkRequest(functionUrl, this.Client, options);

            if (this.HasParameter("scope"))
            {
                request.RequestBody.Scope = this.GetParameter <string>("scope");
            }

            if (this.HasParameter("type"))
            {
                request.RequestBody.Type = this.GetParameter <string>("type");
            }

            return(request);
        }