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

refactor: user Swift convention for parameter names #321

Merged
merged 4 commits into from
Jan 18, 2022
Merged
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
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### main

[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.0.0...main)
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/3.1.2...main)
* _Contributing to this repo? Add info about your change here to be included in the next release_

### 4.0.0
Expand All @@ -18,6 +18,9 @@ __New features__
define a ParseObject. Look at the PR for
details on why this is important when using the SDK ([#315](https://github.com/parse-community/Parse-Swift/pull/315)), thanks to [Corey Baker](https://github.com/cbaker6).

__Improvements__
- (Breaking Change) Change the following method parameter names: isUsingMongoDB -> usingMongoDB, isIgnoreCustomObjectIdConfig -> ignoringCustomObjectIdConfig, isUsingEQ -> usingEqComparator ([#321](https://github.com/parse-community/Parse-Swift/pull/321)), thanks to [Corey Baker](https://github.com/cbaker6).

### 3.1.2
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/3.1.1...3.1.2)

Expand All @@ -35,7 +38,7 @@ __Fixes__
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/3.0.0...3.1.0)

__New features__
- Add the ability to explain MongoDB queries by setting isUsingMongoDB = true for the respective explain query ([#314](https://github.com/parse-community/Parse-Swift/pull/314)), thanks to [Corey Baker](https://github.com/cbaker6).
- Add the ability to explain MongoDB queries by setting usingMongoDB = true for the respective explain query ([#314](https://github.com/parse-community/Parse-Swift/pull/314)), thanks to [Corey Baker](https://github.com/cbaker6).

### 3.0.0
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.5.1...3.0.0)
Expand Down Expand Up @@ -244,7 +247,7 @@ __Fixes__
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.9.6...1.9.7)

__Improvements__
- Properly allow a mixed custom objectId environment without compromising safety checks using .save(). If a developer wants to ignore the objectId checks, they need to specify isIgnoreCustomObjectIdConfig = true each time ([#222](https://github.com/parse-community/Parse-Swift/pull/222)), thanks to [Corey Baker](https://github.com/cbaker6).
- Properly allow a mixed custom objectId environment without compromising safety checks using .save(). If a developer wants to ignore the objectId checks, they need to specify ignoringCustomObjectIdConfig = true each time ([#222](https://github.com/parse-community/Parse-Swift/pull/222)), thanks to [Corey Baker](https://github.com/cbaker6).

### 1.9.6
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.9.5...1.9.6)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import PackageDescription
let package = Package(
name: "YOUR_PROJECT_NAME",
dependencies: [
.package(url: "https://github.com/parse-community/Parse-Swift", from: "4.0.0"),
.package(url: "https://github.com/parse-community/Parse-Swift", from: "3.1.2"),
]
)
```
Expand Down
4 changes: 2 additions & 2 deletions Sources/ParseSwift/API/API+Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ internal extension API.Command {
// MARK: Saving ParseObjects
static func save<T>(_ object: T,
original data: Data?,
isIgnoreCustomObjectIdConfig: Bool) throws -> API.Command<T, T> where T: ParseObject {
ignoringCustomObjectIdConfig: Bool) throws -> API.Command<T, T> where T: ParseObject {
if ParseSwift.configuration.isAllowingCustomObjectIds
&& object.objectId == nil && !isIgnoreCustomObjectIdConfig {
&& object.objectId == nil && !ignoringCustomObjectIdConfig {
throw ParseError(code: .missingObjectId, message: "objectId must not be nil")
}
if object.isSaved {
Expand Down
20 changes: 10 additions & 10 deletions Sources/ParseSwift/Objects/ParseInstallation+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public extension ParseInstallation {

/**
Saves the `ParseInstallation` *asynchronously*.
- parameter isIgnoreCustomObjectIdConfig: Ignore checking for `objectId`
- parameter ignoringCustomObjectIdConfig: Ignore checking for `objectId`
when `ParseConfiguration.isAllowingCustomObjectIds = true` to allow for mixed
`objectId` environments. Defaults to false.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
Expand All @@ -45,20 +45,20 @@ public extension ParseInstallation {
- important: If an object saved has the same objectId as current, it will automatically update the current.
- warning: If you are using `ParseConfiguration.isAllowingCustomObjectIds = true`
and plan to generate all of your `objectId`'s on the client-side then you should leave
`isIgnoreCustomObjectIdConfig = false`. Setting
`ignoringCustomObjectIdConfig = false`. Setting
`ParseConfiguration.isAllowingCustomObjectIds = true` and
`isIgnoreCustomObjectIdConfig = true` means the client will generate `objectId`'s
`ignoringCustomObjectIdConfig = true` means the client will generate `objectId`'s
and the server will generate an `objectId` only when the client does not provide one. This can
increase the probability of colliiding `objectId`'s as the client and server `objectId`'s may be generated using
different algorithms. This can also lead to overwriting of `ParseObject`'s by accident as the
client-side checks are disabled. Developers are responsible for handling such cases.
- note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer
desires a different policy, it should be inserted in `options`.
*/
func save(isIgnoreCustomObjectIdConfig: Bool = false,
func save(ignoringCustomObjectIdConfig: Bool = false,
options: API.Options = []) async throws -> Self {
try await withCheckedThrowingContinuation { continuation in
self.save(isIgnoreCustomObjectIdConfig: isIgnoreCustomObjectIdConfig,
self.save(ignoringCustomObjectIdConfig: ignoringCustomObjectIdConfig,
options: options,
completion: continuation.resume)
}
Expand Down Expand Up @@ -149,7 +149,7 @@ public extension Sequence where Element: ParseInstallation {
Defaults to 50.
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
prevents the transaction from completing, then none of the objects are committed to the Parse Server database.
- parameter isIgnoreCustomObjectIdConfig: Ignore checking for `objectId`
- parameter ignoringCustomObjectIdConfig: Ignore checking for `objectId`
when `ParseConfiguration.isAllowingCustomObjectIds = true` to allow for mixed
`objectId` environments. Defaults to false.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
Expand All @@ -162,9 +162,9 @@ public extension Sequence where Element: ParseInstallation {
the transactions can fail.
- warning: If you are using `ParseConfiguration.isAllowingCustomObjectIds = true`
and plan to generate all of your `objectId`'s on the client-side then you should leave
`isIgnoreCustomObjectIdConfig = false`. Setting
`ignoringCustomObjectIdConfig = false`. Setting
`ParseConfiguration.isAllowingCustomObjectIds = true` and
`isIgnoreCustomObjectIdConfig = true` means the client will generate `objectId`'s
`ignoringCustomObjectIdConfig = true` means the client will generate `objectId`'s
and the server will generate an `objectId` only when the client does not provide one. This can
increase the probability of colliiding `objectId`'s as the client and server `objectId`'s may be generated using
different algorithms. This can also lead to overwriting of `ParseObject`'s by accident as the
Expand All @@ -174,12 +174,12 @@ public extension Sequence where Element: ParseInstallation {
*/
func saveAll(batchLimit limit: Int? = nil,
transaction: Bool = ParseSwift.configuration.isUsingTransactions,
isIgnoreCustomObjectIdConfig: Bool = false,
ignoringCustomObjectIdConfig: Bool = false,
options: API.Options = []) async throws -> [(Result<Self.Element, ParseError>)] {
try await withCheckedThrowingContinuation { continuation in
self.saveAll(batchLimit: limit,
transaction: transaction,
isIgnoreCustomObjectIdConfig: isIgnoreCustomObjectIdConfig,
ignoringCustomObjectIdConfig: ignoringCustomObjectIdConfig,
options: options,
completion: continuation.resume)
}
Expand Down
20 changes: 10 additions & 10 deletions Sources/ParseSwift/Objects/ParseInstallation+combine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,28 @@ public extension ParseInstallation {
/**
Saves the `ParseInstallation` *asynchronously* and publishes when complete.

- parameter isIgnoreCustomObjectIdConfig: Ignore checking for `objectId`
- parameter ignoringCustomObjectIdConfig: Ignore checking for `objectId`
when `ParseConfiguration.isAllowingCustomObjectIds = true` to allow for mixed
`objectId` environments. Defaults to false.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- returns: A publisher that eventually produces a single value and then finishes or fails.
- important: If an object saved has the same objectId as current, it will automatically update the current.
- warning: If you are using `ParseConfiguration.isAllowingCustomObjectIds = true`
and plan to generate all of your `objectId`'s on the client-side then you should leave
`isIgnoreCustomObjectIdConfig = false`. Setting
`ignoringCustomObjectIdConfig = false`. Setting
`ParseConfiguration.isAllowingCustomObjectIds = true` and
`isIgnoreCustomObjectIdConfig = true` means the client will generate `objectId`'s
`ignoringCustomObjectIdConfig = true` means the client will generate `objectId`'s
and the server will generate an `objectId` only when the client does not provide one. This can
increase the probability of colliiding `objectId`'s as the client and server `objectId`'s may be generated using
different algorithms. This can also lead to overwriting of `ParseObject`'s by accident as the
client-side checks are disabled. Developers are responsible for handling such cases.
- note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer
desires a different policy, it should be inserted in `options`.
*/
func savePublisher(isIgnoreCustomObjectIdConfig: Bool = false,
func savePublisher(ignoringCustomObjectIdConfig: Bool = false,
options: API.Options = []) -> Future<Self, ParseError> {
Future { promise in
self.save(isIgnoreCustomObjectIdConfig: isIgnoreCustomObjectIdConfig,
self.save(ignoringCustomObjectIdConfig: ignoringCustomObjectIdConfig,
options: options,
completion: promise)
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public extension Sequence where Element: ParseInstallation {
Defaults to 50.
- parameter transaction: Treat as an all-or-nothing operation. If some operation failure occurs that
prevents the transaction from completing, then none of the objects are committed to the Parse Server database.
- parameter isIgnoreCustomObjectIdConfig: Ignore checking for `objectId`
- parameter ignoringCustomObjectIdConfig: Ignore checking for `objectId`
when `ParseConfiguration.isAllowingCustomObjectIds = true` to allow for mixed
`objectId` environments. Defaults to false.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
Expand All @@ -159,9 +159,9 @@ public extension Sequence where Element: ParseInstallation {
the transactions can fail.
- warning: If you are using `ParseConfiguration.isAllowingCustomObjectIds = true`
and plan to generate all of your `objectId`'s on the client-side then you should leave
`isIgnoreCustomObjectIdConfig = false`. Setting
`ignoringCustomObjectIdConfig = false`. Setting
`ParseConfiguration.isAllowingCustomObjectIds = true` and
`isIgnoreCustomObjectIdConfig = true` means the client will generate `objectId`'s
`ignoringCustomObjectIdConfig = true` means the client will generate `objectId`'s
and the server will generate an `objectId` only when the client does not provide one. This can
increase the probability of colliiding `objectId`'s as the client and server `objectId`'s may be generated using
different algorithms. This can also lead to overwriting of `ParseObject`'s by accident as the
Expand All @@ -171,12 +171,12 @@ public extension Sequence where Element: ParseInstallation {
*/
func saveAllPublisher(batchLimit limit: Int? = nil,
transaction: Bool = ParseSwift.configuration.isUsingTransactions,
isIgnoreCustomObjectIdConfig: Bool = false,
ignoringCustomObjectIdConfig: Bool = false,
options: API.Options = []) -> Future<[(Result<Self.Element, ParseError>)], ParseError> {
Future { promise in
self.saveAll(batchLimit: limit,
transaction: transaction,
isIgnoreCustomObjectIdConfig: isIgnoreCustomObjectIdConfig,
ignoringCustomObjectIdConfig: ignoringCustomObjectIdConfig,
options: options,
completion: promise)
}
Expand Down
Loading