import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { TopLevelDomains } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { WebSiteManagementClient } from "../webSiteManagementClient" ; import { TopLevelDomain , TopLevelDomainsListNextOptionalParams , TopLevelDomainsListOptionalParams , TldLegalAgreement , TopLevelDomainAgreementOption , TopLevelDomainsListAgreementsNextOptionalParams , TopLevelDomainsListAgreementsOptionalParams , TopLevelDomainsListResponse , TopLevelDomainsGetOptionalParams , TopLevelDomainsGetResponse , TopLevelDomainsListAgreementsResponse , TopLevelDomainsListNextResponse , TopLevelDomainsListAgreementsNextResponse } from "../models" ; /** Class containing TopLevelDomains operations. */ export class TopLevelDomainsImpl implements TopLevelDomains { private readonly client : WebSiteManagementClient ; 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 . nextLink ; while ( continuationToken ) { result = await this . _listNext ( continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( options ? ) { for await ( const page of this . listPagingPage ( options ) ) { yield * page ; } } param name param agreementOption param options public listAgreements ( name , agreementOption , options ? ) { const iter = this . listAgreementsPagingAll ( name , agreementOption , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAgreementsPagingPage ( name , agreementOption , options ) ; } } ; } private async * listAgreementsPagingPage ( name , agreementOption , options ? ) { let result = await this . _listAgreements ( name , agreementOption , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listAgreementsNext ( name , agreementOption , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listAgreementsPagingAll ( name , agreementOption , options ? ) { for await ( const page of this . listAgreementsPagingPage ( name , agreementOption , options ) ) { yield * page ; } } param options private _list ( options ? ) { return this . client . sendOperationRequest ( { options } , listOperationSpec ) ; } param name param options get ( name , options ? ) { return this . client . sendOperationRequest ( { name , options } , getOperationSpec ) ; } param name param agreementOption param options private _listAgreements ( name , agreementOption , options ? ) { return this . client . sendOperationRequest ( { name , agreementOption , options } , listAgreementsOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } param name param agreementOption param nextLink param options private _listAgreementsNext ( name , agreementOption , nextLink , options ? ) { return this . client . sendOperationRequest ( { name , agreementOption , nextLink , options } , listAgreementsNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . TopLevelDomainCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . TopLevelDomain } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . name ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAgreementsOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/topLevelDomains/{name}/listAgreements" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . TldLegalAgreementCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , requestBody : Parameters . agreementOption , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . name ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . TopLevelDomainCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAgreementsNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . TldLegalAgreementCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . name , Parameters . nextLink ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ;