Class CallSettingsExtensions (4.2.0)

public static class CallSettingsExtensions

Extension methods for CallSettings. All methods accept a null first parameter as valid unless stated otherwise.

Inheritance

Object > CallSettingsExtensions

Namespace

Google.Api.Gax.Grpc

Assembly

Google.Api.Gax.Grpc.dll

Methods

MergedWith(CallSettings, CallSettings)

public static CallSettings MergedWith(this CallSettings original, CallSettings overlaid)

This method merges the settings in overlaid with those in original, with overlaid taking priority. If both arguments are null, the result is null. If one argument is null, the other argument is returned. Otherwise, a new object is created with a property-wise overlay, where null values do not override non-null values. Any header mutations are combined, however: the mutation from the original is performed, then the mutation in the overlay.

Parameters
NameDescription
originalCallSettings

Original settings. May be null.

overlaidCallSettings

Settings to overlay. May be null.

Returns
TypeDescription
CallSettings

A merged set of call settings, or null if both parameters are null.

WithCancellationToken(CallSettings, CancellationToken)

public static CallSettings WithCancellationToken(this CallSettings settings, CancellationToken cancellationToken)

Returns a new CallSettings with the specified cancellation token, merged with the (optional) original settings specified by settings.

Parameters
NameDescription
settingsCallSettings

Original settings. May be null, in which case the returned settings will only contain the cancellation token.

cancellationTokenCancellationToken

Cancellation token for the new call settings.

Returns
TypeDescription
CallSettings

A new set of call settings.

WithDeadline(CallSettings, DateTime)

public static CallSettings WithDeadline(this CallSettings settings, DateTime deadline)

Returns a CallSettings which will have the specified deadline.

Parameters
NameDescription
settingsCallSettings

Existing settings. May be null, meaning there are currently no settings.

deadlineDateTime

The deadline for the new settings.

Returns
TypeDescription
CallSettings

A new CallSettings with the given deadline.

WithEarlierDeadline(CallSettings, Nullable<DateTime>, IClock)

public static CallSettings WithEarlierDeadline(this CallSettings settings, DateTime? deadline, IClock clock)

Returns a CallSettings which will have an effective deadline of at least deadline. If settings already observes an earlier deadline (with respect to clock), or if deadline is null, the original settings will be returned.

Parameters
NameDescription
settingsCallSettings

Existing settings. May be null, meaning there are currently no settings.

deadlineNullable<DateTime>

Deadline to enforce. May be null, meaning there is no deadline to enforce.

clockIClock

The clock to use when computing deadlines. Must not be null.

Returns
TypeDescription
CallSettings

The call settings to use to observe the given deadline.

WithExpiration(CallSettings, Expiration)

public static CallSettings WithExpiration(this CallSettings settings, Expiration expiration)

Returns a new CallSettings with the specified expiration, merged with the (optional) original settings specified by settings.

Parameters
NameDescription
settingsCallSettings

Original settings. May be null, in which case the returned settings will only contain the expiration.

expirationExpiration

Expiration to use in the returned settings, possibly as part of a retry. May be null, in which case any expiration in settings is not present in the new call settings. If both this and settings are null, the return value is null.

Returns
TypeDescription
CallSettings

A new set of call settings with the specified expiration, or null of both parameters are null.

WithHeader(CallSettings, String, String)

public static CallSettings WithHeader(this CallSettings settings, string name, string value)

Returns a new CallSettings with the specified header, merged with the (optional) original settings specified by settings.

Parameters
NameDescription
settingsCallSettings

Original settings. May be null, in which case the returned settings will only contain the header.

nameString

Header name. Must not be null.

valueString

Header value. Must not be null.

Returns
TypeDescription
CallSettings

A new set of call settings including the specified header.

WithResponseMetadataHandler(CallSettings, Action<Metadata>)

public static CallSettings WithResponseMetadataHandler(this CallSettings settings, Action<Metadata> handler)
Parameters
NameDescription
settingsCallSettings
handlerAction<Metadata>
Returns
TypeDescription
CallSettings

WithRetry(CallSettings, RetrySettings)

public static CallSettings WithRetry(this CallSettings settings, RetrySettings retry)

Returns a new CallSettings with the specified retry settings, merged with the (optional) original settings specified by settings.

Parameters
NameDescription
settingsCallSettings

Original settings. May be null, in which case the returned settings will only contain call timing.

retryRetrySettings

Call timing for the new call settings. This may be null, in which case any retry settings in settings are not present in the new call settings. If both this and settings are null, the return value is null.

Returns
TypeDescription
CallSettings

A new set of call settings, or null if both parameters are null.

WithTimeout(CallSettings, TimeSpan)

public static CallSettings WithTimeout(this CallSettings settings, TimeSpan timeout)

Returns a CallSettings which will have the specified timeout.

Parameters
NameDescription
settingsCallSettings

Existing settings. May be null, meaning there are currently no settings.

timeoutTimeSpan

The timeout for the new settings.

Returns
TypeDescription
CallSettings

A new CallSettings with the given timeout.

WithTrailingMetadataHandler(CallSettings, Action<Metadata>)

public static CallSettings WithTrailingMetadataHandler(this CallSettings settings, Action<Metadata> handler)
Parameters
NameDescription
settingsCallSettings
handlerAction<Metadata>
Returns
TypeDescription
CallSettings