Skip to content

Commit

Permalink
feat: Add generated types and documentation for new exported helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
PolariTOON committed Dec 6, 2022
1 parent 6c8adf4 commit a6b74bd
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 9 deletions.
5 changes: 3 additions & 2 deletions docs/api/cozy-client/modules/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [folder](models.folder.md)
* [instance](models.instance.md)
* [note](models.note.md)
* [paper](models.paper.md)
* [permission](models.permission.md)
* [sharing](models.sharing.md)
* [timeseries](models.timeseries.md)
Expand All @@ -28,7 +29,7 @@

*Defined in*

[packages/cozy-client/src/models/index.js:19](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/index.js#L19)
[packages/cozy-client/src/models/index.js:20](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/index.js#L20)

***

Expand All @@ -38,4 +39,4 @@

*Defined in*

[packages/cozy-client/src/models/index.js:18](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/index.js#L18)
[packages/cozy-client/src/models/index.js:19](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/index.js#L19)
153 changes: 153 additions & 0 deletions docs/api/cozy-client/modules/models.paper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
[cozy-client](../README.md) / [models](models.md) / paper

# Namespace: paper

[models](models.md).paper

## Type aliases

### IOCozyFile

Ƭ **IOCozyFile**<>: `IOCozyFile`

*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)

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

***

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

***

### computeExpirationNoticeLink

**computeExpirationNoticeLink**(`file`): `string`

**`description`** Computes et returns the expiration notice link of the given file, or null if it has none or it is not expiring

*Parameters*

| Name | Type | Description |
| :------ | :------ | :------ |
| `file` | `IOCozyFile` | io.cozy.files document |

*Returns*

`string`

Expiration notice link

*Defined in*

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

***

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

***

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

***

### 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:167](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/models/paper.js#L167)
3 changes: 2 additions & 1 deletion packages/cozy-client/types/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ import * as timeseries from "./timeseries";
import * as sharing from "./sharing";
import * as dacc from "./dacc";
import * as doctypes from "./doctypes";
export { trigger, instance, applications, file, folder, note, account, permission, utils, contact, document, timeseries, sharing, dacc, doctypes };
import * as paper from "./paper";
export { trigger, instance, applications, file, folder, note, account, permission, utils, contact, document, timeseries, sharing, dacc, doctypes, paper };
7 changes: 7 additions & 0 deletions packages/cozy-client/types/models/paper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function isExpiring(file: IOCozyFile): boolean;
export function computeExpirationDate(file: IOCozyFile): Date | null;
export function computeExpirationNoticeDate(file: IOCozyFile): Date | null;
export function computeExpirationNoticeLink(file: IOCozyFile): string | null;
export function isExpired(file: IOCozyFile): boolean;
export function isExpiringSoon(file: IOCozyFile): boolean;
export type IOCozyFile = import("../types").CozyClientDocument & import("../types").FileDocument;
37 changes: 31 additions & 6 deletions packages/cozy-client/types/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
declare var _default: {};
export default _default;
export type Qualification = import("./models/document/qualification").Qualification;
export type AccountsDoctype = "io.cozy.accounts";
export type TriggersDoctype = "io.cozy.triggers";
export type KonnectorsDoctype = "io.cozy.konnectors";
Expand Down Expand Up @@ -194,6 +195,26 @@ export type FileMetadata = {
* - Number of a note
*/
version?: number;
/**
* - Qualification of the file
*/
qualification?: Qualification;
/**
* - Country of the paper
*/
country?: string;
/**
* - Expiration date of the paper
*/
expirationDate?: string;
/**
* - Reference date of the paper
*/
referencedDate?: string;
/**
* - Notice period of the paper, in days
*/
noticePeriod?: string;
};
/**
* - An io.cozy.files document
Expand Down Expand Up @@ -235,6 +256,10 @@ export type FileDocument = {
* - Whether or not the file is client-side encrypted
*/
encrypted: boolean;
/**
* - Creation date of the file
*/
created_at: string;
};
/**
* - An io.cozy.files document
Expand Down Expand Up @@ -370,7 +395,7 @@ export type Theme = {
defaultItems?: Array<string>;
};
export type ThemesList = Theme[];
export type ThemesLabels = "transport" | "identity" | "family" | "work_study" | "health" | "home" | "finance" | "invoice";
export type ThemesLabels = "transport" | "identity" | "family" | "health" | "invoice" | "work_study" | "home" | "finance";
export type QualificationAttributes = {
label: string;
purpose?: string;
Expand All @@ -381,13 +406,13 @@ export type QualificationAttributes = {
export type IdentityLabel = "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "citizen_registration_certificate" | "personal_sporting_licence";
export type FamilyLabel = "family_record_book" | "birth_certificate" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "payment_proof_family_allowance";
export type WorkStudyLabels = "resume" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "work_disability_recognition" | "school_attendance_certificate";
export type HealthLabels = "work_disability_recognition" | "health_certificate" | "health_book" | "national_health_insurance_card" | "health_insurance_card" | "prescription" | "health_invoice" | "national_health_insurance_right_certificate" | "pregnancy_medical_certificate" | "other_health_document";
export type HomeLabels = "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "unfit_for_habitation_declaration" | "accommodation_proof";
export type HealthLabels = "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document";
export type HomeLabels = "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "unfit_for_habitation_declaration" | "accommodation_proof";
export type TransportLabels = "driver_license" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document";
export type FinanceLabels = "payment_proof_family_allowance" | "pay_sheet" | "tax_return" | "tax_notice" | "tax_timetable" | "receipt" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "other_revenue";
export type InvoiceLabels = "health_invoice" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "work_invoice" | "transport_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice";
export type FinanceLabels = "pay_sheet" | "other_revenue" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance";
export type InvoiceLabels = "health_invoice" | "transport_invoice" | "work_invoice" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice";
export type ActivityLabels = "personal_sporting_licence" | "other_activity_document";
export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "citizen_registration_certificate" | "personal_sporting_licence" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "payment_proof_family_allowance" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "work_disability_recognition" | "school_attendance_certificate" | "health_certificate" | "health_book" | "national_health_insurance_card" | "health_insurance_card" | "prescription" | "health_invoice" | "national_health_insurance_right_certificate" | "pregnancy_medical_certificate" | "other_health_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "unfit_for_habitation_declaration" | "accommodation_proof" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "tax_return" | "tax_notice" | "tax_timetable" | "receipt" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "other_revenue" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_activity_document";
export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance" | "school_attendance_certificate" | "unfit_for_habitation_declaration" | "accommodation_proof" | "citizen_registration_certificate" | "personal_sporting_licence" | "other_activity_document";
/**
* See https://github.com/cozy/DACC
*/
Expand Down

0 comments on commit a6b74bd

Please sign in to comment.