Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3523148
D8996.id30671.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8996.id30671.diff
View Options
diff --git a/native/backup/api.js b/native/backup/api.js
--- a/native/backup/api.js
+++ b/native/backup/api.js
@@ -99,4 +99,30 @@
return getBackupBytesFromBlob(blob);
}
-export { uploadBackup, getBackupID, getUserKeys };
+async function getUserData(
+ backupID: string,
+ auth: BackupAuth,
+): Promise<Uint8Array> {
+ const authHeader = getBackupAuthorizationHeader(auth);
+
+ const getUserDataEndpoint = backupService.httpEndpoints.GET_USER_DATA;
+ const getUserDataResponse = await fetch(
+ makeBackupServiceEndpointURL(getUserDataEndpoint, { backupID }),
+ {
+ method: getUserDataEndpoint.method,
+ headers: {
+ Authorization: authHeader,
+ },
+ },
+ );
+
+ if (!getUserDataResponse.ok) {
+ const { status, statusText } = getUserDataResponse;
+ throw new Error(`Server responded with HTTP ${status}: ${statusText}`);
+ }
+
+ const blob = await getUserDataResponse.blob();
+ return getBackupBytesFromBlob(blob);
+}
+
+export { uploadBackup, getBackupID, getUserKeys, getUserData };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 8:28 AM (4 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2698485
Default Alt Text
D8996.id30671.diff (1 KB)
Attached To
Mode
D8996: [client-backup] implement API call to get UserData
Attached
Detach File
Event Timeline
Log In to Comment