The doctypes used in cozy-stack
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cc.cozycloud.autocategorization
cc.cozycloud.sentry
com.deezer.api.track
com.googleapis.maps
com.omdbapi.img
docs
org.musicbrainz.recording.search
org.musicbrainz.release-group.search
org.musicbrainz.release-group
org.musicbrainz.release
org.wikidata.entity
org.wikidata.search
org.wikidata.sparql
org.wikidata.wbsearchentities
org.wikipedia.en.api.parse.images
org.wikipedia.en.api.query.imageinfo
org.wikipedia.fr.api.parse.text
LICENSE
toc.yml

README.md

Table of contents

Cozy doctypes

Remote doctypes

This repository is where the declaration of remote doctypes is done. Read more about remote doctypes in the cozy stack repository.

External doctypes

Generic model

Relationships

Relations between documents are under a relationships object at the root of the document. Relations are referenced by their names.

Each relation is an object with a data property containing either null, one reference or an array of references.

A reference is an object containing at least a _type with the name of the referenced doctype and an _id with the id of the referenced document inside its doctype.

{
  "_id": "mobydick",
  "relationships": {
    "authors": {
      "data": [
        { "_id": "hermanmelville", "_type": "io.cozy.contacts" }
      ]
    }
  }
}

Document metadata

We distinguish three levels : the data (a list of songs from a playlist), the metadata about the data (the creation date of the playlist itself), the metadata of the cozy document (the creation date of the cozy document describing the playlist).

The third level (metadata of the wrapping document) is described by an object named cozyMetadata at the root of the document.

The following keys are reserved and have special meanings:

  • doctypeVersion: Name or identifier for the version of the schema used by this document (ie: doctypeVersion: 2 for "This document conforms to io.cozy.contacts in it's version 2")
  • createdAt: Creation date of the cozy document
  • createdByApp: Slug of the app or connector which created the document
  • createdByAppVersion: Version identifier of the app
  • updatedAt: Last modification date of the cozy document
  • updatedByApps: List of applications (slugs) which modified the cozy document in its life
  • importedAt: If the document originated from elsewhere, date from when it was first imported
  • importedFrom: Where it was imported from (free text)
  • sourceAccount: When the document was imported from a connector, identifier of the account in io.cozy.accounts

By convention, the first app (slug) listed in updatedByApps is the one which did the last update.

Note: All these attributes are optionnal and taken care by the apps modifying the document. Unless specified otherwise in the documentation of the doctype, all these attributes may not be present or may have a null value.

{
  "_id": "xxxx",
  "cozyMetadata": { 
    "doctypeVersion": 4,
    "createdAt": "xxxxx",
    "createdByApp": "xxxx",
    "createdByAppVersion": "xxxx",
    "updatedAt": "xxxxx",
    "updatedByApps": [ "" ],
    "importedAt": "xxxxx",
    "sourceAccount": "xxxxx",
    "importedFrom": "xxxxx",
  },
} 

Date format

Date should be formatted in ISO8601 :

  • 2017-04-22T01:00:00-05:00
  • 2017-04-22T01:00:00Z
  • 2017-04-22 01:00