@agentforge-io/sdk-server 4.86.0 → 4.88.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.
- package/dist/index.d.ts +2 -1
- package/dist/resources/cases.d.ts +20 -1
- package/dist/resources/cases.js +34 -1
- package/dist/resources/contacts.d.ts +21 -0
- package/dist/resources/contacts.js +2 -0
- package/dist/types.d.ts +103 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
|
|
|
3
3
|
export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, AgentForgeDuplicateContactError, AgentForgeBillingError, AGENTFORGE_BILLING_ERROR_CODES, AgentForgeCreditError, AGENTFORGE_CREDIT_ERROR_CODES, } from './errors';
|
|
4
4
|
export type { AgentForgeBillingErrorCode, AgentForgeCreditErrorCode } from './errors';
|
|
5
5
|
export { CreditResource, CreditAccountsResource } from './resources/credit';
|
|
6
|
+
export type { CreateDirectRentalInput, UpdateCaseRentalInput, CaseRental, RentalPeriodUnit } from './types';
|
|
6
7
|
export type { CreditEntryKind, CreditAgingBucket, CreditAccountStatus, CreditEntry, CreditAllocation, CreditDebt, CreditAccount, CreditWriteResult, CreditStatementRow, CreditAccountListRow, CreditAccountsQuery, CreditAccountsPage, CreditStatementQuery, CreditStatement, UpdateCreditAccountInput, CreditPayInput, CreditReversePaymentInput, CreditWriteOffInput, CreditOpeningInput, CreditPayoutInput, } from './resources/credit';
|
|
7
8
|
export { BillingResource } from './resources/billing';
|
|
8
9
|
export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingInvoicePage, BillingInvoicesQuery, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
|
|
@@ -28,7 +29,7 @@ export type { ListMarketplaceCategoriesInput } from './resources/marketplace';
|
|
|
28
29
|
export { TenantConfigResource } from './resources/config';
|
|
29
30
|
export { PlacesResource } from './resources/places';
|
|
30
31
|
export { ContactsResource, ContactVerificationResource, ContactAddressesResource, ContactTagsResource, ContactListsResource, } from './resources/contacts';
|
|
31
|
-
export type { ContactVerificationChannel, LinkContactInput, LinkContactResult, AppContact, ContactAvatarUploadTarget, ClaimContactInput, ClaimContactResult, StartVerificationInput, StartVerificationResult, ConfirmVerificationInput, ConfirmVerificationResult, ContactDocumentType, ContactDocumentInput, ContactDocument, ContactMatchedBy, ContactSummary, ContactSegment, ContactSort, ContactStats, ContactNote, BusinessContact, ContactPage, SearchContactsInput, CreateBusinessContactInput, UpdateBusinessContactInput, ContactAddress, ContactAddressInput, ContactTag, ContactList, } from './resources/contacts';
|
|
32
|
+
export type { ContactVerificationChannel, LinkContactInput, LinkContactResult, AppContact, ContactAvatarUploadTarget, ClaimContactInput, ClaimContactResult, StartVerificationInput, StartVerificationResult, ConfirmVerificationInput, ConfirmVerificationResult, ContactDocumentType, ContactDocumentInput, ContactDocument, ContactMatchedBy, ContactSummary, ContactSegment, ContactSort, ContactStats, ContactNote, BusinessContact, ContactProperties, ContactPropertiesPatch, ContactPropertyValue, ContactPage, SearchContactsInput, CreateBusinessContactInput, UpdateBusinessContactInput, ContactAddress, ContactAddressInput, ContactTag, ContactList, } from './resources/contacts';
|
|
32
33
|
export { FilesResource } from './resources/files';
|
|
33
34
|
export type { AppFileKind, SignAppFileInput, AppFileUploadTarget } from './resources/files';
|
|
34
35
|
export { DeliveryResource } from './resources/delivery';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CaseAccount, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetOnAccountInput, SetOnAccountResult } from '../types';
|
|
2
|
+
import type { CaseAccount, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateDirectRentalInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetOnAccountInput, SetOnAccountResult, UpdateCaseRentalInput } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -161,6 +161,7 @@ export declare class CasesResource {
|
|
|
161
161
|
*/
|
|
162
162
|
directForm(opts?: {
|
|
163
163
|
type?: string;
|
|
164
|
+
rental?: boolean;
|
|
164
165
|
}): Promise<DirectOrderForm>;
|
|
165
166
|
/**
|
|
166
167
|
* `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
|
|
@@ -178,6 +179,24 @@ export declare class CasesResource {
|
|
|
178
179
|
* duration. A retried `idempotencyKey` returns the same booking.
|
|
179
180
|
*/
|
|
180
181
|
createDirectBooking(input: CreateDirectBookingInput): Promise<CaseView>;
|
|
182
|
+
/**
|
|
183
|
+
* `POST /api/v1/cases/direct-rental` — PDK-RENTAL-AVAILABILITY: an order of items rented over a time range (a machine
|
|
184
|
+
* Friday to Sunday). A direct order (holds, receipt, `case.submitted`, same errors) plus `rental`. The platform prices
|
|
185
|
+
* each line from the catalog — price of one period (options included) × units × `rental.periods.count` — and writes it on
|
|
186
|
+
* the receipt («2 × Retroexcavadora 320 × 3 días»); `CaseView.rental` carries the range. Hold the units in YOUR ledger
|
|
187
|
+
* first: the platform keeps what was rented, you own availability. Created `submitted`, or `confirmed` at once with
|
|
188
|
+
* `confirmation: 'instant'`. 400 for a bad range (end ≤ start, > 366 days, a count below what the range spans) or a
|
|
189
|
+
* line with `variantId`/`amountCents`; 409 when a product lacks stock. A retried `idempotencyKey` returns the same rental.
|
|
190
|
+
* R2d: `lines[].periodRateCents` (App sk_ key) prices a line with YOUR rate of one period instead of the catalog; still multiplied here.
|
|
191
|
+
*/
|
|
192
|
+
createDirectRental(input: CreateDirectRentalInput): Promise<CaseView>;
|
|
193
|
+
/**
|
|
194
|
+
* `PATCH /api/v1/cases/:id/rental` — PDK-RENTAL-AVAILABILITY: reschedule or extend a rental you already moved in your
|
|
195
|
+
* ledger. Periods and prices are recomputed from the catalog and the receipt is re-issued (same link, revision + 1).
|
|
196
|
+
* Allowed after it is confirmed (an extension on site); 400 once it is closed or when the case is not a rental.
|
|
197
|
+
* R2d: `lines[].periodRateCents` re-prices a product (e.g. after changing `periods.unit` from `hora` to `dia`).
|
|
198
|
+
*/
|
|
199
|
+
updateRental(caseId: string, input: UpdateCaseRentalInput): Promise<CaseView>;
|
|
181
200
|
/**
|
|
182
201
|
* `POST /api/v1/cases/:id/notice` — AGF-DELIVERY: tells the customer something through the
|
|
183
202
|
* conversation's channel. The same `key` never says it twice.
|
package/dist/resources/cases.js
CHANGED
|
@@ -28,6 +28,10 @@ class CasesResource {
|
|
|
28
28
|
qs.set('slotFrom', at(input.slotFrom));
|
|
29
29
|
if (input.slotTo)
|
|
30
30
|
qs.set('slotTo', at(input.slotTo));
|
|
31
|
+
if (input.rentalFrom)
|
|
32
|
+
qs.set('rentalFrom', at(input.rentalFrom));
|
|
33
|
+
if (input.rentalTo)
|
|
34
|
+
qs.set('rentalTo', at(input.rentalTo));
|
|
31
35
|
if (input.assignee)
|
|
32
36
|
qs.set('assignee', input.assignee);
|
|
33
37
|
if (input.contactId)
|
|
@@ -225,7 +229,14 @@ class CasesResource {
|
|
|
225
229
|
* and the phone: the order type and its other fields (chips for a closed choice).
|
|
226
230
|
*/
|
|
227
231
|
async directForm(opts = {}) {
|
|
228
|
-
|
|
232
|
+
const qs = new URLSearchParams();
|
|
233
|
+
if (opts.type)
|
|
234
|
+
qs.set('type', opts.type);
|
|
235
|
+
// PDK-RENTAL-AVAILABILITY: the form of a rental order's type («Reserva»).
|
|
236
|
+
if (opts.rental)
|
|
237
|
+
qs.set('rental', 'true');
|
|
238
|
+
const q = qs.toString();
|
|
239
|
+
return this.client.request('GET', `/api/v1/cases/direct/form${q ? `?${q}` : ''}`);
|
|
229
240
|
}
|
|
230
241
|
/**
|
|
231
242
|
* `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
|
|
@@ -247,6 +258,28 @@ class CasesResource {
|
|
|
247
258
|
async createDirectBooking(input) {
|
|
248
259
|
return this.client.request('POST', '/api/v1/cases/bookings', input);
|
|
249
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* `POST /api/v1/cases/direct-rental` — PDK-RENTAL-AVAILABILITY: an order of items rented over a time range (a machine
|
|
263
|
+
* Friday to Sunday). A direct order (holds, receipt, `case.submitted`, same errors) plus `rental`. The platform prices
|
|
264
|
+
* each line from the catalog — price of one period (options included) × units × `rental.periods.count` — and writes it on
|
|
265
|
+
* the receipt («2 × Retroexcavadora 320 × 3 días»); `CaseView.rental` carries the range. Hold the units in YOUR ledger
|
|
266
|
+
* first: the platform keeps what was rented, you own availability. Created `submitted`, or `confirmed` at once with
|
|
267
|
+
* `confirmation: 'instant'`. 400 for a bad range (end ≤ start, > 366 days, a count below what the range spans) or a
|
|
268
|
+
* line with `variantId`/`amountCents`; 409 when a product lacks stock. A retried `idempotencyKey` returns the same rental.
|
|
269
|
+
* R2d: `lines[].periodRateCents` (App sk_ key) prices a line with YOUR rate of one period instead of the catalog; still multiplied here.
|
|
270
|
+
*/
|
|
271
|
+
async createDirectRental(input) {
|
|
272
|
+
return this.client.request('POST', '/api/v1/cases/direct-rental', input);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* `PATCH /api/v1/cases/:id/rental` — PDK-RENTAL-AVAILABILITY: reschedule or extend a rental you already moved in your
|
|
276
|
+
* ledger. Periods and prices are recomputed from the catalog and the receipt is re-issued (same link, revision + 1).
|
|
277
|
+
* Allowed after it is confirmed (an extension on site); 400 once it is closed or when the case is not a rental.
|
|
278
|
+
* R2d: `lines[].periodRateCents` re-prices a product (e.g. after changing `periods.unit` from `hora` to `dia`).
|
|
279
|
+
*/
|
|
280
|
+
async updateRental(caseId, input) {
|
|
281
|
+
return this.client.request('PATCH', `/api/v1/cases/${encodeURIComponent(caseId)}/rental`, input);
|
|
282
|
+
}
|
|
250
283
|
/**
|
|
251
284
|
* `POST /api/v1/cases/:id/notice` — AGF-DELIVERY: tells the customer something through the
|
|
252
285
|
* conversation's channel. The same `key` never says it twice.
|
|
@@ -203,7 +203,24 @@ export interface ContactNote {
|
|
|
203
203
|
createdAt: string;
|
|
204
204
|
updatedAt: string;
|
|
205
205
|
}
|
|
206
|
+
/** PDK-CONTACT-FIELDS C1 — a custom property value. Strings ≤ 500 characters; numbers finite. */
|
|
207
|
+
export type ContactPropertyValue = string | number | boolean;
|
|
208
|
+
/** What `BusinessContact.properties` holds: this App's properties of the contact. */
|
|
209
|
+
export type ContactProperties = Record<string, ContactPropertyValue>;
|
|
210
|
+
/**
|
|
211
|
+
* PDK-CONTACT-FIELDS C1 — `properties` on create/update (and `customer.properties` of `cases.createDirect*`).
|
|
212
|
+
* MERGED into the App's stored properties: a value sets or overwrites the key, `null` deletes it, absent keys are kept.
|
|
213
|
+
* Limits (400 otherwise, `error` = `invalid_properties` | `invalid_property_key` | `invalid_property_value` |
|
|
214
|
+
* `too_many_properties`): keys match `/^[a-z][a-z0-9_]{0,39}$/`, string values ≤ 500 characters, at most 50 keys
|
|
215
|
+
* stored per App per contact.
|
|
216
|
+
*/
|
|
217
|
+
export type ContactPropertiesPatch = Record<string, ContactPropertyValue | null>;
|
|
206
218
|
export interface BusinessContact extends ContactSummary {
|
|
219
|
+
/**
|
|
220
|
+
* PDK-CONTACT-FIELDS C1 — the custom properties YOUR App stored on this contact (namespaced per App: another App's
|
|
221
|
+
* keys are never visible nor overwritten). `{}` when none. Absent on a platform older than C1.
|
|
222
|
+
*/
|
|
223
|
+
properties?: ContactProperties;
|
|
207
224
|
marketingConsent: boolean;
|
|
208
225
|
marketingConsentAt: string | null;
|
|
209
226
|
notes: string | null;
|
|
@@ -240,6 +257,8 @@ export interface CreateBusinessContactInput {
|
|
|
240
257
|
tags?: string[];
|
|
241
258
|
/** «Acepta recibir promociones» (Ley 1581). Default `false`. */
|
|
242
259
|
marketingConsent?: boolean;
|
|
260
|
+
/** PDK-CONTACT-FIELDS C1 — custom properties of this App on the contact (see `ContactPropertiesPatch`). */
|
|
261
|
+
properties?: ContactPropertiesPatch;
|
|
243
262
|
}
|
|
244
263
|
export interface UpdateBusinessContactInput {
|
|
245
264
|
/** The business contact to change (`ContactSummary.id`). */
|
|
@@ -254,6 +273,8 @@ export interface UpdateBusinessContactInput {
|
|
|
254
273
|
addTags?: string[];
|
|
255
274
|
removeTags?: string[];
|
|
256
275
|
marketingConsent?: boolean;
|
|
276
|
+
/** PDK-CONTACT-FIELDS C1 — MERGED into this App's properties; a `null` value deletes that key. */
|
|
277
|
+
properties?: ContactPropertiesPatch;
|
|
257
278
|
}
|
|
258
279
|
export interface ContactAddress {
|
|
259
280
|
id: string;
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
// - `create(...)` — needs a name, a phone or a document; a phone/document that
|
|
26
26
|
// already exists throws `AgentForgeDuplicateContactError` (`existingId`).
|
|
27
27
|
// - `getById(id)` · `update({ contactId, ... })` (documents, tags, consent).
|
|
28
|
+
// - `properties` (PDK-CONTACT-FIELDS C1) on `create` / `update` / `getById`: custom fields of YOUR App on the contact,
|
|
29
|
+
// merged per key (`null` deletes), namespaced per App (≤ 50 keys, key `[a-z][a-z0-9_]{0,39}`, string ≤ 500).
|
|
28
30
|
// - `addresses.*` · `tags.*` (per-business catalog) · `lists.*` (static lists).
|
|
29
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
32
|
exports.ContactsResource = exports.ContactListsResource = exports.ContactTagsResource = exports.ContactNotesResource = exports.ContactAddressesResource = exports.ContactVerificationResource = void 0;
|
package/dist/types.d.ts
CHANGED
|
@@ -2565,6 +2565,10 @@ export interface CaseView {
|
|
|
2565
2565
|
slot: (CaseSlot & {
|
|
2566
2566
|
label: string;
|
|
2567
2567
|
}) | null;
|
|
2568
|
+
/** PDK-RENTAL-AVAILABILITY — the time range a rental order holds and what it is charged for; null for any other case (absent on an older platform). */
|
|
2569
|
+
rental?: (CaseRental & {
|
|
2570
|
+
label: string;
|
|
2571
|
+
}) | null;
|
|
2568
2572
|
/** AGF-DELIVERY D0 — where it is taken or performed (absent on an older platform). */
|
|
2569
2573
|
destination?: CaseDestination | null;
|
|
2570
2574
|
openedAt: string;
|
|
@@ -2748,6 +2752,16 @@ export interface CaseReceiptLine {
|
|
|
2748
2752
|
currency: string;
|
|
2749
2753
|
priceKind: 'fixed' | 'from' | 'per_unit' | 'on_request';
|
|
2750
2754
|
unit?: string;
|
|
2755
|
+
/**
|
|
2756
|
+
* PDK-RENTAL-AVAILABILITY — a rented line (receipt of `cases.createDirectRental`): charged for `count` periods of `unit`.
|
|
2757
|
+
* `unitCents` of the line is then the price of ONE unit over the whole range (rate × count); `periods.unitCents` is the rate
|
|
2758
|
+
* per period. Show it as «{qty} × {title} × {count} {unit}».
|
|
2759
|
+
*/
|
|
2760
|
+
periods?: {
|
|
2761
|
+
unit: RentalPeriodUnit;
|
|
2762
|
+
count: number;
|
|
2763
|
+
unitCents: number | null;
|
|
2764
|
+
};
|
|
2751
2765
|
/** AGF-UNITS U2 — sold by measure: `qty` is in `unit` (0.75 lb), not a count of items. */
|
|
2752
2766
|
measured?: boolean;
|
|
2753
2767
|
/** PDK-SERVICE-CART — the line is a service. Absent: a product, a receipt issued before, or an older platform. */
|
|
@@ -2984,12 +2998,16 @@ export interface CreateDirectOrderInput {
|
|
|
2984
2998
|
* Who orders: the App's visitor id, and the name and phone they gave (both required
|
|
2985
2999
|
* unless `place`). A sale the team registers (`origin.channel` `pos`) may leave both
|
|
2986
3000
|
* out: it is then named after its place («Mostrador», «Mesa 2») and has no phone.
|
|
3001
|
+
* `customer.properties` (PDK-CONTACT-FIELDS C1, also on open orders, bookings and rentals): custom contact properties of
|
|
3002
|
+
* your App, merged (`null` deletes) onto the contact the case links to once it is created; no linked contact → not
|
|
3003
|
+
* written. 400 (`invalid_property_*`) before anything is held when malformed.
|
|
2987
3004
|
*/
|
|
2988
3005
|
customer: {
|
|
2989
3006
|
ref: string;
|
|
2990
3007
|
name?: string;
|
|
2991
3008
|
phone?: string;
|
|
2992
3009
|
contactId?: string;
|
|
3010
|
+
properties?: ContactPropertiesPatch;
|
|
2993
3011
|
};
|
|
2994
3012
|
/** AGF-ORDER-ORIGIN-POS — where it comes from; default `{ channel: 'page' }`. A `pos` sale needs `place` and `by`. */
|
|
2995
3013
|
origin?: CaseOrigin;
|
|
@@ -3094,6 +3112,7 @@ export interface CreateOpenOrderInput {
|
|
|
3094
3112
|
name?: string;
|
|
3095
3113
|
phone?: string;
|
|
3096
3114
|
contactId?: string;
|
|
3115
|
+
properties?: ContactPropertiesPatch;
|
|
3097
3116
|
};
|
|
3098
3117
|
origin: {
|
|
3099
3118
|
channel: 'link';
|
|
@@ -3371,6 +3390,9 @@ export interface ListCasesInput {
|
|
|
3371
3390
|
/** AGF-AGENDA — bookings whose time starts in [slotFrom, slotTo), earliest first. */
|
|
3372
3391
|
slotFrom?: string | Date;
|
|
3373
3392
|
slotTo?: string | Date;
|
|
3393
|
+
/** PDK-RENTAL-AVAILABILITY — rentals whose range overlaps [rentalFrom, rentalTo), earliest first. */
|
|
3394
|
+
rentalFrom?: string | Date;
|
|
3395
|
+
rentalTo?: string | Date;
|
|
3374
3396
|
/** AGF-AGENDA — one member's requests (your reference), or `none` for unassigned ones. */
|
|
3375
3397
|
assignee?: string;
|
|
3376
3398
|
/** PDK-LOYALTY-CRM L1 — one business contact's cases (also those of contacts merged into it). */
|
|
@@ -3400,6 +3422,7 @@ export interface CreateDirectBookingInput {
|
|
|
3400
3422
|
name: string;
|
|
3401
3423
|
phone: string;
|
|
3402
3424
|
contactId?: string;
|
|
3425
|
+
properties?: ContactPropertiesPatch;
|
|
3403
3426
|
};
|
|
3404
3427
|
/** A catalog service of the business with a `booking` rule. */
|
|
3405
3428
|
serviceId: string;
|
|
@@ -3424,6 +3447,85 @@ export interface CreateDirectBookingInput {
|
|
|
3424
3447
|
/** AGF-DELIVERY D0 — where it is performed: required for a service `attendedAt: 'customer'`, refused for one at the business. */
|
|
3425
3448
|
destination?: CaseDestination;
|
|
3426
3449
|
}
|
|
3450
|
+
/** The billing period of a rental. */
|
|
3451
|
+
export type RentalPeriodUnit = 'hora' | 'dia' | 'semana' | 'mes';
|
|
3452
|
+
/** The time a rental holds and what it is charged for (a snapshot: your App's rentals ledger decides what is free). */
|
|
3453
|
+
export interface CaseRental {
|
|
3454
|
+
/** ISO instants. */
|
|
3455
|
+
startsAt: string;
|
|
3456
|
+
endsAt: string;
|
|
3457
|
+
/** IANA zone the business reads it in. */
|
|
3458
|
+
timezone: string;
|
|
3459
|
+
/** The period and how many of them the range is charged for. */
|
|
3460
|
+
periods: {
|
|
3461
|
+
unit: RentalPeriodUnit;
|
|
3462
|
+
count: number;
|
|
3463
|
+
};
|
|
3464
|
+
/** The rate of ONE period of ONE unit per product id when your App priced the lines (`periodRateCents`); absent: the catalog price. */
|
|
3465
|
+
periodRates?: Record<string, number>;
|
|
3466
|
+
}
|
|
3467
|
+
/**
|
|
3468
|
+
* `POST /api/v1/cases/direct-rental` — an order of items rented over a time range. The body of `CreateDirectOrderInput`
|
|
3469
|
+
* (customer, lines, fields, destination, origin, payment, type, idempotencyKey…) plus `rental`. Without the options
|
|
3470
|
+
* that make no sense for a rental: no free lines, no value lines (`amountCents`), no redo (`reopens`).
|
|
3471
|
+
*
|
|
3472
|
+
* Each line's `quantity` is UNITS of the item; its price is computed by the platform from the catalog:
|
|
3473
|
+
* price of ONE period (with the chosen `options`) × units × `rental.periods.count`. Never send totals; an App that owns a rate
|
|
3474
|
+
* table sends only the rate of one period per line (`lines[].periodRateCents`, R2d).
|
|
3475
|
+
*/
|
|
3476
|
+
export interface CreateDirectRentalInput extends Omit<CreateDirectOrderInput, 'lines' | 'reopens' | 'allowOffCatalog' | 'maxOffCatalogLines' | 'offCatalogLines'> {
|
|
3477
|
+
lines: Array<{
|
|
3478
|
+
productId: string;
|
|
3479
|
+
/** Units of the item (2 backhoes). */
|
|
3480
|
+
quantity: number;
|
|
3481
|
+
/** The choice for a product with option groups (con operador, combustible, transporte…). */
|
|
3482
|
+
options?: CatalogOptionChoice[];
|
|
3483
|
+
/**
|
|
3484
|
+
* PDK-RENTAL-AVAILABILITY R2d — the rate of ONE unit for ONE period (cents) from YOUR rate table (a machine is
|
|
3485
|
+
* $135.000/hora, $1.000.000/día, …). It replaces the catalog price; the chosen `options` deltas are still added and
|
|
3486
|
+
* the platform multiplies by units × `rental.periods.count`. Only for an App (an sk_ key bound to an App): 403 without it.
|
|
3487
|
+
* A positive integer; 400 `price overflow` when rate × units × periods would exceed 2147483647 cents (int32).
|
|
3488
|
+
* The same product on two lines must use the same rate. Send the SAME unit as `rental.periods.unit`.
|
|
3489
|
+
*/
|
|
3490
|
+
periodRateCents?: number;
|
|
3491
|
+
}>;
|
|
3492
|
+
rental: {
|
|
3493
|
+
/** ISO instants with their offset (Z or ±hh:mm); at most 366 days apart. */
|
|
3494
|
+
startsAt: string;
|
|
3495
|
+
endsAt: string;
|
|
3496
|
+
/** IANA zone the business reads the range in. */
|
|
3497
|
+
timezone: string;
|
|
3498
|
+
periods: {
|
|
3499
|
+
/** The unit the product is priced in. */
|
|
3500
|
+
unit: RentalPeriodUnit;
|
|
3501
|
+
/** Optional: defaults to the periods the range spans (the last partial one counted). May be higher (a minimum of 3 days), never lower. */
|
|
3502
|
+
count?: number;
|
|
3503
|
+
};
|
|
3504
|
+
};
|
|
3505
|
+
/** `review` (default): the business accepts it (`submitted`); `instant`: `confirmed` as it is made (your ledger guarantees the units). */
|
|
3506
|
+
confirmation?: 'review' | 'instant';
|
|
3507
|
+
}
|
|
3508
|
+
/** `PATCH /api/v1/cases/:id/rental` — reschedule or extend: the new range (you already hold it). */
|
|
3509
|
+
export interface UpdateCaseRentalInput {
|
|
3510
|
+
startsAt: string;
|
|
3511
|
+
endsAt: string;
|
|
3512
|
+
/** Default: the rental's own zone. */
|
|
3513
|
+
timezone?: string;
|
|
3514
|
+
/** Default: the rental's own unit, count derived from the new range. */
|
|
3515
|
+
periods?: {
|
|
3516
|
+
unit?: RentalPeriodUnit;
|
|
3517
|
+
count?: number;
|
|
3518
|
+
};
|
|
3519
|
+
/**
|
|
3520
|
+
* R2d — the rate of one period for the new `periods.unit` (App sk_ key only). Rates sent earlier stay for the products
|
|
3521
|
+
* not listed; after a change of period unit send the new rate or the old one (of the other unit) is kept. Same validation as on create.
|
|
3522
|
+
*/
|
|
3523
|
+
lines?: Array<{
|
|
3524
|
+
productId: string;
|
|
3525
|
+
periodRateCents: number;
|
|
3526
|
+
quantity?: number;
|
|
3527
|
+
}>;
|
|
3528
|
+
}
|
|
3427
3529
|
/** `POST /api/v1/cases/:id/slot` — the new time (you already hold it), optionally another member. */
|
|
3428
3530
|
export interface MoveCaseSlotInput {
|
|
3429
3531
|
startsAt: string;
|
|
@@ -3433,6 +3535,7 @@ export interface MoveCaseSlotInput {
|
|
|
3433
3535
|
assigneeName?: string;
|
|
3434
3536
|
}
|
|
3435
3537
|
import type { AppBillingWebhookEvent } from './resources/billing';
|
|
3538
|
+
import type { ContactPropertiesPatch } from './resources/contacts';
|
|
3436
3539
|
export type AppCaseWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request' | 'case.payment_changed' | 'case.proposal';
|
|
3437
3540
|
export type AppWebhookEventName = AppCaseWebhookEventName | 'conversation.message' | 'channel.status_changed' | 'billing.plan_changed' | 'billing.trial_ended';
|
|
3438
3541
|
export interface AppWebhook {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.88.0",
|
|
4
4
|
"description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken, ak_live_ API key or App secret (sk_live_), with App installations across tenants.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|