@cimplify/sdk 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +379 -262
- package/dist/index.d.ts +379 -262
- package/dist/index.js +457 -291
- package/dist/index.mjs +457 -291
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -536,6 +536,156 @@ interface ProductTimeProfile {
|
|
|
536
536
|
metadata?: Record<string, unknown>;
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
+
/**
|
|
540
|
+
* A Result type that makes errors explicit in the type system.
|
|
541
|
+
* Inspired by Rust's Result and fp-ts Either.
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```typescript
|
|
545
|
+
* const result = await client.cart.addItemSafe({ item_id: "prod_123" });
|
|
546
|
+
*
|
|
547
|
+
* if (result.ok) {
|
|
548
|
+
* console.log(result.value); // Cart
|
|
549
|
+
* } else {
|
|
550
|
+
* console.log(result.error); // CimplifyError
|
|
551
|
+
* }
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
type Result<T, E = Error> = Ok<T> | Err<E>;
|
|
555
|
+
interface Ok<T> {
|
|
556
|
+
readonly ok: true;
|
|
557
|
+
readonly value: T;
|
|
558
|
+
}
|
|
559
|
+
interface Err<E> {
|
|
560
|
+
readonly ok: false;
|
|
561
|
+
readonly error: E;
|
|
562
|
+
}
|
|
563
|
+
/** Create a successful Result */
|
|
564
|
+
declare function ok<T>(value: T): Ok<T>;
|
|
565
|
+
/** Create a failed Result */
|
|
566
|
+
declare function err<E>(error: E): Err<E>;
|
|
567
|
+
/** Check if Result is Ok */
|
|
568
|
+
declare function isOk<T, E>(result: Result<T, E>): result is Ok<T>;
|
|
569
|
+
/** Check if Result is Err */
|
|
570
|
+
declare function isErr<T, E>(result: Result<T, E>): result is Err<E>;
|
|
571
|
+
/**
|
|
572
|
+
* Transform the success value of a Result.
|
|
573
|
+
*
|
|
574
|
+
* @example
|
|
575
|
+
* ```typescript
|
|
576
|
+
* const result = ok(5);
|
|
577
|
+
* const doubled = mapResult(result, (n) => n * 2);
|
|
578
|
+
* // doubled = { ok: true, value: 10 }
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
declare function mapResult<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
582
|
+
/**
|
|
583
|
+
* Transform the error value of a Result.
|
|
584
|
+
*
|
|
585
|
+
* @example
|
|
586
|
+
* ```typescript
|
|
587
|
+
* const result = err(new Error("oops"));
|
|
588
|
+
* const mapped = mapError(result, (e) => new CustomError(e.message));
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
592
|
+
/**
|
|
593
|
+
* Chain Results together. If the first Result is Ok, apply the function.
|
|
594
|
+
* If it's Err, propagate the error.
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```typescript
|
|
598
|
+
* const getUser = (id: string): Result<User, Error> => { ... }
|
|
599
|
+
* const getOrders = (user: User): Result<Order[], Error> => { ... }
|
|
600
|
+
*
|
|
601
|
+
* const result = flatMap(getUser("123"), (user) => getOrders(user));
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
|
|
605
|
+
/**
|
|
606
|
+
* Get the value or a default if the Result is Err.
|
|
607
|
+
*
|
|
608
|
+
* @example
|
|
609
|
+
* ```typescript
|
|
610
|
+
* const result = err(new Error("failed"));
|
|
611
|
+
* const value = getOrElse(result, () => defaultCart);
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
declare function getOrElse<T, E>(result: Result<T, E>, defaultFn: () => T): T;
|
|
615
|
+
/**
|
|
616
|
+
* Get the value or throw the error.
|
|
617
|
+
* Use sparingly - defeats the purpose of Result!
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* ```typescript
|
|
621
|
+
* const cart = unwrap(result); // throws if Err
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
625
|
+
/**
|
|
626
|
+
* Get the value or undefined if Err.
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```typescript
|
|
630
|
+
* const cart = toNullable(result); // Cart | undefined
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
declare function toNullable<T, E>(result: Result<T, E>): T | undefined;
|
|
634
|
+
/**
|
|
635
|
+
* Convert a Promise that might throw into a Result.
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```typescript
|
|
639
|
+
* const result = await fromPromise(
|
|
640
|
+
* fetch("/api/data"),
|
|
641
|
+
* (error) => new NetworkError(error.message)
|
|
642
|
+
* );
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
declare function fromPromise<T, E>(promise: Promise<T>, mapError: (error: unknown) => E): Promise<Result<T, E>>;
|
|
646
|
+
/**
|
|
647
|
+
* Convert a function that might throw into one that returns Result.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* const safeParse = tryCatch(
|
|
652
|
+
* () => JSON.parse(input),
|
|
653
|
+
* (e) => new ParseError(e.message)
|
|
654
|
+
* );
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
declare function tryCatch<T, E>(fn: () => T, mapError: (error: unknown) => E): Result<T, E>;
|
|
658
|
+
/**
|
|
659
|
+
* Combine multiple Results. Returns Ok with array of values if all succeed,
|
|
660
|
+
* or the first Err encountered.
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```typescript
|
|
664
|
+
* const results = await Promise.all([
|
|
665
|
+
* client.cart.getSafe(),
|
|
666
|
+
* client.business.getSafe(),
|
|
667
|
+
* ]);
|
|
668
|
+
* const combined = combine(results);
|
|
669
|
+
* // Result<[Cart, Business], CimplifyError>
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
declare function combine<T, E>(results: Result<T, E>[]): Result<T[], E>;
|
|
673
|
+
/**
|
|
674
|
+
* Like combine, but for an object of Results.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```typescript
|
|
678
|
+
* const data = combineObject({
|
|
679
|
+
* cart: await client.cart.getSafe(),
|
|
680
|
+
* business: await client.business.getSafe(),
|
|
681
|
+
* });
|
|
682
|
+
* // Result<{ cart: Cart, business: Business }, CimplifyError>
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
declare function combineObject<T extends Record<string, Result<unknown, unknown>>>(results: T): Result<{
|
|
686
|
+
[K in keyof T]: T[K] extends Result<infer V, unknown> ? V : never;
|
|
687
|
+
}, T[keyof T] extends Result<unknown, infer E> ? E : never>;
|
|
688
|
+
|
|
539
689
|
interface GetProductsOptions {
|
|
540
690
|
category?: string;
|
|
541
691
|
collection?: string;
|
|
@@ -554,51 +704,67 @@ interface SearchOptions {
|
|
|
554
704
|
limit?: number;
|
|
555
705
|
category?: string;
|
|
556
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Catalogue queries with explicit error handling via Result type.
|
|
709
|
+
*
|
|
710
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```typescript
|
|
714
|
+
* const result = await client.catalogue.getProducts({ category: "burgers" });
|
|
715
|
+
*
|
|
716
|
+
* if (result.ok) {
|
|
717
|
+
* console.log("Products:", result.value);
|
|
718
|
+
* } else {
|
|
719
|
+
* console.error("Failed:", result.error.code);
|
|
720
|
+
* }
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
557
723
|
declare class CatalogueQueries {
|
|
558
724
|
private client;
|
|
559
725
|
constructor(client: CimplifyClient);
|
|
560
|
-
getProducts(options?: GetProductsOptions): Promise<Product[]
|
|
561
|
-
getProduct(id: string): Promise<ProductWithDetails
|
|
562
|
-
getProductBySlug(slug: string): Promise<ProductWithDetails
|
|
563
|
-
getVariants(productId: string): Promise<ProductVariant[]
|
|
564
|
-
getVariantAxes(productId: string): Promise<VariantAxis[]
|
|
726
|
+
getProducts(options?: GetProductsOptions): Promise<Result<Product[], CimplifyError>>;
|
|
727
|
+
getProduct(id: string): Promise<Result<ProductWithDetails, CimplifyError>>;
|
|
728
|
+
getProductBySlug(slug: string): Promise<Result<ProductWithDetails, CimplifyError>>;
|
|
729
|
+
getVariants(productId: string): Promise<Result<ProductVariant[], CimplifyError>>;
|
|
730
|
+
getVariantAxes(productId: string): Promise<Result<VariantAxis[], CimplifyError>>;
|
|
565
731
|
/**
|
|
566
732
|
* Find a variant by axis selections (e.g., { "Size": "Large", "Color": "Red" })
|
|
567
733
|
* Returns the matching variant or null if no match found.
|
|
568
734
|
*/
|
|
569
|
-
getVariantByAxisSelections(productId: string, selections: VariantAxisSelection): Promise<ProductVariant | null
|
|
735
|
+
getVariantByAxisSelections(productId: string, selections: VariantAxisSelection): Promise<Result<ProductVariant | null, CimplifyError>>;
|
|
570
736
|
/**
|
|
571
737
|
* Get a specific variant by its ID
|
|
572
738
|
*/
|
|
573
|
-
getVariantById(productId: string, variantId: string): Promise<ProductVariant
|
|
574
|
-
getAddOns(productId: string): Promise<AddOn[]
|
|
575
|
-
getCategories(): Promise<Category[]
|
|
576
|
-
getCategory(id: string): Promise<Category
|
|
577
|
-
getCategoryBySlug(slug: string): Promise<Category
|
|
578
|
-
getCategoryProducts(categoryId: string): Promise<Product[]
|
|
579
|
-
getCollections(): Promise<Collection[]
|
|
580
|
-
getCollection(id: string): Promise<Collection
|
|
581
|
-
getCollectionBySlug(slug: string): Promise<Collection
|
|
582
|
-
getCollectionProducts(collectionId: string): Promise<Product[]
|
|
583
|
-
searchCollections(query: string, limit?: number): Promise<Collection[]
|
|
584
|
-
getBundles(): Promise<Bundle[]
|
|
585
|
-
getBundle(id: string): Promise<BundleWithDetails
|
|
586
|
-
getBundleBySlug(slug: string): Promise<BundleWithDetails
|
|
587
|
-
searchBundles(query: string, limit?: number): Promise<Bundle[]
|
|
739
|
+
getVariantById(productId: string, variantId: string): Promise<Result<ProductVariant, CimplifyError>>;
|
|
740
|
+
getAddOns(productId: string): Promise<Result<AddOn[], CimplifyError>>;
|
|
741
|
+
getCategories(): Promise<Result<Category[], CimplifyError>>;
|
|
742
|
+
getCategory(id: string): Promise<Result<Category, CimplifyError>>;
|
|
743
|
+
getCategoryBySlug(slug: string): Promise<Result<Category, CimplifyError>>;
|
|
744
|
+
getCategoryProducts(categoryId: string): Promise<Result<Product[], CimplifyError>>;
|
|
745
|
+
getCollections(): Promise<Result<Collection[], CimplifyError>>;
|
|
746
|
+
getCollection(id: string): Promise<Result<Collection, CimplifyError>>;
|
|
747
|
+
getCollectionBySlug(slug: string): Promise<Result<Collection, CimplifyError>>;
|
|
748
|
+
getCollectionProducts(collectionId: string): Promise<Result<Product[], CimplifyError>>;
|
|
749
|
+
searchCollections(query: string, limit?: number): Promise<Result<Collection[], CimplifyError>>;
|
|
750
|
+
getBundles(): Promise<Result<Bundle[], CimplifyError>>;
|
|
751
|
+
getBundle(id: string): Promise<Result<BundleWithDetails, CimplifyError>>;
|
|
752
|
+
getBundleBySlug(slug: string): Promise<Result<BundleWithDetails, CimplifyError>>;
|
|
753
|
+
searchBundles(query: string, limit?: number): Promise<Result<Bundle[], CimplifyError>>;
|
|
588
754
|
getComposites(options?: {
|
|
589
755
|
limit?: number;
|
|
590
|
-
}): Promise<Composite[]
|
|
591
|
-
getComposite(id: string): Promise<CompositeWithDetails
|
|
592
|
-
getCompositeByProductId(productId: string): Promise<CompositeWithDetails
|
|
593
|
-
calculateCompositePrice(compositeId: string, selections: ComponentSelectionInput[], locationId?: string): Promise<CompositePriceResult
|
|
594
|
-
search(query: string, options?: SearchOptions): Promise<Product[]
|
|
595
|
-
searchProducts(query: string, options?: SearchOptions): Promise<Product[]
|
|
756
|
+
}): Promise<Result<Composite[], CimplifyError>>;
|
|
757
|
+
getComposite(id: string): Promise<Result<CompositeWithDetails, CimplifyError>>;
|
|
758
|
+
getCompositeByProductId(productId: string): Promise<Result<CompositeWithDetails, CimplifyError>>;
|
|
759
|
+
calculateCompositePrice(compositeId: string, selections: ComponentSelectionInput[], locationId?: string): Promise<Result<CompositePriceResult, CimplifyError>>;
|
|
760
|
+
search(query: string, options?: SearchOptions): Promise<Result<Product[], CimplifyError>>;
|
|
761
|
+
searchProducts(query: string, options?: SearchOptions): Promise<Result<Product[], CimplifyError>>;
|
|
596
762
|
getMenu(options?: {
|
|
597
763
|
category?: string;
|
|
598
764
|
limit?: number;
|
|
599
|
-
}): Promise<Product[]
|
|
600
|
-
getMenuCategory(categoryId: string): Promise<Product[]
|
|
601
|
-
getMenuItem(itemId: string): Promise<ProductWithDetails
|
|
765
|
+
}): Promise<Result<Product[], CimplifyError>>;
|
|
766
|
+
getMenuCategory(categoryId: string): Promise<Result<Product[], CimplifyError>>;
|
|
767
|
+
getMenuItem(itemId: string): Promise<Result<ProductWithDetails, CimplifyError>>;
|
|
602
768
|
}
|
|
603
769
|
|
|
604
770
|
type CartStatus = "active" | "converting" | "converted" | "expired" | "abandoned";
|
|
@@ -1075,156 +1241,6 @@ interface CartSummary {
|
|
|
1075
1241
|
currency: string;
|
|
1076
1242
|
}
|
|
1077
1243
|
|
|
1078
|
-
/**
|
|
1079
|
-
* A Result type that makes errors explicit in the type system.
|
|
1080
|
-
* Inspired by Rust's Result and fp-ts Either.
|
|
1081
|
-
*
|
|
1082
|
-
* @example
|
|
1083
|
-
* ```typescript
|
|
1084
|
-
* const result = await client.cart.addItemSafe({ item_id: "prod_123" });
|
|
1085
|
-
*
|
|
1086
|
-
* if (result.ok) {
|
|
1087
|
-
* console.log(result.value); // Cart
|
|
1088
|
-
* } else {
|
|
1089
|
-
* console.log(result.error); // CimplifyError
|
|
1090
|
-
* }
|
|
1091
|
-
* ```
|
|
1092
|
-
*/
|
|
1093
|
-
type Result<T, E = Error> = Ok<T> | Err<E>;
|
|
1094
|
-
interface Ok<T> {
|
|
1095
|
-
readonly ok: true;
|
|
1096
|
-
readonly value: T;
|
|
1097
|
-
}
|
|
1098
|
-
interface Err<E> {
|
|
1099
|
-
readonly ok: false;
|
|
1100
|
-
readonly error: E;
|
|
1101
|
-
}
|
|
1102
|
-
/** Create a successful Result */
|
|
1103
|
-
declare function ok<T>(value: T): Ok<T>;
|
|
1104
|
-
/** Create a failed Result */
|
|
1105
|
-
declare function err<E>(error: E): Err<E>;
|
|
1106
|
-
/** Check if Result is Ok */
|
|
1107
|
-
declare function isOk<T, E>(result: Result<T, E>): result is Ok<T>;
|
|
1108
|
-
/** Check if Result is Err */
|
|
1109
|
-
declare function isErr<T, E>(result: Result<T, E>): result is Err<E>;
|
|
1110
|
-
/**
|
|
1111
|
-
* Transform the success value of a Result.
|
|
1112
|
-
*
|
|
1113
|
-
* @example
|
|
1114
|
-
* ```typescript
|
|
1115
|
-
* const result = ok(5);
|
|
1116
|
-
* const doubled = mapResult(result, (n) => n * 2);
|
|
1117
|
-
* // doubled = { ok: true, value: 10 }
|
|
1118
|
-
* ```
|
|
1119
|
-
*/
|
|
1120
|
-
declare function mapResult<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
1121
|
-
/**
|
|
1122
|
-
* Transform the error value of a Result.
|
|
1123
|
-
*
|
|
1124
|
-
* @example
|
|
1125
|
-
* ```typescript
|
|
1126
|
-
* const result = err(new Error("oops"));
|
|
1127
|
-
* const mapped = mapError(result, (e) => new CustomError(e.message));
|
|
1128
|
-
* ```
|
|
1129
|
-
*/
|
|
1130
|
-
declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
1131
|
-
/**
|
|
1132
|
-
* Chain Results together. If the first Result is Ok, apply the function.
|
|
1133
|
-
* If it's Err, propagate the error.
|
|
1134
|
-
*
|
|
1135
|
-
* @example
|
|
1136
|
-
* ```typescript
|
|
1137
|
-
* const getUser = (id: string): Result<User, Error> => { ... }
|
|
1138
|
-
* const getOrders = (user: User): Result<Order[], Error> => { ... }
|
|
1139
|
-
*
|
|
1140
|
-
* const result = flatMap(getUser("123"), (user) => getOrders(user));
|
|
1141
|
-
* ```
|
|
1142
|
-
*/
|
|
1143
|
-
declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
|
|
1144
|
-
/**
|
|
1145
|
-
* Get the value or a default if the Result is Err.
|
|
1146
|
-
*
|
|
1147
|
-
* @example
|
|
1148
|
-
* ```typescript
|
|
1149
|
-
* const result = err(new Error("failed"));
|
|
1150
|
-
* const value = getOrElse(result, () => defaultCart);
|
|
1151
|
-
* ```
|
|
1152
|
-
*/
|
|
1153
|
-
declare function getOrElse<T, E>(result: Result<T, E>, defaultFn: () => T): T;
|
|
1154
|
-
/**
|
|
1155
|
-
* Get the value or throw the error.
|
|
1156
|
-
* Use sparingly - defeats the purpose of Result!
|
|
1157
|
-
*
|
|
1158
|
-
* @example
|
|
1159
|
-
* ```typescript
|
|
1160
|
-
* const cart = unwrap(result); // throws if Err
|
|
1161
|
-
* ```
|
|
1162
|
-
*/
|
|
1163
|
-
declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
1164
|
-
/**
|
|
1165
|
-
* Get the value or undefined if Err.
|
|
1166
|
-
*
|
|
1167
|
-
* @example
|
|
1168
|
-
* ```typescript
|
|
1169
|
-
* const cart = toNullable(result); // Cart | undefined
|
|
1170
|
-
* ```
|
|
1171
|
-
*/
|
|
1172
|
-
declare function toNullable<T, E>(result: Result<T, E>): T | undefined;
|
|
1173
|
-
/**
|
|
1174
|
-
* Convert a Promise that might throw into a Result.
|
|
1175
|
-
*
|
|
1176
|
-
* @example
|
|
1177
|
-
* ```typescript
|
|
1178
|
-
* const result = await fromPromise(
|
|
1179
|
-
* fetch("/api/data"),
|
|
1180
|
-
* (error) => new NetworkError(error.message)
|
|
1181
|
-
* );
|
|
1182
|
-
* ```
|
|
1183
|
-
*/
|
|
1184
|
-
declare function fromPromise<T, E>(promise: Promise<T>, mapError: (error: unknown) => E): Promise<Result<T, E>>;
|
|
1185
|
-
/**
|
|
1186
|
-
* Convert a function that might throw into one that returns Result.
|
|
1187
|
-
*
|
|
1188
|
-
* @example
|
|
1189
|
-
* ```typescript
|
|
1190
|
-
* const safeParse = tryCatch(
|
|
1191
|
-
* () => JSON.parse(input),
|
|
1192
|
-
* (e) => new ParseError(e.message)
|
|
1193
|
-
* );
|
|
1194
|
-
* ```
|
|
1195
|
-
*/
|
|
1196
|
-
declare function tryCatch<T, E>(fn: () => T, mapError: (error: unknown) => E): Result<T, E>;
|
|
1197
|
-
/**
|
|
1198
|
-
* Combine multiple Results. Returns Ok with array of values if all succeed,
|
|
1199
|
-
* or the first Err encountered.
|
|
1200
|
-
*
|
|
1201
|
-
* @example
|
|
1202
|
-
* ```typescript
|
|
1203
|
-
* const results = await Promise.all([
|
|
1204
|
-
* client.cart.getSafe(),
|
|
1205
|
-
* client.business.getSafe(),
|
|
1206
|
-
* ]);
|
|
1207
|
-
* const combined = combine(results);
|
|
1208
|
-
* // Result<[Cart, Business], CimplifyError>
|
|
1209
|
-
* ```
|
|
1210
|
-
*/
|
|
1211
|
-
declare function combine<T, E>(results: Result<T, E>[]): Result<T[], E>;
|
|
1212
|
-
/**
|
|
1213
|
-
* Like combine, but for an object of Results.
|
|
1214
|
-
*
|
|
1215
|
-
* @example
|
|
1216
|
-
* ```typescript
|
|
1217
|
-
* const data = combineObject({
|
|
1218
|
-
* cart: await client.cart.getSafe(),
|
|
1219
|
-
* business: await client.business.getSafe(),
|
|
1220
|
-
* });
|
|
1221
|
-
* // Result<{ cart: Cart, business: Business }, CimplifyError>
|
|
1222
|
-
* ```
|
|
1223
|
-
*/
|
|
1224
|
-
declare function combineObject<T extends Record<string, Result<unknown, unknown>>>(results: T): Result<{
|
|
1225
|
-
[K in keyof T]: T[K] extends Result<infer V, unknown> ? V : never;
|
|
1226
|
-
}, T[keyof T] extends Result<unknown, infer E> ? E : never>;
|
|
1227
|
-
|
|
1228
1244
|
/**
|
|
1229
1245
|
* Cart operations with explicit error handling via Result type.
|
|
1230
1246
|
*
|
|
@@ -2018,17 +2034,33 @@ interface GetOrdersOptions {
|
|
|
2018
2034
|
limit?: number;
|
|
2019
2035
|
offset?: number;
|
|
2020
2036
|
}
|
|
2037
|
+
/**
|
|
2038
|
+
* Order queries with explicit error handling via Result type.
|
|
2039
|
+
*
|
|
2040
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
2041
|
+
*
|
|
2042
|
+
* @example
|
|
2043
|
+
* ```typescript
|
|
2044
|
+
* const result = await client.orders.list({ status: "pending" });
|
|
2045
|
+
*
|
|
2046
|
+
* if (result.ok) {
|
|
2047
|
+
* console.log("Orders:", result.value);
|
|
2048
|
+
* } else {
|
|
2049
|
+
* console.error("Failed:", result.error.code);
|
|
2050
|
+
* }
|
|
2051
|
+
* ```
|
|
2052
|
+
*/
|
|
2021
2053
|
declare class OrderQueries {
|
|
2022
2054
|
private client;
|
|
2023
2055
|
constructor(client: CimplifyClient);
|
|
2024
|
-
list(options?: GetOrdersOptions): Promise<Order[]
|
|
2025
|
-
get(orderId: string): Promise<Order
|
|
2026
|
-
getRecent(limit?: number): Promise<Order[]
|
|
2027
|
-
getByStatus(status: OrderStatus): Promise<Order[]
|
|
2028
|
-
cancel(orderId: string, reason?: string): Promise<Order
|
|
2056
|
+
list(options?: GetOrdersOptions): Promise<Result<Order[], CimplifyError>>;
|
|
2057
|
+
get(orderId: string): Promise<Result<Order, CimplifyError>>;
|
|
2058
|
+
getRecent(limit?: number): Promise<Result<Order[], CimplifyError>>;
|
|
2059
|
+
getByStatus(status: OrderStatus): Promise<Result<Order[], CimplifyError>>;
|
|
2060
|
+
cancel(orderId: string, reason?: string): Promise<Result<Order, CimplifyError>>;
|
|
2029
2061
|
}
|
|
2030
2062
|
|
|
2031
|
-
interface SuccessResult {
|
|
2063
|
+
interface SuccessResult$2 {
|
|
2032
2064
|
success: boolean;
|
|
2033
2065
|
message?: string;
|
|
2034
2066
|
}
|
|
@@ -2040,9 +2072,9 @@ interface SuccessResult {
|
|
|
2040
2072
|
declare class LinkService {
|
|
2041
2073
|
private client;
|
|
2042
2074
|
constructor(client: CimplifyClient);
|
|
2043
|
-
requestOtp(input: RequestOtpInput): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2075
|
+
requestOtp(input: RequestOtpInput): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2044
2076
|
verifyOtp(input: VerifyOtpInput): Promise<Result<AuthResponse, CimplifyError>>;
|
|
2045
|
-
logout(): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2077
|
+
logout(): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2046
2078
|
checkStatus(contact: string): Promise<Result<LinkStatusResult, CimplifyError>>;
|
|
2047
2079
|
getLinkData(): Promise<Result<LinkData, CimplifyError>>;
|
|
2048
2080
|
getAddresses(): Promise<Result<CustomerAddress[], CimplifyError>>;
|
|
@@ -2050,28 +2082,28 @@ declare class LinkService {
|
|
|
2050
2082
|
getPreferences(): Promise<Result<CustomerLinkPreferences, CimplifyError>>;
|
|
2051
2083
|
enroll(data: EnrollmentData): Promise<Result<LinkEnrollResult, CimplifyError>>;
|
|
2052
2084
|
enrollAndLinkOrder(data: EnrollAndLinkOrderInput): Promise<Result<EnrollAndLinkOrderResult, CimplifyError>>;
|
|
2053
|
-
updatePreferences(preferences: Partial<CustomerLinkPreferences>): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2085
|
+
updatePreferences(preferences: Partial<CustomerLinkPreferences>): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2054
2086
|
createAddress(input: CreateAddressInput): Promise<Result<CustomerAddress, CimplifyError>>;
|
|
2055
|
-
updateAddress(input: UpdateAddressInput): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2056
|
-
deleteAddress(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2057
|
-
setDefaultAddress(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2058
|
-
trackAddressUsage(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2087
|
+
updateAddress(input: UpdateAddressInput): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2088
|
+
deleteAddress(addressId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2089
|
+
setDefaultAddress(addressId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2090
|
+
trackAddressUsage(addressId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2059
2091
|
createMobileMoney(input: CreateMobileMoneyInput): Promise<Result<CustomerMobileMoney, CimplifyError>>;
|
|
2060
|
-
deleteMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2061
|
-
setDefaultMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2062
|
-
trackMobileMoneyUsage(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2063
|
-
verifyMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2092
|
+
deleteMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2093
|
+
setDefaultMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2094
|
+
trackMobileMoneyUsage(mobileMoneyId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2095
|
+
verifyMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2064
2096
|
getSessions(): Promise<Result<LinkSession[], CimplifyError>>;
|
|
2065
2097
|
revokeSession(sessionId: string): Promise<Result<RevokeSessionResult, CimplifyError>>;
|
|
2066
2098
|
revokeAllSessions(): Promise<Result<RevokeAllSessionsResult, CimplifyError>>;
|
|
2067
2099
|
getAddressesRest(): Promise<Result<CustomerAddress[], CimplifyError>>;
|
|
2068
2100
|
createAddressRest(input: CreateAddressInput): Promise<Result<CustomerAddress, CimplifyError>>;
|
|
2069
|
-
deleteAddressRest(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2070
|
-
setDefaultAddressRest(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2101
|
+
deleteAddressRest(addressId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2102
|
+
setDefaultAddressRest(addressId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2071
2103
|
getMobileMoneyRest(): Promise<Result<CustomerMobileMoney[], CimplifyError>>;
|
|
2072
2104
|
createMobileMoneyRest(input: CreateMobileMoneyInput): Promise<Result<CustomerMobileMoney, CimplifyError>>;
|
|
2073
|
-
deleteMobileMoneyRest(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2074
|
-
setDefaultMobileMoneyRest(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2105
|
+
deleteMobileMoneyRest(mobileMoneyId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2106
|
+
setDefaultMobileMoneyRest(mobileMoneyId: string): Promise<Result<SuccessResult$2, CimplifyError>>;
|
|
2075
2107
|
}
|
|
2076
2108
|
|
|
2077
2109
|
interface AuthStatus {
|
|
@@ -2092,24 +2124,39 @@ interface ChangePasswordInput {
|
|
|
2092
2124
|
current_password: string;
|
|
2093
2125
|
new_password: string;
|
|
2094
2126
|
}
|
|
2127
|
+
interface SuccessResult$1 {
|
|
2128
|
+
success: boolean;
|
|
2129
|
+
}
|
|
2130
|
+
/**
|
|
2131
|
+
* Auth service with explicit error handling via Result type.
|
|
2132
|
+
*
|
|
2133
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
2134
|
+
*
|
|
2135
|
+
* @example
|
|
2136
|
+
* ```typescript
|
|
2137
|
+
* const result = await client.auth.verifyOtp("123456");
|
|
2138
|
+
*
|
|
2139
|
+
* if (result.ok) {
|
|
2140
|
+
* console.log("Logged in as:", result.value.customer.name);
|
|
2141
|
+
* } else {
|
|
2142
|
+
* if (result.error.code === "INVALID_OTP") {
|
|
2143
|
+
* toast.error("Invalid code. Please try again.");
|
|
2144
|
+
* }
|
|
2145
|
+
* }
|
|
2146
|
+
* ```
|
|
2147
|
+
*/
|
|
2095
2148
|
declare class AuthService {
|
|
2096
2149
|
private client;
|
|
2097
2150
|
constructor(client: CimplifyClient);
|
|
2098
|
-
getStatus(): Promise<AuthStatus
|
|
2099
|
-
getCurrentUser(): Promise<Customer | null
|
|
2100
|
-
isAuthenticated(): Promise<boolean
|
|
2101
|
-
requestOtp(contact: string, contactType?: "phone" | "email"): Promise<void
|
|
2102
|
-
verifyOtp(code: string, contact?: string): Promise<OtpResult
|
|
2103
|
-
logout(): Promise<
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
changePassword(input: ChangePasswordInput): Promise<{
|
|
2108
|
-
success: boolean;
|
|
2109
|
-
}>;
|
|
2110
|
-
resetPassword(email: string): Promise<{
|
|
2111
|
-
success: boolean;
|
|
2112
|
-
}>;
|
|
2151
|
+
getStatus(): Promise<Result<AuthStatus, CimplifyError>>;
|
|
2152
|
+
getCurrentUser(): Promise<Result<Customer | null, CimplifyError>>;
|
|
2153
|
+
isAuthenticated(): Promise<Result<boolean, CimplifyError>>;
|
|
2154
|
+
requestOtp(contact: string, contactType?: "phone" | "email"): Promise<Result<void, CimplifyError>>;
|
|
2155
|
+
verifyOtp(code: string, contact?: string): Promise<Result<OtpResult, CimplifyError>>;
|
|
2156
|
+
logout(): Promise<Result<SuccessResult$1, CimplifyError>>;
|
|
2157
|
+
updateProfile(input: UpdateProfileInput): Promise<Result<Customer, CimplifyError>>;
|
|
2158
|
+
changePassword(input: ChangePasswordInput): Promise<Result<SuccessResult$1, CimplifyError>>;
|
|
2159
|
+
resetPassword(email: string): Promise<Result<SuccessResult$1, CimplifyError>>;
|
|
2113
2160
|
}
|
|
2114
2161
|
|
|
2115
2162
|
type BusinessType = "eatery" | "retail" | "service" | "other" | "system" | "unset";
|
|
@@ -2270,19 +2317,35 @@ interface CategoryInfo {
|
|
|
2270
2317
|
slug: string;
|
|
2271
2318
|
}
|
|
2272
2319
|
|
|
2320
|
+
/**
|
|
2321
|
+
* Business service with explicit error handling via Result type.
|
|
2322
|
+
*
|
|
2323
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
2324
|
+
*
|
|
2325
|
+
* @example
|
|
2326
|
+
* ```typescript
|
|
2327
|
+
* const result = await client.business.getInfo();
|
|
2328
|
+
*
|
|
2329
|
+
* if (result.ok) {
|
|
2330
|
+
* console.log("Business:", result.value.name);
|
|
2331
|
+
* } else {
|
|
2332
|
+
* console.error("Failed:", result.error.code);
|
|
2333
|
+
* }
|
|
2334
|
+
* ```
|
|
2335
|
+
*/
|
|
2273
2336
|
declare class BusinessService {
|
|
2274
2337
|
private client;
|
|
2275
2338
|
constructor(client: CimplifyClient);
|
|
2276
|
-
getInfo(): Promise<Business
|
|
2277
|
-
getByHandle(handle: string): Promise<Business
|
|
2278
|
-
getByDomain(domain: string): Promise<Business
|
|
2279
|
-
getSettings(): Promise<BusinessSettings
|
|
2280
|
-
getTheme(): Promise<Record<string, unknown>>;
|
|
2281
|
-
getLocations(): Promise<Location[]
|
|
2282
|
-
getLocation(locationId: string): Promise<Location
|
|
2283
|
-
getHours(): Promise<BusinessHours[]
|
|
2284
|
-
getLocationHours(locationId: string): Promise<BusinessHours[]
|
|
2285
|
-
getBootstrap(): Promise<StorefrontBootstrap
|
|
2339
|
+
getInfo(): Promise<Result<Business, CimplifyError>>;
|
|
2340
|
+
getByHandle(handle: string): Promise<Result<Business, CimplifyError>>;
|
|
2341
|
+
getByDomain(domain: string): Promise<Result<Business, CimplifyError>>;
|
|
2342
|
+
getSettings(): Promise<Result<BusinessSettings, CimplifyError>>;
|
|
2343
|
+
getTheme(): Promise<Result<Record<string, unknown>, CimplifyError>>;
|
|
2344
|
+
getLocations(): Promise<Result<Location[], CimplifyError>>;
|
|
2345
|
+
getLocation(locationId: string): Promise<Result<Location, CimplifyError>>;
|
|
2346
|
+
getHours(): Promise<Result<BusinessHours[], CimplifyError>>;
|
|
2347
|
+
getLocationHours(locationId: string): Promise<Result<BusinessHours[], CimplifyError>>;
|
|
2348
|
+
getBootstrap(): Promise<Result<StorefrontBootstrap, CimplifyError>>;
|
|
2286
2349
|
}
|
|
2287
2350
|
|
|
2288
2351
|
type StockOwnershipType = "owned" | "consignment" | "dropship";
|
|
@@ -2373,22 +2436,38 @@ interface InventorySummary {
|
|
|
2373
2436
|
total_value?: Money;
|
|
2374
2437
|
}
|
|
2375
2438
|
|
|
2439
|
+
/**
|
|
2440
|
+
* Inventory service with explicit error handling via Result type.
|
|
2441
|
+
*
|
|
2442
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
2443
|
+
*
|
|
2444
|
+
* @example
|
|
2445
|
+
* ```typescript
|
|
2446
|
+
* const result = await client.inventory.isInStock("prod_123");
|
|
2447
|
+
*
|
|
2448
|
+
* if (result.ok) {
|
|
2449
|
+
* console.log("In stock:", result.value);
|
|
2450
|
+
* } else {
|
|
2451
|
+
* console.error("Failed:", result.error.code);
|
|
2452
|
+
* }
|
|
2453
|
+
* ```
|
|
2454
|
+
*/
|
|
2376
2455
|
declare class InventoryService {
|
|
2377
2456
|
private client;
|
|
2378
2457
|
constructor(client: CimplifyClient);
|
|
2379
|
-
getStockLevels(): Promise<StockLevel[]
|
|
2380
|
-
getProductStock(productId: string, locationId?: string): Promise<ProductStock
|
|
2381
|
-
getVariantStock(variantId: string, locationId?: string): Promise<StockLevel
|
|
2382
|
-
checkProductAvailability(productId: string, quantity: number, locationId?: string): Promise<AvailabilityResult
|
|
2383
|
-
checkVariantAvailability(variantId: string, quantity: number, locationId?: string): Promise<AvailabilityResult
|
|
2458
|
+
getStockLevels(): Promise<Result<StockLevel[], CimplifyError>>;
|
|
2459
|
+
getProductStock(productId: string, locationId?: string): Promise<Result<ProductStock, CimplifyError>>;
|
|
2460
|
+
getVariantStock(variantId: string, locationId?: string): Promise<Result<StockLevel, CimplifyError>>;
|
|
2461
|
+
checkProductAvailability(productId: string, quantity: number, locationId?: string): Promise<Result<AvailabilityResult, CimplifyError>>;
|
|
2462
|
+
checkVariantAvailability(variantId: string, quantity: number, locationId?: string): Promise<Result<AvailabilityResult, CimplifyError>>;
|
|
2384
2463
|
checkMultipleAvailability(items: {
|
|
2385
2464
|
product_id: string;
|
|
2386
2465
|
variant_id?: string;
|
|
2387
2466
|
quantity: number;
|
|
2388
|
-
}[], locationId?: string): Promise<AvailabilityResult[]
|
|
2389
|
-
getSummary(): Promise<InventorySummary
|
|
2390
|
-
isInStock(productId: string, locationId?: string): Promise<boolean
|
|
2391
|
-
getAvailableQuantity(productId: string, locationId?: string): Promise<number
|
|
2467
|
+
}[], locationId?: string): Promise<Result<AvailabilityResult[], CimplifyError>>;
|
|
2468
|
+
getSummary(): Promise<Result<InventorySummary, CimplifyError>>;
|
|
2469
|
+
isInStock(productId: string, locationId?: string): Promise<Result<boolean, CimplifyError>>;
|
|
2470
|
+
getAvailableQuantity(productId: string, locationId?: string): Promise<Result<number, CimplifyError>>;
|
|
2392
2471
|
}
|
|
2393
2472
|
|
|
2394
2473
|
interface ServiceAvailabilityRule {
|
|
@@ -2631,29 +2710,48 @@ interface ServiceAvailabilityResult {
|
|
|
2631
2710
|
days: DayAvailability[];
|
|
2632
2711
|
}
|
|
2633
2712
|
|
|
2713
|
+
/**
|
|
2714
|
+
* Scheduling service with explicit error handling via Result type.
|
|
2715
|
+
*
|
|
2716
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
2717
|
+
*
|
|
2718
|
+
* @example
|
|
2719
|
+
* ```typescript
|
|
2720
|
+
* const result = await client.scheduling.getAvailableSlots({
|
|
2721
|
+
* service_id: "svc_haircut",
|
|
2722
|
+
* date: "2024-01-15"
|
|
2723
|
+
* });
|
|
2724
|
+
*
|
|
2725
|
+
* if (result.ok) {
|
|
2726
|
+
* console.log("Available slots:", result.value);
|
|
2727
|
+
* } else {
|
|
2728
|
+
* console.error("Failed:", result.error.code);
|
|
2729
|
+
* }
|
|
2730
|
+
* ```
|
|
2731
|
+
*/
|
|
2634
2732
|
declare class SchedulingService {
|
|
2635
2733
|
private client;
|
|
2636
2734
|
constructor(client: CimplifyClient);
|
|
2637
|
-
getServices(): Promise<Service[]
|
|
2735
|
+
getServices(): Promise<Result<Service[], CimplifyError>>;
|
|
2638
2736
|
/**
|
|
2639
2737
|
* Get a specific service by ID
|
|
2640
2738
|
* Note: Filters from all services client-side (no single-service endpoint)
|
|
2641
2739
|
*/
|
|
2642
|
-
getService(serviceId: string): Promise<Service | null
|
|
2643
|
-
getAvailableSlots(input: GetAvailableSlotsInput): Promise<AvailableSlot[]
|
|
2644
|
-
checkSlotAvailability(input: CheckSlotAvailabilityInput): Promise<{
|
|
2740
|
+
getService(serviceId: string): Promise<Result<Service | null, CimplifyError>>;
|
|
2741
|
+
getAvailableSlots(input: GetAvailableSlotsInput): Promise<Result<AvailableSlot[], CimplifyError>>;
|
|
2742
|
+
checkSlotAvailability(input: CheckSlotAvailabilityInput): Promise<Result<{
|
|
2645
2743
|
available: boolean;
|
|
2646
2744
|
reason?: string;
|
|
2647
|
-
}
|
|
2648
|
-
getServiceAvailability(params: ServiceAvailabilityParams): Promise<ServiceAvailabilityResult
|
|
2649
|
-
getBooking(bookingId: string): Promise<BookingWithDetails
|
|
2650
|
-
getCustomerBookings(): Promise<Booking[]
|
|
2651
|
-
getUpcomingBookings(): Promise<Booking[]
|
|
2652
|
-
getPastBookings(limit?: number): Promise<Booking[]
|
|
2653
|
-
cancelBooking(input: CancelBookingInput): Promise<Booking
|
|
2654
|
-
rescheduleBooking(input: RescheduleBookingInput): Promise<Booking
|
|
2655
|
-
getNextAvailableSlot(serviceId: string, fromDate?: string): Promise<AvailableSlot | null
|
|
2656
|
-
hasAvailabilityOn(serviceId: string, date: string): Promise<boolean
|
|
2745
|
+
}, CimplifyError>>;
|
|
2746
|
+
getServiceAvailability(params: ServiceAvailabilityParams): Promise<Result<ServiceAvailabilityResult, CimplifyError>>;
|
|
2747
|
+
getBooking(bookingId: string): Promise<Result<BookingWithDetails, CimplifyError>>;
|
|
2748
|
+
getCustomerBookings(): Promise<Result<Booking[], CimplifyError>>;
|
|
2749
|
+
getUpcomingBookings(): Promise<Result<Booking[], CimplifyError>>;
|
|
2750
|
+
getPastBookings(limit?: number): Promise<Result<Booking[], CimplifyError>>;
|
|
2751
|
+
cancelBooking(input: CancelBookingInput): Promise<Result<Booking, CimplifyError>>;
|
|
2752
|
+
rescheduleBooking(input: RescheduleBookingInput): Promise<Result<Booking, CimplifyError>>;
|
|
2753
|
+
getNextAvailableSlot(serviceId: string, fromDate?: string): Promise<Result<AvailableSlot | null, CimplifyError>>;
|
|
2754
|
+
hasAvailabilityOn(serviceId: string, date: string): Promise<Result<boolean, CimplifyError>>;
|
|
2657
2755
|
}
|
|
2658
2756
|
|
|
2659
2757
|
interface LiteBootstrap {
|
|
@@ -2686,22 +2784,41 @@ interface KitchenOrderResult {
|
|
|
2686
2784
|
order_number: string;
|
|
2687
2785
|
estimated_time_minutes?: number;
|
|
2688
2786
|
}
|
|
2787
|
+
interface SuccessResult {
|
|
2788
|
+
success: boolean;
|
|
2789
|
+
}
|
|
2790
|
+
interface RequestBillResult {
|
|
2791
|
+
success: boolean;
|
|
2792
|
+
order_id: string;
|
|
2793
|
+
}
|
|
2794
|
+
/**
|
|
2795
|
+
* Lite service for QR code ordering with explicit error handling via Result type.
|
|
2796
|
+
*
|
|
2797
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
2798
|
+
*
|
|
2799
|
+
* @example
|
|
2800
|
+
* ```typescript
|
|
2801
|
+
* const result = await client.lite.getBootstrap();
|
|
2802
|
+
*
|
|
2803
|
+
* if (result.ok) {
|
|
2804
|
+
* console.log("Business:", result.value.business.name);
|
|
2805
|
+
* console.log("Table:", result.value.table?.number);
|
|
2806
|
+
* } else {
|
|
2807
|
+
* console.error("Failed:", result.error.code);
|
|
2808
|
+
* }
|
|
2809
|
+
* ```
|
|
2810
|
+
*/
|
|
2689
2811
|
declare class LiteService {
|
|
2690
2812
|
private client;
|
|
2691
2813
|
constructor(client: CimplifyClient);
|
|
2692
|
-
getBootstrap(): Promise<LiteBootstrap
|
|
2693
|
-
getTable(tableId: string): Promise<TableInfo
|
|
2694
|
-
getTableByNumber(tableNumber: string, locationId?: string): Promise<TableInfo
|
|
2695
|
-
sendToKitchen(tableId: string, items: KitchenOrderItem[]): Promise<KitchenOrderResult
|
|
2696
|
-
callWaiter(tableId: string, reason?: string): Promise<
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
success: boolean;
|
|
2701
|
-
order_id: string;
|
|
2702
|
-
}>;
|
|
2703
|
-
getMenu(): Promise<Product[]>;
|
|
2704
|
-
getMenuByCategory(categoryId: string): Promise<Product[]>;
|
|
2814
|
+
getBootstrap(): Promise<Result<LiteBootstrap, CimplifyError>>;
|
|
2815
|
+
getTable(tableId: string): Promise<Result<TableInfo, CimplifyError>>;
|
|
2816
|
+
getTableByNumber(tableNumber: string, locationId?: string): Promise<Result<TableInfo, CimplifyError>>;
|
|
2817
|
+
sendToKitchen(tableId: string, items: KitchenOrderItem[]): Promise<Result<KitchenOrderResult, CimplifyError>>;
|
|
2818
|
+
callWaiter(tableId: string, reason?: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2819
|
+
requestBill(tableId: string): Promise<Result<RequestBillResult, CimplifyError>>;
|
|
2820
|
+
getMenu(): Promise<Result<Product[], CimplifyError>>;
|
|
2821
|
+
getMenuByCategory(categoryId: string): Promise<Result<Product[], CimplifyError>>;
|
|
2705
2822
|
}
|
|
2706
2823
|
|
|
2707
2824
|
interface CimplifyConfig {
|