Class CallSettingsExtensions
Extension methods for CallSettings. All methods accept a null first parameter as valid unless stated otherwise.
Inheritance
Inherited Members
Namespace: Google.Api.Gax.Grpc
Assembly: Google.Api.Gax.Grpc.dll
Syntax
public static class CallSettingsExtensions
Methods
MergedWith(CallSettings, CallSettings)
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.
Declaration
public static CallSettings MergedWith(this CallSettings original, CallSettings overlaid)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | original | Original settings. May be null. |
CallSettings | overlaid | Settings to overlay. May be null. |
Returns
Type | Description |
---|---|
CallSettings | A merged set of call settings, or null if both parameters are null. |
WithCallCredentials(CallSettings, CallCredentials)
Returns a new CallSettings with the specified call credentials,
merged with the (optional) original settings specified by settings
.
Declaration
public static CallSettings WithCallCredentials(this CallSettings settings, CallCredentials credentials)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Original settings. May be null, in which case the returned settings will only contain call credentials. |
CallCredentials | credentials | Call credentials for the new call settings.
This may be null, in which case any call credentials in |
Returns
Type | Description |
---|---|
CallSettings | A new set of call settings, or null if both parameters are null. |
WithCancellationToken(CallSettings, CancellationToken)
Returns a new CallSettings with the specified cancellation token,
merged with the (optional) original settings specified by settings
.
Declaration
public static CallSettings WithCancellationToken(this CallSettings settings, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Original settings. May be null, in which case the returned settings will only contain the cancellation token. |
System.Threading.CancellationToken | cancellationToken | Cancellation token for the new call settings. |
Returns
Type | Description |
---|---|
CallSettings | A new set of call settings. |
WithDeadline(CallSettings, DateTime)
Returns a CallSettings which will have the specified deadline.
Declaration
public static CallSettings WithDeadline(this CallSettings settings, DateTime deadline)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Existing settings. May be null, meaning there are currently no settings. |
System.DateTime | deadline | The deadline for the new settings. |
Returns
Type | Description |
---|---|
CallSettings | A new CallSettings with the given deadline. |
WithEarlierDeadline(CallSettings, Nullable<DateTime>, IClock)
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.
Declaration
public static CallSettings WithEarlierDeadline(this CallSettings settings, DateTime? deadline, IClock clock)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Existing settings. May be null, meaning there are currently no settings. |
System.Nullable<System.DateTime> | deadline | Deadline to enforce. May be null, meaning there is no deadline to enforce. |
IClock | clock | 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)
Returns a new CallSettings with the specified expiration,
merged with the (optional) original settings specified by settings
.
Declaration
public static CallSettings WithExpiration(this CallSettings settings, Expiration expiration)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | 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)
Returns a new CallSettings with the specified header,
merged with the (optional) original settings specified by settings
.
Declaration
public static CallSettings WithHeader(this CallSettings settings, string name, string value)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Original settings. May be null, in which case the returned settings will only contain the header. |
System.String | name | Header name. Must not be null. |
System.String | value | Header value. Must not be null. |
Returns
Type | Description |
---|---|
CallSettings | A new set of call settings including the specified header. |
WithResponseMetadataHandler(CallSettings, Action<Metadata>)
Declaration
public static CallSettings WithResponseMetadataHandler(this CallSettings settings, Action<Metadata> handler)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | |
System.Action<Metadata> | handler |
Returns
Type | Description |
---|---|
CallSettings |
WithRetry(CallSettings, RetrySettings)
Returns a new CallSettings with the specified retry settings,
merged with the (optional) original settings specified by settings
.
Declaration
public static CallSettings WithRetry(this CallSettings settings, RetrySettings retry)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Original settings. May be null, in which case the returned settings will only contain call timing. |
RetrySettings | retry | 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)
Returns a CallSettings which will have the specified timeout.
Declaration
public static CallSettings WithTimeout(this CallSettings settings, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Existing settings. May be null, meaning there are currently no settings. |
System.TimeSpan | timeout | The timeout for the new settings. |
Returns
Type | Description |
---|---|
CallSettings | A new CallSettings with the given timeout. |
WithTrailingMetadataHandler(CallSettings, Action<Metadata>)
Declaration
public static CallSettings WithTrailingMetadataHandler(this CallSettings settings, Action<Metadata> handler)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | |
System.Action<Metadata> | handler |
Returns
Type | Description |
---|---|
CallSettings |