Class SmartsheetBuilder
- Namespace
- Smartsheet.Api
- Assembly
- smartsheet-csharp-sdk.dll
A convenience class to help create a SmartsheetClient instance with the appropriate fields.
If not explicitly set, the builder will use default implementations for HttpClient (DefaultHttpClient) and JsonSerializer (JsonNetSerializer).
Thread Safety: This class is not thread safe since it's mutable, one builder instance is NOT expected to be used in multiple threads.
public class SmartsheetBuilder
- Inheritance
-
SmartsheetBuilder
- Inherited Members
Constructors
SmartsheetBuilder()
Constructor.
public SmartsheetBuilder()
Fields
DEFAULT_BASE_URI
Represents the default base URI of the Smartsheet REST API.
It is a constant with Value "https://api.smartsheet.com/2.0".
public const string DEFAULT_BASE_URI = "https://api.smartsheet.com/2.0/"
Field Value
GOV_BASE_URI
Represents the base URI of the Smartsheetgov REST API.
It is a constant with Value "https://api.smartsheetgov.com/2.0".
public const string GOV_BASE_URI = "https://api.smartsheetgov.com/2.0/"
Field Value
SMARTSHEET_ACCESS_TOKEN
Represents the environment variable for locating the Smartsheet API access token.
It is a constant with Value "SMARTSHEET_ACCESS_TOKEN".
public const string SMARTSHEET_ACCESS_TOKEN = "SMARTSHEET_ACCESS_TOKEN"
Field Value
Properties
AccessToken
Gets the access token.
public string AccessToken { get; }
Property Value
- string
the access token
AssumedUser
Gets the assumed user.
public string AssumedUser { get; }
Property Value
- string
the assumed user
BaseURI
Gets the base uri.
public string BaseURI { get; }
Property Value
- string
the base uri
DefaultBaseUri
Gets the default base uri.
public static string DefaultBaseUri { get; }
Property Value
- string
the default base uri
HttpClient
Gets the http client.
public HttpClient HttpClient { get; }
Property Value
- HttpClient
the http client
JsonSerializer
Gets the Json serializer.
public JsonSerializer JsonSerializer { get; }
Property Value
- JsonSerializer
the Json serializer
Methods
Build()
Build the SmartsheetClient instance.
public SmartsheetClient Build()
Returns
- SmartsheetClient
the SmartsheetClient instance
SetAccessToken(string)
Set the access token.
public SmartsheetBuilder SetAccessToken(string accessToken)
Parameters
accessTokenstringthe access token
Returns
- SmartsheetBuilder
the SmartsheetClient builder
SetAssumedUser(string)
Set the assumed user.
public SmartsheetBuilder SetAssumedUser(string assumedUser)
Parameters
assumedUserstringthe assumed user
Returns
- SmartsheetBuilder
the SmartsheetClient builder
SetBaseURI(string)
Set the base URI.
public SmartsheetBuilder SetBaseURI(string baseURI)
Parameters
baseURIstringthe base uri
Returns
- SmartsheetBuilder
the SmartsheetClient builder
SetChangeAgent(string)
Set the Smartsheet change agent.
public SmartsheetBuilder SetChangeAgent(string changeAgent)
Parameters
changeAgentstringthe change agent
Returns
- SmartsheetBuilder
the SmartsheetClient builder
SetDateTimeFixOptOut(bool)
Set optional flag to re-enable JSON deserializers conversion from string to C# DateTime
public SmartsheetBuilder SetDateTimeFixOptOut(bool dateTimeFixOptOut)
Parameters
dateTimeFixOptOutbool
Returns
SetEnableDecimalObjectValue(bool)
Set optional flag to enable DecimalObjectValue when deserializing numeric ObjectValue types. When set to true, numeric values are deserialized as DecimalObjectValue preserving decimal precision. When set to false (default), numeric values are deserialized as NumberObjectValue converting to double.
public SmartsheetBuilder SetEnableDecimalObjectValue(bool enableDecimalObjectValue)
Parameters
enableDecimalObjectValuebooltrue to enable DecimalObjectValue, false to use NumberObjectValue (default)
Returns
- SmartsheetBuilder
the SmartsheetBuilder
SetHttpClient(HttpClient)
Set the HttpClient.
This is optional. If not set, a DefaultHttpClient instance will be used.
public SmartsheetBuilder SetHttpClient(HttpClient httpClient)
Parameters
httpClientHttpClientthe http client
Returns
- SmartsheetBuilder
the SmartsheetClient builder
SetJsonSerializer(JsonSerializer)
Set the JsonSerializer.
This is optional. If not set, a JsonNetSerializer instance will be used.
public SmartsheetBuilder SetJsonSerializer(JsonSerializer jsonSerializer)
Parameters
jsonSerializerJsonSerializerthe JsonSerializer
Returns
- SmartsheetBuilder
the SmartsheetBuilder
SetMaxRetryTimeout(long)
Create a DefaultCalcBackoff with a max elapsed timeout specified by the user. This interface is only valid when the DefaultHttpClient is used.
public SmartsheetBuilder SetMaxRetryTimeout(long maxRetryTimeout)
Parameters
maxRetryTimeoutlong