{"library":"onedrive-api","title":"OneDrive API Client","description":"This package, `onedrive-api`, provides a functional programming-oriented interface for interacting with the Microsoft OneDrive API. It is designed for Node.js environments and facilitates operations such as file and folder management, link creation, and metadata retrieval. The current stable version is 1.1.1, which was last published in June 2019. Due to its age, it should be considered a legacy library, and its compatibility with the latest OneDrive API changes may be limited. The library focuses solely on API communication, advising users to handle authentication separately, with `simple-oauth2` being a suggested tool. It features a modular API for various item operations like `createFolder`, `uploadSimple`, and `listChildren`.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install onedrive-api"],"cli":null},"imports":["import oneDriveAPI from 'onedrive-api';","const oneDriveAPI = require('onedrive-api');","oneDriveAPI.items.listChildren({...});"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import oneDriveAPI from 'onedrive-api';\n\n// This library does not handle authentication. \n// You need to obtain an access token yourself, e.g., using simple-oauth2.\nconst accessToken: string = process.env.ONEDRIVE_ACCESS_TOKEN ?? 'YOUR_ONEDRIVE_ACCESS_TOKEN';\n\nif (!accessToken || accessToken === 'YOUR_ONEDRIVE_ACCESS_TOKEN') {\n  console.error('Please set the ONEDRIVE_ACCESS_TOKEN environment variable or replace the placeholder.');\n  process.exit(1);\n}\n\nasync function listRootChildren() {\n  try {\n    console.log('Attempting to list children of the root directory...');\n    const children = await oneDriveAPI.items.listChildren({\n      accessToken: accessToken,\n      itemId: 'root',\n      drive: 'me' \n    });\n    console.log('Children of root directory:');\n    children.value.forEach((item: any) => {\n      console.log(`- ${item.name} (ID: ${item.id}, Type: ${item.folder ? 'Folder' : 'File'})`);\n    });\n    // Uncomment for full response body: \n    // console.log(JSON.stringify(children, null, 2));\n  } catch (error) {\n    console.error('Failed to list children:', error);\n    if (error && typeof error === 'object' && 'response' in error) {\n      console.error('API Error Response:', error.response.body);\n    }\n  }\n}\n\nlistRootChildren();","lang":"typescript","description":"Demonstrates how to import the library and use the `listChildren` method to retrieve and log the names and types of items in the user's OneDrive root directory.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}