cozy-client / models / paper
Namespace: paper¶
models.paper
Type aliases¶
IOCozyFile¶
Ƭ IOCozyFile<>: IOCozyFile
Defined in
packages/cozy-client/src/models/paper.js:12
MetadataQualificationType¶
Ƭ MetadataQualificationType<>: "date"
| "information"
| "contact"
| "other"
| "bills"
Defined in
packages/cozy-client/src/models/paper.js:280
Variables¶
KNOWN_BILLS_ATTRIBUTES_NAMES¶
• Const
KNOWN_BILLS_ATTRIBUTES_NAMES: string
[]
Defined in
packages/cozy-client/src/models/paper.js:51
KNOWN_DATE_METADATA_NAMES¶
• Const
KNOWN_DATE_METADATA_NAMES: string
[]
Defined in
packages/cozy-client/src/models/paper.js:25
KNOWN_INFORMATION_METADATA_NAMES¶
• Const
KNOWN_INFORMATION_METADATA_NAMES: string
[]
Defined in
packages/cozy-client/src/models/paper.js:38
KNOWN_OTHER_METADATA_NAMES¶
• Const
KNOWN_OTHER_METADATA_NAMES: string
[]
Defined in
packages/cozy-client/src/models/paper.js:50
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:126
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:162
computeExpirationNoticeLink¶
▸ 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:181
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:452
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:330
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:373
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:249
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:427
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
The type of the metadata
Defined in
packages/cozy-client/src/models/paper.js:288
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:442
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:317
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:350
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:414
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:193
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:108
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:205
isForeignPaper¶
▸ isForeignPaper(file
): boolean
Parameters
Name | Type | Description |
---|---|---|
file |
IOCozyFile |
io.cozy.files document |
Returns
boolean
Defined in
packages/cozy-client/src/models/paper.js:505
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:491
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:463
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:475
makeMetadataQualification¶
▸ makeMetadataQualification(params
): Object
Parameters
Name | Type | Description |
---|---|---|
params |
Object |
- |
params.knownMetadataPath |
string |
Path of the metadata |
params.metadata |
any |
An io.cozy.files metadata object |
params.value |
string |
- |
Returns
Object
displayable metadata
Name | Type |
---|---|
name |
string |
value |
string |
Defined in