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

fix: includeKeys when fetching pointer #129

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Sources/ParseSwift/API/API+NonParseBodyCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ internal extension API {

guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
return .failure(ParseError(code: .otherCause,
message: "Could not unrwrap url components for \(url)"))
message: "Could not unwrap url components for \(url)"))
}
components.queryItems = params

Expand Down
2 changes: 1 addition & 1 deletion Sources/ParseSwift/Coding/ParseCoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public extension ParseObject {
}

/// The Parse encoder is used to JSON encode all `ParseObject`s and
/// types in a way meaninful for a Parse Server to consume.
/// types in a way meaningful for a Parse Server to consume.
func getEncoder() -> ParseEncoder {
return Self.getEncoder()
}
Expand Down
17 changes: 12 additions & 5 deletions Sources/ParseSwift/Types/Pointer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,20 @@ public extension Pointer {
Task {
var options = options
options.insert(.cachePolicy(.reloadIgnoringLocalCacheData))

Check warning

Code scanning / Swiftlint (reported by Codacy)

Lines should not have trailing whitespace.

Lines should not have trailing whitespace.

Check warning

Code scanning / Tailor (reported by Codacy)

Line should not have any trailing whitespace

Line should not have any trailing whitespace
let method = API.Method.GET
let path = API.Endpoint.object(className: className, objectId: objectId)
await API.NonParseBodyCommand<NoBody, T>(method: .GET,
path: path) { (data) -> T in
let params: [String: String]? = {
guard let includeKeys else { return nil }
return ["include": "\(Set(includeKeys))"]
}()
let mapper = { (data) -> T in
try ParseCoding.jsonDecoder().decode(T.self, from: data)
}.execute(options: options,
callbackQueue: callbackQueue,
completion: completion)
}
await API.NonParseBodyCommand<NoBody, T>(method: method, path: path, params: params, mapper: mapper)
.execute(options: options,
callbackQueue: callbackQueue,
completion: completion)
}
}
}
Expand Down