SwiftBMLSDK_Query
public struct SwiftBMLSDK_Query
This struct is for generating queries to instances of LGV_MeetingServer
, and returning the parsed results.
It is designed for minimal filtering. Most filter parameters are for paging the search, or filtering for specific meeting types. Most filtering should be performed on the results.
This is the “working” part of the SwiftBMLSDK system. You instantiate an instance of this struct, and everything else comes from that.
Supported Systems
This will support iOS 16 (and greater), iPadOS 16 (and greater), tvOS 16 (and greater), macOS 13 (and greater), and watchOS 9 (and greater)
This requires Swift 5 or greater.
Usage
Instantiate this struct with a URL to an LGV_MeetingServer implementation.
For example:
SwiftBMLSDK_Query(serverBaseURI: URL(string: "https://littlegreenviper.com/LGV_MeetingServer/Tests/entrypoint.php"))
creates an instance, based on the LGV test server.
Once the struct is instantiated, it can then be queried. Responses to queries are a SwiftBMLSDK_Parser
instance, which contains and interprets the found set.
There are limited parameters to queries, as it is expected that most of the filtering and sorting will be performed on the found set of meeting instances.
Querying the Server
There are only two public query methods:
serverInfo(completion:)
This is a method that fetches the general information structure from the server, and presents it as aServerInfo
struct.meetingSearch(specification:completion:)
This actually queries the server for a set of meetings, based on aSearchSpecification
instance, and provides an instance ofSwiftBMLSDK_Parser
to a completion function.
Dependencies
This type has no dependencies, other than the Foundation and CoreLocation SDKs, provided by Apple.
-
This is the completion function for the server info query.
Note
The completion may be called in any thread!
Declaration
Swift
public typealias ServerInfoResultCompletion = (ServerInfo?, Error?) -> Void
-
This is the completion function for the meeting search query.
Note
The completion may be called in any thread!
Declaration
Swift
public typealias QueryResultCompletion = (SwiftBMLSDK_Parser?, Error?) -> Void
-
This is the response to the general server info query. It contains information about all the individual servers, represented by the aggregator server.
See moreDeclaration
Swift
public struct ServerInfo
-
This struct is what we use to prescribe the search spec.
Search specifications are quite simple. We only have the meeting type, location/radius (for in-person meetings), and paging options (to break up large found sets).
See moreDeclaration
Swift
public struct SearchSpecification
-
Default initializer.
Declaration
Swift
public init(serverBaseURI inServerBaseURI: URL? = nil)
Parameters
serverBaseURI
The URL to the “base (main directory) of an instance of
LGV_MeetingServer
. Optional. Can be omitted.
-
Accessor for the base URI.
Declaration
Swift
public var serverBaseURI: URL? { get set }
-
Fetches the server info.
Declaration
Swift
public func serverInfo(completion inCompletion: @escaping ServerInfoResultCompletion)
Parameters
completion
A tail completion proc (may be called in any thread).
-
Perform a server-based search.
Declaration
Swift
public func meetingSearch(specification inSpecification: SearchSpecification, completion inCompletion: @escaping QueryResultCompletion)
Parameters
specification
The search specification.
completion
A tail completion proc (may be called in any thread).