An open API service indexing awesome lists of open source software.

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

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.