StringExtensionsMaskApiKey Method
Masks the API key present in the query string of a URL.
Namespace: GenerativeAIAssembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
public static string MaskApiKey(
this string url
)
- url String
-
The input URL containing an API key as part of its query parameters. If the key exists, it will be replaced with "Google_API_Key".
String
A new URL string with the API key masked. If the input URL does not contain a key or the input is null/whitespace, it returns the original URL.
In Visual Basic and C#, you can call this method as an instance method on any object of type
String. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).