@tryterra/react-native 0.0.0-stage → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -2
  3. package/TerraReactNative.podspec +48 -0
  4. package/android/build.gradle +87 -0
  5. package/android/src/bridgeCore/kotlin/README.md +1 -0
  6. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/BridgeBootstrap.kt +133 -0
  7. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/BridgeHost.kt +32 -0
  8. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/Conversions.kt +468 -0
  9. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/LauncherSlots.kt +41 -0
  10. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/Rejections.kt +150 -0
  11. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/StreamRegistry.kt +77 -0
  12. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridge.kt +86 -0
  13. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridgeOpsImpl.kt +258 -0
  14. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridgeStreamsImpl.kt +52 -0
  15. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TokenBroker.kt +198 -0
  16. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeErrors.kt +217 -0
  17. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeOps.kt +493 -0
  18. package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeTypes.kt +897 -0
  19. package/android/src/healthConnectOnly/kotlin/co/tryterra/sdk/reactnative/TerraStores.kt +11 -0
  20. package/android/src/main/AndroidManifest.xml +24 -0
  21. package/android/src/main/java/co/tryterra/sdk/reactnative/TerraBridgeModule.kt +96 -0
  22. package/android/src/main/java/co/tryterra/sdk/reactnative/TerraReactNativePackage.kt +26 -0
  23. package/android/src/main/java/co/tryterra/sdk/reactnative/TerraStartup.kt +46 -0
  24. package/android/src/samsung/kotlin/co/tryterra/sdk/reactnative/TerraStores.kt +13 -0
  25. package/docs/availability.md +246 -0
  26. package/frameworks/TerraSDK.xcframework/Info.plist +48 -0
  27. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Info.plist +0 -0
  28. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.abi.json +81513 -0
  29. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.package.swiftinterface +2150 -0
  30. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +2150 -0
  31. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  32. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.swiftinterface +2127 -0
  33. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/PrivacyInfo.xcprivacy +96 -0
  34. package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/TerraSDK +0 -0
  35. package/frameworks/TerraSDK.xcframework/ios-arm64/dSYMs/TerraSDK.framework.dSYM/Contents/Info.plist +20 -0
  36. package/frameworks/TerraSDK.xcframework/ios-arm64/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/DWARF/TerraSDK +0 -0
  37. package/frameworks/TerraSDK.xcframework/ios-arm64/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/TerraSDK.yml +6473 -0
  38. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Info.plist +0 -0
  39. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +81513 -0
  40. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +2150 -0
  41. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2150 -0
  42. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  43. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2127 -0
  44. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +81513 -0
  45. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +2150 -0
  46. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2150 -0
  47. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  48. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +2127 -0
  49. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/PrivacyInfo.xcprivacy +96 -0
  50. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/TerraSDK +0 -0
  51. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/_CodeSignature/CodeResources +223 -0
  52. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Info.plist +20 -0
  53. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/DWARF/TerraSDK +0 -0
  54. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/TerraSDK.yml +6474 -0
  55. package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/TerraSDK.yml +6392 -0
  56. package/ios/TerraBridgeCore/BridgeBootstrap.swift +89 -0
  57. package/ios/TerraBridgeCore/BridgeHost.swift +13 -0
  58. package/ios/TerraBridgeCore/Conversions.swift +467 -0
  59. package/ios/TerraBridgeCore/Generated/BridgeErrors.swift +179 -0
  60. package/ios/TerraBridgeCore/Generated/BridgeOps.swift +795 -0
  61. package/ios/TerraBridgeCore/Generated/BridgeTypes.swift +1317 -0
  62. package/ios/TerraBridgeCore/Locked.swift +15 -0
  63. package/ios/TerraBridgeCore/README.md +1 -0
  64. package/ios/TerraBridgeCore/Rejections.swift +130 -0
  65. package/ios/TerraBridgeCore/RuntimeAttachment.swift +60 -0
  66. package/ios/TerraBridgeCore/StreamRegistry.swift +59 -0
  67. package/ios/TerraBridgeCore/TerraBridge.swift +122 -0
  68. package/ios/TerraBridgeCore/TerraBridgeOpsImpl.swift +254 -0
  69. package/ios/TerraBridgeCore/TerraBridgeStreamsImpl.swift +60 -0
  70. package/ios/TerraBridgeCore/TokenBroker.swift +147 -0
  71. package/ios/TerraBridgeModule.mm +79 -0
  72. package/ios/TerraBridgeModuleImpl.swift +49 -0
  73. package/ios/TerraReactNative.swift +19 -0
  74. package/lib/EndUser.d.ts +12 -0
  75. package/lib/EndUser.js +13 -0
  76. package/lib/NativeTerraBridge.d.ts +23 -0
  77. package/lib/NativeTerraBridge.js +13 -0
  78. package/lib/Terra.d.ts +154 -0
  79. package/lib/Terra.js +280 -0
  80. package/lib/TerraError.d.ts +42 -0
  81. package/lib/TerraError.js +95 -0
  82. package/lib/createTerra.d.ts +8 -0
  83. package/lib/createTerra.js +19 -0
  84. package/lib/generated/client.d.ts +92 -0
  85. package/lib/generated/client.js +196 -0
  86. package/lib/generated/codecs.d.ts +135 -0
  87. package/lib/generated/codecs.js +1358 -0
  88. package/lib/generated/errors.d.ts +13 -0
  89. package/lib/generated/errors.js +68 -0
  90. package/lib/generated/ops.d.ts +13 -0
  91. package/lib/generated/ops.js +137 -0
  92. package/lib/generated/streams.d.ts +23 -0
  93. package/lib/generated/streams.js +58 -0
  94. package/lib/generated/types.d.ts +481 -0
  95. package/lib/generated/types.js +92 -0
  96. package/lib/index.d.ts +29 -0
  97. package/lib/index.js +55 -0
  98. package/package.json +71 -4
  99. package/src/EndUser.ts +15 -0
  100. package/src/NativeTerraBridge.ts +27 -0
  101. package/src/Terra.ts +462 -0
  102. package/src/TerraError.ts +116 -0
  103. package/src/createTerra.ts +18 -0
  104. package/src/generated/client.ts +243 -0
  105. package/src/generated/codecs.ts +1287 -0
  106. package/src/generated/errors.ts +113 -0
  107. package/src/generated/ops.ts +197 -0
  108. package/src/generated/streams.ts +74 -0
  109. package/src/generated/types.ts +667 -0
  110. package/src/index.ts +52 -0
@@ -0,0 +1,18 @@
1
+ import { Platform } from "react-native";
2
+
3
+ import NativeTerraBridge from "./NativeTerraBridge";
4
+ import { Terra, type TerraOptions } from "./Terra";
5
+
6
+ /**
7
+ * Attaches this JavaScript runtime to the native client the app built at launch.
8
+ *
9
+ * Call it once, at module scope. The native client outlives a reload, so a reload attaches again
10
+ * rather than building a second client.
11
+ */
12
+ export function createTerra(options: TerraOptions = {}): Terra {
13
+ const platform = Platform.OS;
14
+ if (platform !== "ios" && platform !== "android") {
15
+ throw new Error(`@tryterra/react-native runs on iOS and Android, not ${platform}`);
16
+ }
17
+ return new Terra(NativeTerraBridge, platform, options);
18
+ }
@@ -0,0 +1,243 @@
1
+ // Generated from surface/terra-surface.json by surface/gen. Do not edit by hand.
2
+ // Regenerate with: node surface/gen/src/cli.ts generate
3
+
4
+ import type { BodyEntryList, BoolResult, BootstrapState, CategoryRequest, ConnectRequest, Connection, ConnectionList, DiagnosticsState, Empty, HealthAccess, HeartRateEntryList, HeartRateList, LastDeliveryResult, MarkCompleteRequest, NutritionEntryList, PermissionGrant, PermissionRequest, PlannedWorkoutList, RangeRequest, RecordIdList, RecordIdRequest, SleepEntryList, SleepSegmentList, SourceRequest, StatusResult, StatusesResult, StepCountList, StepEntryList, SupportReport, TokenProviderRequest, TokenRejectRequest, TokenResolveRequest, WorkoutEntryList, WorkoutList, WorkoutScheduling } from "./types";
5
+ import { encodeBodyEntryList, encodeCategoryRequest, encodeConnectRequest, encodeEmpty, encodeHeartRateEntryList, encodeMarkCompleteRequest, encodeNutritionEntryList, encodePermissionRequest, encodeRangeRequest, encodeRecordIdRequest, encodeSleepEntryList, encodeSourceRequest, encodeStepEntryList, encodeTokenProviderRequest, encodeTokenRejectRequest, encodeTokenResolveRequest, encodeWorkoutEntryList, decodeBoolResult, decodeBootstrapState, decodeConnection, decodeConnectionList, decodeDiagnosticsState, decodeEmpty, decodeHealthAccess, decodeHeartRateList, decodeLastDeliveryResult, decodePermissionGrant, decodePlannedWorkoutList, decodeRecordIdList, decodeSleepSegmentList, decodeStatusResult, decodeStatusesResult, decodeStepCountList, decodeSupportReport, decodeWorkoutList, decodeWorkoutScheduling } from "./codecs";
6
+ import type { OpId } from "./ops";
7
+ import { TerraError } from "../TerraError";
8
+
9
+ /** What the facade needs from the native module. The TurboModule spec satisfies it; so does a test double. */
10
+ export interface Invoker {
11
+ invoke(op: OpId, payload: string): Promise<string>;
12
+ }
13
+
14
+ /**
15
+ * One generated method per op, and nothing else.
16
+ *
17
+ * The `op` string exists only between this file and the generated native dispatch, and a vector
18
+ * in `vectors/bridge` pins the two to each other. A caller never sees it.
19
+ */
20
+ export class GeneratedClient {
21
+ protected readonly invoker: Invoker;
22
+
23
+ constructor(invoker: Invoker) {
24
+ this.invoker = invoker;
25
+ }
26
+
27
+ private async call<T>(op: OpId, encode: () => Record<string, unknown>, decode: (raw: unknown) => T): Promise<T> {
28
+ let payload: string;
29
+ try {
30
+ payload = JSON.stringify(encode());
31
+ } catch (thrown) {
32
+ throw TerraError.invalidPayload(op, thrown);
33
+ }
34
+ let text: string;
35
+ try {
36
+ text = await this.invoker.invoke(op, payload);
37
+ } catch (thrown) {
38
+ throw TerraError.from(thrown);
39
+ }
40
+ try {
41
+ return decode(JSON.parse(text));
42
+ } catch (thrown) {
43
+ throw TerraError.invalidPayload(op, thrown);
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Reports the native client the JS side is attaching to. Idempotent, and safe to call after a
49
+ * JS reload.
50
+ */
51
+ async clientAttach(request: Empty): Promise<BootstrapState> {
52
+ return this.call("client.attach", () => encodeEmpty(request), (raw) => decodeBootstrapState(raw, "BootstrapState"));
53
+ }
54
+
55
+ async clientConnect(request: ConnectRequest): Promise<Connection> {
56
+ return this.call("client.connect", () => encodeConnectRequest(request), (raw) => decodeConnection(raw, "Connection"));
57
+ }
58
+
59
+ async clientConnections(request: Empty): Promise<ConnectionList> {
60
+ return this.call("client.connections", () => encodeEmpty(request), (raw) => decodeConnectionList(raw, "ConnectionList"));
61
+ }
62
+
63
+ async clientDisconnect(request: SourceRequest): Promise<Empty> {
64
+ return this.call("client.disconnect", () => encodeSourceRequest(request), (raw) => decodeEmpty(raw, "Empty"));
65
+ }
66
+
67
+ /**
68
+ * Tells the broker whether JS can answer at all. Without it a link asks a provider that is not
69
+ * there and waits out the timeout.
70
+ */
71
+ async tokenSetProviderPresent(request: TokenProviderRequest): Promise<Empty> {
72
+ return this.call("token.setProviderPresent", () => encodeTokenProviderRequest(request), (raw) => decodeEmpty(raw, "Empty"));
73
+ }
74
+
75
+ /**
76
+ * An unknown or already-settled requestId is ignored rather than rejected, so a reload cannot
77
+ * fail a link that has already moved on.
78
+ */
79
+ async tokenResolve(request: TokenResolveRequest): Promise<Empty> {
80
+ return this.call("token.resolve", () => encodeTokenResolveRequest(request), (raw) => decodeEmpty(raw, "Empty"));
81
+ }
82
+
83
+ async tokenReject(request: TokenRejectRequest): Promise<Empty> {
84
+ return this.call("token.reject", () => encodeTokenRejectRequest(request), (raw) => decodeEmpty(raw, "Empty"));
85
+ }
86
+
87
+ async permissionsRequest(request: PermissionRequest): Promise<PermissionGrant> {
88
+ return this.call("permissions.request", () => encodePermissionRequest(request), (raw) => decodePermissionGrant(raw, "PermissionGrant"));
89
+ }
90
+
91
+ async permissionsStatus(request: CategoryRequest): Promise<StatusResult> {
92
+ return this.call("permissions.status", () => encodeCategoryRequest(request), (raw) => decodeStatusResult(raw, "StatusResult"));
93
+ }
94
+
95
+ async permissionsWriteStatus(request: CategoryRequest): Promise<StatusResult> {
96
+ return this.call("permissions.writeStatus", () => encodeCategoryRequest(request), (raw) => decodeStatusResult(raw, "StatusResult"));
97
+ }
98
+
99
+ async permissionsRequested(request: SourceRequest): Promise<HealthAccess> {
100
+ return this.call("permissions.requested", () => encodeSourceRequest(request), (raw) => decodeHealthAccess(raw, "HealthAccess"));
101
+ }
102
+
103
+ /** Available on android only. */
104
+ async permissionsStatuses(request: SourceRequest): Promise<StatusesResult> {
105
+ return this.call("permissions.statuses", () => encodeSourceRequest(request), (raw) => decodeStatusesResult(raw, "StatusesResult"));
106
+ }
107
+
108
+ /** Available on android only. */
109
+ async permissionsBackgroundReadStatus(request: SourceRequest): Promise<StatusResult> {
110
+ return this.call("permissions.backgroundReadStatus", () => encodeSourceRequest(request), (raw) => decodeStatusResult(raw, "StatusResult"));
111
+ }
112
+
113
+ /** Available on android only. */
114
+ async permissionsHistoryReadStatus(request: SourceRequest): Promise<StatusResult> {
115
+ return this.call("permissions.historyReadStatus", () => encodeSourceRequest(request), (raw) => decodeStatusResult(raw, "StatusResult"));
116
+ }
117
+
118
+ async diagnosticsState(request: SourceRequest): Promise<DiagnosticsState> {
119
+ return this.call("diagnostics.state", () => encodeSourceRequest(request), (raw) => decodeDiagnosticsState(raw, "DiagnosticsState"));
120
+ }
121
+
122
+ async diagnosticsLastDelivery(request: SourceRequest): Promise<LastDeliveryResult> {
123
+ return this.call("diagnostics.lastDelivery", () => encodeSourceRequest(request), (raw) => decodeLastDeliveryResult(raw, "LastDeliveryResult"));
124
+ }
125
+
126
+ async diagnosticsReport(request: SourceRequest): Promise<SupportReport> {
127
+ return this.call("diagnostics.report", () => encodeSourceRequest(request), (raw) => decodeSupportReport(raw, "SupportReport"));
128
+ }
129
+
130
+ async diagnosticsSend(request: SourceRequest): Promise<Empty> {
131
+ return this.call("diagnostics.send", () => encodeSourceRequest(request), (raw) => decodeEmpty(raw, "Empty"));
132
+ }
133
+
134
+ /**
135
+ * False means bootstrap did not run. The SDK reports the same thing independently as
136
+ * backgroundRefreshUnscheduled.
137
+ */
138
+ async backgroundIsRegistered(request: Empty): Promise<BoolResult> {
139
+ return this.call("background.isRegistered", () => encodeEmpty(request), (raw) => decodeBoolResult(raw, "BoolResult"));
140
+ }
141
+
142
+ /** Available on android only. */
143
+ async backgroundCancel(request: Empty): Promise<BoolResult> {
144
+ return this.call("background.cancel", () => encodeEmpty(request), (raw) => decodeBoolResult(raw, "BoolResult"));
145
+ }
146
+
147
+ async bodyHeartRate(request: RangeRequest): Promise<HeartRateList> {
148
+ return this.call("body.heartRate", () => encodeRangeRequest(request), (raw) => decodeHeartRateList(raw, "HeartRateList"));
149
+ }
150
+
151
+ /** Its own op rather than an overload: Swift overloads log by element type and JS cannot. */
152
+ async bodyLogHeartRate(request: HeartRateEntryList): Promise<RecordIdList> {
153
+ return this.call("body.logHeartRate", () => encodeHeartRateEntryList(request), (raw) => decodeRecordIdList(raw, "RecordIdList"));
154
+ }
155
+
156
+ async bodyLog(request: BodyEntryList): Promise<RecordIdList> {
157
+ return this.call("body.log", () => encodeBodyEntryList(request), (raw) => decodeRecordIdList(raw, "RecordIdList"));
158
+ }
159
+
160
+ async bodyDelete(request: RecordIdRequest): Promise<Empty> {
161
+ return this.call("body.delete", () => encodeRecordIdRequest(request), (raw) => decodeEmpty(raw, "Empty"));
162
+ }
163
+
164
+ async dailySteps(request: RangeRequest): Promise<StepCountList> {
165
+ return this.call("daily.steps", () => encodeRangeRequest(request), (raw) => decodeStepCountList(raw, "StepCountList"));
166
+ }
167
+
168
+ async dailyLog(request: StepEntryList): Promise<RecordIdList> {
169
+ return this.call("daily.log", () => encodeStepEntryList(request), (raw) => decodeRecordIdList(raw, "RecordIdList"));
170
+ }
171
+
172
+ async dailyDelete(request: RecordIdRequest): Promise<Empty> {
173
+ return this.call("daily.delete", () => encodeRecordIdRequest(request), (raw) => decodeEmpty(raw, "Empty"));
174
+ }
175
+
176
+ async sleepSegments(request: RangeRequest): Promise<SleepSegmentList> {
177
+ return this.call("sleep.segments", () => encodeRangeRequest(request), (raw) => decodeSleepSegmentList(raw, "SleepSegmentList"));
178
+ }
179
+
180
+ async sleepLog(request: SleepEntryList): Promise<RecordIdList> {
181
+ return this.call("sleep.log", () => encodeSleepEntryList(request), (raw) => decodeRecordIdList(raw, "RecordIdList"));
182
+ }
183
+
184
+ async sleepDelete(request: RecordIdRequest): Promise<Empty> {
185
+ return this.call("sleep.delete", () => encodeRecordIdRequest(request), (raw) => decodeEmpty(raw, "Empty"));
186
+ }
187
+
188
+ async activityWorkouts(request: RangeRequest): Promise<WorkoutList> {
189
+ return this.call("activity.workouts", () => encodeRangeRequest(request), (raw) => decodeWorkoutList(raw, "WorkoutList"));
190
+ }
191
+
192
+ async activityLog(request: WorkoutEntryList): Promise<RecordIdList> {
193
+ return this.call("activity.log", () => encodeWorkoutEntryList(request), (raw) => decodeRecordIdList(raw, "RecordIdList"));
194
+ }
195
+
196
+ async activityDelete(request: RecordIdRequest): Promise<Empty> {
197
+ return this.call("activity.delete", () => encodeRecordIdRequest(request), (raw) => decodeEmpty(raw, "Empty"));
198
+ }
199
+
200
+ async nutritionLog(request: NutritionEntryList): Promise<RecordIdList> {
201
+ return this.call("nutrition.log", () => encodeNutritionEntryList(request), (raw) => decodeRecordIdList(raw, "RecordIdList"));
202
+ }
203
+
204
+ async nutritionDelete(request: RecordIdRequest): Promise<Empty> {
205
+ return this.call("nutrition.delete", () => encodeRecordIdRequest(request), (raw) => decodeEmpty(raw, "Empty"));
206
+ }
207
+
208
+ /** Available on ios only. */
209
+ async plannedWorkoutsPlanned(request: Empty): Promise<PlannedWorkoutList> {
210
+ return this.call("plannedWorkouts.planned", () => encodeEmpty(request), (raw) => decodePlannedWorkoutList(raw, "PlannedWorkoutList"));
211
+ }
212
+
213
+ /** Available on ios only. */
214
+ async plannedWorkoutsMarkComplete(request: MarkCompleteRequest): Promise<Empty> {
215
+ return this.call("plannedWorkouts.markComplete", () => encodeMarkCompleteRequest(request), (raw) => decodeEmpty(raw, "Empty"));
216
+ }
217
+
218
+ /** Available on ios only. */
219
+ async plannedWorkoutsDelete(request: RecordIdRequest): Promise<Empty> {
220
+ return this.call("plannedWorkouts.delete", () => encodeRecordIdRequest(request), (raw) => decodeEmpty(raw, "Empty"));
221
+ }
222
+
223
+ /**
224
+ * Never prompts.
225
+ *
226
+ * Available on ios only.
227
+ */
228
+ async plannedWorkoutsSchedulingStatus(request: Empty): Promise<WorkoutScheduling> {
229
+ return this.call("plannedWorkouts.schedulingStatus", () => encodeEmpty(request), (raw) => decodeWorkoutScheduling(raw, "WorkoutScheduling"));
230
+ }
231
+
232
+ /**
233
+ * Shows WorkoutKit's sheet if the person has not been asked, and reconciles straight away once
234
+ * authorized.
235
+ *
236
+ * Available on ios only.
237
+ */
238
+ async plannedWorkoutsRequestScheduling(request: Empty): Promise<WorkoutScheduling> {
239
+ return this.call("plannedWorkouts.requestScheduling", () => encodeEmpty(request), (raw) => decodeWorkoutScheduling(raw, "WorkoutScheduling"));
240
+ }
241
+
242
+ }
243
+