Skip to content

Commit

Permalink
style: clean types
Browse files Browse the repository at this point in the history
  • Loading branch information
joscha committed Jul 23, 2024
1 parent e9b0b59 commit dd60999
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/v1/list_entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions src/v1/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export type OrganizationResponse =
& Omit<OrganizationResponseRaw, keyof InteractionDateResponseRaw>
& InteractionDateResponse

export type PagedResponseRaw = {
export type PagedResponse = {
next_page_token: string | null
}

Expand All @@ -174,7 +174,7 @@ export type PagedOrganizationResponseRaw =
& {
organizations: OrganizationResponseRaw[]
}
& PagedResponseRaw
& PagedResponse

export type PagedOrganizationResponse =
& Omit<PagedOrganizationResponseRaw, 'organizations'>
Expand Down Expand Up @@ -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
}
Expand Down
21 changes: 6 additions & 15 deletions src/v1/persons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
OptionalMaxQueryParams,
OptionalMinQueryParams,
PagedRequest,
PagedResponseRaw,
PagedResponse,
transformInteractionDateResponseRaw,
} from './organizations.ts'
import type { ListEntryReferenceRaw } from './list_entries.ts'
Expand Down Expand Up @@ -70,15 +70,6 @@ export type PersonResponse =
& Omit<PersonResponseRaw, keyof InteractionDateResponseRaw>
& 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 =
& {
/**
Expand All @@ -97,15 +88,15 @@ export type PagedPersonResponseRaw =
& {
persons: PersonResponseRaw[]
}
& PagedResponseRaw
& PagedResponse

export type PagedPersonResponse =
& Omit<PagedPersonResponseRaw, 'persons'>
& {
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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dd60999

Please sign in to comment.