Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- dogo8me2
- local HttpClient = require(script.HttpClient)
- local HttpService = game:GetService("HttpService")
- local GroupsAPI = {}
- -- https://groups.roblox.com/docs/index.html?urls.primaryName=Groups%20Api%20v1
- local API_URL = "https://groups.roproxy.com"
- --local API_KEY = "G1B00Od+3kmFne25y22x6tTTuxeNjpCrG7KjUyV8UJrZaOVr" -- dogo8me api key
- local API_KEY = "5gFT8kV2qE6gzw1RWnVwknU7Xu3j85R/rzYBFb94kOyRoI2g" -- group API key
- function GroupsAPI.GetGroupInformationByIds(groupIds: {number}): any
- local newUrl = API_URL .. "/v2/groups"
- return HttpClient.getRequest(newUrl, API_KEY, {["groupIds"] = groupIds})
- end
- function GroupsAPI.GetGroupInformationById(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets the Group's audit log.
- function GroupsAPI.GetGroupAuditLog(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/audit-log"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets the Group's name change history.
- function GroupsAPI.GetGroupNameChangeHistory(groupId: number, limit: string, cursor: string, sortOrder: string) -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/name-history"
- local dataBody = {
- ["limit"] = limit,
- ["cursor"] = cursor,
- ["sortOrder"] = sortOrder
- }
- return HttpClient.getRequest(newUrl, API_KEY, dataBody)
- end
- --Gets the Group's settings.
- function GroupsAPI.GetGroupSettings(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/settings"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Updates the group's settings.
- function GroupsAPI.UpdateGroupSettings(groupId: number, isApprovalRequired: boolean, areEnemiesAllowed: boolean, areGroupFundsVisible: boolean, areGroupGamesVisible: boolean): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/settings"
- local dataBody = {
- ["isApprovalRequired"] = isApprovalRequired,
- ["areEnemiesAllowed"] = areEnemiesAllowed,
- ["areGroupFundsVisible"] = areGroupFundsVisible,
- ["areGroupGamesVisible"] = areGroupGamesVisible
- }
- return HttpClient.patchRequest(newUrl, API_KEY, dataBody)
- end
- --Gets Group configuration contextual information.
- function GroupsAPI.GetGroupConfigurationMetadata(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/configuration/metadata"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets Groups contextual information: Max number of groups a user can be part of. Current number of groups a user is a member of. Whether to show/hide certain features based on device type.
- function GroupsAPI.GetGroupMetadata(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/metadata"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Creates a new group.
- function GroupsAPI.CreateNewGroup(name: string, description: string, publicGroup: boolean, buildersClubMembersOnly: boolean): any -- POST
- local newUrl = API_URL .. "/v1/groups/create"
- local dataBody = {
- ["name"] = name,
- ["description"] = description,
- ["publicGroup"] = publicGroup,
- ["buildersClubMembersOnly"] = buildersClubMembersOnly
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Gets group policy info used for compliance.
- function GroupsAPI.GetGroupPolicies(groupId: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/policies"
- return HttpClient.getRequest(newUrl, API_KEY, {["groupId"] = groupId})
- end
- --Updates the groups description.
- function GroupsAPI.UpdateGroupDescription(groupId: number, description: string): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/description"
- return HttpClient.patchRequest(newUrl, API_KEY, {["description"] = description})
- end
- --Updates the group's name.
- function GroupsAPI.UpdateGroupName(groupId: number, name: string): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/name"
- return HttpClient.patchRequest(newUrl, API_KEY, {["name"] = name})
- end
- --Updates the Notification Preference.
- function GroupsAPI.UpdateGroupNotificationPreference(groupId: number, notificationsEnabled: boolean): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/notification-preference"
- return HttpClient.patchRequest(newUrl, API_KEY, {["notificationsEnabled"] = notificationsEnabled})
- end
- --Sets group status
- function GroupsAPI.UpdateGroupStatus(groupId: number, message: string): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/status"
- return HttpClient.patchRequest(newUrl, API_KEY, {["message"] = message})
- end
- --Batch declines group join requests
- function GroupsAPI.BatchDeclineGroupJoinRequests(groupId: number, UserIds: {number}): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/join-requests"
- return HttpClient.deleteRequest(newUrl, API_KEY, {["UserIds"] = UserIds})
- end
- --Gets a page of Group Join Requests for a group.
- function GroupsAPI.GetGroupJoinRequests(groupId: number, limit: string, cursor: string, sortOrder: string): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/join-requests"
- local dataBody = {
- ["limit"] = limit,
- ["cursor"] = cursor,
- ["sortOrder"] = sortOrder
- }
- return HttpClient.getRequest(newUrl, API_KEY, dataBody)
- end
- --Batch accepts group join requests
- function GroupsAPI.BatchAcceptGroupJoinRequests(groupId: number, UserIds: {number}): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/join-requests"
- return HttpClient.postRequest(newUrl, API_KEY, {["UserIds"] = UserIds})
- end
- --Declines/cancels a group join request.
- function GroupsAPI.DeclineGroupJoinRequest(groupId: number, userId: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/join-requests/users/" .. userId
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Gets a group join request by userId.
- function GroupsAPI.GetGroupJoinRequestByUserId(groupId: number, userId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/join-requests/users/" .. userId
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Accepts a group join request.
- function GroupsAPI.AcceptGroupJoinRequest(groupId: number, userId: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/join-requests/users/" .. userId
- return HttpClient.postRequest(newUrl, API_KEY)
- end
- --Gets group membership information in the context of the authenticated user
- function GroupsAPI.GetGroupMembership(groupId: number, includeNotificationPreferences): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/membership"
- return HttpClient.getRequest(newUrl, API_KEY, {["includeNotificationPreferences"] = includeNotificationPreferences})
- end
- --Gets a list of the rolesets in a group.
- function GroupsAPI.GetGroupRoles(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/roles"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets a list of users in a group for a specific roleset.
- function GroupsAPI.GetPlayersInGroupRoles(groupId: number, roleSetId: number, limit: string, cursor: string, sortOrder: string): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/roles/" .. roleSetId .. "/users"
- local dataBody = {
- ["limit"] = limit,
- ["cursor"] = cursor,
- ["sortOrder"] = sortOrder
- }
- return HttpClient.getRequest(newUrl, API_KEY, dataBody)
- end
- --Gets a list of users in a group.
- function GroupsAPI.GetPlayersInGroup(groupId: number, limit: string, cursor: string, sortOrder: string): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/users"
- local dataBody = {
- ["limit"] = limit,
- ["cursor"] = cursor,
- ["sortOrder"] = sortOrder
- }
- return HttpClient.getRequest(newUrl, API_KEY, dataBody)
- end
- --Joins a group
- function GroupsAPI.JoinGroup(groupId: number, sessionId: string, redemptionToken: string, captchaId: string, captchaToken: string, captchaProvider: string, challengeId: string): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/users"
- local dataBody = {
- ["sessionId"] = sessionId,
- ["redemptionToken"] = redemptionToken,
- ["captchaId"] = captchaId,
- ["captchaToken"] = captchaToken,
- ["captchaProvider"] = captchaProvider,
- ["challengeId"] = challengeId,
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Gets groups that the authenticated user has requested to join
- function GroupsAPI.GetPending(): any -- GET
- local newUrl = API_URL .. "/v1/user/groups/pending"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets a list of all groups the specified users' friends are in.
- function GroupsAPI.GetFriendsGroups(userId: number): any -- GET
- local newUrl = API_URL .. "/v1/users/" .. userId .. "/friends/groups/roles"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets a list of all group roles for groups the specified user is in.
- function GroupsAPI.GetAllRolesForUserId(userId: number): any -- GET
- local newUrl = API_URL .. "/v1/users/" .. userId .. "/groups/roles"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Changes the group owner to another user.
- function GroupsAPI.ChangeGroupOwner(groupId: number, userId: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/change-owner"
- return HttpClient.postRequest(newUrl, API_KEY, {["userId"] = userId})
- end
- --Claims ownership of the group as the authenticated user
- function GroupsAPI.ClaimGroupOwnership(groupId: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/claim-ownership"
- return HttpClient.postRequest(newUrl, API_KEY)
- end
- --Removes a user from a group
- function GroupsAPI.RemoveGroupPlayer(groupId: number, userId: number, roleId: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/users/" .. userId
- return HttpClient.deleteRequest(newUrl, API_KEY, {["roleId"] = roleId})
- end
- --Updates a users role in a group.
- function GroupsAPI.UpdateGroupPlayerRoles(groupId: number, userId: number, roleId: number): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/users/" .. userId
- return HttpClient.patchRequest(newUrl, API_KEY, {["roleId"] = roleId})
- end
- --Gets a value indicating whether the group can use payout feature
- function GroupsAPI.GroupCanUsePayout(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/payout-restriction"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets a list of the group payout percentages
- function GroupsAPI.GetCurrentRecurringPayouts(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/payouts"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Pays out a user in Robux.
- function GroupsAPI.PayoutGroupFundsToUser(groupId: number, PayoutType: number, Recipients: {["recipientId"]: number, ["recipientType"]: number, ["amount"]: number}): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/payouts"
- local dataBody = {
- ["PayoutType"] = PayoutType,
- ["Recipients"] = Recipients
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Updates recurring payouts.
- function GroupsAPI.UpdateRecurringPayouts(groupId: number, PayoutType: number, Recipients: {["recipientId"]: number, ["recipientType"]: number, ["amount"]: number}): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/payouts/recurring"
- local dataBody = {
- ["PayoutType"] = PayoutType,
- ["Recipients"] = Recipients
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Gets a group's relationships
- function GroupsAPI.GetGroupRelationships(groupId: number, groupRelationshipType: number, StartRowIndex: number, MaxRows: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType
- local dataBody = {
- ["StartRowIndex"] = StartRowIndex,
- ["MaxRows"] = MaxRows
- }
- return HttpClient.getRequest(newUrl, API_KEY, dataBody)
- end
- --Batch declines group affiliate requests
- function GroupsAPI.DeclineGroupAffiliateRequests(groupId: number, groupRelationshipType: number, GroupIds: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType .. "/requests"
- local dataBody = {
- ["GroupIds"] = GroupIds
- }
- return HttpClient.deleteRequest(newUrl, API_KEY, dataBody)
- end
- --Gets a group's relationship requests
- function GroupsAPI.GetGroupRelationshipRequests(groupId: number, groupRelationshipType: number, StartRowIndex: number, MaxRows: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType .. "/requests"
- local dataBody = {
- ["StartRowIndex"] = StartRowIndex,
- ["MaxRows"] = MaxRows
- }
- return HttpClient.getRequest(newUrl, API_KEY, dataBody)
- end
- --Batch accepts group affiliate requests
- function GroupsAPI.AcceptGroupAffiliateRequests(groupId: number, groupRelationshipType: number, GroupIds: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType .. "/requests"
- local dataBody = {
- ["GroupIds"] = GroupIds
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Deletes a group relationship.
- function GroupsAPI.DeleteGroupRelationship(groupId: number, relatedGroupId: number, groupRelationshipType: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType .. "/" .. relatedGroupId
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Create a group relationship.
- function GroupsAPI.CreateGroupRelationship(groupId: number, relatedGroupId: number, groupRelationshipType: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType .. "/" .. relatedGroupId
- return HttpClient.postRequest(newUrl, API_KEY)
- end
- --Declines a group relationship request.
- function GroupsAPI.DeclineGroupRelationshipRequest(groupId: number, relatedGroupId: number, groupRelationshipType: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType .. "/requests/" .. relatedGroupId
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Accepts a group relationship request.
- function GroupsAPI.AcceptGroupRelationshipRequest(groupId: number, relatedGroupId: number, groupRelationshipType: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/relationships/" .. groupRelationshipType .. "/requests/" .. relatedGroupId
- return HttpClient.postRequest(newUrl, API_KEY)
- end
- --Gets the permissions for a group's roleset. The authorized user must either be the group owner or the roleset being requested, except for guest roles, which can be viewed by all (members and guests).
- function GroupsAPI.GetGroupRolePermissions(groupId: number, roleSetId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/roles/" .. roleSetId .. "/permissions"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Updates the permissions for a group's roleset. The authorized user must be the group owner.
- function GroupsAPI.UpdateRolePermissions(groupId: number, roleSetId: number, DeleteFromWall: boolean, PostToWall: boolean, InviteMembers: boolean, PostToStatus: boolean, RemoveMembers: boolean, BanMembers: boolean, ViewStatus: boolean, ViewWall: boolean, ChangeRank: boolean, AdvertiseGroup: boolean, ManageRelationships: boolean, AddGroupPlaces: boolean, ViewAuditLogs: boolean, CreateItems: boolean, ManageItems: boolean, SpendGroupFunds: boolean, ManageClan: boolean, ManageGroupGames: boolean, UseCloudAuthentication: boolean, AdministerCloudAuthentication: boolean, ViewAnalytics: boolean): any
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/roles/" .. roleSetId .. "/permissions"
- local dataBody = {
- permissions = {
- DeleteFromWall = DeleteFromWall,
- PostToWall = PostToWall,
- InviteMembers = InviteMembers,
- PostToStatus = PostToStatus,
- RemoveMembers = RemoveMembers,
- BanMembers = BanMembers,
- ViewStatus = ViewStatus,
- ViewWall = ViewWall,
- ChangeRank = ChangeRank,
- AdvertiseGroup = AdvertiseGroup,
- ManageRelationships = ManageRelationships,
- AddGroupPlaces = AddGroupPlaces,
- ViewAuditLogs = ViewAuditLogs,
- CreateItems = CreateItems,
- ManageItems = ManageItems,
- SpendGroupFunds = SpendGroupFunds,
- ManageClan = ManageClan,
- ManageGroupGames = ManageGroupGames,
- UseCloudAuthentication = UseCloudAuthentication,
- AdministerCloudAuthentication = AdministerCloudAuthentication,
- ViewAnalytics = ViewAnalytics
- }
- }
- return HttpClient.patchRequest(newUrl, API_KEY, dataBody)
- end
- --Gets the permissions for a group's guest roleset. These can be viewed by all (members and guests) users.
- function GroupsAPI.GetGuestPermissions(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/roles/guest/permissions"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets all permissions for each role
- function GroupsAPI.GetEveryRolesPermissions(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/roles/permissions"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Get social link data associated with a group
- function GroupsAPI.GetGroupSocialLinkData(groupId: number): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/social-links"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Posts a social links
- function GroupsAPI.AddGroupSocialLink(groupId: number, type: number, url: string, title: string): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/social-links"
- local dataBody = {
- ["type"] = type,
- ["url"] = url,
- ["title"] = title
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Deletes a social link
- function GroupsAPI.DeleteGroupSocialLink(groupId: number, socialLinkId: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/social-links/" .. socialLinkId
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Updates a social link
- function GroupsAPI.UpdateGroupSocialLink(groupId: number, socialLinkId: number, type: number, url: string, title: string): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/social-links/" .. socialLinkId
- local dataBody = {
- ["type"] = type,
- ["url"] = url,
- ["title"] = title
- }
- return HttpClient.patchRequest(newUrl, API_KEY, dataBody)
- end
- --Gets a list of group wall posts.
- function GroupsAPI.GetGroupWallPosts(groupId: number, limit: string, cursor: string, sortOrder: string): any -- GET
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/wall/posts"
- local dataBody = {
- ["limit"] = limit,
- ["cursor"] = cursor,
- ["sortOrder"] = sortOrder
- }
- return HttpClient.getRequest(newUrl, API_KEY, dataBody)
- end
- --Creates a post on a group wall
- function GroupsAPI.GroupWallPostRequest(groupId: number, body: string, captchaId: string, captchaToken: string, captchaProvider: string, challengeId: string): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/wall/posts"
- local dataBody = {
- ["body"] = body,
- ["captchaId"] = captchaId,
- ["captchaToken"] = captchaToken,
- ["captchaProvider"] = captchaProvider,
- ["challengeId"] = challengeId,
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Subscribes the authenticated user to notifications of group wall events.
- function GroupsAPI.SubscribeToGroupWall(groupId: number): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/wall/subscribe"
- return HttpClient.postRequest(newUrl, API_KEY)
- end
- --Deletes a group wall post.
- function GroupsAPI.DeleteGroupWallPost(groupId: number, postId: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/wall/posts/" .. postId
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Deletes all group wall posts made by a specific user.
- function GroupsAPI.DeleteUsersGroupWallPosts(groupId: number, userId: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/wall/users/" .. userId .. "/posts"
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Search for groups by keyword.
- function GroupsAPI.SearchForGroupsByKeyword(keyword: string, prioritizeExactMatch: boolean, limit: string, cursor: string): any -- GET
- local newUrl = API_URL .. "/v1/groups/search"
- local dataBody = {
- ["keyword"] = keyword,
- ["prioritizeExactMatch"] = prioritizeExactMatch,
- ["limit"] = limit,
- ["cursor"] = cursor,
- }
- return HttpClient.getRequest(newUrl, API_KEY, BrickColor)
- end
- --Looks up groups by a name. Prioritizes an exact match as the first result.
- function GroupsAPI.LookUpGroupByName(groupName: string): any -- GET
- local newUrl = API_URL .. "/v1/groups/search/lookup"
- return HttpClient.getRequest(newUrl, API_KEY, {["groupName"] = groupName})
- end
- --Get suggested groups and other miscellaneous information needed for the group/join page like flags
- function GroupsAPI.GetGroupSearchMetadata(): any -- GET
- local newUrl = API_URL .. "/v1/groups/search/metadata"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Gets the Roles by their ids.
- function GroupsAPI.GetGroupRoleById(ids: {number}): any -- GET
- local newUrl = API_URL .. "/v1/roles"
- return HttpClient.getRequest(newUrl, API_KEY, {["ids"] = ids})
- end
- --Gets a user's primary group.
- function GroupsAPI.GetPrimaryGroupByUserId(userId: number): any -- GET
- local newUrl = API_URL .. "/v1/users/" .. userId .. "/groups/primary/role"
- return HttpClient.getRequest(newUrl, API_KEY)
- end
- --Removes the authenticated user's primary group
- function GroupsAPI.RemovePrimaryGroup(): any -- DELETE
- local newUrl = API_URL .. "/v1/user/groups/primary"
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Sets the authenticated user's primary group
- function GroupsAPI.SetPrimaryGroup(groupId: number): any -- POST
- local newUrl = API_URL .. "/v1/user/groups/primary"
- return HttpClient.postRequest(newUrl, API_KEY, {["groupId"] = groupId})
- end
- --Creates new group roleset.
- function GroupsAPI.CreateNewGroupRoleset(groupId: number, name: string, description: string, rank: number, usingGroupFunds: boolean): any -- POST
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/rolesets/create"
- local dataBody = {
- ["name"] = name,
- ["description"] = description,
- ["rank"] = rank,
- ["usingGroupFunds"] = usingGroupFunds
- }
- return HttpClient.postRequest(newUrl, API_KEY, dataBody)
- end
- --Deletes existing group roleset.
- function GroupsAPI.DeleteGroupRoleset(groupId: number, roleSetId: number): any -- DELETE
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/rolesets/" .. roleSetId
- return HttpClient.deleteRequest(newUrl, API_KEY)
- end
- --Updates existing group roleset.
- function GroupsAPI.UpdateGroupRoleset(groupId: number, roleSetId: number, name: string, description: string, rank: number): any -- PATCH
- local newUrl = API_URL .. "/v1/groups/" .. groupId .. "/rolesets/" .. roleSetId
- local dataBody = {
- ["name"] = name,
- ["description"] = description,
- ["rank"] = rank
- }
- return HttpClient.patchRequest(newUrl, API_KEY, dataBody)
- end
- return GroupsAPI
Advertisement
Add Comment
Please, Sign In to add comment