UNPKG

@fairmint/canton-node-sdk

Version:
46 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AllocateParty = exports.AllocatePartyParamsSchema = void 0; const core_1 = require("../../../../../core"); const zod_1 = require("zod"); // Schema for the parameters exports.AllocatePartyParamsSchema = zod_1.z.object({ /** Party ID hint (required) */ partyIdHint: zod_1.z.string(), /** Identity provider ID (required) */ identityProviderId: zod_1.z.string(), /** Local metadata (optional) */ localMetadata: zod_1.z.object({ resourceVersion: zod_1.z.string().optional(), annotations: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(), }).optional(), }); /** * @description Allocate a new party to the participant node * @example * ```typescript * const result = await client.allocateParty({ * partyIdHint: 'alice', * identityProviderId: 'default' * }); * console.log(`Allocated party: ${result.partyDetails.party}`); * ``` */ exports.AllocateParty = (0, core_1.createApiOperation)({ paramsSchema: exports.AllocatePartyParamsSchema, method: 'POST', buildUrl: (_params, apiUrl) => `${apiUrl}/v2/parties`, buildRequestData: (params, _client) => { return { partyIdHint: params.partyIdHint ?? '', identityProviderId: params.identityProviderId ?? '', ...(params.localMetadata && { localMetadata: { resourceVersion: params.localMetadata.resourceVersion ?? '', annotations: params.localMetadata.annotations ?? {}, }, }), }; }, }); //# sourceMappingURL=post.js.map