Пример #1
0
        /// <summary>
        /// Creates new portion.
        /// </summary>
        /// <param name="request">Request. <see cref="PostNotesSlideAddNewPortionRequest" /></param>
        /// <returns><see cref="PortionResponse"/></returns>
        public PortionResponse PostNotesSlideAddNewPortion(PostNotesSlideAddNewPortionRequest request)
        {
            // verify the required parameter 'name' is set
            if (request.Name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling PostNotesSlideAddNewPortion");
            }

            // verify the required parameter 'path' is set
            if (request.Path == null)
            {
                throw new ApiException(400, "Missing required parameter 'path' when calling PostNotesSlideAddNewPortion");
            }

            // create path and map variables
            string resourcePath = GetResourceUrl("/slides/{name}/slides/{slideIndex}/notesSlide/shapes/{path}/{shapeIndex}/paragraphs/{paragraphIndex}/portions");

            resourcePath = UrlHelper.AddPathParameter(resourcePath, "name", request.Name);
            resourcePath = UrlHelper.AddPathParameter(resourcePath, "slideIndex", request.SlideIndex);
            resourcePath = UrlHelper.AddPathParameter(resourcePath, "path", request.Path);
            resourcePath = UrlHelper.AddPathParameter(resourcePath, "shapeIndex", request.ShapeIndex);
            resourcePath = UrlHelper.AddPathParameter(resourcePath, "paragraphIndex", request.ParagraphIndex);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.Folder);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.Storage);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "position", request.Position);
            string contentType;
            var    postBody = SerializationHelper.Serialize(request.Dto, out contentType); // http body (model) parameter
            var    files    = new List <FileInfo>();

            PickFiles(files, request);
            return(InvokeApi <PortionResponse>(resourcePath, "POST", postBody, null, files, contentType));
        }
        private PostNotesSlideAddNewPortionRequest createPostNotesSlideAddNewPortionRequest()
        {
            PostNotesSlideAddNewPortionRequest request = new PostNotesSlideAddNewPortionRequest();

            request.Name           = "test.pptx";
            request.SlideIndex     = 1;
            request.SlideIndex     = 1;
            request.ParagraphIndex = 1;
            return(request);
        }
        public void postNotesSlideAddNewPortionTest()
        {
            PortionResponse response = null;

            try
            {
                PostNotesSlideAddNewPortionRequest request = createPostNotesSlideAddNewPortionRequest();
                response = api.PostNotesSlideAddNewPortion(request);
                Console.WriteLine(response.Code);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }