Пример #1
0
        /// <summary>
        /// Requests information to start a new upload
        /// </summary>
        /// <param name="query">Contains the information needed to request upload information</param>
        /// <returns>Task containing <see cref="UploadRequest"/> information</returns>
        private async Task <UploadRequest> RequestUploadInformationAsync(RequestUploadQuery query)
        {
            var request = new ApiRequest <UploadRequest>
            {
                Path       = "/api/upload/init",
                HTTPMethod = HttpMethod.Post,
                Query      = query
            };

            return(await _requestSender.SendRequestAsync(request).ConfigureAwait(false));
        }
Пример #2
0
        /// <summary>
        /// Requests information to start a new upload
        /// </summary>
        /// <param name="query">Contains the information needed to request upload information</param>
        /// <returns>Task containing <see cref="UploadRequest"/> information</returns>
        private Task <UploadRequest> RequestUploadInformationAsync(RequestUploadQuery query)
        {
            var request = new ApiRequest <UploadRequest>
            {
                Path       = "/api/upload/init",
                HTTPMethod = HttpMethod.Post,
                Query      = query
            };

            return(_requestSender.SendRequestAsync(request));
        }
Пример #3
0
        public UploadRequest RequestUploadInformation(RequestUploadQuery requestUploadQuery)
        {
            if (requestUploadQuery == null || string.IsNullOrWhiteSpace(requestUploadQuery.Filename))
            {
                return(null);
            }
            var postData = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("filename", requestUploadQuery.Filename)
            };

            string result = Post($"{_customerBynderUrl}/api/upload/init", postData);

            return((string.IsNullOrWhiteSpace(result)) ? null : JsonConvert.DeserializeObject <UploadRequest>(result.ToString()));
        }