コード例 #1
0
        /// <summary>
        /// Create project
        /// </summary>
        /// <remarks>
        /// This method requires authentication.
        /// See the <a href="http://gs2017dev.sdl.com:41234/documentation/api/index#/">API documentation</a> for more information.
        /// </remarks>
        /// <exception cref="AuthorizationException">
        /// Thrown when the current user does not have permission to make the request.
        /// </exception>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        public async Task <string> CreateProject(CreateProjectRequest request)
        {
            Ensure.ArgumentNotNull(request, "request");

            var projectUri = await ApiConnection.Post <string>(ApiUrls.GetAllProjects(), request, "application/json");

            var projectId = projectUri.Split('/').Last();

            await UploadFilesForProject(projectId, request.RawData, request.Name);

            return(projectId);
        }
コード例 #2
0
        /// <summary>
        ///Publish  project
        /// <param name="projectRequest"><see cref="CreateProjectRequest"/></param>
        /// </summary>
        /// <remarks>
        /// This method requires authentication.
        /// See the <a href="http://gs2017dev.sdl.com:41234/documentation/api/index#/">API documentation</a> for more information.
        /// </remarks>
        /// <exception cref="AuthorizationException">
        /// Thrown when the current user does not have permission to make the request.
        /// </exception>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        public async Task PublishPackage(CreateProjectRequest projectRequest)
        {
            Ensure.ArgumentNotNull(projectRequest, "request");
            var projectId = await CreateProjectForPublishingPackage(projectRequest);

            var byteContent = new ByteArrayContent(projectRequest.RawData);

            byteContent.Headers.Add("Content-Type", "application/json");
            var multipartContent = new MultipartFormDataContent
            {
                { byteContent, projectRequest.Name, projectRequest.Name }
            };
            await ApiConnection.Post <string>(ApiUrls.PublishProjectPackage(projectId), multipartContent, "application/json");
        }
コード例 #3
0
        /// <summary>
        /// Create project
        /// </summary>
        /// <remarks>
        /// This method requires authentication.
        /// See the <a href="http://sdldevelopmentpartners.sdlproducts.com/documentation/api">API documentation</a> for more information.
        /// </remarks>
        /// <exception cref="AuthorizationException">
        /// Thrown when the current user does not have permission to make the request.
        /// </exception>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>A list of <see cref="Phase"/>s.</returns>
        public async Task<string> CreateProject(CreateProjectRequest request)
        {
            Ensure.ArgumentNotNull(request, "request");

            var projectUri = await ApiConnection.Post<string>(ApiUrls.OrganizationProjects(), request, "application/json");
            var projectId = projectUri.Split('/').Last();

            var byteContent = new ByteArrayContent(request.RawData);
            byteContent.Headers.Add("Content-Type", "application/octet-stream");
            var multipartContent = new MultipartFormDataContent
            {
                {byteContent, "file", request.Name}
            };

            await ApiConnection.Post<string>(ApiUrls.PublishProjectPackage(projectId), multipartContent, "application/octet-stream");

            return projectId;
        }