A WebDAV collection (RFC 4918) as a document store, e.g. on Nextcloud, ownCloud, Seafile, Synology, Box, Fastmail or a Hetzner storage box.
It uses GET, PUT, DELETE and a PROPFIND at depth one, with the ETag as the version. If-Match makes a put conditional, and If-None-Match: * asks for a document that isn't there yet. HEAD asks for the ETag when a server answers a put without one, and MKCOL makes the collection when it isn't there.
In a browser, the server must let the page through CORS and expose the ETag.
A WebDAV collection (RFC 4918) as a document store, e.g. on Nextcloud, ownCloud, Seafile, Synology, Box, Fastmail or a Hetzner storage box. It uses GET, PUT, DELETE and a PROPFIND at depth one, with the ETag as the version. If-Match makes a put conditional, and If-None-Match: * asks for a document that isn't there yet. HEAD asks for the ETag when a server answers a put without one, and MKCOL makes the collection when it isn't there. In a browser, the server must let the page through CORS and expose the ETag.
The calls that a store makes to a collection:
The calls that a store makes to a collection: - :list, for the documents in it - :fetch, :put and :delete, for one document - :head, for the version of one document - :make-collection, for the collection itself
(content-type name)(content-type name content-types)The Content-Type that the document name is put and served with, by
the extension of its name in content-types or default-content-types,
and application/octet-stream for any other name.
The Content-Type that the document `name` is put and served with, by the extension of its name in `content-types` or default-content-types, and application/octet-stream for any other name.
The Content-Type of a document by the extension of its name, unless the options of a store or a server give others. A type with a charset is that of text, and a type without one, that of bytes.
The Content-Type of a document by the extension of its name, unless the options of a store or a server give others. A type with a charset is that of text, and a type without one, that of bytes.
(request call root)(request call root name)(request call root name {:keys [credentials body content-types] :as opts})The request map for call on the collection at root, for the
document name when the call takes one, with the opts below.
The call is one of calls, and the root is a URL that ends in a
slash. The opts give the :credentials, the :body to put, text or
bytes, and :as :bytes for a fetch of bytes. For a put, they can give
:if-version, the version that the document must still have, where nil
means that it must not exist yet. Without :if-version, the put has no
condition. Its Content-Type is by the :content-types of opts, as
content-type has them.
The request map for `call` on the collection at `root`, for the document `name` when the call takes one, with the `opts` below. The `call` is one of calls, and the `root` is a URL that ends in a slash. The `opts` give the :credentials, the :body to put, text or bytes, and :as :bytes for a fetch of bytes. For a put, they can give :if-version, the version that the document must still have, where nil means that it must not exist yet. Without :if-version, the put has no condition. Its Content-Type is by the :content-types of `opts`, as content-type has them.
(response call {:keys [status headers body] :as answer})What the answer to call, a map of :status, :headers and :body, says:
Any other status throws ::failed with the :status.
What the `answer` to `call`, a map of :status, :headers and :body, says: - :list, the documents as maps of :name and :version, or none for a collection that isn't there yet - :fetch, the :body and :version, or nil when the document isn't there - :head, the :version - :put, the :version when it was written, :conflict? when the precondition failed, or :missing-collection? when the collection isn't there - :delete and :make-collection, nil Any other status throws ::failed with the :status.
(store root)(store root {:keys [credentials name send content-types] :as opts})The store over the WebDAV collection at root, a URL such as
https://dav.example.org/notes/, with the opts below:
The collection is made on the first put when it isn't there, and a server that answers a put without an ETag is asked for one.
The store over the WebDAV collection at `root`, a URL such as https://dav.example.org/notes/, with the `opts` below: - :credentials, a :username and a :password, or a :token, as a map or a function of no arguments that returns one - :name, for the UI, the host by default - :send, a function that sends a request map, in place of http/send! - :timeout-seconds, how long a request can take, 30 by default - :user-agent, as http/send! takes it - :content-types, the Content-Type of a document by the extension of its name, over default-content-types The collection is made on the first put when it isn't there, and a server that answers a put without an ETag is asked for one.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |