queryGroupRequests( )
Creates a query to retrieve a list of create requests.
Description
The queryGroupRequests()
function builds a query to retrieve a list of all requests to create a group, and returns a GroupRequestsQueryBuilder
object.
The returned object contains the query definition which is typically used to run the query using the find()
function. You can refine the query by chaining GroupRequestQueryBuilder
functions onto the query. GroupRequestQueryBuilder
functions enable you to sort, filter, and control the results that queryGroupRequests()
returns.
queryGorupRequests()
runs with these GroupRequestsQueryBuilder
defaults, which you can override:
The following GroupRequestsQueryBuilder
functions are supported for queryGroupRequests()
. For a full description of the GroupRequests
object, see the object returned for the items
property in GroupRequestsQueryResult
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
status | eq() ,ne() ,exists() ,in() ,hasSome() |
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function queryGroupRequests(): GroupRequestsQueryBuilder
queryGroupRequests Parameters
This function does not take any parameters.
Returns
Return Type:
Was this helpful?
Query requests to create a group
1import { createRequests } from 'wix-groups.v2';23export function myQueryGroupRequestsFunction() {4 return createRequests.queryGroupRequests()5 .find()6 .then((queryResults) => {7 const items = queryResults.items;8 const firstItem = queryResults.items[0];9 const pageSize = queryResults.pageSize;10 const totalPages = queryResults.totalPages;11 const totalCount = queryResults.totalCount;12 const currentPage = queryResults.currentPage();13 const next = queryResults.next();14 const previous = queryResults.prev();15 const hasNext = queryResults.hasNext();16 const hasPrev = queryResults.hasPrev();17 const length = queryResults.length;1819 return items;20 })21 .catch((error) => {22 console.error(error);23 });24}2526/* Returns items:27 * {28 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7",29 * "status": "PENDING",30 * "group": {31 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7",32 * "name": "My Group Request 1",33 * "slug": "my-group-request-1",34 * "description": "Welcome to the group! You can connect with other members, get updates and share videos.",35 * "privacyStatus": "PUBLIC",36 * "coverImage": {37 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2dzcvx22~mv2.jpg/fossil.jpg#originWidth=800&originHeight=720",38 * "position": {39 * "x": 9,40 * "y": 441 * }42 * }43 * "memberTitle": "Employees",44 * "memberCount": 1,45 * "settings": {46 * "groupDetailsChangedPostEnabled": true,47 * "membersCanApprove": false,48 * "membersCanInvite": true,49 * "showMemberList": true,50 * "welcomeMemberPostEnabled": true51 * }52 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300",53 * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300",54 * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300",55 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"56 * }57 * },58 * {59 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221",60 * "status": "APPROVED",61 * "group": {62 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221",63 * "name": "My Group Request 2",64 * "slug": "my-group-request-2",65 * "description": "Welcome to the group! You can connect with other members, get updates and share videos.",66 * "privacyStatus": "PRIVATE",67 * "coverImage": {68 * "imageUrl": "wix:image://v1/ef9074e348009011fa9f2dzcvx22~mv2.jpg/house.jpg#originWidth=559&originHeight=399",69 * "position": {70 * "x": 30,71 * "y": 22572 * }73 * }74 * "memberTitle": "Friends",75 * "memberCount": 65,76 * "settings": {77 * "groupDetailsChangedPostEnabled": true,78 * "membersCanApprove": true,79 * "membersCanInvite": true,80 * "showMemberList": false,81 * "welcomeMemberPostEnabled": true82 * }83 * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300",84 * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300",85 * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300",86 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"87 * }88 * }89 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337",90 * "status": "REJECTED",91 * "rejectionReason": "This group has inappropriate content.",92 * "group": {93 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337",94 * "name": "My Group Request 3",95 * "slug": "my-group-request-3",96 * "description": "Welcome to the group! You can connect with other members, get updates and share videos.",97 * "privacyStatus": "PRIVATE",98 * "coverImage": {99 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2dzcvx22~mv2.jpg/friends.jpg#originWidth=4494&originHeight=2248",100 * "position": {101 * "x": 36,102 * "y": 87103 * }104 * }105 * "memberTitle": "Students",106 * "memberCount": 1,107 * "settings": {108 * "groupDetailsChangedPostEnabled": true,109 * "membersCanApprove": true,110 * "membersCanInvite": true,111 * "showMemberList": false,112 * "welcomeMemberPostEnabled": true113 * }114 * "lastActivityDate": "Mon Feb 04 2019 01:19:53 GMT+0300",115 * "_createdDate": "Mon Feb 04 2019 01:19:53 GMT+0300",116 * "_updatedDate": "Mon Feb 04 2019 01:19:53 GMT+0300",117 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"118 * }119 * }120 * ]121 */