microsoftgraph/MSGraph-SDK-Code-Generator

Create RequestBuilders for structural properties that need to be accessed directly

darrelmiller opened this issue · 2 comments

e.g. mailboxsettings

and

https://graph.microsoft.com/beta/print/printers/{id}/jobs/{id}/configuration

Currently we don't know when this is possible and instead of generating RequestBuilders for every structural property we don't generate any. We should use a capability annotation to indicate that support is required.
AB#7626

Would we want to support accessing arbitrary structural properties as the API supports this? I can't think of any reason other than slightly simplifying the scenario to update a single property in .NET.

For example, I can do the following:

GET https://graph.microsoft.com/v1.0/me/jobtitle
PATCH https://graph.microsoft.com/v1.0/me/jobtitle

{
  "value":"Marketing Director2"
}

Instead of doing:

GET https://graph.microsoft.com/v1.0/me?$select=jobtitle
PATCH https://graph.microsoft.com/v1.0/me/jobtitle

{
  "jobTitle":"Marketing Director3"
}

We could enable scenarios like these for .NET:

// Get the type parameter for the property when the property is specified.
client.Me.GetProperty(u => u.MailboxSettings).Request().GetAsync<MailboxSettings>();
// Don't need to new up an object to update a single property.
client.Me.SetProperty(u => u.JobTitle, "Marketing Director2").Request().UpdateAsync();