public async Task <Result <int> > CreateMergeRequest(CreateMergeRequestParameters parameters) { var client = await _clientFactory.Create(); int?projecId = await GetProjectId(client, parameters.Project); if (!projecId.HasValue) { return(Result.Fail <int>($"Project {parameters.Project} was not found")); } int?assigneeId = await GetUserId(client, parameters.AssignedToCurrentUser, parameters.Assignee); var createdMergeRequest = await client.MergeRequests.CreateAsync( new CreateMergeRequest( projecId.Value.ToString(), parameters.SourceBranch, parameters.TargetBranch, parameters.Title) { AssigneeId = assigneeId }); return(Result.Ok(createdMergeRequest.Iid)); }
public async Task CreateMergeRequest(CreateMergeRequestParameters parameters) { var mergeRequestResult = await _gitLabFacade.CreateMergeRequest(parameters); if (mergeRequestResult.IsFailure) { _presenter.ShowError("Failed to create merge request", mergeRequestResult.Error); return; } _presenter.ShowSuccess($"Successfully created merge request #{mergeRequestResult.Value}"); }
public async Task <Result <int> > CreateMergeRequest(CreateMergeRequestParameters parameters) => await SafeGetResult(() => _mergesFacade.CreateMergeRequest(parameters));