Skip to content

Commit

Permalink
enh: Provide @nextcloud/typings/ocs for OCSResult type
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Nov 29, 2023
1 parent 06f5d1e commit 1ac96ab
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 44 deletions.
30 changes: 30 additions & 0 deletions lib/ocs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export interface OCSResponse<T = any> {
ocs: {
meta: {
/**
* Request success or failure state
*/
status: 'ok' | 'failure'

/**
* Status code defaults to 100, but often HTTP status codes are used
*/
statuscode: number

/**
* Message text
*/
message: string | undefined

/**
* Optionally the total number of items available
*/
totalitems: number | undefined
/**
* Optionally the the number of items per page
*/
itemsperpage: number | undefined
}
data: T
}
}
2 changes: 1 addition & 1 deletion lib/v27/OC.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from "vue-router";
import type { Route } from 'vue-router'

declare global {
namespace Nextcloud.v27 {
Expand Down
44 changes: 22 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"description": "Nextcloud TypeScript typings",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"exports": {
".": "./dist/index.d.ts",
"./types": "./dist/types.d.ts"
},
"scripts": {
"build": "tsc",
"test": "jest",
Expand Down Expand Up @@ -31,13 +35,13 @@
},
"dependencies": {
"@types/jquery": "3.5.16",
"vue": "^2.7.14",
"vue": "^2.7.15",
"vue-router": "<4"
},
"devDependencies": {
"babel-jest": "^29.5.0",
"jest": "^29.5.0",
"typescript": "^5.1.6"
"typescript": "^5.3.2"
},
"engines": {
"node": "^20.0.0",
Expand Down
38 changes: 19 additions & 19 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"outDir": "./dist",
"strict": true,
"lib": [
"es6",
"dom"
]
},
"include": [
"lib"
],
"exclude": [
"dist",
"node_modules",
"test"
]
"compilerOptions": {
"target": "ESNext",
"declaration": true,
"moduleResolution": "Node",
"outDir": "./dist",
"strict": true,
"lib": [
"ESNext",
"DOM"
]
},
"include": [
"lib"
],
"exclude": [
"dist",
"node_modules",
"test"
]
}

0 comments on commit 1ac96ab

Please sign in to comment.