Skip to content

Commit fc516a6

Browse files
fix: includeKeys when fetching pointer (#133)
* fix: includeKeys when fetching pointer * lint * add change log entry * fix unwrap for older Swift --------- Co-authored-by: project-academy <[email protected]>
1 parent eeb2704 commit fc516a6

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
# Parse-Swift Changelog
33

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

8+
### 5.8.1
9+
[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)
10+
11+
__Fixes__
12+
* 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).
13+
814
### 5.8.0
915
[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)
1016

Sources/ParseSwift/API/API+NonParseBodyCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ internal extension API {
7474

7575
guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
7676
return .failure(ParseError(code: .otherCause,
77-
message: "Could not unrwrap url components for \(url)"))
77+
message: "Could not unwrap url components for \(url)"))
7878
}
7979
components.queryItems = params
8080

Sources/ParseSwift/Coding/ParseCoding.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public extension ParseObject {
5353
}
5454

5555
/// The Parse encoder is used to JSON encode all `ParseObject`s and
56-
/// types in a way meaninful for a Parse Server to consume.
56+
/// types in a way meaningful for a Parse Server to consume.
5757
func getEncoder() -> ParseEncoder {
5858
return Self.getEncoder()
5959
}

Sources/ParseSwift/ParseConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010

1111
enum ParseConstants {
1212
static let sdk = "swift"
13-
static let version = "5.8.0"
13+
static let version = "5.8.1"
1414
static let fileManagementDirectory = "parse/"
1515
static let fileManagementPrivateDocumentsDirectory = "Private Documents/"
1616
static let fileManagementLibraryDirectory = "Library/"

Sources/ParseSwift/Types/Pointer.swift

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,22 @@ public extension Pointer {
115115
Task {
116116
var options = options
117117
options.insert(.cachePolicy(.reloadIgnoringLocalCacheData))
118+
119+
let method = API.Method.GET
118120
let path = API.Endpoint.object(className: className, objectId: objectId)
119-
await API.NonParseBodyCommand<NoBody, T>(method: .GET,
120-
path: path) { (data) -> T in
121+
let params: [String: String]? = {
122+
guard let includeKeys = includeKeys else {
123+
return nil
124+
}
125+
return ["include": "\(Set(includeKeys))"]
126+
}()
127+
let mapper = { (data) -> T in
121128
try ParseCoding.jsonDecoder().decode(T.self, from: data)
122-
}.execute(options: options,
123-
callbackQueue: callbackQueue,
124-
completion: completion)
129+
}
130+
await API.NonParseBodyCommand<NoBody, T>(method: method, path: path, params: params, mapper: mapper)
131+
.execute(options: options,
132+
callbackQueue: callbackQueue,
133+
completion: completion)
125134
}
126135
}
127136
}

0 commit comments

Comments
 (0)