Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh: sharing wrappers #18

Closed

Conversation

feefladder
Copy link

@feefladder feefladder commented Sep 29, 2023

Nobody responded to #17 so I just made my contribution.

Basically, I created wrapper functions for all API calls described in the sharing API section

I added one test, since I didn't know if this is all wanted.

kind regards :)

"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"ts-node": "^10.9.1",
"typedoc": "^0.25.1",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by npm audit --fix --force

Comment on lines +31 to +34
"@types/jest": "^29.5.5",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"ts-node": "^10.9.1",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For testing

Comment on lines +21 to +22
"@nextcloud/axios": "^2.4.0",
"@nextcloud/router": "^2.1.2",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for wrapper functions

@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES6",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was needed for building documentation, due to the following error:

> @nextcloud/[email protected] build:doc
> typedoc --out dist/doc lib && touch dist/doc/.nojekyll

node_modules/@jest/reporters/build/index.d.ts:136:3 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.

136   #private;
      ~~~~~~~~

node_modules/jest-runner/build/index.d.ts:101:3 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.

101   #private;


/**
* interface, generated using QuickType from response object
* TODO: find out where this is defined and make better
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO here


import type { AxiosResponse } from 'axios'

export enum NcShareType {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent naming conflicts in libraries that use it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree that Type is very generic, but ShareType should be good.
If it conflicts then just import it with alias like import { ShareType as NcShareType } from '...'.

Especially as we do not use prefixes on e.g. nextcloud-files or all other libraries

* interface, generated using QuickType from response object
* TODO: find out where this is defined and make better
*/
export interface ShareData {
Copy link
Author

@feefladder feefladder Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe name Nc(OCS)ShareData to also prevent naming conflicts?

jest.config.ts Outdated
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Autogenerated by npm run test -- --init

@feefladder feefladder changed the title Enh/sharing wrappers Enh: sharing wrappers Sep 29, 2023
@feefladder
Copy link
Author

Nothing is outdated, I just signed off the commits

/**
* Successful OCS responses look like this, `T` is a template for the response data inside the response
*/
export interface NcOCSResponse<T>{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already provided by @nextcloud/typings

* interface, generated using QuickType from response object
* TODO: find out where this is defined and make better
*/
export interface ShareData {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sure about this, maybe instead like the Folder or Node class of nextcloud-files?

@feefladder
Copy link
Author

Oh wow, I'm like completely out of this and would need quite some reading/comprehending to get back to knowing what is going on... Sorry folks, but will close for now. If someone else feels the need to develop this further, I think they can build on top of this...

@feefladder feefladder closed this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants