@genz-its/sevdesk-sdk 0.1.0 → 0.1.2
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.ts +152 -6
- package/dist/index.js +183 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,133 @@ declare class CheckAccountsResource extends BaseResource {
|
|
|
146
146
|
}): Promise<string>;
|
|
147
147
|
}
|
|
148
148
|
//#endregion
|
|
149
|
+
//#region src/resources/communication-ways.d.ts
|
|
150
|
+
/** The medium of a communication way. */
|
|
151
|
+
type CommunicationWayType = 'EMAIL' | 'PHONE' | 'WEB' | 'MOBILE';
|
|
152
|
+
interface ListCommunicationWaysOptions extends ListOptions {
|
|
153
|
+
/** Only returns the communication ways of this contact. */
|
|
154
|
+
contactId?: number;
|
|
155
|
+
type?: CommunicationWayType;
|
|
156
|
+
/** `'1'` returns only the main communication ways. */
|
|
157
|
+
main?: '0' | '1';
|
|
158
|
+
}
|
|
159
|
+
interface CreateCommunicationWayOptions {
|
|
160
|
+
/** The contact this communication way belongs to. */
|
|
161
|
+
contactId: number;
|
|
162
|
+
type: CommunicationWayType;
|
|
163
|
+
/** The phone number, e-mail address or website. */
|
|
164
|
+
value: string;
|
|
165
|
+
/**
|
|
166
|
+
* The key of the communication way, e.g. `1` for private and `2` for work.
|
|
167
|
+
* For all keys, send a `GET` to `/CommunicationWayKey`.
|
|
168
|
+
*/
|
|
169
|
+
keyId: number;
|
|
170
|
+
/** Defines if this is the main communication way of the contact. */
|
|
171
|
+
main?: boolean;
|
|
172
|
+
}
|
|
173
|
+
interface UpdateCommunicationWayOptions extends Partial<CreateCommunicationWayOptions> {
|
|
174
|
+
communicationWayId: number;
|
|
175
|
+
}
|
|
176
|
+
interface CommunicationWay {
|
|
177
|
+
id: string;
|
|
178
|
+
objectName: string;
|
|
179
|
+
create: string;
|
|
180
|
+
update: string;
|
|
181
|
+
sevClient: ModelRefResponse;
|
|
182
|
+
contact: ModelRefResponse;
|
|
183
|
+
type: string;
|
|
184
|
+
value: string;
|
|
185
|
+
key: ModelRefResponse;
|
|
186
|
+
main: string;
|
|
187
|
+
}
|
|
188
|
+
/** The key of a communication way, similar to the category of an address. */
|
|
189
|
+
interface CommunicationWayKey {
|
|
190
|
+
id: string;
|
|
191
|
+
objectName: string;
|
|
192
|
+
create: string;
|
|
193
|
+
update: string;
|
|
194
|
+
name: string;
|
|
195
|
+
translationCode: string;
|
|
196
|
+
}
|
|
197
|
+
declare class CommunicationWaysResource extends BaseResource {
|
|
198
|
+
/** Retrieves communication ways via `GET /CommunicationWay`. */
|
|
199
|
+
list(options?: ListCommunicationWaysOptions): Promise<CommunicationWay[]>;
|
|
200
|
+
/** Retrieves a single communication way via `GET /CommunicationWay/{communicationWayId}`. */
|
|
201
|
+
get(options: {
|
|
202
|
+
communicationWayId: number;
|
|
203
|
+
}): Promise<CommunicationWay>;
|
|
204
|
+
/** Creates a communication way via `POST /CommunicationWay`. */
|
|
205
|
+
create(options: CreateCommunicationWayOptions): Promise<CommunicationWay>;
|
|
206
|
+
/** Updates a communication way via `PUT /CommunicationWay/{communicationWayId}`. */
|
|
207
|
+
update(options: UpdateCommunicationWayOptions): Promise<CommunicationWay>;
|
|
208
|
+
/** Deletes a communication way via `DELETE /CommunicationWay/{communicationWayId}`. */
|
|
209
|
+
delete(options: {
|
|
210
|
+
communicationWayId: number;
|
|
211
|
+
}): Promise<void>;
|
|
212
|
+
/** Retrieves all communication way keys via `GET /CommunicationWayKey`. */
|
|
213
|
+
listKeys(options?: ListOptions): Promise<CommunicationWayKey[]>;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/resources/contact-addresses.d.ts
|
|
217
|
+
interface CreateContactAddressOptions {
|
|
218
|
+
/** The contact this address belongs to. */
|
|
219
|
+
contactId: number;
|
|
220
|
+
/** The country of the address. For all countries, send a `GET` to `/StaticCountry`. */
|
|
221
|
+
countryId: number;
|
|
222
|
+
/**
|
|
223
|
+
* The category of the address. For all categories, send a `GET` to
|
|
224
|
+
* `/Category?objectType=ContactAddress`.
|
|
225
|
+
*/
|
|
226
|
+
categoryId: number;
|
|
227
|
+
street?: string;
|
|
228
|
+
zip?: string;
|
|
229
|
+
city?: string;
|
|
230
|
+
/** Name in the address. */
|
|
231
|
+
name?: string;
|
|
232
|
+
/** Second name in the address. */
|
|
233
|
+
name2?: string;
|
|
234
|
+
/** Third name in the address. */
|
|
235
|
+
name3?: string;
|
|
236
|
+
/** Fourth name in the address. */
|
|
237
|
+
name4?: string;
|
|
238
|
+
}
|
|
239
|
+
interface UpdateContactAddressOptions extends Partial<CreateContactAddressOptions> {
|
|
240
|
+
contactAddressId: number;
|
|
241
|
+
}
|
|
242
|
+
interface ContactAddress {
|
|
243
|
+
id: string;
|
|
244
|
+
objectName: string;
|
|
245
|
+
create: string;
|
|
246
|
+
update: string;
|
|
247
|
+
sevClient: ModelRefResponse;
|
|
248
|
+
contact: ModelRefResponse;
|
|
249
|
+
street: string | null;
|
|
250
|
+
zip: string | null;
|
|
251
|
+
city: string | null;
|
|
252
|
+
country: ModelRefResponse;
|
|
253
|
+
category: ModelRefResponse | null;
|
|
254
|
+
name: string | null;
|
|
255
|
+
name2: string | null;
|
|
256
|
+
name3: string | null;
|
|
257
|
+
name4: string | null;
|
|
258
|
+
}
|
|
259
|
+
declare class ContactAddressesResource extends BaseResource {
|
|
260
|
+
/** Retrieves contact addresses via `GET /ContactAddress`. */
|
|
261
|
+
list(options?: ListOptions): Promise<ContactAddress[]>;
|
|
262
|
+
/** Retrieves a single contact address via `GET /ContactAddress/{contactAddressId}`. */
|
|
263
|
+
get(options: {
|
|
264
|
+
contactAddressId: number;
|
|
265
|
+
}): Promise<ContactAddress>;
|
|
266
|
+
/** Creates a contact address via `POST /ContactAddress`. */
|
|
267
|
+
create(options: CreateContactAddressOptions): Promise<ContactAddress>;
|
|
268
|
+
/** Updates a contact address via `PUT /ContactAddress/{contactAddressId}`. */
|
|
269
|
+
update(options: UpdateContactAddressOptions): Promise<ContactAddress>;
|
|
270
|
+
/** Deletes a contact address via `DELETE /ContactAddress/{contactAddressId}`. */
|
|
271
|
+
delete(options: {
|
|
272
|
+
contactAddressId: number;
|
|
273
|
+
}): Promise<void>;
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
149
276
|
//#region src/resources/contacts.d.ts
|
|
150
277
|
/** `100` for a lead, `500` for a pending and `1000` for an active contact. */
|
|
151
278
|
type ContactStatus = 100 | 500 | 1000;
|
|
@@ -1709,6 +1836,10 @@ interface CheckAccountTransaction {
|
|
|
1709
1836
|
}
|
|
1710
1837
|
interface ListTransactionsOptions extends ListOptions {
|
|
1711
1838
|
checkAccountId?: number;
|
|
1839
|
+
/**
|
|
1840
|
+
* Documented by sevdesk, but the API is known to ignore `false` — filter
|
|
1841
|
+
* client-side on `status` to find unbooked transactions.
|
|
1842
|
+
*/
|
|
1712
1843
|
isBooked?: boolean;
|
|
1713
1844
|
paymtPurpose?: string;
|
|
1714
1845
|
startDate?: DateInput;
|
|
@@ -1817,6 +1948,18 @@ interface ListVouchersOptions extends ListOptions {
|
|
|
1817
1948
|
startDate?: DateInput;
|
|
1818
1949
|
endDate?: DateInput;
|
|
1819
1950
|
contactId?: number;
|
|
1951
|
+
/**
|
|
1952
|
+
* Filters vouchers by a linked object, for example a document the voucher
|
|
1953
|
+
* originated from. Payment bookings are not exposed as linked objects, so
|
|
1954
|
+
* this cannot look up the voucher booked against a bank transaction.
|
|
1955
|
+
*/
|
|
1956
|
+
linkedObjectId?: number;
|
|
1957
|
+
linkedObjectName?: string;
|
|
1958
|
+
embed?: string[];
|
|
1959
|
+
}
|
|
1960
|
+
interface ListVoucherPositionsOptions extends ListOptions {
|
|
1961
|
+
/** Only returns the positions of this voucher. */
|
|
1962
|
+
voucherId?: number;
|
|
1820
1963
|
embed?: string[];
|
|
1821
1964
|
}
|
|
1822
1965
|
interface UpdateVoucherOptions {
|
|
@@ -1880,7 +2023,10 @@ interface VoucherPosition {
|
|
|
1880
2023
|
update: string;
|
|
1881
2024
|
sevClient: ModelRefResponse;
|
|
1882
2025
|
voucher: ModelRefResponse;
|
|
1883
|
-
|
|
2026
|
+
/** `null` for legacy bookkeeping-1.0 positions, which carry `accountingType` instead. */
|
|
2027
|
+
accountDatev: ModelRefResponse | null;
|
|
2028
|
+
/** Booking account of legacy bookkeeping-1.0 positions. `null` for 2.0 positions. */
|
|
2029
|
+
accountingType: ModelRefResponse | null;
|
|
1884
2030
|
taxRate: string;
|
|
1885
2031
|
net: boolean;
|
|
1886
2032
|
isAsset: boolean;
|
|
@@ -1954,16 +2100,16 @@ declare class VouchersResource extends BaseResource {
|
|
|
1954
2100
|
enshrine(options: {
|
|
1955
2101
|
voucherId: number;
|
|
1956
2102
|
}): Promise<void>;
|
|
1957
|
-
/** Retrieves
|
|
1958
|
-
listPositions(options:
|
|
1959
|
-
voucherId: number;
|
|
1960
|
-
} & ListOptions): Promise<VoucherPosition[]>;
|
|
2103
|
+
/** Retrieves voucher positions via `GET /VoucherPos`. */
|
|
2104
|
+
listPositions(options?: ListVoucherPositionsOptions): Promise<VoucherPosition[]>;
|
|
1961
2105
|
}
|
|
1962
2106
|
//#endregion
|
|
1963
2107
|
//#region src/client.d.ts
|
|
1964
2108
|
declare class SevDesk {
|
|
1965
2109
|
readonly basics: BasicsResource;
|
|
1966
2110
|
readonly checkAccounts: CheckAccountsResource;
|
|
2111
|
+
readonly communicationWays: CommunicationWaysResource;
|
|
2112
|
+
readonly contactAddresses: ContactAddressesResource;
|
|
1967
2113
|
readonly contacts: ContactsResource;
|
|
1968
2114
|
readonly creditNotes: CreditNotesResource;
|
|
1969
2115
|
readonly exports: ExportsResource;
|
|
@@ -1990,5 +2136,5 @@ declare class SevDeskError extends Error {
|
|
|
1990
2136
|
});
|
|
1991
2137
|
}
|
|
1992
2138
|
//#endregion
|
|
1993
|
-
export { AllowedTaxRule, BasicsResource, BookCreditNoteOptions, BookCreditNoteResult, BookInvoiceOptions, BookInvoiceResult, BookVoucherOptions, BookVoucherResult, BookkeepingSystemVersion, CheckAccount, CheckAccountTransaction, CheckAccountsResource, Contact, ContactStatus, ContactTabsItemCount, ContactsResource, CreateClearingAccountOptions, CreateContactOptions, CreateCreditNoteFromInvoiceResult, CreateFileImportAccountOptions, CreateInvoiceFromOrderOptions, CreatePartOptions, CreateTagOptions, CreateTransactionOptions, CreditNote, CreditNoteBookingCategory, CreditNoteBookingType, CreditNoteDiscount, CreditNoteInput, CreditNoteMail, CreditNotePdf, CreditNotePosition, CreditNotePositionInput, CreditNoteSendType, CreditNoteStatus, CreditNotesResource, DEFAULT_BASE_URL, type DateInput, ExportConfigOptions, ExportContactFilter, ExportContactsOptions, ExportCreditNotesOptions, ExportDatevCsvJobOptions, ExportDatevXmlJobOptions, ExportDocumentFilter, ExportFile, ExportInvoiceFilter, ExportInvoiceType, ExportInvoicesOptions, ExportJobDownloadInfo, ExportProgress, ExportSevQueryObject, ExportSevQueryOptions, ExportSevQueryValue, ExportTransactionFilter, ExportTransactionsOptions, ExportVoucherFilter, ExportVouchersOptions, ExportsResource, FindContactsByCustomFieldValueOptions, GetOrderRelatedObjectsOptions, type HttpRequestOptions, Invoice, InvoiceBookingType, InvoiceEmail, InvoiceInput, InvoicePdf, InvoicePosition, InvoicePositionInput, InvoiceRenderParameter, InvoiceSendType, InvoiceStatus, InvoiceType, InvoicesResource, ListContactsOptions, ListCreditNotePositionsOptions, ListCreditNotesOptions, ListInvoicesOptions, type ListOptions, ListOrderPositionsOptions, ListOrdersOptions, ListPartsOptions, ListTagsOptions, ListTransactionsOptions, ListVouchersOptions, type ModelRef, type ModelRefResponse, Order, OrderDiscount, OrderInput, OrderMail, OrderPdf, OrderPosition, OrderPositionInput, OrderRelatedObject, OrderSendType, OrderStatus, OrderType, OrdersResource, Part, PartStatus, PartsResource, type Query, type QueryValue, ReceiptGuidanceResource, ReceiptGuide, RenderInvoiceResult, ReportContactListOptions, ReportInvoiceListOptions, ReportOrderFilter, ReportOrderListOptions, ReportOrderType, ReportVoucherListOptions, ReportsResource, SaveCreditNoteOptions, SaveCreditNoteResult, SaveInvoiceOptions, SaveInvoiceResult, SaveOrderOptions, SaveOrderResult, SaveVoucherOptions, SaveVoucherResult, SendCreditNoteByOptions, SendCreditNoteViaEmailOptions, SendInvoiceByOptions, SendInvoiceViaEmailOptions, SendOrderByOptions, SendOrderViaEmailOptions, SevDesk, SevDeskError, type SevDeskOptions, Tag, TagObjectType, TagRelation, TagsResource, TransactionStatus, TransactionsResource, UpdateCheckAccountOptions, UpdateContactOptions, UpdateCreditNoteOptions, UpdateOrderOptions, UpdateOrderPositionOptions, UpdatePartOptions, UpdateTransactionOptions, UpdateVoucherOptions, UploadVoucherFileResult, Voucher, VoucherBookingType, VoucherInput, VoucherPosition, VoucherPositionInput, VoucherStatus, VouchersResource, toExportContactFilter, toExportDocumentFilter, toExportInvoiceFilter, toExportSevQueryParams, toExportVoucherFilter };
|
|
2139
|
+
export { AllowedTaxRule, BasicsResource, BookCreditNoteOptions, BookCreditNoteResult, BookInvoiceOptions, BookInvoiceResult, BookVoucherOptions, BookVoucherResult, BookkeepingSystemVersion, CheckAccount, CheckAccountTransaction, CheckAccountsResource, CommunicationWay, CommunicationWayKey, CommunicationWayType, CommunicationWaysResource, Contact, ContactAddress, ContactAddressesResource, ContactStatus, ContactTabsItemCount, ContactsResource, CreateClearingAccountOptions, CreateCommunicationWayOptions, CreateContactAddressOptions, CreateContactOptions, CreateCreditNoteFromInvoiceResult, CreateFileImportAccountOptions, CreateInvoiceFromOrderOptions, CreatePartOptions, CreateTagOptions, CreateTransactionOptions, CreditNote, CreditNoteBookingCategory, CreditNoteBookingType, CreditNoteDiscount, CreditNoteInput, CreditNoteMail, CreditNotePdf, CreditNotePosition, CreditNotePositionInput, CreditNoteSendType, CreditNoteStatus, CreditNotesResource, DEFAULT_BASE_URL, type DateInput, ExportConfigOptions, ExportContactFilter, ExportContactsOptions, ExportCreditNotesOptions, ExportDatevCsvJobOptions, ExportDatevXmlJobOptions, ExportDocumentFilter, ExportFile, ExportInvoiceFilter, ExportInvoiceType, ExportInvoicesOptions, ExportJobDownloadInfo, ExportProgress, ExportSevQueryObject, ExportSevQueryOptions, ExportSevQueryValue, ExportTransactionFilter, ExportTransactionsOptions, ExportVoucherFilter, ExportVouchersOptions, ExportsResource, FindContactsByCustomFieldValueOptions, GetOrderRelatedObjectsOptions, type HttpRequestOptions, Invoice, InvoiceBookingType, InvoiceEmail, InvoiceInput, InvoicePdf, InvoicePosition, InvoicePositionInput, InvoiceRenderParameter, InvoiceSendType, InvoiceStatus, InvoiceType, InvoicesResource, ListCommunicationWaysOptions, ListContactsOptions, ListCreditNotePositionsOptions, ListCreditNotesOptions, ListInvoicesOptions, type ListOptions, ListOrderPositionsOptions, ListOrdersOptions, ListPartsOptions, ListTagsOptions, ListTransactionsOptions, ListVoucherPositionsOptions, ListVouchersOptions, type ModelRef, type ModelRefResponse, Order, OrderDiscount, OrderInput, OrderMail, OrderPdf, OrderPosition, OrderPositionInput, OrderRelatedObject, OrderSendType, OrderStatus, OrderType, OrdersResource, Part, PartStatus, PartsResource, type Query, type QueryValue, ReceiptGuidanceResource, ReceiptGuide, RenderInvoiceResult, ReportContactListOptions, ReportInvoiceListOptions, ReportOrderFilter, ReportOrderListOptions, ReportOrderType, ReportVoucherListOptions, ReportsResource, SaveCreditNoteOptions, SaveCreditNoteResult, SaveInvoiceOptions, SaveInvoiceResult, SaveOrderOptions, SaveOrderResult, SaveVoucherOptions, SaveVoucherResult, SendCreditNoteByOptions, SendCreditNoteViaEmailOptions, SendInvoiceByOptions, SendInvoiceViaEmailOptions, SendOrderByOptions, SendOrderViaEmailOptions, SevDesk, SevDeskError, type SevDeskOptions, Tag, TagObjectType, TagRelation, TagsResource, TransactionStatus, TransactionsResource, UpdateCheckAccountOptions, UpdateCommunicationWayOptions, UpdateContactAddressOptions, UpdateContactOptions, UpdateCreditNoteOptions, UpdateOrderOptions, UpdateOrderPositionOptions, UpdatePartOptions, UpdateTransactionOptions, UpdateVoucherOptions, UploadVoucherFileResult, Voucher, VoucherBookingType, VoucherInput, VoucherPosition, VoucherPositionInput, VoucherStatus, VouchersResource, toExportContactFilter, toExportDocumentFilter, toExportInvoiceFilter, toExportSevQueryParams, toExportVoucherFilter };
|
|
1994
2140
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -100,7 +100,7 @@ var HttpClient = class {
|
|
|
100
100
|
const url = new URL(this.baseUrl + options.path);
|
|
101
101
|
for (const [key, value] of Object.entries(options.query ?? {})) {
|
|
102
102
|
if (value === void 0) continue;
|
|
103
|
-
url.searchParams.append(key,
|
|
103
|
+
url.searchParams.append(key, serializeQueryValue(value));
|
|
104
104
|
}
|
|
105
105
|
return url.toString();
|
|
106
106
|
}
|
|
@@ -124,6 +124,15 @@ var HttpClient = class {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
+
/**
|
|
128
|
+
* Booleans are serialized as `1`/`0` because the sevdesk API ignores the
|
|
129
|
+
* literal string `false` in query parameters.
|
|
130
|
+
*/
|
|
131
|
+
function serializeQueryValue(value) {
|
|
132
|
+
if (Array.isArray(value)) return value.join(",");
|
|
133
|
+
if (typeof value === "boolean") return value ? "1" : "0";
|
|
134
|
+
return String(value);
|
|
135
|
+
}
|
|
127
136
|
function unwrap(payload) {
|
|
128
137
|
if (typeof payload === "object" && payload !== null && "objects" in payload) return payload.objects;
|
|
129
138
|
return payload;
|
|
@@ -266,6 +275,165 @@ var CheckAccountsResource = class extends BaseResource {
|
|
|
266
275
|
}
|
|
267
276
|
};
|
|
268
277
|
//#endregion
|
|
278
|
+
//#region src/resources/communication-ways.ts
|
|
279
|
+
var CommunicationWaysResource = class extends BaseResource {
|
|
280
|
+
/** Retrieves communication ways via `GET /CommunicationWay`. */
|
|
281
|
+
list(options = {}) {
|
|
282
|
+
const { contactId, type, main, limit, offset } = options;
|
|
283
|
+
return this.http.request({
|
|
284
|
+
method: "GET",
|
|
285
|
+
path: "/CommunicationWay",
|
|
286
|
+
query: {
|
|
287
|
+
"contact[id]": contactId,
|
|
288
|
+
"contact[objectName]": contactId === void 0 ? void 0 : "Contact",
|
|
289
|
+
type,
|
|
290
|
+
main,
|
|
291
|
+
limit,
|
|
292
|
+
offset
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/** Retrieves a single communication way via `GET /CommunicationWay/{communicationWayId}`. */
|
|
297
|
+
async get(options) {
|
|
298
|
+
const communicationWay = (await this.http.request({
|
|
299
|
+
method: "GET",
|
|
300
|
+
path: `/CommunicationWay/${options.communicationWayId}`
|
|
301
|
+
}))[0];
|
|
302
|
+
if (!communicationWay) throw new SevDeskError({
|
|
303
|
+
status: 404,
|
|
304
|
+
statusText: "Not Found",
|
|
305
|
+
body: null
|
|
306
|
+
});
|
|
307
|
+
return communicationWay;
|
|
308
|
+
}
|
|
309
|
+
/** Creates a communication way via `POST /CommunicationWay`. */
|
|
310
|
+
create(options) {
|
|
311
|
+
return this.http.request({
|
|
312
|
+
method: "POST",
|
|
313
|
+
path: "/CommunicationWay",
|
|
314
|
+
body: toCommunicationWayBody(options)
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
/** Updates a communication way via `PUT /CommunicationWay/{communicationWayId}`. */
|
|
318
|
+
update(options) {
|
|
319
|
+
const { communicationWayId, ...fields } = options;
|
|
320
|
+
return this.http.request({
|
|
321
|
+
method: "PUT",
|
|
322
|
+
path: `/CommunicationWay/${communicationWayId}`,
|
|
323
|
+
body: toCommunicationWayBody(fields)
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/** Deletes a communication way via `DELETE /CommunicationWay/{communicationWayId}`. */
|
|
327
|
+
async delete(options) {
|
|
328
|
+
await this.http.request({
|
|
329
|
+
method: "DELETE",
|
|
330
|
+
path: `/CommunicationWay/${options.communicationWayId}`
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/** Retrieves all communication way keys via `GET /CommunicationWayKey`. */
|
|
334
|
+
listKeys(options = {}) {
|
|
335
|
+
return this.http.request({
|
|
336
|
+
method: "GET",
|
|
337
|
+
path: "/CommunicationWayKey",
|
|
338
|
+
query: {
|
|
339
|
+
limit: options.limit,
|
|
340
|
+
offset: options.offset
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
function toCommunicationWayBody(fields) {
|
|
346
|
+
return {
|
|
347
|
+
objectName: "CommunicationWay",
|
|
348
|
+
mapAll: true,
|
|
349
|
+
contact: toRef$8(fields.contactId, "Contact"),
|
|
350
|
+
type: fields.type,
|
|
351
|
+
value: fields.value,
|
|
352
|
+
key: toRef$8(fields.keyId, "CommunicationWayKey"),
|
|
353
|
+
main: fields.main
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function toRef$8(id, objectName) {
|
|
357
|
+
return id === void 0 ? void 0 : {
|
|
358
|
+
id,
|
|
359
|
+
objectName
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/resources/contact-addresses.ts
|
|
364
|
+
var ContactAddressesResource = class extends BaseResource {
|
|
365
|
+
/** Retrieves contact addresses via `GET /ContactAddress`. */
|
|
366
|
+
list(options = {}) {
|
|
367
|
+
return this.http.request({
|
|
368
|
+
method: "GET",
|
|
369
|
+
path: "/ContactAddress",
|
|
370
|
+
query: {
|
|
371
|
+
limit: options.limit,
|
|
372
|
+
offset: options.offset
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
/** Retrieves a single contact address via `GET /ContactAddress/{contactAddressId}`. */
|
|
377
|
+
async get(options) {
|
|
378
|
+
const address = (await this.http.request({
|
|
379
|
+
method: "GET",
|
|
380
|
+
path: `/ContactAddress/${options.contactAddressId}`
|
|
381
|
+
}))[0];
|
|
382
|
+
if (!address) throw new SevDeskError({
|
|
383
|
+
status: 404,
|
|
384
|
+
statusText: "Not Found",
|
|
385
|
+
body: null
|
|
386
|
+
});
|
|
387
|
+
return address;
|
|
388
|
+
}
|
|
389
|
+
/** Creates a contact address via `POST /ContactAddress`. */
|
|
390
|
+
create(options) {
|
|
391
|
+
return this.http.request({
|
|
392
|
+
method: "POST",
|
|
393
|
+
path: "/ContactAddress",
|
|
394
|
+
body: toContactAddressBody(options)
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
/** Updates a contact address via `PUT /ContactAddress/{contactAddressId}`. */
|
|
398
|
+
update(options) {
|
|
399
|
+
const { contactAddressId, ...fields } = options;
|
|
400
|
+
return this.http.request({
|
|
401
|
+
method: "PUT",
|
|
402
|
+
path: `/ContactAddress/${contactAddressId}`,
|
|
403
|
+
body: toContactAddressBody(fields)
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
/** Deletes a contact address via `DELETE /ContactAddress/{contactAddressId}`. */
|
|
407
|
+
async delete(options) {
|
|
408
|
+
await this.http.request({
|
|
409
|
+
method: "DELETE",
|
|
410
|
+
path: `/ContactAddress/${options.contactAddressId}`
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
function toContactAddressBody(fields) {
|
|
415
|
+
return {
|
|
416
|
+
objectName: "ContactAddress",
|
|
417
|
+
mapAll: true,
|
|
418
|
+
contact: toRef$7(fields.contactId, "Contact"),
|
|
419
|
+
country: toRef$7(fields.countryId, "StaticCountry"),
|
|
420
|
+
category: toRef$7(fields.categoryId, "Category"),
|
|
421
|
+
street: fields.street,
|
|
422
|
+
zip: fields.zip,
|
|
423
|
+
city: fields.city,
|
|
424
|
+
name: fields.name,
|
|
425
|
+
name2: fields.name2,
|
|
426
|
+
name3: fields.name3,
|
|
427
|
+
name4: fields.name4
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function toRef$7(id, objectName) {
|
|
431
|
+
return id === void 0 ? void 0 : {
|
|
432
|
+
id,
|
|
433
|
+
objectName
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
//#endregion
|
|
269
437
|
//#region src/resources/contacts.ts
|
|
270
438
|
var ContactsResource = class extends BaseResource {
|
|
271
439
|
/** Retrieves contacts via `GET /Contact`. */
|
|
@@ -1788,7 +1956,7 @@ function toOptionalIsoDateTime(value) {
|
|
|
1788
1956
|
var VouchersResource = class extends BaseResource {
|
|
1789
1957
|
/** Retrieves vouchers via `GET /Voucher`. */
|
|
1790
1958
|
list(options = {}) {
|
|
1791
|
-
const { status, creditDebit, descriptionLike, startDate, endDate, contactId, limit, offset, embed } = options;
|
|
1959
|
+
const { status, creditDebit, descriptionLike, startDate, endDate, contactId, linkedObjectId, linkedObjectName, limit, offset, embed } = options;
|
|
1792
1960
|
return this.http.request({
|
|
1793
1961
|
method: "GET",
|
|
1794
1962
|
path: "/Voucher",
|
|
@@ -1800,6 +1968,8 @@ var VouchersResource = class extends BaseResource {
|
|
|
1800
1968
|
endDate: toOptionalVoucherDate(endDate),
|
|
1801
1969
|
"contact[id]": contactId,
|
|
1802
1970
|
"contact[objectName]": contactId === void 0 ? void 0 : "Contact",
|
|
1971
|
+
"object[id]": linkedObjectId,
|
|
1972
|
+
"object[objectName]": linkedObjectId === void 0 ? void 0 : linkedObjectName,
|
|
1803
1973
|
limit,
|
|
1804
1974
|
offset,
|
|
1805
1975
|
embed
|
|
@@ -1918,17 +2088,18 @@ var VouchersResource = class extends BaseResource {
|
|
|
1918
2088
|
path: `/Voucher/${options.voucherId}/enshrine`
|
|
1919
2089
|
});
|
|
1920
2090
|
}
|
|
1921
|
-
/** Retrieves
|
|
1922
|
-
listPositions(options) {
|
|
1923
|
-
const { voucherId, limit, offset } = options;
|
|
2091
|
+
/** Retrieves voucher positions via `GET /VoucherPos`. */
|
|
2092
|
+
listPositions(options = {}) {
|
|
2093
|
+
const { voucherId, limit, offset, embed } = options;
|
|
1924
2094
|
return this.http.request({
|
|
1925
2095
|
method: "GET",
|
|
1926
2096
|
path: "/VoucherPos",
|
|
1927
2097
|
query: {
|
|
1928
2098
|
"voucher[id]": voucherId,
|
|
1929
|
-
"voucher[objectName]": "Voucher",
|
|
2099
|
+
"voucher[objectName]": voucherId === void 0 ? void 0 : "Voucher",
|
|
1930
2100
|
limit,
|
|
1931
|
-
offset
|
|
2101
|
+
offset,
|
|
2102
|
+
embed
|
|
1932
2103
|
}
|
|
1933
2104
|
});
|
|
1934
2105
|
}
|
|
@@ -1987,6 +2158,8 @@ function toOptionalVoucherDate(value) {
|
|
|
1987
2158
|
var SevDesk = class {
|
|
1988
2159
|
basics;
|
|
1989
2160
|
checkAccounts;
|
|
2161
|
+
communicationWays;
|
|
2162
|
+
contactAddresses;
|
|
1990
2163
|
contacts;
|
|
1991
2164
|
creditNotes;
|
|
1992
2165
|
exports;
|
|
@@ -2002,6 +2175,8 @@ var SevDesk = class {
|
|
|
2002
2175
|
const http = new HttpClient(options);
|
|
2003
2176
|
this.basics = new BasicsResource(http);
|
|
2004
2177
|
this.checkAccounts = new CheckAccountsResource(http);
|
|
2178
|
+
this.communicationWays = new CommunicationWaysResource(http);
|
|
2179
|
+
this.contactAddresses = new ContactAddressesResource(http);
|
|
2005
2180
|
this.contacts = new ContactsResource(http);
|
|
2006
2181
|
this.creditNotes = new CreditNotesResource(http);
|
|
2007
2182
|
this.exports = new ExportsResource(http);
|
|
@@ -2016,6 +2191,6 @@ var SevDesk = class {
|
|
|
2016
2191
|
}
|
|
2017
2192
|
};
|
|
2018
2193
|
//#endregion
|
|
2019
|
-
export { BasicsResource, CheckAccountsResource, ContactsResource, CreditNotesResource, DEFAULT_BASE_URL, ExportsResource, InvoicesResource, OrdersResource, PartsResource, ReceiptGuidanceResource, ReportsResource, SevDesk, SevDeskError, TagsResource, TransactionsResource, VouchersResource, toExportContactFilter, toExportDocumentFilter, toExportInvoiceFilter, toExportSevQueryParams, toExportVoucherFilter };
|
|
2194
|
+
export { BasicsResource, CheckAccountsResource, CommunicationWaysResource, ContactAddressesResource, ContactsResource, CreditNotesResource, DEFAULT_BASE_URL, ExportsResource, InvoicesResource, OrdersResource, PartsResource, ReceiptGuidanceResource, ReportsResource, SevDesk, SevDeskError, TagsResource, TransactionsResource, VouchersResource, toExportContactFilter, toExportDocumentFilter, toExportInvoiceFilter, toExportSevQueryParams, toExportVoucherFilter };
|
|
2020
2195
|
|
|
2021
2196
|
//# sourceMappingURL=index.js.map
|