Hope these code snippet below help you solve the problem.
const { MendixPlatformClient, Project, OnlineWorkingCopy, Branch } = require('mendixplatformsdk');
const { domainmodels } = require('mendixmodelsdk');
async function main() {
const client = new MendixPlatformClient({ apiKey: 'YOUR_API_KEY' });
const project = new Project(client, 'YOUR_PROJECT_ID', 'YOUR_PROJECT_NAME');
const branch = new Branch(project, 'main');
const workingCopy = await project.createOnlineWorkingCopy(branch);
const domainModel = await loadDomainModel(workingCopy);
await workingCopy.commit();
async function loadDomainModel(workingCopy) {
const dm = await domainmodels.load(workingCopy.model().root);
return dm;
}
main().catch(error => { console.error("An error occurred", error); });
Ah I've solved this now. The answer was "trunk".
Reading the documentation explains the documentation https://apidocs.rnd.mendix.com/platformsdk/latest/classes/Repository.html#getBranch