Documentation ¶
Overview ¶
Package api has type definitions for webdav
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Exception string `xml:"exception,omitempty"` Message string `xml:"message,omitempty"` Status string StatusCode int }
Error is used to describe webdav errors
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotFound</s:exception> <s:message>File with name Photo could not be located</s:message>
</d:error>
type Multistatus ¶
type Multistatus struct {
Responses []Response `xml:"response"`
}
Multistatus contains responses returned from an HTTP 207 return code
type Prop ¶
type Prop struct { Status []string `xml:"DAV: status"` Name string `xml:"DAV: prop>displayname,omitempty"` Type *xml.Name `xml:"DAV: prop>resourcetype>collection,omitempty"` IsCollection *string `xml:"DAV: prop>iscollection,omitempty"` // this is a Microsoft extension see #2716 Size int64 `xml:"DAV: prop>getcontentlength,omitempty"` Modified Time `xml:"DAV: prop>getlastmodified,omitempty"` Checksums []string `xml:"prop>checksums>checksum,omitempty"` }
Prop is the properties of a response
This is a lazy way of decoding the multiple <s:propstat> in the response.
The response might look like this ¶
<d:response>
<d:href>/remote.php/webdav/Nextcloud%20Manual.pdf</d:href> <d:propstat> <d:prop> <d:getlastmodified>Tue, 19 Dec 2017 22:02:36 GMT</d:getlastmodified> <d:getcontentlength>4143665</d:getcontentlength> <d:resourcetype/> <d:getetag>"048d7be4437ff7deeae94db50ff3e209"</d:getetag> <d:getcontenttype>application/pdf</d:getcontenttype> </d:prop> <d:status>HTTP/1.1 200 OK</d:status> </d:propstat> <d:propstat> <d:prop> <d:quota-used-bytes/> <d:quota-available-bytes/> </d:prop> <d:status>HTTP/1.1 404 Not Found</d:status> </d:propstat>
</d:response>
So we elide the array of <d:propstat> and within that the array of <d:prop> into one struct.
Note that status collects all the status values for which we just check the first is OK.
type Quota ¶
type Quota struct { Available string `xml:"DAV: response>propstat>prop>quota-available-bytes"` Used string `xml:"DAV: response>propstat>prop>quota-used-bytes"` }
Quota is used to read the bytes used and available
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
<d:response> <d:href>/remote.php/webdav/</d:href> <d:propstat> <d:prop> <d:quota-available-bytes>-3</d:quota-available-bytes> <d:quota-used-bytes>376461895</d:quota-used-bytes> </d:prop> <d:status>HTTP/1.1 200 OK</d:status> </d:propstat> </d:response>
</d:multistatus>
type Time ¶
Time represents date and time information for the webdav API marshalling to and from timeFormat
func (*Time) MarshalXML ¶
MarshalXML turns a Time into XML
func (*Time) UnmarshalXML ¶
UnmarshalXML turns XML into a Time