Skip to content

Commit

Permalink
docs: Use IOCozyContact type in contact model
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Apr 22, 2024
1 parent 382a319 commit a88cef3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
24 changes: 12 additions & 12 deletions docs/api/cozy-client/modules/models.contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Returns 'byFamilyNameGivenNameEmailCozyUrl' index of a contact

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand All @@ -60,7 +60,7 @@ Returns a display name for the contact

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand All @@ -84,7 +84,7 @@ Returns the contact's fullname

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand All @@ -110,7 +110,7 @@ Returns 'byFamilyNameGivenNameEmailCozyUrl' index of a contact

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand Down Expand Up @@ -158,7 +158,7 @@ Returns the contact's main address

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand All @@ -182,7 +182,7 @@ Returns the contact's main cozy

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand All @@ -206,7 +206,7 @@ Returns the contact's main cozy url without protocol

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand All @@ -230,7 +230,7 @@ Returns the contact's main email

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand Down Expand Up @@ -286,7 +286,7 @@ Returns the contact's main phone number

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand Down Expand Up @@ -332,7 +332,7 @@ Makes 'byFamilyNameGivenNameEmailCozyUrl' index of a contact

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |

*Returns*

Expand All @@ -356,7 +356,7 @@ Makes displayName from contact data

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |
| `opts` | `Object` | - |
| `opts.attributesFullname` | [`FullnameAttributes`](models.contact.md#fullnameattributes)\[] | - |

Expand All @@ -382,7 +382,7 @@ Makes fullname from contact name

| Name | Type | Description |
| :------ | :------ | :------ |
| `contact` | `any` | A contact |
| `contact` | `IOCozyContact` | A contact |
| `opts` | `Object` | - |
| `opts.attributesFullname` | [`FullnameAttributes`](models.contact.md#fullnameattributes)\[] | - |

Expand Down
24 changes: 12 additions & 12 deletions packages/cozy-client/src/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getInitials = contact => {
/**
* Returns the contact's main email
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - The contact's main email
*/
export const getPrimaryEmail = contact =>
Expand All @@ -55,7 +55,7 @@ export const getPrimaryEmail = contact =>
/**
* Returns the contact's main cozy
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - The contact's main cozy
*/
export const getPrimaryCozy = contact =>
Expand All @@ -66,7 +66,7 @@ export const getPrimaryCozy = contact =>
/**
* Returns the contact's main cozy url without protocol
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - The contact's main cozy url
*/
export const getPrimaryCozyDomain = contact => {
Expand All @@ -81,7 +81,7 @@ export const getPrimaryCozyDomain = contact => {
/**
* Returns the contact's main phone number
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - The contact's main phone number
*/
export const getPrimaryPhone = contact =>
Expand All @@ -90,7 +90,7 @@ export const getPrimaryPhone = contact =>
/**
* Returns the contact's main address
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - The contact's main address
*/
export const getPrimaryAddress = contact =>
Expand All @@ -110,7 +110,7 @@ const defaultFullnameAttributes = [
/**
* Makes fullname from contact name
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @param {{ attributesFullname: FullnameAttributes[] }} [opts] - Options
* @returns {string} - The contact's fullname
*/
Expand All @@ -131,7 +131,7 @@ export const makeFullname = (contact, opts) => {
/**
* Returns the contact's fullname
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - The contact's fullname
*/
export const getFullname = contact => {
Expand All @@ -145,7 +145,7 @@ export const getFullname = contact => {
/**
* Makes displayName from contact data
*
* @param {*} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @param {{ attributesFullname: FullnameAttributes[] }} [opts] - Options
* @returns {string} - The contact's displayName
*/
Expand All @@ -170,7 +170,7 @@ export const makeDisplayName = (contact, opts) => {
/**
* Returns a display name for the contact
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - the contact's display name
**/
export const getDisplayName = contact => {
Expand All @@ -184,7 +184,7 @@ export const getDisplayName = contact => {
/**
* Makes 'byFamilyNameGivenNameEmailCozyUrl' index of a contact
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - the contact's 'byFamilyNameGivenNameEmailCozyUrl' index
*/
export const makeDefaultSortIndexValue = contact => {
Expand All @@ -208,7 +208,7 @@ export const makeDefaultSortIndexValue = contact => {
/**
* Returns 'byFamilyNameGivenNameEmailCozyUrl' index of a contact
*
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - the contact's 'byFamilyNameGivenNameEmailCozyUrl' index
*/
export const getDefaultSortIndexValue = contact => {
Expand All @@ -229,7 +229,7 @@ export const getDefaultSortIndexValue = contact => {
* Returns 'byFamilyNameGivenNameEmailCozyUrl' index of a contact
*
* @deprecated Prefer to use getDefaultSortIndexValue.
* @param {object} contact - A contact
* @param {import('../types').IOCozyContact} contact - A contact
* @returns {string} - the contact's 'byFamilyNameGivenNameEmailCozyUrl' index
*/
export const getIndexByFamilyNameGivenNameEmailCozyUrl = contact => {
Expand Down
24 changes: 12 additions & 12 deletions packages/cozy-client/types/models/contact.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
export const CONTACTS_DOCTYPE: "io.cozy.contacts";
export function getPrimaryOrFirst(property: any): (obj: any) => any;
export function getInitials(contact: import('../types').IOCozyContact): string;
export function getPrimaryEmail(contact: object): string;
export function getPrimaryCozy(contact: object): string;
export function getPrimaryCozyDomain(contact: object): string;
export function getPrimaryPhone(contact: object): string;
export function getPrimaryAddress(contact: object): string;
export function makeFullname(contact: object, opts?: {
export function getPrimaryEmail(contact: import('../types').IOCozyContact): string;
export function getPrimaryCozy(contact: import('../types').IOCozyContact): string;
export function getPrimaryCozyDomain(contact: import('../types').IOCozyContact): string;
export function getPrimaryPhone(contact: import('../types').IOCozyContact): string;
export function getPrimaryAddress(contact: import('../types').IOCozyContact): string;
export function makeFullname(contact: import('../types').IOCozyContact, opts?: {
attributesFullname: FullnameAttributes[];
}): string;
export function getFullname(contact: object): string;
export function makeDisplayName(contact: any, opts?: {
export function getFullname(contact: import('../types').IOCozyContact): string;
export function makeDisplayName(contact: import('../types').IOCozyContact, opts?: {
attributesFullname: FullnameAttributes[];
}): string;
export function getDisplayName(contact: object): string;
export function makeDefaultSortIndexValue(contact: object): string;
export function getDefaultSortIndexValue(contact: object): string;
export function getIndexByFamilyNameGivenNameEmailCozyUrl(contact: object): string;
export function getDisplayName(contact: import('../types').IOCozyContact): string;
export function makeDefaultSortIndexValue(contact: import('../types').IOCozyContact): string;
export function getDefaultSortIndexValue(contact: import('../types').IOCozyContact): string;
export function getIndexByFamilyNameGivenNameEmailCozyUrl(contact: import('../types').IOCozyContact): string;
export function isContact(doc: object): boolean;
export type FullnameAttributes = "namePrefix" | "givenName" | "additionalName" | "familyName" | "nameSuffix";

0 comments on commit a88cef3

Please sign in to comment.