MCPcopy Create free account
hub / github.com/apitable/apitable / updateDescription

Method updateDescription

packages/widget-sdk/src/model/field.ts:264–287  ·  view source on GitHub ↗

* Updates the description for this field. * * Throws an error if the user does not have permission to update the field, or if an invalid description is provided. * * @param description new description for the field * @returns * * #### Example * ```js * field.updateDescr

(description: string | null)

Source from the content-addressed store, hash-verified

262 * ```
263 */
264 updateDescription(description: string | null): Promise<void> {
265 const desc = description || undefined;
266 if (description && description.length > MAX_DESC) {
267 throw new Error('Description exceeds the maximum length limit of 200');
268 }
269 return new Promise(async(resolve) => {
270 const result: ICollaCommandExecuteResult<any> = await cmdExecute({
271 cmd: CollaCommandName.SetFieldAttr,
272 datasheetId: this.datasheetId,
273 fieldId: this.fieldData.id,
274 data: {
275 ...this.fieldData,
276 desc
277 }
278 }, this.wCtx.id);
279 if (result.result === ExecuteResult.Fail) {
280 throw new Error(result.reason);
281 }
282 if (result.result === ExecuteResult.None) {
283 throw new Error('update description method has been ignored');
284 }
285 resolve();
286 });
287 }
288
289 /**
290 *

Callers 1

Calls 1

cmdExecuteFunction · 0.90

Tested by

no test coverage detected