import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { OAuth2PermissionGrantOperations } 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 { OAuth2PermissionGrant , OAuth2PermissionGrantListNextOptionalParams , OAuth2PermissionGrantListOptionalParams , OAuth2PermissionGrantListResponse , OAuth2PermissionGrantCreateOptionalParams , OAuth2PermissionGrantCreateResponse , OAuth2PermissionGrantDeleteOptionalParams , OAuth2PermissionGrantListNextResponse } from "../models" ; /** Class containing OAuth2PermissionGrantOperations operations. */ export class OAuth2PermissionGrantOperationsImpl implements OAuth2PermissionGrantOperations { 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 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 options private _list ( options ? ) { return this . client . sendOperationRequest ( { options } , listOperationSpec ) ; } param options create ( options ? ) { return this . client . sendOperationRequest ( { options } , createOperationSpec ) ; } param objectId param options delete ( objectId , options ? ) { return this . client . sendOperationRequest ( { objectId , options } , deleteOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const listOperationSpec = { path : "/{tenantID}/oauth2PermissionGrants" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . OAuth2PermissionGrantListResult } } , queryParameters : [ Parameters . apiVersion , Parameters . filter ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept1 ] , serializer } ; const createOperationSpec = { path : "/{tenantID}/oauth2PermissionGrants" , httpMethod : "POST" , responses : { 201 : { bodyMapper : Mappers . OAuth2PermissionGrant } } , requestBody : Parameters . body , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . contentType , Parameters . accept1 ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/{tenantID}/oauth2PermissionGrants/{objectId}" , httpMethod : "DELETE" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . objectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "/{tenantID}/{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . OAuth2PermissionGrantListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;