https://github.com/kizzycode/onedrive-swift
A package that implements basic OneDrive file operations
https://github.com/kizzycode/onedrive-swift
Last synced: about 2 months ago
JSON representation
A package that implements basic OneDrive file operations
- Host: GitHub
- URL: https://github.com/kizzycode/onedrive-swift
- Owner: KizzyCode
- Created: 2020-09-07T19:11:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-07T19:26:01.000Z (over 4 years ago)
- Last Synced: 2025-02-06T04:44:19.321Z (4 months ago)
- Language: Swift
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE BSD 2-CLAUSE.md
Awesome Lists containing this project
README
# OneDrive
A package that implements basic OneDrive file operations.
## Example: Creating a file
```swift
// A callback to open a webview
let webview = { (url: String, code: String) in
// Open a browser window at `url` and display the code so that the user can enter it
}// Perform a login to get a token and create the OneDrive instance
let token = AsyncResult()
_ = try Login(webview: webview, completion: token.set)
let oneDrive = OneDrive(token: try token.await())// Create a file "/TestFile" with the contents "Testolope"
let data = "Testolope".data(using: .utf8)!, result = AsyncResult()
oneDrive.create(file: "/TestFile", data: data, completion: result.set)
try result.await()
```Tip: See `Tests/OneDriveTests/OneDriveTests.swift` for more inspiration.