Coder Social home page Coder Social logo

Comments (5)

hobigo avatar hobigo commented on August 16, 2024

Hi kbzowski,
thanks for sharing the bug.

I have fixed the bug and added test 13-3 that covers the bug.

Please try out v1.8.1.

Regards
hobigo

from nextcloud-node-client.

kbzowski avatar kbzowski commented on August 16, 2024

Works fine with 1.8.1. Does not work with 1.8.2

from nextcloud-node-client.

hobigo avatar hobigo commented on August 16, 2024

Hi kbzowski,
I did not publish 1.8.2 to npm - 1.8.1 is the latest version
here is an example project.
rgds hobigo

src/index.ts

import Client, {
    Server,
    ICreateShare,
    Folder,
    Share,
} from "nextcloud-node-client";

(async () => {
const client: Client = new Client(
    new Server({url:"https://myServer",basicAuth:{username:"myUser",password:"myPassword"}})
    );
const folder: Folder = await client.createFolder("/my Public Share");
const createShare: ICreateShare = { fileSystemElement: folder, publicUpload: true };

let share: Share;

try {
    share = await client.createShare(createShare);
    console.log(`share created successfully for folder ${folder.name}`);
} catch (e) {
    console.log("error occurred",e)
}

})();

package.json

{
  "name": "ncnc-public-share",
  "version": "1.0.0",
  "description": "test project to create a public share with a nextcloud folder",
  "main": "./dist/index.js",
  "scripts": {
    "build": "tsc",
    "start": "node ./dist/index.js"
  },
   "author": "test",
  "license": "ISC",
  "devDependencies": {
    "@types/node": "^14.0.27",
    "@types/node-fetch": "^2.5.7",
    "typescript": "^3.9.7"
  },
  "dependencies": {
    "nextcloud-node-client": "^1.8.1"
  }
}

tsconfig.json

{
    "compilerOptions": {
        "target": "es2018",
        "module": "commonjs",
        "rootDir": "./src",
        "outDir": "./dist",
        "strict": true,
        "esModuleInterop": true
    },
    "include": [
        "./**/*.ts"
    ],
    "exclude": [
        "node_modules"
    ]
}
npm i
npm run build
npm run start

from nextcloud-node-client.

kbzowski avatar kbzowski commented on August 16, 2024

I was almost sure that I saw 1.8.2 in my package.json. My mistake. It works fine with 1.8.1. Issue can be closed.

from nextcloud-node-client.

hobigo avatar hobigo commented on August 16, 2024

I had a commit with that version
If you like the nextcloud-node-client please leave me a star
rgds hobigo

from nextcloud-node-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.