Skip to content

node-zendesk / Exports / clients/core/groupmemberships / GroupMemberships

Class: GroupMemberships

clients/core/groupmemberships.GroupMemberships

Represents a GroupMembership in Zendesk.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new GroupMemberships(options): GroupMemberships

Parameters

NameType
optionsany

Returns

GroupMemberships

Overrides

Client.constructor

Defined in

clients/core/groupmemberships.d.ts:6

Properties

_transporter

_transporter: Transporter

Inherited from

Client._transporter

Defined in

clients/client.d.ts:94


eventTarget

eventTarget: CustomEventTarget

Event target to handle custom events.

Inherited from

Client.eventTarget

Defined in

clients/client.d.ts:92


jsonAPINames

jsonAPINames: string[]

Array to hold names used in the JSON API.

Overrides

Client.jsonAPINames

Defined in

clients/core/groupmemberships.d.ts:7


options

options: ClientOptions & { get: (key: string) => any }

Configuration options for the client.

Inherited from

Client.options

Defined in

clients/client.d.ts:86


sideLoad

sideLoad: any[]

Array to handle side-loaded resources.

Inherited from

Client.sideLoad

Defined in

clients/client.d.ts:89


sideLoadMap

sideLoadMap: { dataset: string ; field: string ; name: string }[]

Defined in

clients/core/groupmemberships.d.ts:8


useDotJson

useDotJson: boolean

Flag to indicate if the API endpoint should use '.json' ending.

Inherited from

Client.useDotJson

Defined in

clients/client.d.ts:91

Accessors

transporter

get transporter(): Transporter

Transporter for making requests.

Returns

Transporter

Inherited from

Client.transporter

Defined in

clients/client.d.ts:93

Methods

_rawRequest

_rawRequest(method, uri, ...args): Promise<{ response: any ; result: {} }>

Parameters

NameType
methodany
uriany
...argsany[]

Returns

Promise<{ response: any ; result: {} }>

Inherited from

Client._rawRequest

Defined in

clients/client.d.ts:130


bulkCreate

bulkCreate(groupMemberships): Promise<object>

Bulk create group memberships.

Parameters

NameTypeDescription
groupMembershipsany[]Array of group memberships to be created.

Returns

Promise<object>

Job status indicating the progress of the bulk create operation.

Async

Throws

Throws an error if the request fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#bulk-create-memberships

Example

ts
const jobStatus = await client.groupmemberships.bulkCreate([{ user_id: 72, group_id: 88 }, { user_id: 73, group_id: 88 }]);

Defined in

clients/core/groupmemberships.d.ts:152


bulkDelete

bulkDelete(ids): Promise<object>

Bulk delete group memberships.

Parameters

NameTypeDescription
idsnumber[]Array of group membership IDs to be deleted.

Returns

Promise<object>

Response object indicating the result of the bulk delete operation.

Async

Throws

Throws an error if the request fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#bulk-delete-memberships

Example

ts
const response = await client.groupmemberships.bulkDelete([1, 2, 3]);

Defined in

clients/core/groupmemberships.d.ts:163


create

create(groupMembership): Promise<object>

Create a new group membership.

Parameters

NameTypeDescription
groupMembershipobjectThe group membership details.

Returns

Promise<object>

The created group membership.

Async

Throws

Throws an error if the creation fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#create-membership

Example

ts
const newMembership = await client.groupmemberships.create({user_id: 72, group_id: 88});

Defined in

clients/core/groupmemberships.d.ts:73


createByUser

createByUser(userID, groupMembership): Promise<object>

Create a new group membership by user ID.

Parameters

NameTypeDescription
userIDnumberThe ID of the user.
groupMembershipobjectThe group membership details.

Returns

Promise<object>

The created group membership.

Async

Throws

Throws an error if the creation fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#create-membership

Example

ts
const newMembership = await client.groupmemberships.createByUser(123, {group_id: 88});

Defined in

clients/core/groupmemberships.d.ts:85


delete

delete(groupMembershipID): Promise<void>

Delete a group membership.

Parameters

NameTypeDescription
groupMembershipIDnumberThe ID of the group membership.

Returns

Promise<void>

Async

Throws

Throws an error if the deletion fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#delete-membership

Example

ts
await client.groupmemberships.delete(123);

Overrides

Client.delete

Defined in

clients/core/groupmemberships.d.ts:96


deleteByUser

deleteByUser(userID, groupMembershipID): Promise<void>

Delete a group membership by user ID.

Parameters

NameTypeDescription
userIDnumberThe ID of the user.
groupMembershipIDnumberThe ID of the group membership.

Returns

Promise<void>

Async

Throws

Throws an error if the deletion fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#delete-membership

Example

ts
await client.groupmemberships.deleteByUser(123, 456);

Defined in

clients/core/groupmemberships.d.ts:108


emit

emit(eventType, eventData): void

Parameters

NameType
eventTypeany
eventDataany

Returns

void

Inherited from

Client.emit

Defined in

clients/client.d.ts:95


get

get(resource): Promise<NodeModule>

Parameters

NameType
resourceany

Returns

Promise<NodeModule>

Inherited from

Client.get

Defined in

clients/client.d.ts:114


getAll

getAll(resource): Promise<any[]>

Parameters

NameType
resourceany

Returns

Promise<any[]>

Inherited from

Client.getAll

Defined in

clients/client.d.ts:129


list

list(): Promise<object[]>

List all group memberships.

Returns

Promise<object[]>

Array of group memberships.

Async

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-memberships

Example

ts
const memberships = await client.groupmemberships.list();

Defined in

clients/core/groupmemberships.d.ts:21


listAssignable

listAssignable(): Promise<any[]>

List all assignable group memberships.

Returns

Promise<any[]>

List of assignable group memberships.

Async

Throws

Throws an error if the request fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-assignable-memberships

Example

ts
const memberships = await client.groupmemberships.listAssignable();

Defined in

clients/core/groupmemberships.d.ts:130


listAssignableByGroup

listAssignableByGroup(groupID): Promise<any[]>

List all assignable group memberships by group.

Parameters

NameTypeDescription
groupIDnumberThe ID of the group.

Returns

Promise<any[]>

List of assignable group memberships for the specified group.

Async

Throws

Throws an error if the request fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-assignable-memberships

Example

ts
const memberships = await client.groupmemberships.listAssignableByGroup(12345);

Defined in

clients/core/groupmemberships.d.ts:141


listByGroup

listByGroup(groupID): Promise<object[]>

List group memberships by group ID.

Parameters

NameTypeDescription
groupIDnumberThe ID of the group.

Returns

Promise<object[]>

Array of group memberships.

Async

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-memberships

Example

ts
const memberships = await client.groupmemberships.listByGroup(123);

Defined in

clients/core/groupmemberships.d.ts:41


listByUser

listByUser(userID): Promise<object[]>

List group memberships by user ID.

Parameters

NameTypeDescription
userIDnumberThe ID of the user.

Returns

Promise<object[]>

Array of group memberships.

Async

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#list-memberships

Example

ts
const memberships = await client.groupmemberships.listByUser(123);

Defined in

clients/core/groupmemberships.d.ts:31


makeDefault

makeDefault(userID, groupMembershipID): Promise<object>

Set a group membership as default.

Parameters

NameTypeDescription
userIDnumberThe ID of the user.
groupMembershipIDnumberThe ID of the group membership.

Returns

Promise<object>

Updated group membership.

Async

Throws

Throws an error if the operation fails.

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#set-membership-as-default

Example

ts
const updatedMembership = await client.groupmemberships.makeDefault(123, 456);

Defined in

clients/core/groupmemberships.d.ts:120


on

on(eventType, callback): void

Parameters

NameType
eventTypeany
callbackany

Returns

void

Inherited from

Client.on

Defined in

clients/client.d.ts:96


patch

patch(...args): Promise<void | object>

Patches a resource.

Parameters

NameTypeDescription
...argsany[]The resources or parts of the resource path followed by the body.

Returns

Promise<void | object>

  • Either void or response object

Inherited from

Client.patch

Defined in

clients/client.d.ts:120


post

post(resource, body): Promise<NodeModule>

Parameters

NameType
resourceany
bodyany

Returns

Promise<NodeModule>

Inherited from

Client.post

Defined in

clients/client.d.ts:122


put

put(resource, body): Promise<NodeModule>

Parameters

NameType
resourceany
bodyany

Returns

Promise<NodeModule>

Inherited from

Client.put

Defined in

clients/client.d.ts:121


request

request<T>(method, uri, ...args): Promise<NodeModule>

Request method that handles various HTTP methods.

Type parameters

Name
T

Parameters

NameTypeDescription
methodstringHTTP method (e.g., 'GET', 'POST').
uristringThe URI for the request.
...argsany[]Additional arguments for the request.

Returns

Promise<NodeModule>

  • The API response.

Inherited from

Client.request

Defined in

clients/client.d.ts:148


requestAll

requestAll(method, uri, ...args): Promise<any[]>

Parameters

NameType
methodany
uriany
...argsany[]

Returns

Promise<any[]>

Inherited from

Client.requestAll

Defined in

clients/client.d.ts:149


requestUpload

requestUpload(uri, file): Promise<any>

Parameters

NameType
uriany
fileany

Returns

Promise<any>

Inherited from

Client.requestUpload

Defined in

clients/client.d.ts:150


setSideLoad

setSideLoad(array): void

Parameters

NameType
arrayany

Returns

void

Inherited from

Client.setSideLoad

Defined in

clients/client.d.ts:113


show

show(groupMembershipID): Promise<object>

Show details of a specific group membership.

Parameters

NameTypeDescription
groupMembershipIDnumberThe ID of the group membership.

Returns

Promise<object>

Details of the group membership.

Async

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#show-membership

Example

ts
const membershipDetails = await client.groupmemberships.show(123);

Defined in

clients/core/groupmemberships.d.ts:51


showByUser

showByUser(userID, groupMembershipID): Promise<object>

Show details of a group membership by user ID.

Parameters

NameTypeDescription
userIDnumberThe ID of the user.
groupMembershipIDnumberThe ID of the group membership.

Returns

Promise<object>

Details of the group membership.

Async

See

https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/#show-membership

Example

ts
const membershipDetails = await client.groupmemberships.showByUser(123, 456);

Defined in

clients/core/groupmemberships.d.ts:62

Released under the MIT License.