https://github.com/alvi-khan/onedrive_api
OneDrive API module for Flutter and Dart.
https://github.com/alvi-khan/onedrive_api
dart microsoft-graph onedrive
Last synced: 24 days ago
JSON representation
OneDrive API module for Flutter and Dart.
- Host: GitHub
- URL: https://github.com/alvi-khan/onedrive_api
- Owner: alvi-khan
- License: bsd-3-clause
- Created: 2024-01-07T17:03:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-10T16:34:34.000Z (about 2 years ago)
- Last Synced: 2025-03-22T07:51:56.711Z (about 1 year ago)
- Topics: dart, microsoft-graph, onedrive
- Language: Dart
- Homepage: https://pub.dev/packages/onedrive_api
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# OneDrive API
[](https://pub.dev/packages/onedrive_api)
OneDrive API allows easy interaction with the [files APIs of Microsoft Graph](https://learn.microsoft.com/en-us/graph/api/resources/onedrive). It follows the [OneDrive API module for Node.js](https://www.npmjs.com/package/onedrive-api).
This library is exclusively for the files APIs. For other Microsoft APIs, check out [microsoft_graph_api](https://pub.dev/packages/microsoft_graph_api).
> Note: Using this library requires an [access token](https://learn.microsoft.com/en-us/graph/auth-v2-user).
## Features
### Implemented
- [x] Create Folders
- [x] Delete Files and Folders
### Planned
- [ ] Create Shareable Links
- [ ] Download Files and Folders
- [ ] Fetch Metadata
- [ ] List Files and Folders
- [ ] Retrieve File Preview URLs
- [ ] Retrieve File Thumbnails
- [ ] Update Metadata
- [ ] Upload Files
## Usage
### Creating a Folder
```dart
import 'package:onedrive_api/onedrive_api.dart';
void main() async {
FolderParams folderParams = FolderParams();
folderParams.accessToken = "ACCESS_TOKEN";
folderParams.name = "Test Folder";
Response response = await createFolder(folderParams);
if (response.statusCode != 201) {
throw Exception(response.errorMsg);
} else {
print("Item Created: ${response.itemId}");
}
}
```
### Delete an Item
```dart
import 'package:onedrive_api/onedrive_api.dart';
void main() async {
ItemParams itemParams = ItemParams();
itemParams.accessToken = "ACCESS_TOKEN";
itemParams.itemId = "ITEM_ID";
Response response = await delete(itemParams);
if (response.statusCode != 204) {
throw Exception(response.errorMsg);
} else {
print("Item Deleted: ${itemParams.itemId}");
}
}
```