#1231 Add API endpoints for messages uploading#1261
Conversation
# Conflicts: # FlowCryptCommon/Extensions/URLSessionExtensions.swift
FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift
Outdated
Show resolved
Hide resolved
FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift
Outdated
Show resolved
Hide resolved
| private func getIdToken(email: String) async throws -> String { | ||
| let googleService = GoogleUserService( | ||
| currentUserEmail: email, | ||
| appDelegateGoogleSessionContainer: nil | ||
| ) | ||
|
|
||
| return try await googleService.getCachedOrRefreshedIdToken() | ||
| } |
There was a problem hiding this comment.
I'd rather the idToken be passed as argument into the methods (instead of email). But probably ok for now.
There was a problem hiding this comment.
Currently getIdToken is used only in performRequest, so we don't need to manually fetch token on each request. Looks like a simpler solution
FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift
Show resolved
Hide resolved
FlowCrypt/Functionality/Services/Account Server Services/EnterpriseServerApi.swift
Show resolved
Hide resolved
|
|
||
| let response: MessageUploadResponse = try await performRequest( | ||
| email: sender, | ||
| email: details.from, |
There was a problem hiding this comment.
This is a subtle thing: from and current account may not be the same thing in the future - once we add support for different sendAs aliases, in which case you may send an email from alias@example.com while on account account@example.com. So this would really need an account and from separately, or in the future maybe idToken and from separately. For now though, it's ok. I'll file an issue.
|
|
||
| func upload(message: Data, sender: String, to: [String], cc: [String], bcc: [String]) async throws -> String { | ||
| func getReplyToken(for email: String) async throws -> String { | ||
| return "" |
There was a problem hiding this comment.
better mock value would be mock-reply-token
| } | ||
|
|
||
| func upload(message: Data, details: MessageUploadDetails) async throws -> String { | ||
| return "" |
There was a problem hiding this comment.
better mock-web-portal-message-url
This PR adds ability to upload messages to FES web portal.
close #1231
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):