public static class CallSettingsExtensions
Extension methods for CallSettings. All methods accept a null first parameter as valid unless stated otherwise.
Namespace
GoogleGoogle.ApiGaxGrpcAssembly
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 | |
---|---|
Name | Description |
original | CallSettings Original settings. May be null. |
overlaid | CallSettings Settings to overlay. May be null. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CallSettings Original settings. May be null, in which case the returned settings will only contain the cancellation token. |
cancellationToken | CancellationToken Cancellation token for the new call settings. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CallSettings Existing settings. May be null, meaning there are currently no settings. |
deadline | DateTime The deadline for the new settings. |
Returns | |
---|---|
Type | Description |
CallSettings | A new CallSettings with the given deadline. |
WithEarlierDeadline(CallSettings, 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 | |
---|---|
Name | Description |
settings | CallSettings Existing settings. May be null, meaning there are currently no settings. |
deadline | DateTime Deadline to enforce. May be null, meaning there is no deadline to enforce. |
clock | IClock The clock to use when computing deadlines. Must not be null. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CallSettings Original settings. May be null, in which case the returned settings will only contain the expiration. |
expiration | Expiration Expiration to use in the returned settings, possibly as part of a retry. May be null,
in which case any expiration in |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CallSettings Original settings. May be null, in which case the returned settings will only contain the header. |
name | string Header name. Must not be null. |
value | string Header value. Must not be null. |
Returns | |
---|---|
Type | Description |
CallSettings | A new set of call settings including the specified header. |
Existing headers in settings will not be overritten, that is, if settings
already contains a header for name
the new value
will be included in that header's set of values, even if it was already present
in settings for the header with the given name.
WithResponseMetadataHandler(CallSettings, Action<Metadata>)
public static CallSettings WithResponseMetadataHandler(this CallSettings settings, Action<Metadata> handler)
Parameters | |
---|---|
Name | Description |
settings | CallSettings |
handler | ActionMetadata |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CallSettings Original settings. May be null, in which case the returned settings will only contain call timing. |
retry | RetrySettings Call timing for the new call settings.
This may be null, in which case any retry settings in |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CallSettings Existing settings. May be null, meaning there are currently no settings. |
timeout | TimeSpan The timeout for the new settings. |
Returns | |
---|---|
Type | Description |
CallSettings | A new CallSettings with the given timeout. |
WithTrailingMetadataHandler(CallSettings, Action<Metadata>)
public static CallSettings WithTrailingMetadataHandler(this CallSettings settings, Action<Metadata> handler)
Parameters | |
---|---|
Name | Description |
settings | CallSettings |
handler | ActionMetadata |
Returns | |
---|---|
Type | Description |
CallSettings |