import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Applications } 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 { Application , ApplicationsListNextOptionalParams , ApplicationsListOptionalParams , DirectoryObjectUnion , ApplicationsListOwnersNextOptionalParams , ApplicationsListOwnersOptionalParams , KeyCredential , ApplicationsListKeyCredentialsOptionalParams , PasswordCredential , ApplicationsListPasswordCredentialsOptionalParams , ApplicationCreateParameters , ApplicationsCreateOptionalParams , ApplicationsCreateResponse , ApplicationsListResponse , ApplicationsDeleteOptionalParams , ApplicationsGetOptionalParams , ApplicationsGetResponse , ApplicationUpdateParameters , ApplicationsPatchOptionalParams , ApplicationsListOwnersResponse , AddOwnerParameters , ApplicationsAddOwnerOptionalParams , ApplicationsRemoveOwnerOptionalParams , ApplicationsListKeyCredentialsResponse , KeyCredentialsUpdateParameters , ApplicationsUpdateKeyCredentialsOptionalParams , ApplicationsListPasswordCredentialsResponse , PasswordCredentialsUpdateParameters , ApplicationsUpdatePasswordCredentialsOptionalParams , ApplicationsGetServicePrincipalsIdByAppIdOptionalParams , ApplicationsGetServicePrincipalsIdByAppIdResponse , ApplicationsListNextResponse , ApplicationsListOwnersNextResponse } from "../models" ; /** Class containing Applications operations. */ export class ApplicationsImpl implements Applications { 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 applicationObjectId param options public listOwners ( applicationObjectId , options ? ) { const iter = this . listOwnersPagingAll ( applicationObjectId , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listOwnersPagingPage ( applicationObjectId , options ) ; } } ; } private async * listOwnersPagingPage ( applicationObjectId , options ? ) { let result = await this . _listOwners ( applicationObjectId , options ) ; yield result . value || [ ] ; let continuationToken = result . odataNextLink ; while ( continuationToken ) { result = await this . _listOwnersNext ( applicationObjectId , continuationToken , options ) ; continuationToken = result . odataNextLink ; yield result . value || [ ] ; } } private async * listOwnersPagingAll ( applicationObjectId , options ? ) { for await ( const page of this . listOwnersPagingPage ( applicationObjectId , options ) ) { yield * page ; } } param applicationObjectId param options public listKeyCredentials ( applicationObjectId , options ? ) { const iter = this . listKeyCredentialsPagingAll ( applicationObjectId , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listKeyCredentialsPagingPage ( applicationObjectId , options ) ; } } ; } private async * listKeyCredentialsPagingPage ( applicationObjectId , options ? ) { let result = await this . _listKeyCredentials ( applicationObjectId , options ) ; yield result . value || [ ] ; } private async * listKeyCredentialsPagingAll ( applicationObjectId , options ? ) { for await ( const page of this . listKeyCredentialsPagingPage ( applicationObjectId , options ) ) { yield * page ; } } param applicationObjectId param options public listPasswordCredentials ( applicationObjectId , options ? ) { const iter = this . listPasswordCredentialsPagingAll ( applicationObjectId , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPasswordCredentialsPagingPage ( applicationObjectId , options ) ; } } ; } private async * listPasswordCredentialsPagingPage ( applicationObjectId , options ? ) { let result = await this . _listPasswordCredentials ( applicationObjectId , options ) ; yield result . value || [ ] ; } private async * listPasswordCredentialsPagingAll ( applicationObjectId , options ? ) { for await ( const page of this . listPasswordCredentialsPagingPage ( applicationObjectId , 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 applicationObjectId param options delete ( applicationObjectId , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , options } , deleteOperationSpec ) ; } param applicationObjectId param options get ( applicationObjectId , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , options } , getOperationSpec ) ; } param applicationObjectId param parameters param options patch ( applicationObjectId , parameters , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , parameters , options } , patchOperationSpec ) ; } param applicationObjectId param options private _listOwners ( applicationObjectId , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , options } , listOwnersOperationSpec ) ; } param applicationObjectId param parameters param options addOwner ( applicationObjectId , parameters , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , parameters , options } , addOwnerOperationSpec ) ; } param applicationObjectId param ownerObjectId param options removeOwner ( applicationObjectId , ownerObjectId , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , ownerObjectId , options } , removeOwnerOperationSpec ) ; } param applicationObjectId param options private _listKeyCredentials ( applicationObjectId , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , options } , listKeyCredentialsOperationSpec ) ; } param applicationObjectId param parameters param options updateKeyCredentials ( applicationObjectId , parameters , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , parameters , options } , updateKeyCredentialsOperationSpec ) ; } param applicationObjectId param options private _listPasswordCredentials ( applicationObjectId , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , options } , listPasswordCredentialsOperationSpec ) ; } param applicationObjectId param parameters param options updatePasswordCredentials ( applicationObjectId , parameters , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , parameters , options } , updatePasswordCredentialsOperationSpec ) ; } param applicationID param options getServicePrincipalsIdByAppId ( applicationID , options ? ) { return this . client . sendOperationRequest ( { applicationID , options } , getServicePrincipalsIdByAppIdOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } param applicationObjectId param nextLink param options private _listOwnersNext ( applicationObjectId , nextLink , options ? ) { return this . client . sendOperationRequest ( { applicationObjectId , nextLink , options } , listOwnersNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOperationSpec = { path : "/{tenantID}/applications" , httpMethod : "POST" , responses : { 201 : { bodyMapper : Mappers . Application } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOperationSpec = { path : "/{tenantID}/applications" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ApplicationListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion , Parameters . filter ] , urlParameters : [ Parameters . $host , Parameters . tenantID ] , headerParameters : [ Parameters . accept ] , serializer } ; const deleteOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}" , httpMethod : "DELETE" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Application } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const patchOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}" , httpMethod : "PATCH" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOwnersOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}/owners" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DirectoryObjectListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const addOwnerOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}/$links/owners" , httpMethod : "POST" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters2 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const removeOwnerOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}" , httpMethod : "DELETE" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId , Parameters . ownerObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listKeyCredentialsOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}/keyCredentials" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . KeyCredentialListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const updateKeyCredentialsOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}/keyCredentials" , httpMethod : "PATCH" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters3 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listPasswordCredentialsOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}/passwordCredentials" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . PasswordCredentialListResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ; const updatePasswordCredentialsOperationSpec = { path : "/{tenantID}/applications/{applicationObjectId}/passwordCredentials" , httpMethod : "PATCH" , responses : { 204 : { } , default : { bodyMapper : Mappers . GraphError } } , requestBody : Parameters . parameters4 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationObjectId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const getServicePrincipalsIdByAppIdOperationSpec = { path : "/{tenantID}/servicePrincipalsByAppId/{applicationID}/objectId" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ServicePrincipalObjectResult } , default : { bodyMapper : Mappers . GraphError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . tenantID , Parameters . applicationID ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "/{tenantID}/{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ApplicationListResult } , 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 . applicationObjectId ] , headerParameters : [ Parameters . accept ] , serializer } ;