mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
🤖 Merge PR #46172 feat(node-zendesk) redefine user fields type and usage by @peterblazejewicz
- provide closed list of custom field type: https://developer.zendesk.com/rest_api/docs/support/user_fields#create-user-fields - provide interface for custom user field itself: https://developer.zendesk.com/rest_api/docs/support/user_fields#json-forma://developer.zendesk.com/rest_api/docs/support/user_fields#json-format - tests amended /cc @hisham Thanks! Closes #46163
This commit is contained in:
parent
d3f0f8302b
commit
d22b577f01
46
types/node-zendesk/index.d.ts
vendored
46
types/node-zendesk/index.d.ts
vendored
@ -1036,13 +1036,55 @@ export namespace Users {
|
||||
list(): Promise<unknown>;
|
||||
show(fieldId: ZendeskID, cb: ZendeskCallback<unknown, unknown>): unknown;
|
||||
show(fieldId: ZendeskID): Promise<unknown>;
|
||||
create(field: unknown, cb: ZendeskCallback<unknown, unknown>): unknown;
|
||||
create(field: unknown): Promise<unknown>;
|
||||
create(field: CreateUserField, cb: ZendeskCallback<unknown, unknown>): unknown;
|
||||
create(field: CreateUserField): Promise<unknown>;
|
||||
create(field: CreateUserField, cb: ZendeskCallback<unknown, unknown>): unknown;
|
||||
update(fieldId: ZendeskID, field: unknown, cb: ZendeskCallback<unknown, unknown>): unknown;
|
||||
update(fieldId: ZendeskID, field: unknown): Promise<unknown>;
|
||||
delete(fieldId: ZendeskID, cb: ZendeskCallback<unknown, unknown>): unknown;
|
||||
delete(fieldId: ZendeskID): Promise<unknown>;
|
||||
}
|
||||
/**
|
||||
* Types of custom fields that can be created
|
||||
* @default 'text'
|
||||
*/
|
||||
type UserFieldType =
|
||||
| 'text'
|
||||
| 'textarea'
|
||||
| 'checkbox'
|
||||
| 'date'
|
||||
| 'integer'
|
||||
| 'decimal'
|
||||
| 'regexp'
|
||||
| 'tagger';
|
||||
|
||||
/**
|
||||
* Represents 'user_field'
|
||||
*/
|
||||
interface UserField {
|
||||
readonly id?: number;
|
||||
readonly url?: string;
|
||||
readonly type?: UserFieldType;
|
||||
key?: string;
|
||||
title: string;
|
||||
raw_title?: string;
|
||||
description?: string;
|
||||
raw_description?: string;
|
||||
position?: number;
|
||||
active?: boolean;
|
||||
readonly system?: boolean;
|
||||
regexp_for_validation?: string;
|
||||
created_at?: Date;
|
||||
updated_at?: Date;
|
||||
tag?: string;
|
||||
custom_field_options?: CustomFieldOptions[];
|
||||
}
|
||||
interface CreateUserField extends UserField {
|
||||
key: string;
|
||||
}
|
||||
interface CustomFieldOptions {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -160,3 +160,33 @@ client.useridentities.requestVerification(123, 234, zendeskCallback);
|
||||
client.useridentities.requestVerification(123, 234).then(zendeskCallback);
|
||||
client.useridentities.delete(123, 234, zendeskCallback);
|
||||
client.useridentities.delete(123, 234).then(zendeskCallback);
|
||||
|
||||
/** User Fields */
|
||||
client.userfields.create({
|
||||
title: 'Support description (type text is default)',
|
||||
description: 'This field describes the support plan this user has',
|
||||
position: 0,
|
||||
active: true,
|
||||
key: 'support_description'
|
||||
}, zendeskCallback);
|
||||
client.userfields.create({
|
||||
type: 'textarea',
|
||||
title: 'Support description',
|
||||
description: 'This field describes the support plan this user has',
|
||||
position: 0,
|
||||
active: true,
|
||||
key: 'support_description'
|
||||
}, zendeskCallback);
|
||||
client.userfields.create({
|
||||
type: 'tagger',
|
||||
title: 'Support description',
|
||||
description: 'This field describes the support plan this user has',
|
||||
position: 0,
|
||||
active: true,
|
||||
key: 'support_description',
|
||||
custom_field_options: [{
|
||||
id: 1,
|
||||
name: "Custom Fielld Option",
|
||||
value: 5,
|
||||
}]
|
||||
}, zendeskCallback);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user