import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Users } 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 { User , UsersListNextOptionalParams , UsersListOptionalParams , UserGetMemberGroupsParameters , UsersGetMemberGroupsOptionalParams , UserCreateParameters , UsersCreateOptionalParams , UsersCreateResponse , UsersListResponse , UsersGetOptionalParams , UsersGetResponse , UserUpdateParameters , UsersUpdateOptionalParams , UsersDeleteOptionalParams , UsersGetMemberGroupsResponse , UsersListNextResponse } from "../models" ; /** Class containing Users operations. */ export class UsersImpl implements Users { 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 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 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 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 upnOrObjectId param options get ( upnOrObjectId , options ? ) { return this . client . sendOperationRequest ( { upnOrObjectId , options } , getOperationSpec ) ; } param upnOrObjectId param parameters param options update ( upnOrObjectId , parameters , options ? ) { return this . client . sendOperationRequest ( { upnOrObjectId , parameters , options } , updateOperationSpec ) ; } param upnOrObjectId param options delete ( upnOrObjectId , options ? ) { return this . client . sendOperationRequest ( { upnOrObjectId , options } , deleteOperationSpec ) ; } param objectId param parameters param options private _getMemberGroups ( objectId , parameters , options ? ) { return this . client . sendOperationRequest ( { objectId , parameters , options } , getMemberGroupsOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOperationSpec = { path : "/{tenantID}/users" , httpMethod : "POST" , responses : { 201 : { bodyMapper : Mappers . User } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters11 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOperationSpec = { path : "/{tenantID}/users" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . UserListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion , Parameters . filter , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/{tenantID}/users/{upnOrObjectId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . User } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . upnOrObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const updateOperationSpec = { path : "/{tenantID}/users/{upnOrObjectId}" , httpMethod : "PATCH" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters12 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . upnOrObjectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/{tenantID}/users/{upnOrObjectId}" , httpMethod : "DELETE" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . upnOrObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const getMemberGroupsOperationSpec = { path : "/{tenantID}/users/{objectId}/getMemberGroups" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . UserGetMemberGroupsResult } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters13 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listNextOperationSpec = { path : "/{tenantID}/{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . UserListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;