From dd60999fa3b235f41f721152033dcae2014541fa Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Tue, 23 Jul 2024 17:40:40 +0100 Subject: [PATCH] style: clean types --- src/v1/list_entries.ts | 4 ++-- src/v1/organizations.ts | 6 +++--- src/v1/persons.ts | 21 ++++++--------------- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/v1/list_entries.ts b/src/v1/list_entries.ts index efc1e8d..c2e03c7 100644 --- a/src/v1/list_entries.ts +++ b/src/v1/list_entries.ts @@ -67,8 +67,8 @@ export type ListEntryResponseRaw = export type PagedListEntryResponseRaw = { list_entries: ListEntryResponseRaw[] /** - * The absence of a `next_page_token` indicates that all the records have been fetched, though its presence does not necessarily indicate that there are more resources to be fetched. - * The next page may be empty (but then `next_page_token` would be `null` to confirm that there are no more resources). + * The absence of a {@link PagedResponse.next_page_token} indicates that all the records have been fetched, though its presence does not necessarily indicate that there are more resources to be fetched. + * The next page may be empty (but then {@link PagedResponse.next_page_token} would be `null` to confirm that there are no more resources). */ next_page_token: string | null } diff --git a/src/v1/organizations.ts b/src/v1/organizations.ts index c836d23..8058951 100644 --- a/src/v1/organizations.ts +++ b/src/v1/organizations.ts @@ -162,7 +162,7 @@ export type OrganizationResponse = & Omit & InteractionDateResponse -export type PagedResponseRaw = { +export type PagedResponse = { next_page_token: string | null } @@ -174,7 +174,7 @@ export type PagedOrganizationResponseRaw = & { organizations: OrganizationResponseRaw[] } - & PagedResponseRaw + & PagedResponse export type PagedOrganizationResponse = & Omit @@ -249,7 +249,7 @@ export type InteractionDatesQueryParams = | { with_interaction_dates: true /** - * When true, persons for each interaction will be returned. Used in conjunction with `with_interaction_dates` + * When true, persons for each interaction will be returned. Used in conjunction with {@link InteractionDatesQueryParams.with_interaction_dates} */ with_interaction_persons: true } diff --git a/src/v1/persons.ts b/src/v1/persons.ts index bf376dc..966ac65 100644 --- a/src/v1/persons.ts +++ b/src/v1/persons.ts @@ -12,7 +12,7 @@ import { OptionalMaxQueryParams, OptionalMinQueryParams, PagedRequest, - PagedResponseRaw, + PagedResponse, transformInteractionDateResponseRaw, } from './organizations.ts' import type { ListEntryReferenceRaw } from './list_entries.ts' @@ -70,15 +70,6 @@ export type PersonResponse = & Omit & InteractionDateResponse -export type SinglePersonResponseRaw = - & PersonResponseRaw - & { - /** - * An array of list entry resources associated with the person, only returned as part of the {@link Persons.get} a specific person endpoint. - */ - list_entries: ListEntryReferenceRaw[] - } - export type SearchPersonsRequest = & { /** @@ -97,7 +88,7 @@ export type PagedPersonResponseRaw = & { persons: PersonResponseRaw[] } - & PagedResponseRaw + & PagedResponse export type PagedPersonResponse = & Omit @@ -105,7 +96,7 @@ export type PagedPersonResponse = persons: PersonResponse[] } -export type SingleOrganizationResponseRaw = +export type SinglePersonResponseRaw = & { /** * An array of list entry resources associated with the person, only returned as part of the {@link Persons.get} a specific person endpoint. @@ -148,10 +139,10 @@ export class Persons { /** * Searches your teams data and fetches all the persons that meet the search criteria. * - * This result is paginated. An initial request returns an object with two fields: `persons` and `next_page_token`. `persons` contains an array of person resources. The value of `next_page_token` should be sent as the query parameter `page_token` in another request to retrieve the next page of results. While paginating through results, each request must have identical query parameters other than the changing `page_token`. Otherwise, an `Invalid page_token variable` error will be returned. + * This result is paginated. An initial request returns an object with two fields: `persons` and {@link PagedResponse.next_page_token}. `persons` contains an array of person resources. The value of {@link PagedResponse.next_page_token} should be sent as the query parameter `page_token` in another request to retrieve the next page of results. While paginating through results, each request must have identical query parameters other than the changing `page_token`. Otherwise, an `Invalid page_token variable` error will be returned. * - * The absence of a `next_page_token` indicates that all the records have been fetched, though its presence does not necessarily indicate that there are *more* resources to be fetched. The next page may be empty (but then `next_page_token` would be `null` to confirm that there are no more resources). - * Pass `with_interaction_dates=true` as a query parameter to include dates of the most recent and upcoming interactions with persons. When this parameter is included, persons with no interactions will not be returned in the response. Pass `with_interaction_persons=true` as a query parameter if `with_interaction_dates=true` to also get the internal persons associated with the interaction. + * The absence of a {@link PagedResponse.next_page_token} indicates that all the records have been fetched, though its presence does not necessarily indicate that there are *more* resources to be fetched. The next page may be empty (but then {@link PagedResponse.next_page_token} would be `null` to confirm that there are no more resources). + * Pass `{@link InteractionDatesQueryParams.with_interaction_dates}=true` as a query parameter to include dates of the most recent and upcoming interactions with persons. When this parameter is included, persons with no interactions will not be returned in the response. Pass `with_interaction_persons=true` as a query parameter if `with_interaction_dates=true` to also get the internal persons associated with the interaction. * You can filter by interaction dates by providing additional query parameters like `min_last_email_date` or `max_next_event_date`. The value of these query parameters should be ISO 8601 formatted date strings. * * @param request - Object containing the data for the request