onedrive-api
Advanced tools
Comparing version 1.0.10 to 1.1.0
@@ -11,3 +11,4 @@ module.exports = { | ||
}, | ||
ignorePatterns: ["lib/index.d.ts"], | ||
rules: {}, | ||
}; |
@@ -11,3 +11,4 @@ const got = import("got"); | ||
* @param {String} params.accessToken OneDrive access token | ||
* @param {String} [params.rootItemId=root] Root Item id | ||
* @param {String} [params.itemId=root] Item id | ||
* @param {String} [params.rootItemId=root] Root Item id - Deprecated: Use itemId instead for consistency | ||
* @param {String} params.itemPath Item path | ||
@@ -27,3 +28,3 @@ * @param {String} params.name New folder name | ||
const itemAddress = params.rootItemId ? ("items/" + params.rootItemId) : (params.itemPath ? itemPathFormatter(params.itemPath) : "items/root") | ||
const itemAddress = (params.itemId || params.rootItemId) ? ("items/" + (params.itemId || params.rootItemId)) : (params.itemPath ? itemPathFormatter(params.itemPath) : "items/root") | ||
@@ -30,0 +31,0 @@ const userPath = userPathGenerator(params); |
@@ -14,5 +14,4 @@ const got = import("got"); | ||
* @param {String} params.itemPath Item path | ||
* @param {Boolean} [params.shared] A flag to indicated whether this files is owned by the user or shared from another user. If true params.user has to be set. | ||
* @param {String} [params.user] The user who shared the file. Must be set if params.shared is true. | ||
* @param {String} [params.query] OData system query options. | ||
* @param {String} [params.queryParameters] OData system query options. | ||
* @param {String} [params.query] OData system query options. - Deprecated: Use queryParameters instead for consistency. | ||
* | ||
@@ -26,10 +25,10 @@ * @return {Promise<Object>} object of children items | ||
params.query = params.query || ""; | ||
params.queryParameters = params.queryParameters || params.query || ""; | ||
const itemAddress = params.itemId ? ("items/" + params.itemId) : (params.itemPath ? itemPathFormatter(params.itemPath) : "items/root") | ||
const userPath = userPathGenerator(params); | ||
if (params.query && !isQueryStringUrlEncoded(params.query)) { | ||
console.warn("Query string (" + params.query + ") doesn't look url encoded. You should url encode query string"); | ||
if (params.queryParameters && !isQueryStringUrlEncoded(params.queryParameters)) { | ||
console.warn("Query string (" + params.queryParameters + ") doesn't look url encoded. You should url encode query string"); | ||
} | ||
const URI = appConfig.apiUrl + userPath + itemAddress + "/children" + params.query; | ||
const URI = appConfig.apiUrl + userPath + itemAddress + "/children" + params.queryParameters; | ||
@@ -36,0 +35,0 @@ const gotExtend = (await got).got.extend({ |
{ | ||
"name": "onedrive-api", | ||
"version": "1.0.10", | ||
"version": "1.1.0", | ||
"description": "OneDrive module for communicating with oneDrive API. Built using functional programming pattern", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
@@ -30,2 +31,4 @@ "test": "npm run test:unit", | ||
"devDependencies": { | ||
"@microsoft/microsoft-graph-types": "^2.35.0", | ||
"@types/node": "^20.4.2", | ||
"chai": "4.2.0", | ||
@@ -37,3 +40,3 @@ "eslint": "^8.5.0", | ||
"install": "0.13.0", | ||
"mocha": "8.1.3", | ||
"mocha": "^10.2.0", | ||
"prettier": "2.5.1", | ||
@@ -40,0 +43,0 @@ "string-to-stream": "3.0.1" |
@@ -37,3 +37,7 @@ # onedrive-api | ||
```javascript | ||
const oneDriveAPI = require("onedrive-api"); | ||
// JavaScript | ||
const oneDriveAPI = require("onedrive-api") | ||
// TypeScript | ||
import oneDriveAPI from "onedrive-api"; | ||
``` | ||
@@ -63,11 +67,11 @@ | ||
| Param | Type | Default | Description | | ||
| ------------------- | ------------------- | ----------------- | ----------------------------------------------------------------------------------------------- | | ||
| params | <code>Object</code> | | | | ||
| params.accessToken | <code>String</code> | | OneDrive access token | | ||
| [params.rootItemId] | <code>String</code> | <code>root</code> | Item id | | ||
| params.itemPath | <code>String</code> | | Item path (ignored if `itemId` is set) | | ||
| params.name | <code>String</code> | | New folder name | | ||
| params.drive | <code>String</code> | `'me'` | If it's set to be either `'user'`/`'drive'`/`'group'`/`'site'`, `params.driveId` has to be set. | | ||
| params.driveId | <code>String</code> | `undefined` | The id of the drive that was shared to you. Must be set if `params.drive` is set. | | ||
| Param | Type | Default | Description | | ||
|--------------------| ------------------- | ----------------- | ----------------------------------------------------------------------------------------------- | | ||
| params | <code>Object</code> | | | | ||
| params.accessToken | <code>String</code> | | OneDrive access token | | ||
| [params.itemId] | <code>String</code> | <code>root</code> | Item id | | ||
| params.itemPath | <code>String</code> | | Item path (ignored if `itemId` is set) | | ||
| params.name | <code>String</code> | | New folder name | | ||
| params.drive | <code>String</code> | `'me'` | If it's set to be either `'user'`/`'drive'`/`'group'`/`'site'`, `params.driveId` has to be set. | | ||
| params.driveId | <code>String</code> | `undefined` | The id of the drive that was shared to you. Must be set if `params.drive` is set. | | ||
@@ -271,11 +275,11 @@ ```javascript | ||
| Param | Type | Default | Description | | ||
| ------------------ | ------------------- | ----------------- | ----------------------------------------------------------------------------------------------- | | ||
| params | <code>Object</code> | | | | ||
| params.accessToken | <code>String</code> | | OneDrive access token | | ||
| [params.itemId] | <code>String</code> | <code>root</code> | Item id | | ||
| params.itemPath | <code>String</code> | | Item path (ignored if `itemId` is set) | | ||
| params.drive | <code>String</code> | `'me'` | If it's set to be either `'user'`/`'drive'`/`'group'`/`'site'`, `params.driveId` has to be set. | | ||
| params.driveId | <code>String</code> | `undefined` | The id of the drive that was shared to you. Must be set if `params.drive` is set. | | ||
| params.query | <code>String</code> | `undefined` | OData system query options. | | ||
| Param | Type | Default | Description | | ||
|------------------------| ------------------- | ----------------- | ----------------------------------------------------------------------------------------------- | | ||
| params | <code>Object</code> | | | | ||
| params.accessToken | <code>String</code> | | OneDrive access token | | ||
| [params.itemId] | <code>String</code> | <code>root</code> | Item id | | ||
| params.itemPath | <code>String</code> | | Item path (ignored if `itemId` is set) | | ||
| params.drive | <code>String</code> | `'me'` | If it's set to be either `'user'`/`'drive'`/`'group'`/`'site'`, `params.driveId` has to be set. | | ||
| params.driveId | <code>String</code> | `undefined` | The id of the drive that was shared to you. Must be set if `params.drive` is set. | | ||
| params.queryParameters | <code>String</code> | `undefined` | OData system query options. | | ||
@@ -282,0 +286,0 @@ ```javascript |
64071
29
847
478
11