SearchEngineUrl

public struct SearchEngineUrl
extension SearchEngineUrl: Sendable
extension SearchEngineUrl: Equatable, Hashable

Defines an individual search engine URL.

  • 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 or POST). If the engine definition has not specified the method, it defaults to GET.

    Declaration

    Swift

    public var method: String
  • 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?
  • The display name of the URL, if any. This is useful if the URL corresponds to a brand name distinct from the engine’s brand name.

    Declaration

    Swift

    public var displayName: 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 None, it’s assumed the content type is text or not relevant. 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]?
  • 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: String, 
        /**
         * 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?, 
        /**
         * The display name of the URL, if any. This is useful if the URL
         * corresponds to a brand name distinct from the engine's brand name.
         */displayName: String? = nil, 
        /**
         * Indicates the date until which the URL is considered new
         * (format: YYYY-MM-DD).
         */isNewUntil: String? = nil, 
        /**
         * Whether the engine's partner code should be excluded from telemetry when
         * this URL is visited.
         */excludePartnerCodeFromTelemetry: Bool = false, 
        /**
         * If this URL performs searches only for certain MIME types, they should
         * be listed here. If `None`, it's assumed the content type is text or not
         * relevant. 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]? = nil)
  • Declaration

    Swift

    public static func == (lhs: SearchEngineUrl, rhs: SearchEngineUrl) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)