### Full Login Example with Region and Backend Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication A comprehensive example demonstrating how to configure TMAuthentication for a specific region (e.g., UK), log in to a particular backend service (e.g., HostModernAccounts), and fetch member info. Includes handling for success, abortion, and failure scenarios. ```swift // login to Host UK member database TMAuthentication.shared.configure( apiKey: "12345", region: .UK) { backendsConfigured in TMAuthentication.shared.login(backend: .HostModernAccounts) { authToken in // user logged in with authToken TMAuthentication.shared.memberInfo(backend: .HostModernAccounts) { memberInfo in // user info available in memberInfo } failure: { oldMemberInfo, error, backend in // error fetching member info } } aborted: { oldAuthToken, backend in // user aborted login } failure: { oldAuthToken, error, backend in // login error } } failure: { error in // configuration error } ``` -------------------------------- ### Get Configured Backend Services Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmapigeeconfigurationprovider-implementations Returns an array of TMAuthentication.BackendService objects that are currently configured. It accepts an optional AuthSource and instanceID as parameters. ```swift func backendServicesConfigured(source: AuthSource?, instanceID: String?) -> [BackendService] ``` -------------------------------- ### Get Configured Backend Services (Swift) Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmapigeeconfigurationprovider/backendservicesconfigured%28source%3Ainstanceid%3A%29 Retrieves an array of `TMAuthentication.BackendService` objects that are currently configured. Supports filtering by `AuthSource` and `instanceID`. Note that these services are stored in RAM and must be re-added on each launch. ```swift func backendServicesConfigured( source: TMAuthentication.AuthSource?, instanceID: String? ) -> [TMAuthentication.BackendService] ``` -------------------------------- ### Get Configured Backend Services Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmapigeeconfigurationprovider This Swift method returns an array of `TMAuthentication.BackendService` objects that are currently configured. It accepts an optional `source` and `instanceID` to potentially filter the results. This is a required method for conforming types. ```swift func backendServicesConfigured(source: TMAuthentication.AuthSource?, instanceID: String?) -> [TMAuthentication.BackendService] ``` -------------------------------- ### Configure Authentication Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/configure%28tmxsettings%3Abranding%3Afetchrule%3Asuccess%3Afailure%3A%29 Configures the TMAuthentication module using TMX settings, optional branding, and fetch rules. This method simplifies the setup by building the BrandedServiceSettings internally. ```APIDOC ## POST /configure ### Description Configures `TMAuthentication` for a given `TMAuthentication.TMXSettings` and `TMAuthentication.Branding`. This is a convenience method that builds the `TMAuthentication.BrandedServiceSettings` for you. ### Method POST ### Endpoint /configure ### Parameters #### Request Body - **tmxSettings** (TMXSettings) - Required - `TMAuthentication.TMXSettings` settings - **branding** (Branding) - Optional - `TMAuthentication.Branding` settings - **fetchRule** (FetchRule) - Optional - Optional `TMApigeeConfig` fetching/caching behavior rules `TMAuthentication.FetchRule`. Defaults to `.fetchIfEmptyOrOld`. - **success** (function) - Required - Block called with `TMAuthentication.BackendService`s successfully configured. - **failure** (function) - Required - Block called when configuration failed, typically network offline or a bad `apiKey`. ### Request Example ```swift TMAuthentication.shared.configure(tmxSettings: myTmxSettings, branding: myBranding) { configuredServices in print("Services configured: \(configuredServices)") } failure: { error in print("Configuration failed: \(error.localizedDescription)") } ``` ### Response #### Success Response (200) Indicates successful configuration. The `success` block in the request will be invoked. #### Failure Response (4xx/5xx) Indicates a failure during configuration. The `failure` block in the request will be invoked. ### Fetch Rules - **cachedOnly**: Use cached `TMApigeeConfig` even if old; if not cached, return error. - **fetchIfEmpty**: Use cached `TMApigeeConfig` even if old; if not cached, fetch. - **fetchIfEmptyOrOld**: Use cached `TMApigeeConfig` if not old; if old or not cached, fetch. - **forceFetch**: Ignore cached `TMApigeeConfig`, fetch always. ``` -------------------------------- ### Configure TMAuthentication with TMXSettings (Swift) Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/configure%28tmxsettings%3Abranding%3Afetchrule%3Asuccess%3Afailure%3A%29 This method configures `TMAuthentication` using `TMXSettings` and optional `Branding`, `FetchRule`, and callback blocks for success and failure. It simplifies the setup by building `BrandedServiceSettings` internally. The `fetchRule` parameter controls how configuration data is fetched and cached. ```swift func configure( tmxSettings: TMXSettings, branding: Branding? = nil, fetchRule: FetchRule? = .fetchIfEmptyOrOld, success: @escaping (_ backendsConfigured: [BackendService]) -> Void, failure: @escaping (_ error: Error) -> Void ) ``` -------------------------------- ### Get APIgee Configuration by TMX Settings Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmapigeeconfigurationprovider This Swift method fetches the `TMApigeeConfig` using provided `TMAuthentication.TMXSettings`. It includes an optional `fetchRule` and requires success and failure callbacks for handling the configuration retrieval process. This is a required method for conforming types. ```swift func apigeeConfig(tmxSettings: TMAuthentication.TMXSettings, fetchRule: TMAuthentication.FetchRule?, success: (_ config: TMApigeeConfig) -> Void, failure: (_ error: Error) -> Void) ``` -------------------------------- ### Get APIgee Configuration by Backend Service Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmapigeeconfigurationprovider This Swift method retrieves the `TMApigeeConfig` for a given `TMAuthentication.BackendService`. It utilizes a success callback to return the configuration or a failure callback in case of an error. This is a required method for conforming types. ```swift func apigeeConfig(backend: TMAuthentication.BackendService?, fetchRule: TMAuthentication.FetchRule?, success: (_ config: TMApigeeConfig) -> Void, failure: (_ error: Error) -> Void) ``` -------------------------------- ### Get TMX Network Service Configuration Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmapigeeconfigurationprovider This Swift method retrieves the `TMXNetworkServiceConfig` for a specified `TMAuthentication.BackendService`. If no backend service is provided or found, it may return `nil`. This is a required method for conforming types. ```swift func tmxNetworkServiceConfig(backend: TMAuthentication.BackendService?) -> TMXNetworkServiceConfig? ``` -------------------------------- ### Get Apigee Configuration Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/apigeeconfig%28tmxsettings%3Afetchrule%3Asuccess%3Afailure%3A%29 Retrieves the Apigee configuration for a given TMX settings. This method allows specifying fetch rules for caching behavior and provides success and failure callbacks. ```APIDOC ## GET /apigeeConfig ### Description Retrieves the Apigee configuration (`TMApigeeConfig`) using provided `TMXSettings`. You can specify a `fetchRule` to control caching behavior and provide callbacks for success and failure scenarios. ### Method GET ### Endpoint `/apigeeConfig` ### Parameters #### Query Parameters - **tmxSettings** (TMXSettings) - Required - Defines a specific TMX instance and apiKey. - **fetchRule** (FetchRule) - Optional - Rules for fetching/caching `TMApigeeConfig`. Defaults to `.fetchIfEmptyOrOld`. ### Request Example ```json { "tmxSettings": { "instance": "my_tmx_instance", "apiKey": "my_api_key" }, "fetchRule": "fetchIfEmptyOrOld" } ``` ### Response #### Success Response (200) - **config** (TMApigeeConfig) - The fetched Apigee configuration object. #### Response Example ```json { "config": { "baseURL": "https://api.ticketmaster.com", "environment": "production" } } ``` #### Error Response (400/500) - **error** (Error) - Description of the error encountered during fetching. ```json { "error": { "message": "Invalid API Key" } } ``` ### Discussion This method is typically not required to be called directly. The `fetchRule` parameter allows for flexible caching strategies: * `.cachedOnly`: Returns cached config if available, otherwise returns an error. * `.fetchIfEmpty`: Returns cached config if available, otherwise fetches a new one. * `.fetchIfEmptyOrOld`: Returns cached config if not old, otherwise fetches a new one. * `.forceFetch`: Ignores cache and always fetches a new config. ### See Also - `apigeeConfig(backend:fetchRule:success:failure:)` ``` -------------------------------- ### Initialize BackendService Instance (Swift) Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/backendservice/init%28source%3Aregion%3Aenvironment%3Ainstanceid%3A%29 Creates an instance of `BackendService` for authentication. It requires an `AuthSource` and optionally accepts parameters for region, environment, and instanceID to configure the authentication service. ```swift init( source: AuthSource, region: TMXDeploymentRegion? = nil, environment: TMXDeploymentEnvironment? = .Production, instanceID: String? = nil ) ``` -------------------------------- ### Get TMX Network Service Config Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmapigeeconfigurationprovider-implementations Retrieves the TMXNetworkServiceConfig for a given TMAuthentication.BackendService. It returns an optional TMXNetworkServiceConfig. ```swift func tmxNetworkServiceConfig(backend: BackendService?) -> TMXNetworkServiceConfig? ``` -------------------------------- ### POST /websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthenticationprovider/loginselectionpage%28backend%3Aloginproperties%3Afetchrule%3Acallsource%3A%29 Creates a login selection UI for configured TMAuthentication.BackendService. ```APIDOC ## POST /websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication ### Description Creates a login selection UI for configured `TMAuthentication.BackendService`. ### Method POST ### Endpoint /websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication ### Parameters #### Path Parameters - **backend** (TMAuthentication.BackendService) - Optional - Login to a specific `TMAuthentication.BackendService`, `nil` = auto-determine service (simple configurations only) - **loginProperties** ([String : String]) - Optional - Optional custom login properties - **fetchRule** (TMAuthentication.FetchRule) - Optional - Optional `TMAuthToken` fetching/caching behavior rules `TMAuthentication.FetchRule` - **callSource** (String) - Optional - Optional name of class or process calling this method ### Request Example ```json { "backend": "TMAuthentication.BackendService", "loginProperties": { "key": "value" }, "fetchRule": "TMAuthentication.FetchRule.forceFetch", "callSource": "MyCallingClass" } ``` ### Response #### Success Response (200) - **UIViewController?**: A `UIViewController` of login services (for you to present on your navigation flow) #### Response Example ```json { "loginViewController": "UIViewController" } ``` ### Discussion Auto-determined services (passing a backend of `nil`) may return a single-login or multiple-login styled page. To simply present login UI on top of your existing UI, use `login(backend:externalToken:loginProperties:presentationViewController:fetchRule:callSource:success:aborted:failure:)` **Fetch Rules:** * `TMAuthentication.FetchRule.cachedOnly` = return cached `TMAuthToken` even if expired, if not cached do not login, return error * `TMAuthentication.FetchRule.fetchIfEmpty` = return cached `TMAuthToken` even if expired, if not cached login * `TMAuthentication.FetchRule.fetchIfEmptyOrOld` = return cached `TMAuthToken` if not expired, if expired fetch, if not cached login * `TMAuthentication.FetchRule.forceFetch` = ignore cached `TMAuthToken`, login always ``` -------------------------------- ### Initialize Ticketmaster Authentication SDK Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/branding/init%28displayname%3Abackgroundcolor%3Aforegroundcolor%3Atheme%3Aenabletmbrandingcoloroverride%3Aeventnametype%3A%29 Initializes the Ticketmaster Authentication SDK with customizable display properties. Allows setting display name, background and foreground colors, theme, TM branding override, and event name type. ```swift init( displayName: String? = nil, backgroundColor: UIColor? = nil, foregroundColor: UIColor? = nil, theme: ColorTheme? = .light, enableTMBrandingColorOverride: Bool? = false, eventNameType: EventNameType? = .event ) ``` -------------------------------- ### Get Login Selection Page Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication Retrieves a view controller for the login selection page, allowing custom presentation logic. This is useful for more control over the login UI flow. ```swift if let vc = TMAuthentication.shared.loginSelectionPage() { onVC.present(vc, animated: true) } ``` -------------------------------- ### RawRepresentable Instance Methods Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmxdeploymentregion/rawrepresentable-implementations Details the instance methods available for types conforming to RawRepresentable. ```APIDOC ## Instance Methods ### `func encode(to: any Encoder) throws` **Description**: Encodes the RawRepresentable type to a given encoder. **Method**: `encode(to:)` **Endpoint**: N/A (Protocol method) #### Parameters ##### Request Body - **encoder** (any Encoder) - Required - The encoder to write data to. #### Response ##### Success Response (N/A - Method execution) (No return value, throws on error) ##### Response Example (Example depends on the specific conforming type) ### `func hash(into: inout Hasher)` **Description**: Hashes the RawRepresentable type using the provided hasher. **Method**: `hash(into:)` **Endpoint**: N/A (Protocol method) #### Parameters ##### Request Body - **hasher** (inout Hasher) - Required - The hasher to use for hashing. #### Response ##### Success Response (N/A - Method execution) (No return value) ##### Response Example (Example depends on the specific conforming type) ``` -------------------------------- ### Get Valid Authentication Token Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthenticationprovider Retrieves a valid TMAuthToken for the specified backend service, optionally showing the login UI if needed. Handles success, abortion, and failure scenarios. ```swift func validToken(backend: TMAuthentication.BackendService?, showLoginIfNeeded: Bool, loginProperties: [String : String]?, presentationViewController: UIViewController?, fetchRule: TMAuthentication.FetchRule?, callSource: String?, success: (_ authToken: TMAuthToken) -> Void, aborted: (_ oldAuthToken: TMAuthToken?, _ backend: TMAuthentication.BackendService) -> Void, failure: (_ oldAuthToken: TMAuthToken?, _ error: Error, _ backend: TMAuthentication.BackendService?) -> Void) ``` -------------------------------- ### Simple Configuration with API Key Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/configure%28brandedservicesettings%3Afetchrule%3Asuccess%3Afailure%3A%29 Configures the TMAuthentication SDK using a simple API key, region, environment, and optional branding and fetch rules. ```APIDOC ## POST /configure/simple ### Description Configures `TMAuthentication` for a given `apiKey` and other settings. ### Method POST ### Endpoint `/configure/simple` ### Parameters #### Request Body - **apiKey** (String) - Required - Your Ticketmaster API key. - **region** (TMXDeploymentRegion) - Required - The deployment region (e.g., "us", "eu"). - **environment** (TMXDeploymentEnvironment) - Required - The deployment environment (e.g., "production", "staging"). - **branding** (Branding?) - Optional - Branding information for the application. - **fetchRule** (FetchRule?) - Optional - Fetching/caching behavior rules. - **success** (@escaping (_ backendsConfigured: [BackendService]) -> Void) - Required - Block called with `TMAuthentication.BackendService`s successfully configured. - **failure** (@escaping (_ error: Error) -> Void) - Required - Block called when configuration failed. ### Request Example ```json { "apiKey": "YOUR_API_KEY", "region": "us", "environment": "production", "branding": { "appName": "My App", "appVersion": "1.0" }, "fetchRule": "forceFetch" } ``` ### Response #### Success Response (200) - **backendsConfigured** ([BackendService]) - A list of successfully configured backend services. #### Response Example ```json { "backendsConfigured": [ { "serviceName": "AuthService", "baseUrl": "https://api.ticketmaster.com" } ] } ``` #### Error Response (400) - **error** (Error) - An error object describing the failure. #### Error Response Example ```json { "error": { "code": "NETWORK_OFFLINE", "message": "Network is offline." } } ``` ``` -------------------------------- ### Get Member Information Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthenticationprovider Retrieves the logged-in user's TMMemberInfo for a specific TMAuthentication.BackendService. It includes parameters for backend service, related account, fetch rule, call source, and handlers for success and failure. ```swift func memberInfo(backend: TMAuthentication.BackendService?, relatedAccount: TMMemberInfo.RelatedAccount?, fetchRule: TMAuthentication.FetchRule?, callSource: String?, success: (_ memberInfo: TMMemberInfo) -> Void, failure: (_ oldMemberInfo: TMMemberInfo?, _ error: Error, _ backend: TMAuthentication.BackendService?) -> Void) ``` -------------------------------- ### Initialize Ticketmaster Authentication SDK Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthtoken/init%28backend%3Aexchangesourcebackend%3Aexternaltoken%3Aaccesstoken%3Atokentype%3Ascope%3Aexpiredate%3Aidtoken%3Ahmacid%3Aaccountmanagerhmacid%3Adonotsellflag%3A%29 Initializes the Ticketmaster Authentication SDK with various parameters. This method requires a backend service and an access token, and optionally accepts an exchange source backend, external token, token type, scope, expiration date, ID token, HMAC IDs, and a do-not-sell flag. ```swift init( backend: TMAuthentication.BackendService, exchangeSourceBackend: TMAuthentication.BackendService?, externalToken: String?, accessToken: String, tokenType: String?, scope: String?, expireDate: Date, idToken: String?, hmacID: String?, accountManagerHmacID: String?, doNotSellFlag: Bool? ) ``` -------------------------------- ### Get Member Information - TMAuthenticationProvider Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmauthenticationprovider-implementations Retrieves the logged-in user's TMMemberInfo for a given TMAuthentication.BackendService. It includes optional related account, fetch rule, and call source, with success and failure handlers. ```swift func memberInfo(backend: BackendService?, relatedAccount: TMMemberInfo.RelatedAccount?, fetchRule: FetchRule?, callSource: String?, success: (_ memberInfo: TMMemberInfo) -> Void, failure: (_ oldMemberInfo: TMMemberInfo?, _ error: Error, _ backend: BackendService?) -> Void) ``` -------------------------------- ### Get Apigee Configuration Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/apigeeconfig%28backend%3Afetchrule%3Asuccess%3Afailure%3A%29 Retrieves the Apigee configuration for the currently configured TMAuthentication.BackendService. This method allows specifying fetch rules for caching behavior. ```APIDOC ## GET /websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication/apigeeConfig ### Description Retrieves the Apigee configuration for the currently configured `TMAuthentication.BackendService`. This method allows specifying fetch rules for caching behavior. ### Method GET ### Endpoint `/websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication/apigeeConfig` ### Parameters #### Query Parameters - **backend** (BackendService) - Optional - An existing `TMAuthentication.BackendService` already returned by `TMAuthentication`, `nil` = auto-determine service (simple configurations only) - **fetchRule** (FetchRule) - Optional - `TMApigeeConfig` fetching/caching behavior rules `TMAuthentication.FetchRule` ### Request Example ``` { "backend": null, "fetchRule": ".fetchIfEmptyOrOld" } ``` ### Response #### Success Response (200) - **config** (TMApigeeConfig) - The fetched Apigee configuration. #### Response Example ``` { "config": { "some_apigee_setting": "value" } } ``` #### Error Response - **error** (Error) - Block called when the config could not be fetched, typically network offline or mismatched `TMAuthentication.BackendService` ``` -------------------------------- ### Initialize TicketmasterAuthentication Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmmemberinfo/init%28backend%3Alocalid%3Aglobalid%3Ahmacid%3Adonotsellflag%3Afirstname%3Alastname%3Aemail%3Aphone%3Apostalcode%3Alanguage%3Acountry%3Arelatedaccounts%3Atermsofuse%3Aacquireddate%3A%29 Initializes the TicketmasterAuthentication service with essential backend configuration and optional user data. Parameters include service backend, user identifiers, personal information, and acquisition details. Ensure all required parameters like 'backend' and 'acquiredDate' are provided for proper initialization. ```swift init( backend: TMAuthentication.BackendService, localID: String?, globalID: String?, hmacID: String?, doNotSellFlag: Bool?, firstName: String?, lastName: String?, email: String?, phone: String?, postalCode: String?, language: String?, country: String?, relatedAccounts: [RelatedAccount]?, termsOfUse: TermsOfUse?, acquiredDate: Date ) ``` -------------------------------- ### RawRepresentable Initializers Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmxdeploymentenvironment/rawrepresentable-implementations Details the initializers available for types conforming to RawRepresentable. ```APIDOC ## Initializers ### `init(from: any Decoder) throws` Available when `Self` conforms to `Decodable` and `RawValue` is `String`. **Description**: Initializes a RawRepresentable type from a decoder, specifically when the raw value is a String. ``` -------------------------------- ### RawRepresentable Instance Methods Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmxdeploymentenvironment/rawrepresentable-implementations Details the instance methods available for types conforming to RawRepresentable. ```APIDOC ## Instance Methods ### `func encode(to: any Encoder) throws` Available when `Self` conforms to `Encodable` and `RawValue` is `String`. **Description**: Encodes the RawRepresentable type into an encoder, applicable when the type is Encodable and its raw value is a String. ``` ```APIDOC ### `func hash(into: inout Hasher)` Available when `Self` conforms to `Hashable` and `RawValue` conforms to `Hashable`. **Description**: Hashes the essential components of the RawRepresentable type using the provided Hasher, requiring Hashable conformance for both the type and its raw value. ``` -------------------------------- ### RawRepresentable Initializers Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmxdeploymentregion/rawrepresentable-implementations Details the initializer available for types conforming to RawRepresentable and Decodable. ```APIDOC ## Initializers ### `init(from: any Decoder) throws` **Description**: Initializes a RawRepresentable type from a decoder. **Method**: `init` (initializer) **Endpoint**: N/A (Protocol method) #### Parameters ##### Request Body - **decoder** (any Decoder) - Required - The decoder to read data from. #### Response ##### Success Response (N/A - Initializer) - **self** (RawRepresentable) - The initialized instance. ##### Response Example (Example depends on the specific conforming type) ``` -------------------------------- ### Access Authentication Notification Details - Swift Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/authnotification Provides Swift code examples for extracting specific information from TMAuthentication.AuthNotification objects. This includes retrieving the source backend service and any associated error from the notification's userInfo dictionary. ```swift struct AuthNotification { static let backendKey = "backendKey" static let errorKey = "errorKey" static let loggedIn: Notification.Name static let loggedOut: Notification.Name static let loginAborted: Notification.Name static let loginCompleted: Notification.Name static let loginExternalExchanging: Notification.Name static let loginFailed: Notification.Name static let loginLinkAccountPresented: Notification.Name static let loginOAuthCodeExchanging: Notification.Name static let loginPresented: Notification.Name static let loginStarted: Notification.Name static let loginSystemExchanging: Notification.Name static let logoutCompleted: Notification.Name static let logoutStarted: Notification.Name static let serviceConfigurationCompleted: Notification.Name static let serviceConfigurationStarted: Notification.Name static let serviceConfigured: Notification.Name static let tokenRefreshed: Notification.Name static func backend(notification: Notification) -> TMAuthentication.BackendService? static func error(notification: Notification) -> Error? static func state(notificationName: Notification.Name) -> TMAuthentication.ServiceState? } ``` -------------------------------- ### Get TMXNetworkServiceConfig for Backend Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmxnetworkserviceconfig%28backend%3A%29 Retrieves the `TMXNetworkServiceConfig` for the currently configured `TMAuthentication.BackendService`. The `backend` parameter allows for auto-determination of the service if not provided. This method is typically used for configuring additional TMXServices and is not usually called directly. ```swift func tmxNetworkServiceConfig(backend: BackendService? = nil) -> TMXNetworkServiceConfig? ``` -------------------------------- ### TMAssertion Protocol Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmassertion Documentation for the TMAssertion protocol, outlining its initializers and instance properties. ```APIDOC ## TMAssertion Protocol ### Description The `TMAssertion` protocol defines the structure for handling assertions, conforming to several standard Swift protocols for encoding, decoding, hashing, and custom encoding. ### Initializers * `init(format: UInt8, authenticatorData: Data, clientDataJSONHash: Data, signature: Data)` * **Description**: Initializes a new `TMAssertion` instance with all required assertion components. * **Required**: Yes * `init(format: UInt8, signature: Data)` * **Description**: Initializes a new `TMAssertion` instance with the format and signature, potentially deriving other properties. * **Required**: Yes ### Instance Properties * `authenticatorData: Data?` * **Description**: The data representing the authenticator. * **Required**: Yes * `clientDataJSONHash: Data?` * **Description**: The hash of the client data in JSON format. * **Required**: Yes * `format: UInt8` * **Description**: The assertion format identifier. * **Required**: Yes * `signature: Data` * **Description**: The digital signature of the assertion. * **Required**: Yes ### Relationships #### Inherits From * `Swift.Decodable` * `Swift.Encodable` * `Swift.Equatable` * `Swift.Hashable` * `TMEncodableAssertion` #### Conforming Types * `AppAttestAssertion` ``` -------------------------------- ### TMAuthenticationProvider Instance Methods Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthenticationprovider Documentation for the various instance methods available on the TMAuthenticationProvider. ```APIDOC ## TMAuthenticationProvider Instance Methods ### `clearAllCachedData` **Description:** Completely resets all the user’s data (except for anything stored in a login webpage). **Required:** true **Parameters:** * `callSource` (String?) - Optional - Source of the call. * `completion` (Void) - Callback when data is cleared. ``` ```APIDOC ### `clearAllStateChangedBlocks` **Description:** Clear and release any block closures retained by `registerStateChanged(block:)`. **Required:** true ``` ```APIDOC ### `deleteAccount` **Description:** Present Delete Account UI for the given `TMAuthentication.BackendService`. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. * `success` (TMAuthentication.BackendService) -> Void - Callback on successful deletion. * `aborted` (TMAuthentication.BackendService) -> Void - Callback if deletion is aborted. * `failure` (Error, TMAuthentication.BackendService?) -> Void - Callback on failure. ``` ```APIDOC ### `hasToken` **Description:** Checks if a token exists for the given backend service. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. ``` ```APIDOC ### `hasUnexpiredToken` **Description:** Checks if a token exists and has not expired for the given backend service. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. ``` ```APIDOC ### `login` **Description:** Present login UI for the given `TMAuthentication.BackendService`. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. * `externalToken` (String?) - Optional - An external token. * `loginProperties` ([String: String]?) - Optional - Properties for login. * `presentationViewController` (UIViewController?) - Optional - The view controller for presentation. * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. * `success` (TMAuthToken) -> Void - Callback with the auth token on success. * `aborted` (TMAuthToken?, TMAuthentication.BackendService) -> Void - Callback if login is aborted. * `failure` (TMAuthToken?, Error, TMAuthentication.BackendService?) -> Void - Callback on failure. ``` ```APIDOC ### `loginSelectionPage` **Description:** Creates a login selection UI for configured `TMAuthentication.BackendService`. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. * `loginProperties` ([String: String]?) - Optional - Properties for login. * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. **Returns:** `UIViewController?` - The login selection view controller. ``` ```APIDOC ### `logout` **Description:** Logs out of the configured `TMAuthentication.BackendService`. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. * `completion` ([TMAuthentication.BackendService]?) -> Void - Callback with the list of backends after logout. ``` ```APIDOC ### `logoutAll` **Description:** Logs out of all `TMAuthentication.BackendService`, even those not currently configured. **Required:** true **Parameters:** * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. * `completion` ([TMAuthentication.BackendService]?) -> Void - Callback with the list of backends after logout. ``` ```APIDOC ### `memberInfo` **Description:** Gets the logged-in user’s `TMMemberInfo` for the `TMAuthentication.BackendService`. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. * `relatedAccount` (TMMemberInfo.RelatedAccount?) - Optional - The related account. * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. * `success` (TMMemberInfo) -> Void - Callback with member info on success. * `failure` (TMMemberInfo?, Error, TMAuthentication.BackendService?) -> Void - Callback on failure. ``` ```APIDOC ### `registerStateChanged` **Description:** Registered blocks will be called on state changes. **Required:** true **Parameters:** * `block` (TMAuthentication.BackendService?, TMAuthentication.ServiceState, Error?) -> Void - The block to register for state changes. ``` ```APIDOC ### `validToken` **Description:** Gets a valid `TMAuthToken` for the `TMAuthentication.BackendService`. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. * `showLoginIfNeeded` (Bool) - Whether to show login if needed. * `loginProperties` ([String: String]?) - Optional - Properties for login. * `presentationViewController` (UIViewController?) - Optional - The view controller for presentation. * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. * `success` (TMAuthToken) -> Void - Callback with the auth token on success. * `aborted` (TMAuthToken?, TMAuthentication.BackendService) -> Void - Callback if token retrieval is aborted. * `failure` (TMAuthToken?, Error, TMAuthentication.BackendService?) -> Void - Callback on failure. ``` ```APIDOC ### `validateMFAToken` **Description:** Performs Multi-Factor Authentication (2FA) for the `TMAuthentication.BackendService`. **Required:** true **Parameters:** * `backend` (TMAuthentication.BackendService?) - Optional - The backend service. * `mfaProperties` ([String: Any]?) - Optional - Properties for MFA. * `presentationViewController` (UIViewController?) - Optional - The view controller for presentation. * `fetchRule` (TMAuthentication.FetchRule?) - Optional - Rule for fetching data. * `callSource` (String?) - Optional - Source of the call. * `success` (TMMFAToken) -> Void - Callback with the MFA token on success. * `aborted` (TMAuthentication.BackendService) -> Void - Callback if MFA is aborted. * `failure` (Error, TMAuthentication.BackendService?) -> Void - Callback on failure. ``` -------------------------------- ### POST /websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication/customConfigure Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/customconfigure%28brandedservicesettingarray%3Afetchrule%3Asuccess%3Afailure%3A%29 Allows for the creation of all possible configurations for a given array of `TMAuthentication.BrandedServiceSettings`. This is intended for advanced use cases where multiple Apigee API keys need to be combined. It also fetches necessary `TMApigeeConfig` files. ```APIDOC ## POST /websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication/customConfigure ### Description This endpoint allows for the creation of all possible configurations for a given array of `TMAuthentication.BrandedServiceSettings`. It is designed for advanced use cases where you need to combine multiple Apigee API Keys. This method will also fetch all necessary `TMApigeeConfig` files. ### Method POST ### Endpoint `/websites/code_ticketmaster_ios-ticketmastersdk_ticketmasterauthentication/customConfigure` ### Parameters #### Path Parameters None #### Query Parameters * **fetchRule** (TMAuthentication.FetchRule) - Optional - Defines fetching and caching behavior rules for `TMApigeeConfig`. #### Request Body * **brandedServiceSettingArray** (Array) - Required - An array of `TMAuthentication.BrandedServiceSettings` which includes `TMAuthentication.TMXSettings` and `TMAuthentication.Branding`. ### Request Example ```json { "brandedServiceSettingArray": [ { "tmxSettings": { "apiKey": "YOUR_TMX_API_KEY", "apiSecret": "YOUR_TMX_API_SECRET" }, "branding": { "appName": "My App", "appVersion": "1.0.0" } } // Add more BrandedServiceSettings objects as needed ], "fetchRule": "fetchIfEmptyOrOld" } ``` ### Response #### Success Response (200) * **backendsConfigured** (Array) - An array of `TMAuthentication.BackendService` objects that were successfully configured. #### Response Example ```json { "backendsConfigured": [ { "serviceName": "ExampleService1", "baseUrl": "https://api.example.com/v1" }, { "serviceName": "ExampleService2", "baseUrl": "https://api.example.com/v2" } ] } ``` #### Error Handling * **failure** (Block) - A block called if only some of the `TMAuthentication.BackendService`s configured successfully. It receives the list of successfully configured backends and the encountered error. **Fetch Rules Explained:** * `TMAuthentication.FetchRule.cachedOnly` = Use cached `TMApigeeConfig` even if old; if not cached, return an error. * `TMAuthentication.FetchRule.fetchIfEmpty` = Use cached `TMApigeeConfig` even if old; if not cached, fetch. * `TMAuthentication.FetchRule.fetchIfEmptyOrOld` = Use cached `TMApigeeConfig` if not old; if old or not cached, fetch. * `TMAuthentication.FetchRule.forceFetch` = Ignore cached `TMApigeeConfig`; fetch always. ``` -------------------------------- ### BackendService Initializers Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/backendservice Initializers for creating a BackendService instance. One initializer decodes from any Decoder, and the other takes explicit parameters for source, region, environment, and instance ID. ```swift init(from: any Decoder) throws ``` ```swift init(source: AuthSource, region: TMXDeploymentRegion?, environment: TMXDeploymentEnvironment?, instanceID: String?) ``` -------------------------------- ### Initialize LoginURLOAuth with Parameters Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/loginurloauth Initializes the LoginURLOAuth struct with a URL, callback URL scheme, an optional code verifier for PKCE, and an optional state string. These parameters are crucial for setting up the authentication session. ```swift init(url: URL, callbackURLScheme: String, codeVerifier: String?, state: String?) ``` -------------------------------- ### Get Member Info Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthenticationprovider/memberinfo%28backend%3Arelatedaccount%3Afetchrule%3Acallsource%3Asuccess%3Afailure%3A%29 Retrieves the logged-in user's TMMemberInfo for a specified backend service. Supports fetching for related accounts and allows configuration of data fetching/caching behavior. ```APIDOC ## POST /memberInfo ### Description Retrieves the logged-in user's `TMMemberInfo` for a specified `TMAuthentication.BackendService`. This method supports fetching member information for related accounts and allows configuration of data fetching and caching behavior through `fetchRule`. ### Method POST ### Endpoint `/memberInfo` ### Parameters #### Request Body - **backend** (`TMAuthentication.BackendService?`) - Optional. Specifies the `TMAuthentication.BackendService`. If `nil`, the service is auto-determined for simple configurations. - **relatedAccount** (`TMMemberInfo.RelatedAccount?`) - Optional. Use to fetch memberInfo for related accounts. If `nil`, the Main Account is used. - **fetchRule** (`TMAuthentication.FetchRule?`) - Optional. Defines the `TMAuthentication.FetchRule` for fetching and caching behavior. - **callSource** (`String?`) - Optional. The name of the class or process calling this method. - **success** (`@escaping (_ memberInfo: TMMemberInfo) -> Void`) - Required. The success callback block that receives the fetched `TMMemberInfo`. - **failure** (`@escaping (_ oldMemberInfo: TMMemberInfo?, _ error: Error, _ backend: TMAuthentication.BackendService?) -> Void`) - Required. The failure callback block that receives any cached `oldMemberInfo`, the `error`, and the `backend` service where the error occurred. ### Request Example ```json { "backend": "ticketmaster", "relatedAccount": null, "fetchRule": "fetchIfEmptyOrOld", "callSource": "MyViewController" } ``` ### Response #### Success Response (200) - **memberInfo** (`TMMemberInfo`) - The fetched member information, which may be cached. #### Response Example ```json { "memberInfo": { "userId": "12345", "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com" } } ``` #### Error Response - **oldMemberInfo** (`TMMemberInfo?`) - Cached member information, if available. - **error** (`Error`) - The error that occurred during the refresh process. - **backend** (`TMAuthentication.BackendService?`) - The backend service that encountered the error. ### Discussion This method automatically refreshes `TMAuthToken` if needed. Fetch Rules: - `TMAuthentication.FetchRule.cachedOnly`: Returns cached `TMMemberInfo` even if expired. Returns an error if not cached. - `TMAuthentication.FetchRule.fetchIfEmpty`: Returns cached `TMMemberInfo` if not old. Fetches if not cached. - `TMAuthentication.FetchRule.fetchIfEmptyOrOld`: Returns cached `TMMemberInfo` if not old. Fetches if old or not cached. - `TMAuthentication.FetchRule.forceFetch`: Ignores cached `TMMemberInfo` and fetches data every time. ``` -------------------------------- ### TMMemberInfo.TermsOfUse Initializers Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmmemberinfo/termsofuse-swift Provides initializers for creating a TermsOfUse object, including one for decoding from any decoder and another for direct initialization with version, acceptance requirement, and text. ```swift init(from: any Decoder) throws ``` ```swift init(version: String?, acceptanceRequired: Bool, text: String?) ``` -------------------------------- ### Get Network Service Config - Swift Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmapigeeconfigurationprovider/tmxnetworkserviceconfig%28backend%3A%29 Retrieves the `TMXNetworkServiceConfig` for the currently configured `TMAuthentication.BackendService`. It can optionally accept a `backend` parameter; if `nil`, the service is auto-determined (for simple configurations). This method is typically used internally by other Ticketmaster SDKs and not directly by developers. ```swift func tmxNetworkServiceConfig(backend: TMAuthentication.BackendService?) -> TMXNetworkServiceConfig? ``` -------------------------------- ### TMApigeeConfig.Base Instance Properties Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmapigeeconfig/base-swift Lists various instance properties of TMApigeeConfig.Base, which control different aspects of the SDK's behavior. These include feature flags, URL configurations, and locale settings. ```swift let accountSwitchEnabled: Bool let assignFlowLearnMoreURLs: [String : URL]? let attractionIdFilter: [String]? let barcodeV2Enabled: Bool let barcodeV2HowToURL: URL? let cmsModulesEnabled: Bool let eventsThrottling: String? let externalModulesEnabled: Bool let fanWalletEnabled: Bool let forceEventsDesignVersion: String? let forceTicketsDesignVersion: String? var isCatalanLocale: Bool var isCzechLocale: Bool var isDanishLocale: Bool var isDutchLocale: Bool var isEnglishLocale: Bool var isFinnishLocale: Bool var isFrenchLocale: Bool var isGermanLocale: Bool var isItalianLocale: Bool var isNorwegianLocale: Bool var isPolishLocale: Bool let isSellButtonHidden: Bool var isSpanishLocale: Bool var isSwedishLocale: Bool let localeString: String let logoURL: URL? var marketDomain: TicketmasterFoundation.MarketDomain let passesThrottling: String? let prefetchTicketsEnabled: Bool let quickLoginDisabled: Bool let sellManageListingsOverrideURL: URL? let ticketsThrottling: String? let timePool: String? let upsellAddOnsEnabled: Bool let useICCPFetchTickets: Bool let uwdKey: String? var validLocale: Locale var validLocaleAcceptLanguageCode: String var validLocaleCountryCode: String var validLocaleLanguageCode: String let venueIdFilter: [String]? let venueNextDisabled: Bool let venueSuppressionRules: [VenueSuppressionRule]? let venueUnsuppressRuleIdentifier: String? ``` -------------------------------- ### Get Bound Device ID Signature - Swift Source: https://code.ticketmaster.com/iOS-TicketmasterSDK/docs/TicketmasterAuthentication/documentation/ticketmasterauthentication/tmauthentication/tmdevicebindingprovider-implementations Retrieves the stored DeviceKeyId for the user currently logged into the given backend. This method requires a backend service, a call source string, and encoded information. It returns a TMDeviceKey object on success or an error and the backend service on failure. ```swift func boundDeviceIdSignature(backend: BackendService?, callSource: String, infoToEncode: InfoToEncode, success: (_ deviceKey: TMDeviceKey) -> Void, failure: (_ error: Error, _ backend: BackendService?) -> Void) ```