GithubHelp home page GithubHelp logo

Comments (3)

georgehrke avatar georgehrke commented on May 27, 2024

do you have any documentation how to run or how to integrate with already existing node application?

As far as i can tell this library does not run on pure node.js. I tried to write our Tests in jest first, but I ended up using karma, because we require certain browser APIs like DomParser and XMLSerializer, latter one having no decent polyfill on NPM.

then open the web browser on localhost:3000 and will see some client but nothing happens.

It seems like you are looking for some GUI? This is simply a library to access Nextcloud's CalDAV/CardDAV server, used by the Contacts app (and future versions of the Calendar / Tasks app).

Please take note that this library is meant to communicate with Nextcloud's CalDAV/CardDAV server. While it's simply CalDAV/CardDAV and should in theory work with other servers, we didn't test this against any other server than Nextcloud and don't accept issues for other servers. Pull-requests that fix compatibility with other servers are certainly welcome though :)

Edit: To answer your main question about docs: You can run npm run build-doc to automatically generate documentation (as in API-reference) from source-code.

from cdav-library.

schaumannj avatar schaumannj commented on May 27, 2024

Hi George,
thanks fr answer, to be honest I seeking some first step for communication with nextcloud calendar via CalDAV. Just read/write/update the events for particular user.
I will go through yours test cases if there some for work with calendar.
any hint are welcomed
Best regards
Jan

from cdav-library.

georgehrke avatar georgehrke commented on May 27, 2024

Ah, in that case:

  1. First you need to create the DavClient object.
    If you are running as a nextcloud app, you gotta hand over the requestToken
function xhrProvider() {
	var headers = {
		'X-Requested-With': 'XMLHttpRequest',
		'requesttoken': OC.requestToken
	}
	var xhr = new XMLHttpRequest()
	var oldOpen = xhr.open

	// override open() method to add headers
	xhr.open = function() {
		var result = oldOpen.apply(this, arguments)
		for (let name in headers) {
			xhr.setRequestHeader(name, headers[name])
		}
		return result
	}
	OC.registerXHRForErrorProcessing(xhr)
	return xhr
}

new DavClient({
	rootUrl: OC.linkToRemote('dav')
}, xhrProvider)

If you don't run inside Nextcloud, you gotta do the authentication yourself.

  1. Start the client
await client.connect({enableCalDAV: true});
const calendars = await client.calendarHomes[0].findAllCalDAVCollections()
const events = await calendars[0].findAllVObjects()
console.log(events[0].data);

from cdav-library.

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.