From e1fcb402c4f68f32456fac051f8970228e0dc7ca Mon Sep 17 00:00:00 2001 From: Linus Bolls Date: Wed, 6 Nov 2024 23:25:40 +0100 Subject: [PATCH] chore: improved types --- src/index.ts | 2 +- src/methods/createGroup.ts | 11 +++++++---- src/methods/joinGroupWithAnyCode.ts | 11 +++++------ src/types/entry.ts | 4 ++-- src/types/groupInfo.ts | 11 +++++++---- src/types/person.ts | 8 ++++---- 6 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/index.ts b/src/index.ts index fd5929a..bd49f07 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ export { default as SplidClient } from './SplidClient'; -export { SplidJs } from './types'; +export type { SplidJs } from './types'; diff --git a/src/methods/createGroup.ts b/src/methods/createGroup.ts index c1fbcb9..d76fe30 100644 --- a/src/methods/createGroup.ts +++ b/src/methods/createGroup.ts @@ -6,10 +6,13 @@ import { UpdateGroupResponse } from './updateGroup'; export interface CreateGroupRawResponse { result: { - code: 'UVFP588H7'; - longCode: 'R6sjlghj8lPm14IGjMkJdEFjPUPYKemcWpwbkrRtDezSQprVAdwGDkEnnKuQoeo8'; - extendedShortCode: 'UVFP588H7L'; - objectId: 'oCCCOtA24J'; + /** + * the invite code used to join the group + */ + code: string; + longCode: string; + extendedShortCode: string; + objectId: string; }; } diff --git a/src/methods/joinGroupWithAnyCode.ts b/src/methods/joinGroupWithAnyCode.ts index a1ecc5c..9e2d0b5 100644 --- a/src/methods/joinGroupWithAnyCode.ts +++ b/src/methods/joinGroupWithAnyCode.ts @@ -1,4 +1,3 @@ -import { AxiosError } from 'axios'; import { RequestConfig } from '../requestConfig'; export type JoinGroupWithCode400Response = @@ -7,13 +6,13 @@ export type JoinGroupWithCode400Response = export type JoinGroupWithAnyCodeResponse = { result: { - objectId: 'LLTvQ7oHPI'; + objectId: string; /** - * the invite code for this group is "PWJE2BP7K" + * the invite code used to join the group */ - shortCode: 'PWJE2B'; - extendedShortCode: 'PWJE2BP7K9'; - longCode: 'jaW3PQ9KAqgfe1DZmx9ysCJhrZx5ZTxmdfpx4W5jZBiTcSy7C1hIbaL7Iyk3lQne'; + shortCode: string; + extendedShortCode: string; + longCode: string; }; }; diff --git a/src/types/entry.ts b/src/types/entry.ts index af1ae8c..fb1c369 100644 --- a/src/types/entry.ts +++ b/src/types/entry.ts @@ -61,7 +61,7 @@ export interface Entry { group: { __type: 'Pointer'; className: '_User'; - objectId: 'QfQhx0XSSc'; + objectId: string; }; items: EntryItem[]; isPayment: boolean; @@ -69,7 +69,7 @@ export interface Entry { currencyCode: CurrencyCode; createdAt: IsoTime; updatedAt: IsoTime; - objectId: 'KITH5S6HmD'; + objectId: string; __type: 'Object'; className: 'Entry'; diff --git a/src/types/groupInfo.ts b/src/types/groupInfo.ts index 518d6ac..b4a83ef 100644 --- a/src/types/groupInfo.ts +++ b/src/types/groupInfo.ts @@ -2,7 +2,7 @@ import { CurrencyCode, GroupId, IsoTime, Uuid } from './primitives'; export interface GroupInfo { UpdateInstallationID: Uuid; - name: string; // e.g. "La Famiglia" + name: string; defaultCurrencyCode: CurrencyCode; creatorInstallationID: Uuid; UpdateID: Uuid; @@ -18,13 +18,16 @@ export interface GroupInfo { group: { __type: 'Pointer'; className: '_User'; - objectId: 'QfQhx0XSSc'; + objectId: string; }; createdAt: IsoTime; updatedAt: IsoTime; - customCategories: string[]; // e.g. [ "Food" ] + /** + * e.g. [ "Food" ] + */ + customCategories: string[]; isDeleted: boolean; - objectId: 'AL5VHgcVHE'; + objectId: string; __type: 'Object'; className: 'GroupInfo'; diff --git a/src/types/person.ts b/src/types/person.ts index 88e2f17..28d503c 100644 --- a/src/types/person.ts +++ b/src/types/person.ts @@ -12,13 +12,13 @@ export interface Person { group: { __type: 'Pointer'; className: '_User'; - objectId: 'QfQhx0XSSc'; + objectId: string; }; - name: string; // e.g. "Daniel" (yes, even when `isDeleted: true`) - initials: string; // e.g. "D" + name: string; + initials: string; createdAt: IsoTime; updatedAt: IsoTime; - objectId: 'Pv2p7KumiG'; + objectId: string; __type: 'Object'; className: 'Person'; }