@mitumba/sdk 5.31.0 → 5.33.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.mts +328 -5
- package/dist/index.d.ts +328 -5
- package/dist/index.js +148 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2312,7 +2312,8 @@ var StoresModule = class {
|
|
|
2312
2312
|
);
|
|
2313
2313
|
}
|
|
2314
2314
|
/**
|
|
2315
|
-
*
|
|
2315
|
+
* The shops the authenticated user works in, owned or joined, each with their role in it and the
|
|
2316
|
+
* permissions it grants. Show only the actions those permissions allow.
|
|
2316
2317
|
*/
|
|
2317
2318
|
async getMyStores(options) {
|
|
2318
2319
|
return this.client.get("/listings/stores/mine", void 0, options);
|
|
@@ -2460,9 +2461,11 @@ var StoresModule = class {
|
|
|
2460
2461
|
return this.client.delete(this.destinationPath(storeId, destinationId, "/default"), void 0, options);
|
|
2461
2462
|
}
|
|
2462
2463
|
/**
|
|
2463
|
-
* Owner: remove a destination, or cancel one still cooling off.
|
|
2464
|
+
* Owner: remove a destination, or cancel one still cooling off. The current default cannot be
|
|
2465
|
+
* removed: make another destination the default first, and remove this one once that applies.
|
|
2466
|
+
* Needs a recent second factor.
|
|
2464
2467
|
*
|
|
2465
|
-
* Errors: 403 store_forbidden, step_up_required; 404 not_found.
|
|
2468
|
+
* Errors: 403 store_forbidden, step_up_required; 404 not_found; 409 default_destination.
|
|
2466
2469
|
*/
|
|
2467
2470
|
async removePayoutDestination(storeId, destinationId, options) {
|
|
2468
2471
|
return this.client.delete(this.destinationPath(storeId, destinationId, ""), void 0, options);
|
|
@@ -2470,6 +2473,112 @@ var StoresModule = class {
|
|
|
2470
2473
|
destinationPath(storeId, destinationId, suffix) {
|
|
2471
2474
|
return `/listings/stores/${encodeURIComponent(storeId)}/payout-destinations/${encodeURIComponent(destinationId)}${suffix}`;
|
|
2472
2475
|
}
|
|
2476
|
+
// ── Team ──────────────────────────────────────────────────────────────────
|
|
2477
|
+
/**
|
|
2478
|
+
* The shop's members, and the roles the caller may give. `store:members.manage`.
|
|
2479
|
+
*
|
|
2480
|
+
* Errors: 403 store_forbidden; 404 not_found.
|
|
2481
|
+
*/
|
|
2482
|
+
async getMembers(storeId, options) {
|
|
2483
|
+
return this.client.get(`${this.storePath(storeId)}/members`, void 0, options);
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* Change a member's role. The owner manages every role; a manager, the roles below manager.
|
|
2487
|
+
* Needs a second factor used in the last 10 minutes.
|
|
2488
|
+
*
|
|
2489
|
+
* Errors: 400 invalid_input; 403 store_forbidden, step_up_required, role_not_allowed; 404 member_not_found.
|
|
2490
|
+
*/
|
|
2491
|
+
async changeMemberRole(storeId, memberId, role, options) {
|
|
2492
|
+
return this.client.patch(`${this.storePath(storeId)}/members/${encodeURIComponent(memberId)}`, { role }, options);
|
|
2493
|
+
}
|
|
2494
|
+
/**
|
|
2495
|
+
* Remove a member. They lose access on their next request. Needs a recent second factor.
|
|
2496
|
+
*
|
|
2497
|
+
* Errors: 403 store_forbidden, step_up_required, role_not_allowed; 404 member_not_found.
|
|
2498
|
+
*/
|
|
2499
|
+
async removeMember(storeId, memberId, options) {
|
|
2500
|
+
return this.client.delete(`${this.storePath(storeId)}/members/${encodeURIComponent(memberId)}`, void 0, options);
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Leave a shop's team. The owner cannot leave their own shop.
|
|
2504
|
+
*
|
|
2505
|
+
* Errors: 404 member_not_found; 409 owner_cannot_leave.
|
|
2506
|
+
*/
|
|
2507
|
+
async leave(storeId, options) {
|
|
2508
|
+
return this.client.post(`${this.storePath(storeId)}/leave`, void 0, options);
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Invite someone by email address or Kenyan phone number. The answer is the same whether or not an
|
|
2512
|
+
* account uses the address. Needs a recent second factor. The invitation lasts 7 days.
|
|
2513
|
+
*
|
|
2514
|
+
* Errors: 400 invalid_input, invalid_address; 403 store_forbidden, step_up_required, role_not_allowed;
|
|
2515
|
+
* 404 not_found; 409 too_many_invitations.
|
|
2516
|
+
*/
|
|
2517
|
+
async invite(storeId, input, options) {
|
|
2518
|
+
return this.client.post(`${this.storePath(storeId)}/invitations`, input, options);
|
|
2519
|
+
}
|
|
2520
|
+
/**
|
|
2521
|
+
* The shop's open invitations, newest first. `store:members.manage`.
|
|
2522
|
+
*
|
|
2523
|
+
* Errors: 403 store_forbidden; 404 not_found.
|
|
2524
|
+
*/
|
|
2525
|
+
async getInvitations(storeId, options) {
|
|
2526
|
+
return this.client.get(`${this.storePath(storeId)}/invitations`, void 0, options);
|
|
2527
|
+
}
|
|
2528
|
+
/**
|
|
2529
|
+
* Revoke an open invitation. Needs a recent second factor.
|
|
2530
|
+
*
|
|
2531
|
+
* Errors: 403 store_forbidden, step_up_required, role_not_allowed; 404 invitation_not_found.
|
|
2532
|
+
*/
|
|
2533
|
+
async revokeInvitation(storeId, invitationId, options) {
|
|
2534
|
+
return this.client.delete(`${this.storePath(storeId)}/invitations/${encodeURIComponent(invitationId)}`, void 0, options);
|
|
2535
|
+
}
|
|
2536
|
+
/** Invitations the caller received and can still answer, newest first. */
|
|
2537
|
+
async getReceivedInvitations(options) {
|
|
2538
|
+
return this.client.get("/listings/store-invitations", void 0, options);
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* Join a shop. Needs a verified phone number; the manager role also needs a recent second factor.
|
|
2542
|
+
*
|
|
2543
|
+
* Errors: 403 step_up_required; 404 invitation_not_found, not_found; 409 phone_not_verified,
|
|
2544
|
+
* membership_limit, already_member.
|
|
2545
|
+
*/
|
|
2546
|
+
async acceptInvitation(invitationId, options) {
|
|
2547
|
+
return this.client.post(`/listings/store-invitations/${encodeURIComponent(invitationId)}/accept`, void 0, options);
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Decline an invitation.
|
|
2551
|
+
*
|
|
2552
|
+
* Errors: 404 invitation_not_found.
|
|
2553
|
+
*/
|
|
2554
|
+
async declineInvitation(invitationId, options) {
|
|
2555
|
+
return this.client.post(`/listings/store-invitations/${encodeURIComponent(invitationId)}/decline`, void 0, options);
|
|
2556
|
+
}
|
|
2557
|
+
/**
|
|
2558
|
+
* The shop's audit log, newest first, 50 per page. `store:audit.read`.
|
|
2559
|
+
*
|
|
2560
|
+
* Errors: 403 store_forbidden; 404 not_found.
|
|
2561
|
+
*/
|
|
2562
|
+
async getAuditLog(storeId, params, options) {
|
|
2563
|
+
return this.client.get(`${this.storePath(storeId)}/audit`, params, options);
|
|
2564
|
+
}
|
|
2565
|
+
// ── Shop limit ────────────────────────────────────────────────────────────
|
|
2566
|
+
/** The caller's shop limit, how many shops they own, and their latest request for more. */
|
|
2567
|
+
async getStoreLimit(options) {
|
|
2568
|
+
return this.client.get("/listings/store-limit-request", void 0, options);
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Ask for a higher shop limit, at the limit, with a reason of at least 30 characters. One request
|
|
2572
|
+
* at a time.
|
|
2573
|
+
*
|
|
2574
|
+
* Errors: 400 invalid_input; 403 not_a_retail_seller; 409 not_at_limit, request_pending.
|
|
2575
|
+
*/
|
|
2576
|
+
async requestStoreLimit(input, options) {
|
|
2577
|
+
return this.client.post("/listings/store-limit-request", input, options);
|
|
2578
|
+
}
|
|
2579
|
+
storePath(storeId) {
|
|
2580
|
+
return `/listings/stores/${encodeURIComponent(storeId)}`;
|
|
2581
|
+
}
|
|
2473
2582
|
};
|
|
2474
2583
|
function stepUpRequired(error) {
|
|
2475
2584
|
return error instanceof APIError && error.code === "step_up_required";
|
|
@@ -2900,6 +3009,42 @@ var AdminModule = class {
|
|
|
2900
3009
|
async disbursePayout(payoutId, options) {
|
|
2901
3010
|
return this.client.post(`/admin/payouts/${payoutId}/disburse`, void 0, options);
|
|
2902
3011
|
}
|
|
3012
|
+
// ── Refunds ──
|
|
3013
|
+
/**
|
|
3014
|
+
* Refunds owed to buyers, newest first, 25 per page. `admin:read`.
|
|
3015
|
+
*
|
|
3016
|
+
* Errors: 400 invalid_input (unknown status).
|
|
3017
|
+
*/
|
|
3018
|
+
async listRefunds(params, options) {
|
|
3019
|
+
return this.client.get("/admin/refunds", params, options);
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* Send a pending refund to the number that paid. `payouts:disburse` with a recent passkey.
|
|
3023
|
+
*
|
|
3024
|
+
* Errors: 403 forbidden; 404 refund_not_found; 409 refund_sandbox_payment, refund_number_unavailable;
|
|
3025
|
+
* 503 refund_disbursement_paused, refund_method_unsupported.
|
|
3026
|
+
*/
|
|
3027
|
+
async sendRefund(refundId, options) {
|
|
3028
|
+
return this.client.post(`/admin/refunds/${encodeURIComponent(refundId)}/send`, void 0, options);
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* Requests for a higher shop limit, 25 per page: pending oldest first, decided latest first.
|
|
3032
|
+
* `admin:read`.
|
|
3033
|
+
*
|
|
3034
|
+
* Errors: 400 invalid_input (unknown status).
|
|
3035
|
+
*/
|
|
3036
|
+
async listShopLimitRequests(params, options) {
|
|
3037
|
+
return this.client.get("/admin/shop-limit-requests", params, options);
|
|
3038
|
+
}
|
|
3039
|
+
/**
|
|
3040
|
+
* Approve a request with a new limit (above the current one, at most 50), or reject it with a note
|
|
3041
|
+
* of at least 10 characters. The owner is told. `sellers:verify`.
|
|
3042
|
+
*
|
|
3043
|
+
* Errors: 400 invalid_input; 403 forbidden; 404 not_found (not pending).
|
|
3044
|
+
*/
|
|
3045
|
+
async decideShopLimitRequest(requestId, input, options) {
|
|
3046
|
+
return this.client.post(`/admin/shop-limit-requests/${encodeURIComponent(requestId)}/decide`, input, options);
|
|
3047
|
+
}
|
|
2903
3048
|
// ── Reports Moderation ──
|
|
2904
3049
|
async listReports(params, options) {
|
|
2905
3050
|
return this.client.get("/admin/reports", params, options);
|