public static FromHeader ( string name, string value ) : |
||
name | string | The name of the header to add. Must not be null. |
value | string | The value of the header to add. Must not be null. |
return |
/// <summary> /// Constructs a helper from the given settings. /// Behavior is undefined if settings are changed after construction. /// </summary> /// <param name="settings">The service settings.</param> public ClientHelper(ServiceSettingsBase settings) { GaxPreconditions.CheckNotNull(settings, nameof(settings)); Clock = settings.Clock ?? SystemClock.Instance; Scheduler = settings.Scheduler ?? SystemScheduler.Instance; _clientCallSettings = settings.CallSettings; _versionCallSettings = CallSettings.FromHeader(VersionHeaderBuilder.HeaderName, settings.VersionHeader); }
// TODO: Accept a Google.Protobuf.FieldMask when we're convinced it's useful and we know // exactly what to do with it. /// <summary> /// Creates a CallSettings which applies an x-goog-request-params header with the specified /// parameter name and value. /// </summary> /// <remarks>The value is URL-encoded; it is expected that <paramref name="parameterName"/> is already URL-encoded.</remarks> /// <param name="parameterName">The name of the parameter. Must not be null.</param> /// <param name="value">The value of the parameter, which may be null. A null value is equivalent to providing an empty string.</param> /// <returns>A CallSettings which applies the appropriate parameter.</returns> internal static CallSettings FromGoogleRequestParamsHeader(string parameterName, string value) => CallSettings.FromHeader(RequestParamsHeader, parameterName + "=" + Uri.EscapeDataString(value ?? ""));
/// <summary> /// Returns a new <see cref="CallSettings"/> with the specified header, /// merged with the (optional) original settings specified by <paramref name="settings"/>. /// </summary> /// <param name="settings">Original settings. May be null, in which case the returned settings /// will only contain the header.</param> /// <param name="name">Header name. Must not be null.</param> /// <param name="value">Header value. Must not be null.</param> /// <returns>A new set of call settings including the specified header.</returns> public static CallSettings WithHeader(this CallSettings settings, string name, string value) => settings.MergedWith(CallSettings.FromHeader(name, value));