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

Add cloud function/job calls and user password reset. #43

Merged
merged 46 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f0f4809
Add cloud function/job calls and user password reset.
cbaker6 Dec 29, 2020
b23edca
Fixed bug. Make sure the right encoders are always used
cbaker6 Dec 30, 2020
4a5822a
Add results response for Cloud Code
cbaker6 Dec 30, 2020
9552ae1
Clean up docs
cbaker6 Dec 30, 2020
e33fc27
Fix Password Reset error. Add playgrounds example
cbaker6 Dec 30, 2020
374b7b6
Fix CloudCode server response error
cbaker6 Dec 30, 2020
8200cf0
Add Cloud function/job error tests
cbaker6 Dec 30, 2020
f261ef3
Merge remote-tracking branch 'refs/remotes/origin/main'
cbaker6 Dec 30, 2020
2e2a45b
Improve server error responses (established priority of errors).
cbaker6 Dec 30, 2020
9843145
Bug fix: User logout was calling incorrect endpoint for server
cbaker6 Dec 30, 2020
676cce2
Clean up docs
cbaker6 Dec 31, 2020
d120749
Added direct calls to Users and Installations endpoints. Added reques…
cbaker6 Dec 31, 2020
2903c3d
Fixed URL error
cbaker6 Dec 31, 2020
5814335
Bump codecov
cbaker6 Dec 31, 2020
f1d820d
Update Sources/ParseSwift/Types/ParseFile.swift
cbaker6 Dec 31, 2020
95d9b59
Update Sources/ParseSwift/Types/ParseFile.swift
cbaker6 Dec 31, 2020
4ca7b3d
Update Sources/ParseSwift/Types/ParseFile.swift
cbaker6 Dec 31, 2020
40c93bb
Resolve review, fix playground project
cbaker6 Dec 31, 2020
24c66d9
Fix backwards compatability with Swift < 5.3. Add a build to CI for S…
cbaker6 Dec 31, 2020
6c370b6
make Swift 5.2 build go after others
cbaker6 Dec 31, 2020
ab827fd
make other CI builds go after watchOS build since it never tests
cbaker6 Dec 31, 2020
bad1648
Add LocallyIdentifiable protocol
cbaker6 Dec 31, 2020
d79984f
wip
cbaker6 Dec 31, 2020
5ebb087
Improved batch and encoder
cbaker6 Jan 1, 2021
c4122ef
Remove json encoder from ParseEncoder
cbaker6 Jan 1, 2021
b5a8cfa
Reduce codecov
cbaker6 Jan 1, 2021
509885a
Update .codecov.yml
cbaker6 Jan 1, 2021
42c2080
clean up
cbaker6 Jan 1, 2021
cfa3110
Merge remote-tracking branch 'refs/remotes/origin/cloudCode'
cbaker6 Jan 1, 2021
9a95280
Improve LocallyIdentifiable protocol, change file structure of project
cbaker6 Jan 1, 2021
2c31d59
Save for later: ParseObject with localID, but doesn't work. This will…
cbaker6 Jan 1, 2021
f8566e8
cleaned up code
cbaker6 Jan 2, 2021
56906d3
Switch to localId
cbaker6 Jan 2, 2021
f1de7e4
Batch in waves of 50 by default.
cbaker6 Jan 2, 2021
616c11c
Update Sources/ParseSwift/Objects/ParseObject.swift
cbaker6 Jan 3, 2021
9dedf81
Update Sources/ParseSwift/Objects/ParseObject.swift
cbaker6 Jan 3, 2021
b0ce82f
Update Sources/ParseSwift/Objects/ParseObject.swift
cbaker6 Jan 3, 2021
7def6db
Update Sources/ParseSwift/Objects/ParseInstallation.swift
cbaker6 Jan 3, 2021
1859921
Update Sources/ParseSwift/Objects/ParseInstallation.swift
cbaker6 Jan 3, 2021
75aa62b
Update Sources/ParseSwift/Objects/ParseInstallation.swift
cbaker6 Jan 3, 2021
e50e129
Update Sources/ParseSwift/Objects/ParseInstallation.swift
cbaker6 Jan 3, 2021
323f428
Update Sources/ParseSwift/Objects/ParseUser.swift
cbaker6 Jan 3, 2021
306b219
Update Sources/ParseSwift/Objects/ParseUser.swift
cbaker6 Jan 3, 2021
f305e5b
Update Sources/ParseSwift/Objects/ParseUser.swift
cbaker6 Jan 3, 2021
59eb3fb
Update Sources/ParseSwift/Objects/ParseObject.swift
cbaker6 Jan 3, 2021
5241554
Update Sources/ParseSwift/Objects/ParseUser.swift
cbaker6 Jan 3, 2021
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
4 changes: 2 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ coverage:
status:
patch:
default:
target: auto
target: 73
changes: false
project:
default:
target: 72
target: 74
comment:
require_changes: true
28 changes: 24 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,29 @@ jobs:
run: xcrun llvm-cov export -format="lcov" .build/debug/ParseSwiftPackageTests.xctest/Contents/MacOS/ParseSwiftPackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov
- name: Send codecov
run: bash <(curl https://codecov.io/bash)


spm-test-5_2:
needs: xcode-build-watchos
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Create and set the default keychain
run: |
security create-keychain -p "" temporary
security default-keychain -s temporary
security unlock-keychain -p "" temporary
security set-keychain-settings -lut 7200 temporary
- name: Build
run: swift build -v
env:
DEVELOPER_DIR: ${{ env.CI_XCODE_VER }}
- name: Test
run: swift test --enable-code-coverage -v
env:
DEVELOPER_DIR: ${{ env.CI_XCODE_VER }}

docs:
needs: spm-test
needs: xcode-build-watchos
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -94,15 +114,15 @@ jobs:
publish_dir: ./docs

cocoapods:
needs: spm-test
needs: xcode-build-watchos
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: CocoaPods
run: pod lib lint --allow-warnings

carthage:
needs: spm-test
needs: xcode-build-watchos
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//: [Previous](@previous)

import PlaygroundSupport
import Foundation
import ParseSwift

PlaygroundPage.current.needsIndefiniteExecution = true
initializeParse()

//: Create your own ValueTyped ParseCloud type
struct Cloud: ParseCloud {
//: These are required for Object
var functionJobName: String

//: If your cloud function takes arguments, they can be passed by creating properties
//var argument1: [String: Int] = ["test": 5]
}

/*: Assuming you have the Cloud Function named "hello" on your parse-server:
// main.js
Parse.Cloud.define('hello', async () => {
return 'Hello world!';
});
*/
let cloud = Cloud(functionJobName: "hello")

cloud.callFunction { result in
switch result {
case .success(let response):
print("Response from cloud function: \(response)")
case .failure(let error):
assertionFailure("Error calling cloud function: \(error)")
}
}

//: Jobs can be run the same way by using the method `callJob()`

//: [Next](@next)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ User.current?.save { results in
case .success(let updatedUser):
print("Successfully save myCustomKey to ParseServer: \(updatedUser)")
case .failure(let error):
assertionFailure("Failed to update user: \(error)")
print("Failed to update user: \(error)")
}
}

Expand All @@ -44,7 +44,7 @@ do {
try User.logout()
print("Successfully logged out")
} catch let error {
assertionFailure("Error logging out: \(error)")
print("Error logging out: \(error)")
}

/*: Login - asynchronously - Performs work on background
Expand All @@ -64,7 +64,7 @@ User.login(username: "hello", password: "world") { results in
print("Successfully logged in as user: \(user)")

case .failure(let error):
assertionFailure("Error logging in: \(error)")
print("Error logging in: \(error)")
}
}

Expand All @@ -73,7 +73,23 @@ do {
try User.logout()
print("Successfully logged out")
} catch let error {
assertionFailure("Error logging out: \(error)")
print("Error logging out: \(error)")
}

//: Password Reset Request - synchronously
do {
try User.verificationEmailRequest(email: "hello@parse.org")
print("Successfully requested verification email be sent")
} catch let error {
print("Error requesting verification email be sent: \(error)")
}

//: Password Reset Request - synchronously
do {
try User.passwordReset(email: "hello@parse.org")
print("Successfully requested password reset")
} catch let error {
print("Error requesting password reset: \(error)")
}

//: Another way to sign up
Expand All @@ -88,7 +104,7 @@ newUser.signup { result in
print("Parse signup successful: \(user)")

case .failure(let error):
assertionFailure("Error logging in: \(error)")
print("Error logging in: \(error)")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ score.save { result in
}
}

/*: Files can also be saved from data. Below is how to do it synchrously, but async is similar to above
/*: Files can also be saved from data. Below is how to do it synchronously, but async is similar to above
Create a new ParseFile for your data
*/
let sampleData = "Hello World".data(using: .utf8)!
Expand All @@ -116,7 +116,7 @@ do {
print("The file is saved to your Parse Server at: \(url)")
print("The full details of your data file are: \(myData)")

//: If you need to download your profilePicture
//: If you need to download your file
let fetchedFile = try myData.fetch()
if fetchedFile.localURL != nil {
print("The file is now saved at: \(fetchedFile.localURL!)")
Expand Down
1 change: 1 addition & 0 deletions ParseSwift.playground/contents.xcplayground
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<page name='7 - GeoPoint'/>
<page name='8 - Pointers'/>
<page name='9 - Files'/>
<page name='10 - Cloud Code'/>
</pages>
</playground>
Loading