import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Groups } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { GraphRbacManagementClient } from "../graphRbacManagementClient" ; import { ADGroup , GroupsListNextOptionalParams , GroupsListOptionalParams , DirectoryObjectUnion , GroupsGetGroupMembersNextOptionalParams , GroupsGetGroupMembersOptionalParams , GroupGetMemberGroupsParameters , GroupsGetMemberGroupsOptionalParams , GroupsListOwnersNextOptionalParams , GroupsListOwnersOptionalParams , CheckGroupMembershipParameters , GroupsIsMemberOfOptionalParams , GroupsIsMemberOfResponse , GroupsRemoveMemberOptionalParams , GroupAddMemberParameters , GroupsAddMemberOptionalParams , GroupCreateParameters , GroupsCreateOptionalParams , GroupsCreateResponse , GroupsListResponse , GroupsGetGroupMembersResponse , GroupsGetOptionalParams , GroupsGetResponse , GroupsDeleteOptionalParams , GroupsGetMemberGroupsResponse , GroupsListOwnersResponse , AddOwnerParameters , GroupsAddOwnerOptionalParams , GroupsRemoveOwnerOptionalParams , GroupsListNextResponse , GroupsGetGroupMembersNextResponse , GroupsListOwnersNextResponse } from "../models" ; /** Class containing Groups operations. */ export class GroupsImpl implements Groups { private readonly client : GraphRbacManagementClient ; param client constructor ( client ) { this . client = client ; } param options public list ( options ? ) { const iter = this . listPagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPagingPage ( options ) ; } } ; } private async * listPagingPage ( options ? ) { let result = await this . _list ( options ) ; yield result . value || [ ] ; let continuationToken = result . odataNextLink ; while ( continuationToken ) { result = await this . _listNext ( continuationToken , options ) ; continuationToken = result . odataNextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( options ? ) { for await ( const page of this . listPagingPage ( options ) ) { yield * page ; } } param objectId param options public listGroupMembers ( objectId , options ? ) { const iter = this . getGroupMembersPagingAll ( objectId , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . getGroupMembersPagingPage ( objectId , options ) ; } } ; } private async * getGroupMembersPagingPage ( objectId , options ? ) { let result = await this . _getGroupMembers ( objectId , options ) ; yield result . value || [ ] ; let continuationToken = result . odataNextLink ; while ( continuationToken ) { result = await this . _getGroupMembersNext ( continuationToken , options ) ; continuationToken = result . odataNextLink ; yield result . value || [ ] ; } } private async * getGroupMembersPagingAll ( objectId , options ? ) { for await ( const page of this . getGroupMembersPagingPage ( objectId , options ) ) { yield * page ; } } param objectId param parameters param options public listMemberGroups ( objectId , parameters , options ? ) { const iter = this . getMemberGroupsPagingAll ( objectId , parameters , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . getMemberGroupsPagingPage ( objectId , parameters , options ) ; } } ; } private async * getMemberGroupsPagingPage ( objectId , parameters , options ? ) { let result = await this . _getMemberGroups ( objectId , parameters , options ) ; yield result . value || [ ] ; } private async * getMemberGroupsPagingAll ( objectId , parameters , options ? ) { for await ( const page of this . getMemberGroupsPagingPage ( objectId , parameters , options ) ) { yield * page ; } } param objectId param options public listOwners ( objectId , options ? ) { const iter = this . listOwnersPagingAll ( objectId , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listOwnersPagingPage ( objectId , options ) ; } } ; } private async * listOwnersPagingPage ( objectId , options ? ) { let result = await this . _listOwners ( objectId , options ) ; yield result . value || [ ] ; let continuationToken = result . odataNextLink ; while ( continuationToken ) { result = await this . _listOwnersNext ( objectId , continuationToken , options ) ; continuationToken = result . odataNextLink ; yield result . value || [ ] ; } } private async * listOwnersPagingAll ( objectId , options ? ) { for await ( const page of this . listOwnersPagingPage ( objectId , options ) ) { yield * page ; } } param nextLink param options public listNext ( nextLink , options ? ) { const iter = this . listNextPagingAll ( nextLink , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listNextPagingPage ( nextLink , options ) ; } } ; } private async * listNextPagingPage ( nextLink , options ? ) { let result = await this . _listNext ( nextLink , options ) ; yield result . value || [ ] ; let continuationToken = result . odataNextLink ; while ( continuationToken ) { result = await this . _listNext ( continuationToken , options ) ; continuationToken = result . odataNextLink ; yield result . value || [ ] ; } } private async * listNextPagingAll ( nextLink , options ? ) { for await ( const page of this . listNextPagingPage ( nextLink , options ) ) { yield * page ; } } param nextLink param options public listGroupMembersNext ( nextLink , options ? ) { const iter = this . getGroupMembersNextPagingAll ( nextLink , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . getGroupMembersNextPagingPage ( nextLink , options ) ; } } ; } private async * getGroupMembersNextPagingPage ( nextLink , options ? ) { let result = await this . _getGroupMembersNext ( nextLink , options ) ; yield result . value || [ ] ; let continuationToken = result . odataNextLink ; while ( continuationToken ) { result = await this . _getGroupMembersNext ( continuationToken , options ) ; continuationToken = result . odataNextLink ; yield result . value || [ ] ; } } private async * getGroupMembersNextPagingAll ( nextLink , options ? ) { for await ( const page of this . getGroupMembersNextPagingPage ( nextLink , options ) ) { yield * page ; } } param parameters param options isMemberOf ( parameters , options ? ) { return this . client . sendOperationRequest ( { parameters , options } , isMemberOfOperationSpec ) ; } param groupObjectId param memberObjectId param options removeMember ( groupObjectId , memberObjectId , options ? ) { return this . client . sendOperationRequest ( { groupObjectId , memberObjectId , options } , removeMemberOperationSpec ) ; } param groupObjectId param parameters param options addMember ( groupObjectId , parameters , options ? ) { return this . client . sendOperationRequest ( { groupObjectId , parameters , options } , addMemberOperationSpec ) ; } param parameters param options create ( parameters , options ? ) { return this . client . sendOperationRequest ( { parameters , options } , createOperationSpec ) ; } param options private _list ( options ? ) { return this . client . sendOperationRequest ( { options } , listOperationSpec ) ; } param objectId param options private _getGroupMembers ( objectId , options ? ) { return this . client . sendOperationRequest ( { objectId , options } , getGroupMembersOperationSpec ) ; } param objectId param options get ( objectId , options ? ) { return this . client . sendOperationRequest ( { objectId , options } , getOperationSpec ) ; } param objectId param options delete ( objectId , options ? ) { return this . client . sendOperationRequest ( { objectId , options } , deleteOperationSpec ) ; } param objectId param parameters param options private _getMemberGroups ( objectId , parameters , options ? ) { return this . client . sendOperationRequest ( { objectId , parameters , options } , getMemberGroupsOperationSpec ) ; } param objectId param options private _listOwners ( objectId , options ? ) { return this . client . sendOperationRequest ( { objectId , options } , listOwnersOperationSpec ) ; } param objectId param parameters param options addOwner ( objectId , parameters , options ? ) { return this . client . sendOperationRequest ( { objectId , parameters , options } , addOwnerOperationSpec ) ; } param objectId param ownerObjectId param options removeOwner ( objectId , ownerObjectId , options ? ) { return this . client . sendOperationRequest ( { objectId , ownerObjectId , options } , removeOwnerOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } param nextLink param options private _getGroupMembersNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , getGroupMembersNextOperationSpec ) ; } param objectId param nextLink param options private _listOwnersNext ( objectId , nextLink , options ? ) { return this . client . sendOperationRequest ( { objectId , nextLink , options } , listOwnersNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const isMemberOfOperationSpec = { path : "/{tenantID}/isMemberOf" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . CheckGroupMembershipResult } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters5 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const removeMemberOperationSpec = { path : "/{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}" , httpMethod : "DELETE" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . groupObjectId , Parameters . memberObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const addMemberOperationSpec = { path : "/{tenantID}/groups/{groupObjectId}/$links/members" , httpMethod : "POST" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters6 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . groupObjectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const createOperationSpec = { path : "/{tenantID}/groups" , httpMethod : "POST" , responses : { 201 : { bodyMapper : Mappers . ADGroup } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters7 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOperationSpec = { path : "/{tenantID}/groups" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . GroupListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion , Parameters . filter ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept ] , serializer } ; const getGroupMembersOperationSpec = { path : "/{tenantID}/groups/{objectId}/members" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DirectoryObjectListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/{tenantID}/groups/{objectId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ADGroup } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const deleteOperationSpec = { path : "/{tenantID}/groups/{objectId}" , httpMethod : "DELETE" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const getMemberGroupsOperationSpec = { path : "/{tenantID}/groups/{objectId}/getMemberGroups" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . GroupGetMemberGroupsResult } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters8 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOwnersOperationSpec = { path : "/{tenantID}/groups/{objectId}/owners" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DirectoryObjectListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const addOwnerOperationSpec = { path : "/{tenantID}/groups/{objectId}/$links/owners" , httpMethod : "POST" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters2 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const removeOwnerOperationSpec = { path : "/{tenantID}/groups/{objectId}/$links/owners/{ownerObjectId}" , httpMethod : "DELETE" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . ownerObjectId , Parameters . objectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "/{tenantID}/{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . GroupListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const getGroupMembersNextOperationSpec = { path : "/{tenantID}/{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DirectoryObjectListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOwnersNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DirectoryObjectListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . nextLink , Parameters . objectId ] , headerParameters : [ Parameters . accept ] , serializer } ;