fastify-xwhatconverts
accounts.update
Update a WhatConverts account's name. Requires Agency Key.
accounts.update
Update an existing account. Requires an Agency (Master) API Key.
Signature
fastify.xwhatconverts.accounts.update(
accountId: string,
params: { accountName: string }
): Promise<object>
Params
| Name | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | ID of the account to update. |
params.accountName | string | Yes | New name for the account. |
Returns
The updated WhatConverts account object.
Throws
[xWhatConverts] accounts.update: accountId is required— called withoutaccountId.[xWhatConverts] accounts.update: params object is required— called without a params object.[xWhatConverts] Network error: <message>— network-level failure.[xWhatConverts] API error: <status>— non-2xx response from WhatConverts.
Examples
Basic — rename an account
const account = await fastify.xwhatconverts.accounts.update("555", {
accountName: "Acme Corp (Renamed)",
});
console.log(account.account_name);
Realistic — rename account on client record update
fastify.put("/clients/:accountId", async (request, reply) => {
const { accountId } = request.params;
const { name } = request.body;
const account = await fastify.xwhatconverts.accounts.update(accountId, {
accountName: name,
});
return { accountId: account.account_id, name: account.account_name };
});
See Also
- accounts.get — fetch the current account state
- accounts.delete — delete an account
AI Context
package: "@xenterprises/fastify-xwhatconverts"
method: fastify.xwhatconverts.accounts.update(accountId, params)
use-when: Update a WhatConverts account's name — requires Agency (Master) API key
params: accountId (string, required), accountName (string, required)
returns: updated WhatConverts account object
