-
Notifications
You must be signed in to change notification settings - Fork 43
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
Is there another way to perform salesforce.nextResultPage in V10? #144
Comments
@perbrondum sorry, I missed this issue. I neglected to include a 'convenience' method in func nextResultsPage(path: String) async throws -> QueryResult<Record> {
return try await request(service: Resource.Query.NextResultsPage(path: path))
} I will add this to |
I tried to create the extension:
But I get: 'Query' is inaccessible due to 'internal' protection level |
Sorry @perbrondum - since struct MyOwnNextResultsPage<T: Decodable>: DataService {
typealias Output = QueryResult<T>
let path: String
var batchSize: Int? = nil
func createRequest(with credential: Credential) throws -> URLRequest {
let headers = batchSize.map { ["Sforce-Query-Options" : "batchSize=\($0)"] }
return try URLRequest(credential: credential, path: path, headers: headers)
}
} and then in your extension: func nextResultsPage(path: String) async throws -> QueryResult<Record> {
return try await request(service: MyOwnNextResultsPage(path: path))
} (Or you could define the struct above within the extension method if the struct won't be reused elsewhere.) |
That works, thanks. Is there a reason that nextResultsPage returns <QueryResult and not a generic? |
Hi @perbrondum not sure I understand your question - the above |
I got the above to work with both Record and my own decodable type SFDCTask, by creating two versions of nextResultsPage. I tried but, my generics is not strong enough to be able to write a version of nextResultsPage that supports it. My only concern was if the official version of nextResultsPage will support generics? Btw, one of the reasons I continue to use my own type [SFDCTask] is that I'm not sure how to address items like 'task.Account.Name' using strings. Can you point me to a source (or example) for how to address this using strings? |
No description provided.
The text was updated successfully, but these errors were encountered: