JsonEngineUrl
public struct JsonEngineUrl
extension JsonEngineUrl: Sendable
extension JsonEngineUrl: Equatable, Hashable
Defines an individual search engine URL. This is defined separately to
types::SearchEngineUrl
as various fields may be optional in the supplied
configuration.
-
The PrePath and FilePath of the URL. May include variables for engines which have a variable FilePath, e.g.
{searchTerms}
for when a search term is within the path of the url.Declaration
Swift
public var base: String?
-
The HTTP method to use to send the request (
GET
orPOST
). If the engine definition has not specified the method, it defaults to GET.Declaration
Swift
public var method: JsonEngineMethod?
-
The parameters for this URL.
Declaration
Swift
public var params: [SearchUrlParam]?
-
The name of the query parameter for the search term. Automatically appended to the end of the query. This may be skipped if
{searchTerms}
is included in the base.Declaration
Swift
public var searchTermParamName: String?
-
A map from locale codes to display names of the URL. This is useful if the URL corresponds to a brand name distinct from the engine’s brand name. Since brand names can be localized, this is a map rather than a URL. The client will fall back to the special locale code “default” when its locale is not present in the map.
Declaration
Swift
public var displayNameMap: [String : String]?
-
Indicates the date until which the URL is considered new (format: YYYY-MM-DD).
Declaration
Swift
public var isNewUntil: String?
-
Whether the engine’s partner code should be excluded from telemetry when this URL is visited.
Declaration
Swift
public var excludePartnerCodeFromTelemetry: Bool
-
If this URL performs searches only for certain MIME types, they should be listed here. If this value is
None
, then it’s assumed the content type is irrelevant. This field is intended to be used for URLs like visual search, which might support certain image types and not others. Consumers can use it to determine whether search UI corresponding to the URL should be shown to the user in a given context.Declaration
Swift
public var acceptedContentTypes: [String]?
-
init(base:
method: params: searchTermParamName: displayNameMap: isNewUntil: excludePartnerCodeFromTelemetry: acceptedContentTypes: ) Declaration
Swift
public init( /** * The PrePath and FilePath of the URL. May include variables for engines * which have a variable FilePath, e.g. `{searchTerms}` for when a search * term is within the path of the url. */base: String?, /** * The HTTP method to use to send the request (`GET` or `POST`). * If the engine definition has not specified the method, it defaults to GET. */method: JsonEngineMethod?, /** * The parameters for this URL. */params: [SearchUrlParam]?, /** * The name of the query parameter for the search term. Automatically * appended to the end of the query. This may be skipped if `{searchTerms}` * is included in the base. */searchTermParamName: String?, /** * A map from locale codes to display names of the URL. This is useful if * the URL corresponds to a brand name distinct from the engine's brand * name. Since brand names can be localized, this is a map rather than a * URL. The client will fall back to the special locale code "default" when * its locale is not present in the map. */displayNameMap: [String: String]?, /** * Indicates the date until which the URL is considered new * (format: YYYY-MM-DD). */isNewUntil: String?, /** * Whether the engine's partner code should be excluded from telemetry when * this URL is visited. */excludePartnerCodeFromTelemetry: Bool, /** * If this URL performs searches only for certain MIME types, they should * be listed here. If this value is `None`, then it's assumed the content * type is irrelevant. This field is intended to be used for URLs like * visual search, which might support certain image types and not others. * Consumers can use it to determine whether search UI corresponding to the * URL should be shown to the user in a given context. */acceptedContentTypes: [String]?)
-
Declaration
Swift
public static func == (lhs: JsonEngineUrl, rhs: JsonEngineUrl) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)