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. |
WithCallTiming(CallSettings, CallTiming)
Returns a new CallSettings with the specified call timing,
merged with the (optional) original settings specified by settings
.
Declaration
public static CallSettings WithCallTiming(this CallSettings settings, CallTiming timing)
Parameters
Type | Name | Description |
---|---|---|
CallSettings | settings | Original settings. May be null, in which case the returned settings will only contain call timing. |
CallTiming | timing | Call timing for the new call settings.
This may be null, in which case any call timing 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. |
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 given the 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 | Existing settings. May be null, meaning there are currently no settings. |
Expiration | expiration | Expiration to use in the returned settings, possibly as part of a retry. Must not be null. |
Returns
Type | Description |
---|---|
CallSettings |
Remarks
If settings
is non-null and has retry-based timing, the returned settings will have the same timing, but with the specified
expiration. Otherwise, the returned settings will have a simple expiration.
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 |
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 |