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
↳
GroupMemberships
Table of contents
Constructors
Properties
Accessors
Methods
- _rawRequest
- bulkCreate
- bulkDelete
- create
- createByUser
- delete
- deleteByUser
- emit
- get
- getAll
- list
- listAssignable
- listAssignableByGroup
- listByGroup
- listByUser
- makeDefault
- on
- patch
- post
- put
- request
- requestAll
- requestUpload
- setSideLoad
- show
- showByUser
Constructors
constructor
• new GroupMemberships(options
): GroupMemberships
Parameters
Name | Type |
---|---|
options | any |
Returns
Overrides
Defined in
clients/core/groupmemberships.d.ts:6
Properties
_transporter
• _transporter: Transporter
Inherited from
Defined in
clients/client.d.ts:94
eventTarget
• eventTarget: CustomEventTarget
Event target to handle custom events.
Inherited from
Defined in
clients/client.d.ts:92
jsonAPINames
• jsonAPINames: string
[]
Array to hold names used in the JSON API.
Overrides
Defined in
clients/core/groupmemberships.d.ts:7
options
• options: ClientOptions
& { get
: (key
: string
) => any
}
Configuration options for the client.
Inherited from
Defined in
clients/client.d.ts:86
sideLoad
• sideLoad: any
[]
Array to handle side-loaded resources.
Inherited from
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
Defined in
clients/client.d.ts:91
Accessors
transporter
• get
transporter(): Transporter
Transporter for making requests.
Returns
Inherited from
Client.transporter
Defined in
clients/client.d.ts:93
Methods
_rawRequest
▸ _rawRequest(method
, uri
, ...args
): Promise
<{ response
: any
; result
: {} }>
Parameters
Name | Type |
---|---|
method | any |
uri | any |
...args | any [] |
Returns
Promise
<{ response
: any
; result
: {} }>
Inherited from
Defined in
clients/client.d.ts:130
bulkCreate
▸ bulkCreate(groupMemberships
): Promise
<object
>
Bulk create group memberships.
Parameters
Name | Type | Description |
---|---|---|
groupMemberships | any [] | 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
Example
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
Name | Type | Description |
---|---|---|
ids | number [] | 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
Example
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
Name | Type | Description |
---|---|---|
groupMembership | object | The 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
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
Name | Type | Description |
---|---|---|
userID | number | The ID of the user. |
groupMembership | object | The 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
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
Name | Type | Description |
---|---|---|
groupMembershipID | number | The 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
await client.groupmemberships.delete(123);
Overrides
Defined in
clients/core/groupmemberships.d.ts:96
deleteByUser
▸ deleteByUser(userID
, groupMembershipID
): Promise
<void
>
Delete a group membership by user ID.
Parameters
Name | Type | Description |
---|---|---|
userID | number | The ID of the user. |
groupMembershipID | number | The 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
await client.groupmemberships.deleteByUser(123, 456);
Defined in
clients/core/groupmemberships.d.ts:108
emit
▸ emit(eventType
, eventData
): void
Parameters
Name | Type |
---|---|
eventType | any |
eventData | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:95
get
▸ get(resource
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:114
getAll
▸ getAll(resource
): Promise
<any
[]>
Parameters
Name | Type |
---|---|
resource | any |
Returns
Promise
<any
[]>
Inherited from
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
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
Example
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
Name | Type | Description |
---|---|---|
groupID | number | The 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
Example
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
Name | Type | Description |
---|---|---|
groupID | number | The 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
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
Name | Type | Description |
---|---|---|
userID | number | The 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
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
Name | Type | Description |
---|---|---|
userID | number | The ID of the user. |
groupMembershipID | number | The ID of the group membership. |
Returns
Promise
<object
>
Updated group membership.
Async
Throws
Throws an error if the operation fails.
See
Example
const updatedMembership = await client.groupmemberships.makeDefault(123, 456);
Defined in
clients/core/groupmemberships.d.ts:120
on
▸ on(eventType
, callback
): void
Parameters
Name | Type |
---|---|
eventType | any |
callback | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:96
patch
▸ patch(...args
): Promise
<void
| object
>
Patches a resource.
Parameters
Name | Type | Description |
---|---|---|
...args | any [] | The resources or parts of the resource path followed by the body. |
Returns
Promise
<void
| object
>
- Either void or response object
Inherited from
Defined in
clients/client.d.ts:120
post
▸ post(resource
, body
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
body | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:122
put
▸ put(resource
, body
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
body | any |
Returns
Promise
<NodeModule
>
Inherited from
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
Name | Type | Description |
---|---|---|
method | string | HTTP method (e.g., 'GET', 'POST'). |
uri | string | The URI for the request. |
...args | any [] | Additional arguments for the request. |
Returns
Promise
<NodeModule
>
- The API response.
Inherited from
Defined in
clients/client.d.ts:148
requestAll
▸ requestAll(method
, uri
, ...args
): Promise
<any
[]>
Parameters
Name | Type |
---|---|
method | any |
uri | any |
...args | any [] |
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:149
requestUpload
▸ requestUpload(uri
, file
): Promise
<any
>
Parameters
Name | Type |
---|---|
uri | any |
file | any |
Returns
Promise
<any
>
Inherited from
Defined in
clients/client.d.ts:150
setSideLoad
▸ setSideLoad(array
): void
Parameters
Name | Type |
---|---|
array | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:113
show
▸ show(groupMembershipID
): Promise
<object
>
Show details of a specific group membership.
Parameters
Name | Type | Description |
---|---|---|
groupMembershipID | number | The 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
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
Name | Type | Description |
---|---|---|
userID | number | The ID of the user. |
groupMembershipID | number | The 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
const membershipDetails = await client.groupmemberships.showByUser(123, 456);
Defined in
clients/core/groupmemberships.d.ts:62