-
Notifications
You must be signed in to change notification settings - Fork 425
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
@W-16589742: [iOS] REST wrappers for select SFAP APIs #3801
Conversation
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiClient.swift
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiClient.swift
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiClient.swift
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiError.swift
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiClient.swift
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiClient.swift
Outdated
Show resolved
Hide resolved
…s For Remaining Three Endpoints Plus Improved Code Reuse)
libs/SalesforceSDKCore/SalesforceSDKCore.xcodeproj/project.pbxproj
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapAPIClient.swift
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiError.swift
Outdated
Show resolved
Hide resolved
...rceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiChatGenerationsRequestBody.swift
Outdated
Show resolved
Hide resolved
libs/SalesforceSDKCore/SalesforceSDKCore/Classes/RestAPI/SfapApi/SfapApiErrorResponseBody.swift
Outdated
Show resolved
Hide resolved
…roject With New Files)
@bbirman - Here's a commit with all your items from last night. Thanks so much for the extra eyes 🤘🏻 |
* } | ||
*/ | ||
@objc | ||
open class SFAPAPIChatGenerationsRequestBody : NSObject, Codable { |
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.
Whoops, sorry, I didn't mean to suggest changing the SFAP part of the Swift names, I meant that I think all the objc
names should match across classes in parallel with the Swift naming.
So from the latest client naming,
@objc(SFAPAPIClient)
public class SfapAPIClient : NSObject {
I would think this
@objc(SFAPAPIChatGenerationsRequestBody)
public class SfapAPIChatGenerationsRequestBody : NSObject {
cc @wmathurin if you have any other thoughts on the format to align on
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.
The funny thing is that the A in SFAP stands for API so SFAP API translates to "salesforce api platform api".
That being said, we didn't start that, the oauth scope is also called "sfap_api".
Should we just call them SfapClient / SfapChat etc ??
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.
👍 for Swift. For Objective-C we'd normally add the SF or SFSDK prefix which is also funny for this one because if we do SF like SFRest it's SFSfapClient? or Eric I think you had a condensed version before like SFApClient? No preference from me
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.
Like @wmathurin said, it's almost like saying "I'll have a chai tea" ☕️ which, of course, translates to Tea-Tea 🤣
So, maybe thinking like someone who's less used to the SF
prefix that was used by everything in the legacy Objc codebase: If I were looking for the sfap_api
related code in either Swift or Objc the SFAPAPI
prefixes seem really intuitive to me for both languages. They're also really consistent with the Android code, even though we uppercased it instead of camel-casing it. It is a bit verbose but that's something the old-school iOS dev in me is also really used to 🤓
I'd lean towards keeping it named similarly to the Android code, being a multi-platform developer as I am.
Outside of this context, I would usually agree we can drop the mandatory SF
prefix the Objc code used since that's not really Swifty (is it?).
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.
To the end of consistency, I actually found one more camel-cased name I missed earlier (I was so sure I got them all!) 74df154
1b52cec
to
90053bb
Compare
* | ||
* See https://developer.salesforce.com/docs/einstein/genai/guide/access-models-api-with-rest.html | ||
*/ | ||
@objc(SFapAPIClient) |
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.
Should it be SfapClient in swift and SFSfapClient in Objective-C ?
|
||
/// An error derived from an `sfap_api` endpoint failure response. | ||
/// See https://developer.salesforce.com/docs/einstein/genai/guide/access-models-api-with-rest.html#step-3-use-models-rest-api | ||
public struct SFapAPIError: Error { |
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.
Maybe SfapError ?
Models error responses from the `sfap_api` endpoints. | ||
See https://developer.salesforce.com/docs/einstein/genai/references/models-api?meta=Summary | ||
*/ | ||
public struct SFapAPIErrorResponseBody: Codable { |
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.
Maybe SfapErrorResponseBody ?
42a5865
to
2407039
Compare
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.
Almost there!
Sorry to nitpick, but I was thinking SfapClient
/ SfapError
/ SfapErrorResponseBody
.
SFap*
looks like it has the SF prefix we use in Objective-C.
…ing Convention Updates)
2407039
to
fe63b95
Compare
ca119e9
into
forcedotcom:dev
🎸 Ready For Final Review 🥁
This adds REST API clients for select sfap_api endpoints to match the Android version in forcedotcom/SalesforceMobileSDK-Android#2644
Here's a sample of how this can be used in detail.