Skip to content

Commit

Permalink
fix: includeKeys when fetching pointer (#133)
Browse files Browse the repository at this point in the history
* fix: includeKeys when fetching pointer

* lint

* add change log entry

* fix unwrap for older Swift

---------

Co-authored-by: project-academy <[email protected]>
  • Loading branch information
cbaker6 and proj-sashido committed Sep 18, 2023
1 parent eeb2704 commit fc516a6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
# Parse-Swift Changelog

### main
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.8.0...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.8.1...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
* _Contributing to this repo? Add info about your change here to be included in the next release_

### 5.8.1
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.8.0...5.8.1), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.8.1/documentation/parseswift)

__Fixes__
* There was an issue where Parse pointers were not sending includeKeys to the server ([#133](https://github.com/netreconlab/Parse-Swift/pull/133)), thanks to [proj-sashido](https://github.com/proj-sashido).

### 5.8.0
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.7.4...5.8.0), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.8.0/documentation/parseswift)

Expand Down
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
2 changes: 1 addition & 1 deletion Sources/ParseSwift/ParseConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

enum ParseConstants {
static let sdk = "swift"
static let version = "5.8.0"
static let version = "5.8.1"
static let fileManagementDirectory = "parse/"
static let fileManagementPrivateDocumentsDirectory = "Private Documents/"
static let fileManagementLibraryDirectory = "Library/"
Expand Down
19 changes: 14 additions & 5 deletions Sources/ParseSwift/Types/Pointer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,22 @@ public extension Pointer {
Task {
var options = options
options.insert(.cachePolicy(.reloadIgnoringLocalCacheData))

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

0 comments on commit fc516a6

Please sign in to comment.