-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@W-16589742: [iOS] REST wrappers for select SFAP APIs #3801
base: dev
Are you sure you want to change the base?
@W-16589742: [iOS] REST wrappers for select SFAP APIs #3801
Conversation
// Guards. | ||
guard | ||
let userAccountCurrent = UserAccountManager.shared.currentUserAccount, | ||
let restClient = RestClient.restClient(for: userAccountCurrent) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this getting a RestClient based on the current user vs using the RestClient from init?
let restClient = RestClient.restClient(for: userAccountCurrent) else { | ||
throw sfapApiErrorWithMessage("Cannot invoke sfap_api client without a current user account.")} | ||
|
||
guard let modelNameUnwrapped = modelName else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you don't want to rename it, I think you could also do guard let modelName {
here
do { | ||
return try sfapApiGenerationsResponse.asDecodable(type: SfapApiGenerationsResponseBody.self) | ||
} catch let error { | ||
throw sfapApiErrorWithMessage("Cannot JSON decode sfap_api generations response body due to a decoding error with description '\(error.localizedDescription)'.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused with the error handling, why does the error need to be caught and re-thrown?
/// @param messageCode The `sfap_api` error code | ||
/// @param source The original `sfap_api` error response body | ||
@objc | ||
public class SfapApiError : NSError, @unchecked Sendable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this use NSError? Was there an issue with Swift's error type?
🧱 Draft: Only one of the four endpoints is included. We'll review that for a quick look, then add the remaining three 🚧
This adds REST API clients for select sfap_api endpoints to match the Android version in forcedotcom/SalesforceMobileSDK-Android#2644
Only one of the four is included in the draft status. Here's a code sample from how I tested in iOSNativeSwiftTemplate's AppDelegate.