diff --git a/schemas/SuperProperties.json b/schemas/SuperProperties.json new file mode 100644 index 0000000..824264c --- /dev/null +++ b/schemas/SuperProperties.json @@ -0,0 +1,24 @@ +{ + "type": "object", + "description": "Super Properties are properties associated with events that are sent with every capture call, be it a $pageview, an autocaptured button click, or anything else.", + "properties": { + "cryptoSDK": { + "description": "Which crypto backend is the client currently using.", + "type": "string", + "oneOf": [ + {"const": "Legacy", "description": "Legacy crypto backend specific to each platform."}, + {"const": "Rust", "description": "Cross-platform crypto backend written in Rust."} + ] + }, + "cryptoSDKVersion": { + "description": "Version of the crypto backend.", + "type": "string" + }, + "appPlatform": { + "description": "Used by web to identify the platform (Web Platform/Electron Platform)", + "type": "string" + } + }, + "required": [], + "additionalProperties": false +} diff --git a/types/kotlin/SuperProperties.kt b/types/kotlin/SuperProperties.kt new file mode 100644 index 0000000..a54b729 --- /dev/null +++ b/types/kotlin/SuperProperties.kt @@ -0,0 +1,22 @@ +package quicktype + +/** + * Super Properties are properties associated with events that are sent with every capture + * call, be it a $pageview, an autocaptured button click, or anything else. + */ +data class SuperProperties ( + /** + * Used by web to identify the platform (Web Platform/Electron Platform) + */ + val appPlatform: String? = null, + + /** + * Which crypto backend is the client currently using. + */ + val cryptoSDK: String? = null, + + /** + * Version of the crypto backend. + */ + val cryptoSDKVersion: String? = null +) diff --git a/types/kotlin2/SuperProperties.kt b/types/kotlin2/SuperProperties.kt new file mode 100644 index 0000000..cd5d9df --- /dev/null +++ b/types/kotlin2/SuperProperties.kt @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2021 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.analytics.plan + +// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT +// https://github.com/matrix-org/matrix-analytics-events/ + +/** + * Super Properties are properties associated with events that are sent with + * every capture call, be it a $pageview, an autocaptured button click, or + * anything else. + */ +data class SuperProperties( + /** + * Used by web to identify the platform (Web Platform/Electron Platform) + */ + val appPlatform: String? = null, + /** + * Which crypto backend is the client currently using. + */ + val cryptoSDK: CryptoSDK? = null, + /** + * Version of the crypto backend. + */ + val cryptoSDKVersion: String? = null, +) { + + enum class CryptoSDK { + /** + * Legacy crypto backend specific to each platform. + */ + Legacy, + + /** + * Cross-platform crypto backend written in Rust. + */ + Rust, + } + + fun getProperties(): Map? { + return mutableMapOf().apply { + appPlatform?.let { put("appPlatform", it) } + cryptoSDK?.let { put("cryptoSDK", it.name) } + cryptoSDKVersion?.let { put("cryptoSDKVersion", it) } + }.takeIf { it.isNotEmpty() } + } +} diff --git a/types/swift/SuperProperties.swift b/types/swift/SuperProperties.swift new file mode 100644 index 0000000..b611ce1 --- /dev/null +++ b/types/swift/SuperProperties.swift @@ -0,0 +1,54 @@ +// +// Copyright 2021 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation + +// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT +// https://github.com/matrix-org/matrix-analytics-events/ + +/// Super Properties are properties associated with events that are sent with every capture call, be it a $pageview, an autocaptured button click, or anything else. +extension AnalyticsEvent { + public struct SuperProperties { + + /// Used by web to identify the platform (Web Platform/Electron Platform) + public let appPlatform: String? + /// Which crypto backend is the client currently using. + public let cryptoSDK: CryptoSDK? + /// Version of the crypto backend. + public let cryptoSDKVersion: String? + + public init(appPlatform: String?, cryptoSDK: CryptoSDK?, cryptoSDKVersion: String?) { + self.appPlatform = appPlatform + self.cryptoSDK = cryptoSDK + self.cryptoSDKVersion = cryptoSDKVersion + } + + public enum CryptoSDK: String { + /// Legacy crypto backend specific to each platform. + case Legacy + /// Cross-platform crypto backend written in Rust. + case Rust + } + + public var properties: [String: Any?] { + return [ + "appPlatform": appPlatform, + "cryptoSDK": cryptoSDK?.rawValue, + "cryptoSDKVersion": cryptoSDKVersion + ] + } + } +}