Many Smartsheet API calls allow for customisation of query options through a wide variety of optional properties. This can be shown by looking at one of the SDK interfaces for accessing Smartsheet functionality: retrieving a sheet.
The documentation for the parameters from includes onwards, denotes that the properties are optional as part of the task of retrieving a sheet e.g. /// <param name="includes"> used to specify the optional objects to include. </param>
The parameters are optional for the underlying http API call, but not for users of the C# SDK, who have to provide an input for all parameters, bar the final two, pageSize, and page, which are denoted as optional owing to them being a nullable long i.e. long?.
A review of the interfaces throughout the API should take place to establish which of the parameters are optional, and which are mandatory. After identifying genuinely optional parameters, we can modify existing interfaces and implementations to mark parameters as optional using the Nullable operator?.
We should then expect to see invocations to Smartsheet SDK functionality that omit parameters where they are the default:
var sheet = smartsheet.SheetResources.GetSheet(sheetId);
Next Steps
Interfaces should be reviewed to consider which methods contain parameters which are permittable by the Smartsheet API to be null values.
Customer Issue
Many Smartsheet API calls allow for customisation of query options through a wide variety of optional properties. This can be shown by looking at one of the SDK interfaces for accessing Smartsheet functionality: retrieving a sheet.
From the
SheetResources
interface in smartsheet-csharp-sdk/main/Smartsheet/Api/SheetResources.csThe documentation for the parameters from
includes
onwards, denotes that the properties are optional as part of the task of retrieving a sheet e.g./// <param name="includes"> used to specify the optional objects to include. </param>
The parameters are optional for the underlying http API call, but not for users of the C# SDK, who have to provide an input for all parameters, bar the final two,
pageSize
, andpage
, which are denoted as optional owing to them being a nullable long i.e.long?
.This results in invocations to the
GetSheet
implementation like this from https://github.com/smartsheet/smartsheet-csharp-sdk/blob/mainline/sdk-csharp-sample-net60/Program.cs#L30:Proposal
A review of the interfaces throughout the API should take place to establish which of the parameters are optional, and which are mandatory. After identifying genuinely optional parameters, we can modify existing interfaces and implementations to mark parameters as optional using the Nullable operator
?
.We should then expect to see invocations to Smartsheet SDK functionality that omit parameters where they are the default:
Next Steps
Interfaces should be reviewed to consider which methods contain parameters which are permittable by the Smartsheet API to be
null
values.The full list of interfaces to review: