-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from matrix-org/valere/super_properties
Define a new SuperProperties Object
- Loading branch information
Showing
4 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, Any>? { | ||
return mutableMapOf<String, Any>().apply { | ||
appPlatform?.let { put("appPlatform", it) } | ||
cryptoSDK?.let { put("cryptoSDK", it.name) } | ||
cryptoSDKVersion?.let { put("cryptoSDKVersion", it) } | ||
}.takeIf { it.isNotEmpty() } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
] | ||
} | ||
} | ||
} |