Skip to content

Commit

Permalink
docs: Update types and docs with new paper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Mar 12, 2024
1 parent 7576895 commit 3daa3e6
Show file tree
Hide file tree
Showing 2 changed files with 239 additions and 18 deletions.
230 changes: 212 additions & 18 deletions docs/api/cozy-client/modules/models.paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

*Defined in*

[packages/cozy-client/src/models/paper.js:5](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L5)
[packages/cozy-client/src/models/paper.js:7](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L7)

***

Expand All @@ -22,7 +22,7 @@

*Defined in*

[packages/cozy-client/src/models/paper.js:263](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L263)
[packages/cozy-client/src/models/paper.js:265](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L265)

## Variables

Expand All @@ -32,7 +32,7 @@

*Defined in*

[packages/cozy-client/src/models/paper.js:18](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L18)
[packages/cozy-client/src/models/paper.js:20](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L20)

***

Expand All @@ -42,7 +42,7 @@

*Defined in*

[packages/cozy-client/src/models/paper.js:31](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L31)
[packages/cozy-client/src/models/paper.js:33](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L33)

***

Expand All @@ -52,7 +52,7 @@

*Defined in*

[packages/cozy-client/src/models/paper.js:41](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L41)
[packages/cozy-client/src/models/paper.js:43](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L43)

## Functions

Expand All @@ -76,7 +76,7 @@ Expiration date

*Defined in*

[packages/cozy-client/src/models/paper.js:116](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L116)
[packages/cozy-client/src/models/paper.js:118](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L118)

***

Expand All @@ -100,7 +100,7 @@ Expiration notice date

*Defined in*

[packages/cozy-client/src/models/paper.js:152](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L152)
[packages/cozy-client/src/models/paper.js:154](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L154)

***

Expand All @@ -124,15 +124,88 @@ Expiration notice link

*Defined in*

[packages/cozy-client/src/models/paper.js:171](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L171)
[packages/cozy-client/src/models/paper.js:173](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L173)

***

### 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:427](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L427)

***

### 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:311](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L311)

***

### 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:354](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L354)

***

### formatMetadataQualification

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

**`description`** Computes and returns the displayable metadata of a paper
**`description`** Select and format displayable metadata of a paper

*Parameters*

Expand All @@ -144,35 +217,156 @@ Expiration notice link

{ `name`: `string` ; `value`: `string` }\[]

\[]} Array of formated metadata
\[]} Array of displayable metadata

*Defined in*

[packages/cozy-client/src/models/paper.js:226](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L226)

***

### 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:224](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L224)
[packages/cozy-client/src/models/paper.js:402](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L402)

***

### getMetadataQualificationType

**getMetadataQualificationType**(`metadataName`): [`MetadataQualificationType`](models.paper.md#metadataqualificationtype)

**`description`** Computes and returns the displayable metadata of a paper
**`description`** Returns the type of the metatada from a metadata name

*Parameters*

| Name | Type | Description |
| :------ | :------ | :------ |
| `metadataName` | `string` | An io.cozy.files metadata object |
| `metadataName` | `string` | A metadata name |

*Returns*

[`MetadataQualificationType`](models.paper.md#metadataqualificationtype)

Array of formated metadata
The type of the metadata

*Defined in*

[packages/cozy-client/src/models/paper.js:273](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L273)

***

### 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:417](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L417)

***

### 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:298](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L298)

***

### 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:331](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L331)

***

### 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:271](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L271)
[packages/cozy-client/src/models/paper.js:389](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L389)

***

Expand All @@ -194,7 +388,7 @@ Array of formated metadata

*Defined in*

[packages/cozy-client/src/models/paper.js:183](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L183)
[packages/cozy-client/src/models/paper.js:185](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L185)

***

Expand All @@ -216,7 +410,7 @@ Array of formated metadata

*Defined in*

[packages/cozy-client/src/models/paper.js:98](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L98)
[packages/cozy-client/src/models/paper.js:100](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L100)

***

Expand All @@ -238,4 +432,4 @@ Array of formated metadata

*Defined in*

[packages/cozy-client/src/models/paper.js:195](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L195)
[packages/cozy-client/src/models/paper.js:197](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L197)
27 changes: 27 additions & 0 deletions packages/cozy-client/types/models/paper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,32 @@ export function formatMetadataQualification(metadata: any): {
value: string | null;
}[];
export function getMetadataQualificationType(metadataName: string): MetadataQualificationType | null;
export function getTranslatedNameForDateMetadata(name: string, { lang }: {
lang: string;
}): string;
export function formatDateMetadataValue(value: string, { lang, f }: {
lang: string;
f: Function;
}): string;
export function getTranslatedNameForInformationMetadata(name: string, { lang, qualificationLabel }: {
lang: string;
qualificationLabel: string;
}): string;
export function formatInformationMetadataValue(value: string, { lang, name, qualificationLabel }: {
lang: string;
name: string;
qualificationLabel: string;
}): string;
export function getTranslatedNameForOtherMetadata(name: string, { lang }: {
lang: string;
}): string;
export function formatOtherMetadataValue(value: string, { lang, name }: {
lang: string;
name: string;
}): string;
export function getTranslatedNameForContact({ lang }: {
lang: string;
}): string;
export function formatContactValue(contacts: object[]): string;
export type IOCozyFile = import("../types").CozyClientDocument & import("../types").FileDocument;
export type MetadataQualificationType = "other" | "date" | "contact" | "information";

0 comments on commit 3daa3e6

Please sign in to comment.