@apideck/unify 0.25.1 → 0.26.0

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.
Files changed (84) hide show
  1. package/README.md +7 -0
  2. package/docs/sdks/categories/README.md +181 -0
  3. package/funcs/accountingCategoriesGet.d.ts +18 -0
  4. package/funcs/accountingCategoriesGet.d.ts.map +1 -0
  5. package/funcs/accountingCategoriesGet.js +133 -0
  6. package/funcs/accountingCategoriesGet.js.map +1 -0
  7. package/funcs/accountingCategoriesList.d.ts +21 -0
  8. package/funcs/accountingCategoriesList.d.ts.map +1 -0
  9. package/funcs/accountingCategoriesList.js +151 -0
  10. package/funcs/accountingCategoriesList.js.map +1 -0
  11. package/jsr.json +1 -1
  12. package/lib/config.d.ts +4 -4
  13. package/lib/config.js +4 -4
  14. package/models/components/bill.d.ts +2 -2
  15. package/models/components/category.d.ts +114 -0
  16. package/models/components/category.d.ts.map +1 -0
  17. package/models/components/category.js +121 -0
  18. package/models/components/category.js.map +1 -0
  19. package/models/components/expense.d.ts +10 -0
  20. package/models/components/expense.d.ts.map +1 -1
  21. package/models/components/expense.js +4 -0
  22. package/models/components/expense.js.map +1 -1
  23. package/models/components/formfieldoption.d.ts +6 -6
  24. package/models/components/formfieldoption.d.ts.map +1 -1
  25. package/models/components/formfieldoption.js +4 -4
  26. package/models/components/formfieldoption.js.map +1 -1
  27. package/models/components/getcategoriesresponse.d.ts +79 -0
  28. package/models/components/getcategoriesresponse.d.ts.map +1 -0
  29. package/models/components/getcategoriesresponse.js +89 -0
  30. package/models/components/getcategoriesresponse.js.map +1 -0
  31. package/models/components/getcategoryresponse.d.ts +67 -0
  32. package/models/components/getcategoryresponse.d.ts.map +1 -0
  33. package/models/components/getcategoryresponse.js +83 -0
  34. package/models/components/getcategoryresponse.js.map +1 -0
  35. package/models/components/index.d.ts +3 -0
  36. package/models/components/index.d.ts.map +1 -1
  37. package/models/components/index.js +3 -0
  38. package/models/components/index.js.map +1 -1
  39. package/models/components/invoice.d.ts +2 -2
  40. package/models/components/supplier.d.ts +10 -0
  41. package/models/components/supplier.d.ts.map +1 -1
  42. package/models/components/supplier.js +8 -0
  43. package/models/components/supplier.js.map +1 -1
  44. package/models/operations/accountingcategoriesall.d.ts +131 -0
  45. package/models/operations/accountingcategoriesall.d.ts.map +1 -0
  46. package/models/operations/accountingcategoriesall.js +149 -0
  47. package/models/operations/accountingcategoriesall.js.map +1 -0
  48. package/models/operations/accountingcategoriesone.d.ts +126 -0
  49. package/models/operations/accountingcategoriesone.d.ts.map +1 -0
  50. package/models/operations/accountingcategoriesone.js +145 -0
  51. package/models/operations/accountingcategoriesone.js.map +1 -0
  52. package/models/operations/index.d.ts +2 -0
  53. package/models/operations/index.d.ts.map +1 -1
  54. package/models/operations/index.js +2 -0
  55. package/models/operations/index.js.map +1 -1
  56. package/package.json +1 -1
  57. package/sdk/accounting.d.ts +3 -0
  58. package/sdk/accounting.d.ts.map +1 -1
  59. package/sdk/accounting.js +4 -0
  60. package/sdk/accounting.js.map +1 -1
  61. package/sdk/categories.d.ts +22 -0
  62. package/sdk/categories.d.ts.map +1 -0
  63. package/sdk/categories.js +33 -0
  64. package/sdk/categories.js.map +1 -0
  65. package/src/__tests__/categories.test.ts +127 -0
  66. package/src/funcs/accountingCategoriesGet.ts +230 -0
  67. package/src/funcs/accountingCategoriesList.ts +288 -0
  68. package/src/lib/config.ts +4 -4
  69. package/src/models/components/bill.ts +2 -2
  70. package/src/models/components/category.ts +193 -0
  71. package/src/models/components/expense.ts +14 -0
  72. package/src/models/components/formfieldoption.ts +12 -12
  73. package/src/models/components/getcategoriesresponse.ts +154 -0
  74. package/src/models/components/getcategoryresponse.ts +128 -0
  75. package/src/models/components/index.ts +3 -0
  76. package/src/models/components/invoice.ts +2 -2
  77. package/src/models/components/supplier.ts +18 -0
  78. package/src/models/operations/accountingcategoriesall.ts +277 -0
  79. package/src/models/operations/accountingcategoriesone.ts +268 -0
  80. package/src/models/operations/index.ts +2 -0
  81. package/src/sdk/accounting.ts +6 -0
  82. package/src/sdk/categories.ts +48 -0
  83. package/src/types/constdatetime.ts +1 -1
  84. package/types/constdatetime.js +1 -1
@@ -0,0 +1,268 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as components from "../components/index.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export type AccountingCategoriesOneGlobals = {
13
+ /**
14
+ * ID of the consumer which you want to get or push data from
15
+ */
16
+ consumerId?: string | undefined;
17
+ /**
18
+ * The ID of your Unify application
19
+ */
20
+ appId?: string | undefined;
21
+ };
22
+
23
+ export type AccountingCategoriesOneRequest = {
24
+ /**
25
+ * ID of the record you are acting upon.
26
+ */
27
+ id: string;
28
+ /**
29
+ * ID of the consumer which you want to get or push data from
30
+ */
31
+ consumerId?: string | undefined;
32
+ /**
33
+ * The ID of your Unify application
34
+ */
35
+ appId?: string | undefined;
36
+ /**
37
+ * Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API.
38
+ */
39
+ serviceId?: string | undefined;
40
+ /**
41
+ * Include raw response. Mostly used for debugging purposes
42
+ */
43
+ raw?: boolean | undefined;
44
+ /**
45
+ * The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation. <br /><br />Example: `fields=name,email,addresses.city`<br /><br />In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
46
+ */
47
+ fields?: string | null | undefined;
48
+ };
49
+
50
+ export type AccountingCategoriesOneResponse = {
51
+ httpMeta: components.HTTPMetadata;
52
+ /**
53
+ * Category
54
+ */
55
+ getCategoryResponse?: components.GetCategoryResponse | undefined;
56
+ /**
57
+ * Unexpected error
58
+ */
59
+ unexpectedErrorResponse?: components.UnexpectedErrorResponse | undefined;
60
+ };
61
+
62
+ /** @internal */
63
+ export const AccountingCategoriesOneGlobals$inboundSchema: z.ZodType<
64
+ AccountingCategoriesOneGlobals,
65
+ z.ZodTypeDef,
66
+ unknown
67
+ > = z.object({
68
+ consumerId: z.string().optional(),
69
+ appId: z.string().optional(),
70
+ });
71
+
72
+ /** @internal */
73
+ export type AccountingCategoriesOneGlobals$Outbound = {
74
+ consumerId?: string | undefined;
75
+ appId?: string | undefined;
76
+ };
77
+
78
+ /** @internal */
79
+ export const AccountingCategoriesOneGlobals$outboundSchema: z.ZodType<
80
+ AccountingCategoriesOneGlobals$Outbound,
81
+ z.ZodTypeDef,
82
+ AccountingCategoriesOneGlobals
83
+ > = z.object({
84
+ consumerId: z.string().optional(),
85
+ appId: z.string().optional(),
86
+ });
87
+
88
+ /**
89
+ * @internal
90
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
91
+ */
92
+ export namespace AccountingCategoriesOneGlobals$ {
93
+ /** @deprecated use `AccountingCategoriesOneGlobals$inboundSchema` instead. */
94
+ export const inboundSchema = AccountingCategoriesOneGlobals$inboundSchema;
95
+ /** @deprecated use `AccountingCategoriesOneGlobals$outboundSchema` instead. */
96
+ export const outboundSchema = AccountingCategoriesOneGlobals$outboundSchema;
97
+ /** @deprecated use `AccountingCategoriesOneGlobals$Outbound` instead. */
98
+ export type Outbound = AccountingCategoriesOneGlobals$Outbound;
99
+ }
100
+
101
+ export function accountingCategoriesOneGlobalsToJSON(
102
+ accountingCategoriesOneGlobals: AccountingCategoriesOneGlobals,
103
+ ): string {
104
+ return JSON.stringify(
105
+ AccountingCategoriesOneGlobals$outboundSchema.parse(
106
+ accountingCategoriesOneGlobals,
107
+ ),
108
+ );
109
+ }
110
+
111
+ export function accountingCategoriesOneGlobalsFromJSON(
112
+ jsonString: string,
113
+ ): SafeParseResult<AccountingCategoriesOneGlobals, SDKValidationError> {
114
+ return safeParse(
115
+ jsonString,
116
+ (x) => AccountingCategoriesOneGlobals$inboundSchema.parse(JSON.parse(x)),
117
+ `Failed to parse 'AccountingCategoriesOneGlobals' from JSON`,
118
+ );
119
+ }
120
+
121
+ /** @internal */
122
+ export const AccountingCategoriesOneRequest$inboundSchema: z.ZodType<
123
+ AccountingCategoriesOneRequest,
124
+ z.ZodTypeDef,
125
+ unknown
126
+ > = z.object({
127
+ id: z.string(),
128
+ consumerId: z.string().optional(),
129
+ appId: z.string().optional(),
130
+ serviceId: z.string().optional(),
131
+ raw: z.boolean().default(false),
132
+ fields: z.nullable(z.string()).optional(),
133
+ });
134
+
135
+ /** @internal */
136
+ export type AccountingCategoriesOneRequest$Outbound = {
137
+ id: string;
138
+ consumerId?: string | undefined;
139
+ appId?: string | undefined;
140
+ serviceId?: string | undefined;
141
+ raw: boolean;
142
+ fields?: string | null | undefined;
143
+ };
144
+
145
+ /** @internal */
146
+ export const AccountingCategoriesOneRequest$outboundSchema: z.ZodType<
147
+ AccountingCategoriesOneRequest$Outbound,
148
+ z.ZodTypeDef,
149
+ AccountingCategoriesOneRequest
150
+ > = z.object({
151
+ id: z.string(),
152
+ consumerId: z.string().optional(),
153
+ appId: z.string().optional(),
154
+ serviceId: z.string().optional(),
155
+ raw: z.boolean().default(false),
156
+ fields: z.nullable(z.string()).optional(),
157
+ });
158
+
159
+ /**
160
+ * @internal
161
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
162
+ */
163
+ export namespace AccountingCategoriesOneRequest$ {
164
+ /** @deprecated use `AccountingCategoriesOneRequest$inboundSchema` instead. */
165
+ export const inboundSchema = AccountingCategoriesOneRequest$inboundSchema;
166
+ /** @deprecated use `AccountingCategoriesOneRequest$outboundSchema` instead. */
167
+ export const outboundSchema = AccountingCategoriesOneRequest$outboundSchema;
168
+ /** @deprecated use `AccountingCategoriesOneRequest$Outbound` instead. */
169
+ export type Outbound = AccountingCategoriesOneRequest$Outbound;
170
+ }
171
+
172
+ export function accountingCategoriesOneRequestToJSON(
173
+ accountingCategoriesOneRequest: AccountingCategoriesOneRequest,
174
+ ): string {
175
+ return JSON.stringify(
176
+ AccountingCategoriesOneRequest$outboundSchema.parse(
177
+ accountingCategoriesOneRequest,
178
+ ),
179
+ );
180
+ }
181
+
182
+ export function accountingCategoriesOneRequestFromJSON(
183
+ jsonString: string,
184
+ ): SafeParseResult<AccountingCategoriesOneRequest, SDKValidationError> {
185
+ return safeParse(
186
+ jsonString,
187
+ (x) => AccountingCategoriesOneRequest$inboundSchema.parse(JSON.parse(x)),
188
+ `Failed to parse 'AccountingCategoriesOneRequest' from JSON`,
189
+ );
190
+ }
191
+
192
+ /** @internal */
193
+ export const AccountingCategoriesOneResponse$inboundSchema: z.ZodType<
194
+ AccountingCategoriesOneResponse,
195
+ z.ZodTypeDef,
196
+ unknown
197
+ > = z.object({
198
+ HttpMeta: components.HTTPMetadata$inboundSchema,
199
+ GetCategoryResponse: components.GetCategoryResponse$inboundSchema.optional(),
200
+ UnexpectedErrorResponse: components.UnexpectedErrorResponse$inboundSchema
201
+ .optional(),
202
+ }).transform((v) => {
203
+ return remap$(v, {
204
+ "HttpMeta": "httpMeta",
205
+ "GetCategoryResponse": "getCategoryResponse",
206
+ "UnexpectedErrorResponse": "unexpectedErrorResponse",
207
+ });
208
+ });
209
+
210
+ /** @internal */
211
+ export type AccountingCategoriesOneResponse$Outbound = {
212
+ HttpMeta: components.HTTPMetadata$Outbound;
213
+ GetCategoryResponse?: components.GetCategoryResponse$Outbound | undefined;
214
+ UnexpectedErrorResponse?:
215
+ | components.UnexpectedErrorResponse$Outbound
216
+ | undefined;
217
+ };
218
+
219
+ /** @internal */
220
+ export const AccountingCategoriesOneResponse$outboundSchema: z.ZodType<
221
+ AccountingCategoriesOneResponse$Outbound,
222
+ z.ZodTypeDef,
223
+ AccountingCategoriesOneResponse
224
+ > = z.object({
225
+ httpMeta: components.HTTPMetadata$outboundSchema,
226
+ getCategoryResponse: components.GetCategoryResponse$outboundSchema.optional(),
227
+ unexpectedErrorResponse: components.UnexpectedErrorResponse$outboundSchema
228
+ .optional(),
229
+ }).transform((v) => {
230
+ return remap$(v, {
231
+ httpMeta: "HttpMeta",
232
+ getCategoryResponse: "GetCategoryResponse",
233
+ unexpectedErrorResponse: "UnexpectedErrorResponse",
234
+ });
235
+ });
236
+
237
+ /**
238
+ * @internal
239
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
240
+ */
241
+ export namespace AccountingCategoriesOneResponse$ {
242
+ /** @deprecated use `AccountingCategoriesOneResponse$inboundSchema` instead. */
243
+ export const inboundSchema = AccountingCategoriesOneResponse$inboundSchema;
244
+ /** @deprecated use `AccountingCategoriesOneResponse$outboundSchema` instead. */
245
+ export const outboundSchema = AccountingCategoriesOneResponse$outboundSchema;
246
+ /** @deprecated use `AccountingCategoriesOneResponse$Outbound` instead. */
247
+ export type Outbound = AccountingCategoriesOneResponse$Outbound;
248
+ }
249
+
250
+ export function accountingCategoriesOneResponseToJSON(
251
+ accountingCategoriesOneResponse: AccountingCategoriesOneResponse,
252
+ ): string {
253
+ return JSON.stringify(
254
+ AccountingCategoriesOneResponse$outboundSchema.parse(
255
+ accountingCategoriesOneResponse,
256
+ ),
257
+ );
258
+ }
259
+
260
+ export function accountingCategoriesOneResponseFromJSON(
261
+ jsonString: string,
262
+ ): SafeParseResult<AccountingCategoriesOneResponse, SDKValidationError> {
263
+ return safeParse(
264
+ jsonString,
265
+ (x) => AccountingCategoriesOneResponse$inboundSchema.parse(JSON.parse(x)),
266
+ `Failed to parse 'AccountingCategoriesOneResponse' from JSON`,
267
+ );
268
+ }
@@ -30,6 +30,8 @@ export * from "./accountingbillsall.js";
30
30
  export * from "./accountingbillsdelete.js";
31
31
  export * from "./accountingbillsone.js";
32
32
  export * from "./accountingbillsupdate.js";
33
+ export * from "./accountingcategoriesall.js";
34
+ export * from "./accountingcategoriesone.js";
33
35
  export * from "./accountingcompanyinfoone.js";
34
36
  export * from "./accountingcreditnotesadd.js";
35
37
  export * from "./accountingcreditnotesall.js";
@@ -11,6 +11,7 @@ import { BankFeedAccounts } from "./bankfeedaccounts.js";
11
11
  import { BankFeedStatements } from "./bankfeedstatements.js";
12
12
  import { BillPayments } from "./billpayments.js";
13
13
  import { Bills } from "./bills.js";
14
+ import { Categories } from "./categories.js";
14
15
  import { CompanyInfo } from "./companyinfo.js";
15
16
  import { CreditNotes } from "./creditnotes.js";
16
17
  import { Customers } from "./customers.js";
@@ -154,4 +155,9 @@ export class Accounting extends ClientSDK {
154
155
  get bankFeedStatements(): BankFeedStatements {
155
156
  return (this._bankFeedStatements ??= new BankFeedStatements(this._options));
156
157
  }
158
+
159
+ private _categories?: Categories;
160
+ get categories(): Categories {
161
+ return (this._categories ??= new Categories(this._options));
162
+ }
157
163
  }
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { accountingCategoriesGet } from "../funcs/accountingCategoriesGet.js";
6
+ import { accountingCategoriesList } from "../funcs/accountingCategoriesList.js";
7
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { unwrapAsync } from "../types/fp.js";
10
+ import { PageIterator, unwrapResultIterator } from "../types/operations.js";
11
+
12
+ export class Categories extends ClientSDK {
13
+ /**
14
+ * List Categories
15
+ *
16
+ * @remarks
17
+ * List Categories
18
+ */
19
+ async list(
20
+ request: operations.AccountingCategoriesAllRequest,
21
+ options?: RequestOptions,
22
+ ): Promise<
23
+ PageIterator<operations.AccountingCategoriesAllResponse, { cursor: string }>
24
+ > {
25
+ return unwrapResultIterator(accountingCategoriesList(
26
+ this,
27
+ request,
28
+ options,
29
+ ));
30
+ }
31
+
32
+ /**
33
+ * Get Category
34
+ *
35
+ * @remarks
36
+ * Get Category
37
+ */
38
+ async get(
39
+ request: operations.AccountingCategoriesOneRequest,
40
+ options?: RequestOptions,
41
+ ): Promise<operations.AccountingCategoriesOneResponse> {
42
+ return unwrapAsync(accountingCategoriesGet(
43
+ this,
44
+ request,
45
+ options,
46
+ ));
47
+ }
48
+ }
@@ -11,5 +11,5 @@ export function constDateTime(
11
11
  return (
12
12
  typeof v === "string" && new Date(v).getTime() === new Date(val).getTime()
13
13
  );
14
- }, `Value must be equivelant to ${val}`);
14
+ }, `Value must be equivalent to ${val}`);
15
15
  }
@@ -31,6 +31,6 @@ const z = __importStar(require("zod"));
31
31
  function constDateTime(val) {
32
32
  return z.custom((v) => {
33
33
  return (typeof v === "string" && new Date(v).getTime() === new Date(val).getTime());
34
- }, `Value must be equivelant to ${val}`);
34
+ }, `Value must be equivalent to ${val}`);
35
35
  }
36
36
  //# sourceMappingURL=constdatetime.js.map