Skip to content
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

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 79 additions & 27 deletions libs/SalesforceSDKCore/SalesforceSDKCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,17 @@
CED452ED1D808DEE009266EB /* SFNativeRestRequestListener.h in Headers */ = {isa = PBXBuildFile; fileRef = CED452E91D808DEE009266EB /* SFNativeRestRequestListener.h */; };
CED452EF1D808E0A009266EB /* SFNativeRestRequestListener.m in Sources */ = {isa = PBXBuildFile; fileRef = CED452EA1D808DEE009266EB /* SFNativeRestRequestListener.m */; };
CED452F01D808E0F009266EB /* SalesforceRestAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CED452E81D808DEE009266EB /* SalesforceRestAPITests.m */; };
D378EA3C2D3977AE008FA71D /* SFAPAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA322D3977AE008FA71D /* SFAPAPIClient.swift */; };
D378EA3D2D3977AE008FA71D /* SFAPAPIChatGenerationsResponseBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA312D3977AE008FA71D /* SFAPAPIChatGenerationsResponseBody.swift */; };
D378EA3E2D3977AE008FA71D /* SFAPAPIErrorResponseBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA362D3977AE008FA71D /* SFAPAPIErrorResponseBody.swift */; };
D378EA3F2D3977AE008FA71D /* SFAPAPIError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA352D3977AE008FA71D /* SFAPAPIError.swift */; };
D378EA402D3977AE008FA71D /* SFAPAPIFeedbackResponseBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA382D3977AE008FA71D /* SFAPAPIFeedbackResponseBody.swift */; };
D378EA412D3977AE008FA71D /* SFAPAPIEmbeddingsRequestBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA332D3977AE008FA71D /* SFAPAPIEmbeddingsRequestBody.swift */; };
D378EA422D3977AE008FA71D /* SFAPAPIGenerationsRequestBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA392D3977AE008FA71D /* SFAPAPIGenerationsRequestBody.swift */; };
D378EA432D3977AE008FA71D /* SFAPAPIGenerationsResponseBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA3A2D3977AE008FA71D /* SFAPAPIGenerationsResponseBody.swift */; };
D378EA442D3977AE008FA71D /* SFAPAPIFeedbackRequestBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA372D3977AE008FA71D /* SFAPAPIFeedbackRequestBody.swift */; };
D378EA452D3977AE008FA71D /* SFAPAPIChatGenerationsRequestBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA302D3977AE008FA71D /* SFAPAPIChatGenerationsRequestBody.swift */; };
D378EA462D3977AE008FA71D /* SFAPAPIEmbeddingsResponseBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D378EA342D3977AE008FA71D /* SFAPAPIEmbeddingsResponseBody.swift */; };
E1C80CDF1C5AEBFA001B3A21 /* SFLoginViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C80CDD1C5AEBFA001B3A21 /* SFLoginViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
E1C80CE01C5AEBFA001B3A21 /* SFLoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1C80CDE1C5AEBFA001B3A21 /* SFLoginViewController.m */; };
E1C80CEC1C5AEE31001B3A21 /* SFSDKLoginHost.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C80CE11C5AEE31001B3A21 /* SFSDKLoginHost.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -894,6 +905,17 @@
CED452E81D808DEE009266EB /* SalesforceRestAPITests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SalesforceRestAPITests.m; path = SalesforceSDKCoreTests/SalesforceRestAPITests.m; sourceTree = SOURCE_ROOT; };
CED452E91D808DEE009266EB /* SFNativeRestRequestListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SFNativeRestRequestListener.h; path = SalesforceSDKCoreTests/SFNativeRestRequestListener.h; sourceTree = SOURCE_ROOT; };
CED452EA1D808DEE009266EB /* SFNativeRestRequestListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SFNativeRestRequestListener.m; path = SalesforceSDKCoreTests/SFNativeRestRequestListener.m; sourceTree = SOURCE_ROOT; };
D378EA302D3977AE008FA71D /* SFAPAPIChatGenerationsRequestBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIChatGenerationsRequestBody.swift; sourceTree = "<group>"; };
D378EA312D3977AE008FA71D /* SFAPAPIChatGenerationsResponseBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIChatGenerationsResponseBody.swift; sourceTree = "<group>"; };
D378EA322D3977AE008FA71D /* SFAPAPIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIClient.swift; sourceTree = "<group>"; };
D378EA332D3977AE008FA71D /* SFAPAPIEmbeddingsRequestBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIEmbeddingsRequestBody.swift; sourceTree = "<group>"; };
D378EA342D3977AE008FA71D /* SFAPAPIEmbeddingsResponseBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIEmbeddingsResponseBody.swift; sourceTree = "<group>"; };
D378EA352D3977AE008FA71D /* SFAPAPIError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIError.swift; sourceTree = "<group>"; };
D378EA362D3977AE008FA71D /* SFAPAPIErrorResponseBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIErrorResponseBody.swift; sourceTree = "<group>"; };
D378EA372D3977AE008FA71D /* SFAPAPIFeedbackRequestBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIFeedbackRequestBody.swift; sourceTree = "<group>"; };
D378EA382D3977AE008FA71D /* SFAPAPIFeedbackResponseBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIFeedbackResponseBody.swift; sourceTree = "<group>"; };
D378EA392D3977AE008FA71D /* SFAPAPIGenerationsRequestBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIGenerationsRequestBody.swift; sourceTree = "<group>"; };
D378EA3A2D3977AE008FA71D /* SFAPAPIGenerationsResponseBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SFAPAPIGenerationsResponseBody.swift; sourceTree = "<group>"; };
E1C80CDD1C5AEBFA001B3A21 /* SFLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SFLoginViewController.h; path = Login/SFLoginViewController.h; sourceTree = "<group>"; };
E1C80CDE1C5AEBFA001B3A21 /* SFLoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SFLoginViewController.m; path = Login/SFLoginViewController.m; sourceTree = "<group>"; };
E1C80CE11C5AEE31001B3A21 /* SFSDKLoginHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SFSDKLoginHost.h; path = Login/LoginHost/SFSDKLoginHost.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1387,23 +1409,23 @@
82AF840C16DFD95F008912EF /* Classes */ = {
isa = PBXGroup;
children = (
B722A702233C432E0089736E /* Extensions */,
B7FB26CA1F78096300FB25A2 /* URLHandlers */,
B7FB26B51F78094A00FB25A2 /* IDP */,
B7A20F7C1F25850E00D1E4B0 /* Views */,
CED452A81D808D0C009266EB /* RestAPI */,
CE145A881D137FD2003BCC20 /* Analytics */,
E139509E1C535F9C00575C03 /* Login */,
4F96FC511BFD32130022F021 /* Common */,
B722A702233C432E0089736E /* Extensions */,
4F96FC631BFD32130022F021 /* Identity */,
B7FB26B51F78094A00FB25A2 /* IDP */,
4F96FC691BFD32130022F021 /* Instrumentation */,
E139509E1C535F9C00575C03 /* Login */,
4F96FCC41BFD32130022F021 /* OAuth */,
4F96FCD81BFD32130022F021 /* PushNotification */,
6935FB9823FDE919002BEFCC /* UserAccount */,
CED452A81D808D0C009266EB /* RestAPI */,
4F96FCEA1BFD32130022F021 /* Security */,
69C5F99F24A3D999002C294D /* Storage */,
4F96FD2E1BFD32140022F021 /* Test */,
B7FB26CA1F78096300FB25A2 /* URLHandlers */,
6935FB9823FDE919002BEFCC /* UserAccount */,
4F96FD371BFD32140022F021 /* Util */,
B7A20F7C1F25850E00D1E4B0 /* Views */,
);
path = Classes;
sourceTree = "<group>";
Expand Down Expand Up @@ -1588,47 +1610,66 @@
CED452A81D808D0C009266EB /* RestAPI */ = {
isa = PBXGroup;
children = (
4F5727DC27F27F1A0008CDA4 /* SFSDKPrimingRecordsResponse.h */,
4F5727E227F27F1A0008CDA4 /* SFSDKPrimingRecordsResponse.m */,
69E2FD9622FB937F008E0AF0 /* SFSDKEncryptedURLCache.h */,
69E2FD9D22FB937F008E0AF0 /* SFSDKEncryptedURLCache.m */,
6938392423C82F38008E8E9A /* SFSDKNullURLCache.h */,
6938392523C82F38008E8E9A /* SFSDKNullURLCache.m */,
D378EA3B2D3977AE008FA71D /* SFAPAPI */,
CE7F66291E556CA800DC3FBB /* SFNetwork.h */,
CE7F662A1E556CA800DC3FBB /* SFNetwork.m */,
CED452B01D808D0C009266EB /* SFRestAPI.h */,
CED452B11D808D0C009266EB /* SFRestAPI.m */,
CED452A91D808D0C009266EB /* SFRestAPI+Blocks.h */,
CED452AA1D808D0C009266EB /* SFRestAPI+Blocks.m */,
CED452AB1D808D0C009266EB /* SFRestAPI+Files.h */,
CED452AC1D808D0C009266EB /* SFRestAPI+Files.m */,
CED452AD1D808D0C009266EB /* SFRestAPI+Internal.h */,
CED452AE1D808D0C009266EB /* SFRestAPI+QueryBuilder.h */,
CED452AF1D808D0C009266EB /* SFRestAPI+QueryBuilder.m */,
6900D802243D521C00888336 /* SFRestAPI+Notifications.h */,
6900D803243D521C00888336 /* SFRestAPI+Notifications.m */,
CED452B01D808D0C009266EB /* SFRestAPI.h */,
CED452B11D808D0C009266EB /* SFRestAPI.m */,
CED452B41D808D0C009266EB /* SFRestRequest+Internal.h */,
CED452AE1D808D0C009266EB /* SFRestAPI+QueryBuilder.h */,
CED452AF1D808D0C009266EB /* SFRestAPI+QueryBuilder.m */,
CED452B51D808D0C009266EB /* SFRestRequest.h */,
CED452B61D808D0C009266EB /* SFRestRequest.m */,
FDCECBE6688B51C1B9BDC524 /* SFSObjectTree.m */,
FDCEC40C4B860474C90D02AF /* SFSObjectTree.h */,
B7895D0B2345015B00765D85 /* SFSDKCompositeRequest.h */,
B7895D0C2345015B00765D85 /* SFSDKCompositeRequest.m */,
B7895D1323450E8E00765D85 /* SFSDKCompositeRequest+Internal.h */,
B7895D172345304800765D85 /* SFSDKCompositeResponse.h */,
B7895D8123469DE200765D85 /* SFSDKCompositeResponse+Internal.h */,
B7895D182345304800765D85 /* SFSDKCompositeResponse.m */,
CED452B41D808D0C009266EB /* SFRestRequest+Internal.h */,
B7460C0C2347DD4E00C7512E /* SFSDKBatchRequest.h */,
B7460C0D2347DD4E00C7512E /* SFSDKBatchRequest.m */,
B7460C192347E1A100C7512E /* SFSDKBatchResponse.h */,
B7460C1A2347E1A100C7512E /* SFSDKBatchResponse.m */,
B7460C0D2347DD4E00C7512E /* SFSDKBatchRequest.m */,
B7460C1D2347E1CB00C7512E /* SFSDKBatchResponse+Internal.h */,
4F2410A9282DC87A00E5EFE3 /* SFSDKCollectionResponse.h */,
4F2410B0282DCA4B00E5EFE3 /* SFSDKCollectionResponse.m */,
B7895D0B2345015B00765D85 /* SFSDKCompositeRequest.h */,
B7895D0C2345015B00765D85 /* SFSDKCompositeRequest.m */,
B7895D1323450E8E00765D85 /* SFSDKCompositeRequest+Internal.h */,
B7895D172345304800765D85 /* SFSDKCompositeResponse.h */,
B7895D182345304800765D85 /* SFSDKCompositeResponse.m */,
B7895D8123469DE200765D85 /* SFSDKCompositeResponse+Internal.h */,
69E2FD9622FB937F008E0AF0 /* SFSDKEncryptedURLCache.h */,
69E2FD9D22FB937F008E0AF0 /* SFSDKEncryptedURLCache.m */,
6938392423C82F38008E8E9A /* SFSDKNullURLCache.h */,
6938392523C82F38008E8E9A /* SFSDKNullURLCache.m */,
4F5727DC27F27F1A0008CDA4 /* SFSDKPrimingRecordsResponse.h */,
4F5727E227F27F1A0008CDA4 /* SFSDKPrimingRecordsResponse.m */,
FDCEC40C4B860474C90D02AF /* SFSObjectTree.h */,
FDCECBE6688B51C1B9BDC524 /* SFSObjectTree.m */,
);
path = RestAPI;
sourceTree = "<group>";
};
D378EA3B2D3977AE008FA71D /* SFAPAPI */ = {
isa = PBXGroup;
children = (
D378EA302D3977AE008FA71D /* SFAPAPIChatGenerationsRequestBody.swift */,
D378EA312D3977AE008FA71D /* SFAPAPIChatGenerationsResponseBody.swift */,
D378EA322D3977AE008FA71D /* SFAPAPIClient.swift */,
D378EA332D3977AE008FA71D /* SFAPAPIEmbeddingsRequestBody.swift */,
D378EA342D3977AE008FA71D /* SFAPAPIEmbeddingsResponseBody.swift */,
D378EA352D3977AE008FA71D /* SFAPAPIError.swift */,
D378EA362D3977AE008FA71D /* SFAPAPIErrorResponseBody.swift */,
D378EA372D3977AE008FA71D /* SFAPAPIFeedbackRequestBody.swift */,
D378EA382D3977AE008FA71D /* SFAPAPIFeedbackResponseBody.swift */,
D378EA392D3977AE008FA71D /* SFAPAPIGenerationsRequestBody.swift */,
D378EA3A2D3977AE008FA71D /* SFAPAPIGenerationsResponseBody.swift */,
);
path = SFAPAPI;
sourceTree = "<group>";
};
E139509E1C535F9C00575C03 /* Login */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2181,6 +2222,17 @@
CE675A341E0B2CC6002DBF5A /* SFSDKSoqlBuilder.m in Sources */,
69E2FD9F22FB937F008E0AF0 /* SFSDKEncryptedURLCache.m in Sources */,
B7BAD70E1FBAB8AA0046629F /* SFSDKStartURLHandler.m in Sources */,
D378EA3C2D3977AE008FA71D /* SFAPAPIClient.swift in Sources */,
D378EA3D2D3977AE008FA71D /* SFAPAPIChatGenerationsResponseBody.swift in Sources */,
D378EA3E2D3977AE008FA71D /* SFAPAPIErrorResponseBody.swift in Sources */,
D378EA3F2D3977AE008FA71D /* SFAPAPIError.swift in Sources */,
D378EA402D3977AE008FA71D /* SFAPAPIFeedbackResponseBody.swift in Sources */,
D378EA412D3977AE008FA71D /* SFAPAPIEmbeddingsRequestBody.swift in Sources */,
D378EA422D3977AE008FA71D /* SFAPAPIGenerationsRequestBody.swift in Sources */,
D378EA432D3977AE008FA71D /* SFAPAPIGenerationsResponseBody.swift in Sources */,
D378EA442D3977AE008FA71D /* SFAPAPIFeedbackRequestBody.swift in Sources */,
D378EA452D3977AE008FA71D /* SFAPAPIChatGenerationsRequestBody.swift in Sources */,
D378EA462D3977AE008FA71D /* SFAPAPIEmbeddingsResponseBody.swift in Sources */,
CE4CE3311C0E523B009F6029 /* SFSDKAppConfig.m in Sources */,
CED452C41D808D0C009266EB /* SFRestRequest.m in Sources */,
6900B62D24B64DD800500923 /* NSURLResponse+SFAdditions.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
SFAPAPIChatGenerationsRequestBody.swift
SalesforceSDKCore

Created by Eric C. Johnson ([email protected]) on 20250114.

Copyright (c) 2025-present, salesforce.com, inc. All rights reserved.

Redistribution and use of this software in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of salesforce.com, inc. nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written
permission of salesforce.com, inc.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import Foundation

/**
* Models a `sfap_api` `chat-generations` endpoint request.
* See https://developer.salesforce.com/docs/einstein/genai/references/models-api?meta=generateChat
*
* The endpoint accepts a `tags` object. To provide `tags`, subclass and introduce a
* new parameter of any object type named `tags`. Also, the subclass will need to conform to
* `Codable` and provide handling for the custom `tags` object's encoding and decoding as in
* the following sample code.
* required init(from decoder: any Decoder) throws {
* let container = try decoder.container(keyedBy: CodingKeys.self)
* self.tags = try container.decode(Tags.self, forKey: .tags)
* try super.init(from: decoder)
* }
*
* public init(
* // Provide superclass parameters
* tags: Tags
* ) {
* self.tags = tags
* super.init( // Provide superclass parameters)
* }
*
* public override func encode(to encoder: any Encoder) throws {
* var container = encoder.container(keyedBy: CodingKeys.self)
* try container.encode(tags, forKey: .tag`)
* try super.encode(to: encoder)
* }
*/
@objc
open class SFAPAPIChatGenerationsRequestBody : NSObject, Codable {
Copy link
Member

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

Copy link
Contributor

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 ??

Copy link
Member

@bbirman bbirman Jan 16, 2025

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

Copy link
Contributor Author

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?).

Copy link
Contributor Author

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


/// The request messages parameter value
public let messages: Array<Message>

/// The request localization parameter value
public let localization: Localization

public init(
messages: Array<Message>,
localization: Localization
) {
self.messages = messages
self.localization = localization
}

public struct Message : Codable {
public let role: String
public let content: String

public init(role: String, content: String) {
self.role = role
self.content = content
}
}

public struct Localization : Codable {
public let defaultLocale: String
public let inputLocales: Array<Locale>
public let expectedLocales: Array<String>

public init(
defaultLocale: String,
inputLocales: Array<Locale>,
expectedLocales: Array<String>
) {
self.defaultLocale = defaultLocale
self.inputLocales = inputLocales
self.expectedLocales = expectedLocales
}
}

public struct Locale : Codable {
public let locale: String
public let probability: Double

public init(
locale: String,
probability: Double
) {
self.locale = locale
self.probability = probability
}
}
}
Loading
Loading