Skip to content

cozy-client / models / paper

Namespace: paper

models.paper

Type aliases

IOCozyFile

Ƭ IOCozyFile<>: IOCozyFile

Defined in

packages/cozy-client/src/models/paper.js:10


MetadataQualificationType

Ƭ MetadataQualificationType<>: "date" | "information" | "contact" | "other"

Defined in

packages/cozy-client/src/models/paper.js:273

Variables

KNOWN_DATE_METADATA_NAMES

Const KNOWN_DATE_METADATA_NAMES: string[]

Defined in

packages/cozy-client/src/models/paper.js:23


KNOWN_INFORMATION_METADATA_NAMES

Const KNOWN_INFORMATION_METADATA_NAMES: string[]

Defined in

packages/cozy-client/src/models/paper.js:36


KNOWN_OTHER_METADATA_NAMES

Const KNOWN_OTHER_METADATA_NAMES: string[]

Defined in

packages/cozy-client/src/models/paper.js:48

Functions

computeExpirationDate

computeExpirationDate(file): Date

description Computes et returns the expiration date of the given file, or null if it is not expiring

Parameters

Name Type Description
file IOCozyFile io.cozy.files document

Returns

Date

Expiration date

Defined in

packages/cozy-client/src/models/paper.js:123


computeExpirationNoticeDate

computeExpirationNoticeDate(file): Date

description Computes et returns the expiration notice date of the given file, or null if it is not expiring

Parameters

Name Type Description
file IOCozyFile io.cozy.files document

Returns

Date

Expiration notice date

Defined in

packages/cozy-client/src/models/paper.js:159


computeExpirationNoticeLink(file): string

description Computes and returns the expiration notice link of the given file, or null if it has none

Parameters

Name Type Description
file IOCozyFile io.cozy.files document

Returns

string

Expiration notice link

Defined in

packages/cozy-client/src/models/paper.js:178


formatContactValue

formatContactValue(contacts): string

Parameters

Name Type Description
contacts any[] An array of contact

Returns

string

Formatted and translated value of an array of contact

Defined in

packages/cozy-client/src/models/paper.js:435


formatDateMetadataValue

formatDateMetadataValue(value, options): string

Parameters

Name Type Description
value string The value of a metadata of type date
options Object Options
options.f Function Date formatting function
options.lang string Lang requested for the translation

Returns

string

Formatted and translated value for the metadata

Defined in

packages/cozy-client/src/models/paper.js:319


formatInformationMetadataValue

formatInformationMetadataValue(value, options): string

Parameters

Name Type Description
value string The value of a metadata of type information
options Object Options
options.lang string Lang requested for the translation
options.name string The name of the metadata
options.qualificationLabel string The qualification label of the metadata

Returns

string

Formatted and translated value for the metadata

Defined in

packages/cozy-client/src/models/paper.js:362


formatMetadataQualification

formatMetadataQualification(metadata): { name: string ; value: string }[]

description Select and format displayable metadata of a paper

Parameters

Name Type Description
metadata any An io.cozy.files metadata object

Returns

{ name: string ; value: string }[]

[]} Array of displayable metadata

Defined in

packages/cozy-client/src/models/paper.js:242


formatOtherMetadataValue

formatOtherMetadataValue(value, options): string

Parameters

Name Type Description
value string The value of a metadata of type other
options Object Options
options.lang string Lang requested for the translation
options.name string The name of the metadata

Returns

string

Formatted and translated value for the metadata

Defined in

packages/cozy-client/src/models/paper.js:410


getMetadataQualificationType

getMetadataQualificationType(metadataName): MetadataQualificationType

description Returns the type of the metatada from a metadata name

Parameters

Name Type Description
metadataName string A metadata name

Returns

MetadataQualificationType

The type of the metadata

Defined in

packages/cozy-client/src/models/paper.js:281


getTranslatedNameForContact

getTranslatedNameForContact(options): string

Parameters

Name Type Description
options Object Options
options.lang string Lang requested for the translation

Returns

string

Translated name for contact

Defined in

packages/cozy-client/src/models/paper.js:425


getTranslatedNameForDateMetadata

getTranslatedNameForDateMetadata(name, options): string

Parameters

Name Type Description
name string The name of a metadata of type date like ‘expirationDate’ or ‘shootingDate’
options Object Options
options.lang string Lang requested for the translation like ‘fr’ or ‘en’

Returns

string

Translated name for the metadata

Defined in

packages/cozy-client/src/models/paper.js:306


getTranslatedNameForInformationMetadata

getTranslatedNameForInformationMetadata(name, options): string

Parameters

Name Type Description
name string The name of a metadata of type information like ‘national_id_card’ or ‘fine’
options Object Options
options.lang string Lang requested for the translation
options.qualificationLabel string The qualification label of the metadata

Returns

string

Translated name for the metadata

Defined in

packages/cozy-client/src/models/paper.js:339


getTranslatedNameForOtherMetadata

getTranslatedNameForOtherMetadata(name, options): string

Parameters

Name Type Description
name string The name of a metadata of type other like ‘page’ or ‘qualification’
options Object Options
options.lang string Lang requested for the translation

Returns

string

Translated name for the metadata

Defined in

packages/cozy-client/src/models/paper.js:397


isExpired

isExpired(file): boolean

description Tells if the given file is expiring and if today is after its expiration date

Parameters

Name Type Description
file IOCozyFile io.cozy.files document

Returns

boolean

Defined in

packages/cozy-client/src/models/paper.js:190


isExpiring

isExpiring(file): boolean

description Tells if a given file matches one of the known types of expiring papers

Parameters

Name Type Description
file IOCozyFile io.cozy.files document

Returns

boolean

Defined in

packages/cozy-client/src/models/paper.js:105


isExpiringSoon

isExpiringSoon(file): boolean

description Tells if the given file is expiring and if today is between its expiration notice date and its expiration date

Parameters

Name Type Description
file IOCozyFile io.cozy.files document

Returns

boolean

Defined in

packages/cozy-client/src/models/paper.js:202


makeExpirationDescription

makeExpirationDescription(expirationDate, options): string

Parameters

Name Type Description
expirationDate string Expiration date
options Object Options
options.lang string Lang requested for the translation

Returns

string

Defined in

packages/cozy-client/src/models/paper.js:474


makeExpiredMessage

makeExpiredMessage(options): string

Parameters

Name Type Description
options Object Options
options.lang string Lang requested for the translation

Returns

string

Defined in

packages/cozy-client/src/models/paper.js:446


makeExpiresInMessage

makeExpiresInMessage(expirationDate, options): string

Parameters

Name Type Description
expirationDate string Expiration date
options Object Options
options.lang string Lang requested for the translation

Returns

string

Defined in

packages/cozy-client/src/models/paper.js:458