Skip to content

node-zendeskDocs


node-zendesk / clients/core/groupmemberships / GroupMemberships

Class: GroupMemberships

Represents a GroupMembership in Zendesk.

See

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

Extends

Constructors

new GroupMemberships()

new GroupMemberships(options): GroupMemberships

Parameters

options: any

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:42


eventTarget

eventTarget: CustomEventTarget

Event target to handle custom events.

Inherited from

Client.eventTarget

Defined in

clients/client.d.ts:40


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: ZendeskClientOptions & object

Configuration options for the client.

Type declaration

get()

get: (key) => any

Parameters

key: string

Returns

any

Inherited from

Client.options

Defined in

clients/client.d.ts:34


sideLoad

sideLoad: any[]

Array to handle side-loaded resources.

Inherited from

Client.sideLoad

Defined in

clients/client.d.ts:37


sideLoadMap

sideLoadMap: object[]

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:39

Accessors

transporter

Get Signature

get transporter(): Transporter

Returns

Transporter

Transporter for making requests.

Inherited from

Client.transporter

Defined in

clients/client.d.ts:41

Methods

_rawRequest()

_rawRequest(method, uri, ...arguments_): Promise<object>

Parameters

method: any

uri: any

• ...arguments_: any[]

Returns

Promise<object>

response

response: any

result

result: object

Inherited from

Client._rawRequest

Defined in

clients/client.d.ts:78


bulkCreate()

bulkCreate(groupMemberships): Promise<object>

Bulk create group memberships.

Parameters

groupMemberships: any[]

Array of group memberships to be created.

Returns

Promise<object>

Job status indicating the progress of the bulk create operation.

response

response: object

result

result: object

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:154


bulkDelete()

bulkDelete(ids): Promise<object>

Bulk delete group memberships.

Parameters

ids: number[]

Array of group membership IDs to be deleted.

Returns

Promise<object>

Response object indicating the result of the bulk delete operation.

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:167


create()

create(groupMembership): Promise<object>

Create a new group membership.

Parameters

groupMembership: object

The group membership details.

Returns

Promise<object>

The created group membership.

response

response: object

result

result: object

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

userID: number

The ID of the user.

groupMembership: object

The group membership details.

Returns

Promise<object>

The created group membership.

response

response: object

result

result: object

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:87


delete()

delete(groupMembershipID): Promise<void>

Delete a group membership.

Parameters

groupMembershipID: number

The ID of the group membership.

Returns

Promise<void>

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:100


deleteByUser()

deleteByUser(userID, groupMembershipID): Promise<void>

Delete a group membership by user ID.

Parameters

userID: number

The ID of the user.

groupMembershipID: number

The ID of the group membership.

Returns

Promise<void>

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:111


emit()

emit(eventType, eventData): void

Parameters

eventType: any

eventData: any

Returns

void

Inherited from

Client.emit

Defined in

clients/client.d.ts:43


get()

get(resource): Promise<NodeModule>

Parameters

resource: any

Returns

Promise<NodeModule>

Inherited from

Client.get

Defined in

clients/client.d.ts:62


getAll()

getAll(resource): Promise<any[]>

Parameters

resource: any

Returns

Promise<any[]>

Inherited from

Client.getAll

Defined in

clients/client.d.ts:77


list()

list(): Promise<object[]>

List all group memberships.

Returns

Promise<object[]>

Array of group memberships.

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:20


listAssignable()

listAssignable(): Promise<any[]>

List all assignable group memberships.

Returns

Promise<any[]>

List of assignable group memberships.

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:134


listAssignableByGroup()

listAssignableByGroup(groupID): Promise<any[]>

List all assignable group memberships by group.

Parameters

groupID: number

The ID of the group.

Returns

Promise<any[]>

List of assignable group memberships for the specified group.

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:144


listByGroup()

listByGroup(groupID): Promise<object[]>

List group memberships by group ID.

Parameters

groupID: number

The ID of the group.

Returns

Promise<object[]>

Array of group memberships.

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:38


listByUser()

listByUser(userID): Promise<object[]>

List group memberships by user ID.

Parameters

userID: number

The ID of the user.

Returns

Promise<object[]>

Array of group memberships.

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:29


makeDefault()

makeDefault(userID, groupMembershipID): Promise<object>

Set a group membership as default.

Parameters

userID: number

The ID of the user.

groupMembershipID: number

The ID of the group membership.

Returns

Promise<object>

Updated group membership.

response

response: object

result

result: object

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:122


on()

on(eventType, callback): void

Parameters

eventType: any

callback: any

Returns

void

Inherited from

Client.on

Defined in

clients/client.d.ts:44


patch()

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

Patches a resource.

Parameters

• ...arguments_: any[]

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:68


post()

post(resource, body): Promise<NodeModule>

Parameters

resource: any

body: any

Returns

Promise<NodeModule>

Inherited from

Client.post

Defined in

clients/client.d.ts:70


put()

put(resource, body): Promise<NodeModule>

Parameters

resource: any

body: any

Returns

Promise<NodeModule>

Inherited from

Client.put

Defined in

clients/client.d.ts:69


request()

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

Request method that handles various HTTP methods.

Type Parameters

T

Parameters

method: string

HTTP method (e.g., 'GET', 'POST').

uri: string

The URI for the request.

• ...arguments_: any[]

Additional arguments for the request.

Returns

Promise<NodeModule>

  • The API response.

Inherited from

Client.request

Defined in

clients/client.d.ts:96


requestAll()

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

Parameters

method: any

uri: any

• ...arguments_: any[]

Returns

Promise<any[]>

Inherited from

Client.requestAll

Defined in

clients/client.d.ts:97


requestUpload()

requestUpload(uri, file): Promise<any>

Parameters

uri: any

file: any

Returns

Promise<any>

Inherited from

Client.requestUpload

Defined in

clients/client.d.ts:98


setSideLoad()

setSideLoad(array): void

Parameters

array: any

Returns

void

Inherited from

Client.setSideLoad

Defined in

clients/client.d.ts:61


show()

show(groupMembershipID): Promise<object>

Show details of a specific group membership.

Parameters

groupMembershipID: number

The ID of the group membership.

Returns

Promise<object>

Details of the group membership.

response

response: object

result

result: object

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:47


showByUser()

showByUser(userID, groupMembershipID): Promise<object>

Show details of a group membership by user ID.

Parameters

userID: number

The ID of the user.

groupMembershipID: number

The ID of the group membership.

Returns

Promise<object>

Details of the group membership.

response

response: object

result

result: object

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:60

Released under the MIT License.