diff --git a/Sources/Segment/Types.swift b/Sources/Segment/Types.swift index e9fb50ac..35246e50 100644 --- a/Sources/Segment/Types.swift +++ b/Sources/Segment/Types.swift @@ -257,71 +257,6 @@ extension RawEvent { } } - /** - Set values to be received for this event in cloud-mode, specific to an integration key path. - Note that when specifying nil as the value, the key will be removed for the given key path. Additionally, - any keys that don't already exist in the path will be created as necessary. - - Example: - ``` - trackEvent.setIntegrationValue(42, forKeyPath: "Amplitude.threshold") - ``` - - - Parameters: - - value: The value to set for the given keyPath, or nil. - - forKeyPath: The key path for the value. - */ - public mutating func setIntegrationValue(_ value: Any?, forKeyPath keyPath: String) { - guard let existing = integrations?.dictionaryValue else { - // this shouldn't happen, might oughta log it. - Analytics.segmentLog(message: "Unable to get what should be a valid list of integrations from event.", kind: .error) - return - } - - var new = existing - new[keyPath: KeyPath(keyPath)] = value - do { - integrations = try JSON(new) - } catch { - // this shouldn't happen, log it. - Analytics.segmentLog(message: "Unable to convert list of integrations to JSON. \(error)", kind: .error) - } - } - - /** - Set context values for this event. - Note that when specifying nil as the value, the key will be removed for the given key path. Additionally, - any keys that don't already exist in the path will be created as necessary. - - Example: - ``` - // the metadata key will be created as a dictionary, and the key nickname will be set. - trackEvent.setContextValue("Brandon's device", forKeyPath: "device.metadata.nickname") - - // the metadata key will be removed entirely. - trackEvent.setContextValue(nil, forKeyPath: "device.metadata") - ``` - - - Parameters: - - value: The value to set for the given keyPath, or nil. - - forKeyPath: The key path for the value. - */ - public mutating func setContextValue(_ value: Any?, forKeyPath keyPath: String) { - guard let existing = context?.dictionaryValue else { - // this shouldn't happen, might oughta log it. - Analytics.segmentLog(message: "Unable to get what should be a valid context from event.", kind: .error) - return - } - - var new = existing - new[keyPath: KeyPath(keyPath)] = value - do { - context = try JSON(new) - } catch { - // this shouldn't happen, log it. - Analytics.segmentLog(message: "Unable to convert context to JSON. \(error)", kind: .error) - } - } }