示例#1
0
        public async Task <ConvertProjectVariablesToGitResponse> MigrateVariablesToGit(ProjectResource projectResource, string branch, string commitMessage)
        {
            if (ProjectHasVariablesInGit(projectResource))
            {
                throw new NotSupportedException("Project variables have already been migrated to Git");
            }

            var command = new ConvertProjectVariablesToGitCommand
            {
                Branch        = branch,
                CommitMessage = commitMessage
            };

            if (!projectResource.HasLink("MigrateVariablesToGit"))
            {
                throw new NotSupportedException("Git variables migration is not available for this project");
            }

            return(await client.Post <ConvertProjectVariablesToGitCommand, ConvertProjectVariablesToGitResponse>(projectResource.Link("MigrateVariablesToGit"), command));
        }