如何使用GitLab API获取合并分支列表?

I am using the command line to run the following:

comm -23 <(git branch -r --merged beta | sort) <(git branch -r --merged master | sort)

I am in the process of automating this but I am stuck on how to perform this part: git branch -r --merged beta which returns a list of remote tracking branches that have been merged, meaning they are fully contained by HEAD.

Once I grab this list I can sort it and do the rest of it, but I can't seem to figure out how to filter or pull this list from the API. I've looked through the API but haven't found anything.

I was thinking that maybe I could use this:

https://docs.gitlab.com/ee/api/branches.html#get-single-repository-branch

Is there a way to do this through the GitLabs API?

There's no direct way of doing this but I ended up grabbing all the requests with state merged and then calling array_column to pluck out the source branch column I wanted.

    public function getAllBranchMergedFeatures(string $branch) : array
    {
        $merge_requests = $this->call("GET",
            "{$this->basePath}/merge_requests?state=merged&target_branch={$branch}"
        );

        return array_column($merge_requests, 'source_branch');
    }

That gives me a list of all the feature branches that have been merged into the specified branch.