A getter that expose the error info needed by the error handler
Return a collection of DriveItems in the children relationship of a DriveItem. DriveItems with a non-null folder or package facet can have one or more child DriveItems.
children(""); children("/"); // both is for root
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_list_children
bare string only if you know the API, otherwise use {path: "/path/to/file"} or {id: "id"}
Optional appendix: ODataAppendixODataAppendix, like {select: "id,name,size,@microsoft.graph.downloadUrl"}
(Only return monitor url) Asynchronously creates a copy of an driveItem (including any children), under a new parent item or with a new name.
const monitorUrl = await copy({ path: "path/to/file" }, { path: "path/to/folder" });
const copyResult = await monitorCopy(monitorUrl);
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_copy
Optional name: stringcustomize a request if not shipped by this library
custom({id}, "versions"); // Listing versions of a DriveItem
custom({id}, "versions", "/{version-id}"); // Get a DriveItemVersion resource
custom({id}, "versions", "/{version-id}/restoreVersion", undefined, "POST"); // Restore a previous version of a DriveItem
bare string only if you know the API, otherwise use {path: "/path/to/file"} or {id: "id"}
the command name, such as children, versions, checkin, checkout, ...
Optional appendix: ODataAppendixthe ODataAppendix or some suffix to the API
Optional body: anythe body of fetch, if method is not specified, it will set to "POST"
Optional method: stringthe method of fetch
Delete a DriveItem by using its ID or path. Note that deleting items using this method will move the items to the recycle bin instead of permanently deleting the item.
delete({ path: "path/to/file" });
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_delete
This method allows your app to track changes to a drive and its children over time.
delta({ path: "" }, { token: "latest" });
delta({ id: "123456789ABC" }, { token: "latest" });
od.fetchAPI((await od.delta(...))["@odata.nextLink"]).then(res=>res.json()); // for next page
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_delta
Optional appendix: ODataAppendix(Only return downloadUrl) Download the contents of the primary stream (file) of a DriveItem. Only driveItems with the file property can be downloaded.
Pre-authenticated download URL which is only valid for a short period of time (a few minutes) and do not require an Authorization header to download.
download({path:"/path/to/file"});
download({path:"/path/to/file"}, {format: "jpg"}); // specify format
Optional appendix: ODataAppendixa fetch that have accessToken attached in headers
https://docs.microsoft.com/onedrive/developer/rest-api/concepts/errors to view errors
Optional info: RequestInitRetrieve the metadata for a DriveItem in a Drive by file system path or ID.
item({ path: "/path/to/file" }, { select: ["name","size"] });
item({ path: "/path/to/file" }, "?select=name,size");
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_get
bare string only if you know the API, otherwise use {path: "/path/to/file"} or {id: "id"}
Optional appendix: ODataAppendixpass OData query string, a string that starts with '?' (OR) pass an object and it will transform to correct OData query string
Create a new folder or DriveItem in a Drive with a specified parent item or path.
createFolder({ path: "path/to/folder" }, "New Folder", true);
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_post_children
the parent id or path of the new folder
the name of the new folder
Optional conflictBehavior: "rename" | "fail" | "replace"set "rename" | "fail" | "replace"
the url returned by copy()
Move a DriveItem to a new folder This is a special case of the Update method. Your app can combine moving an item to a new container and updating other properties of the item into a single request. Items cannot be moved between Drives using this request.
move({ path: "path/to/file" }, { path: "path/to/folder" });
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_move
Optional parentLocator: { like parentReference, but is {path: "/path/to/file"} or {id: "id"}, string is not allowed
Optional name: stringoptional, new name for the item, has the same effect as rename
This action allows you to obtain short-lived embeddable URLs for an item.
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_preview
Optional allowOptional chromeless?: booleanOptional page?: string | numberOptional viewer?: null | "onedrive" | "office"Optional zoom?: numberA shortcut for renaming a DriveItem resource
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_update
Search the hierarchy of items for items matching a query. You can search within a folder hierarchy, a whole drive, or files shared with the current user.
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_search
Retrieve a collection of ThumbnailSet resources for a DriveItem resource.
thumbnails({ path:"图片" });
thumbnails({ path:"图片" }, "0", "small | medium | large");
thumbnails({ path:"图片" }, "0", "small", "/content"); // get downloadUrl
children({ path:"图片" }, { $expand:"thumbnails" }); // a replacement for getting thumbnails
Optional appendix: ODataAppendixOptional appendix: ODataAppendixThis only returns {uploadUrl, expirationDateTime}, where the uploadUrl need not authorization, use upload-node.ts to upload the file (unavailable at present)
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_createuploadsession
Optional item: { Upload the contents of a DriveItem (less than 4MB)
uploadSimple({path:"/path/to/folder"}, "./filename.txt", ""); // node.js, auto detect file name
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_put_content
pass an parentLocator for upload a new file, e.g. {path:"/path/to/folder"}
if pass a File object assuming you are running in a browser or deno, you need to construct the File object yourself (OR) if pass a string, it should be the file path, only supported in node.js
pass "" if you want to use the file name of the file
Replace the contents of a DriveItem (less than 4MB)
uploadSimple({path:"/path/to/file"}, "./filename.txt"); // node.js
https://docs.microsoft.com/onedrive/developer/rest-api/api/driveitem_put_content
pass an itemLocator for replacing the old file
Generated using TypeDoc
initialize the API with accessToken