@typespec/http-client-java
Version:
TypeSpec library for emitting Java client from the TypeSpec REST protocol binding
69 lines • 2.52 kB
JavaScript
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
import { Aspect, Metadata, Security, } from "@autorest/codemodel";
export class Client extends Aspect {
constructor(name, description, objectInitializer) {
super(name, description, objectInitializer);
this.operationGroups = [];
this.security = new Security(false);
this.subClients = [];
this.buildMethodPublic = true;
this.parentAccessorPublic = false;
this.applyTo(this, objectInitializer);
}
get globals() {
return this.globalParameters || (this.globalParameters = []);
}
addGlobalParameters(parameters) {
this.globals.push(...parameters);
}
/**
* Add a sub Client to Client.
*
* @param subClient the sub Client
* @param buildMethodPublic the sub Client can be initialized by its ClientBuilder
* @param parentAccessorPublic the sub Client can be accessed by its parent Client
*/
addSubClient(subClient, buildMethodPublic, parentAccessorPublic) {
subClient.parent = this;
subClient.buildMethodPublic = buildMethodPublic;
subClient.parentAccessorPublic = parentAccessorPublic;
this.subClients.push(subClient);
// at present, sub client must be in same namespace of its parent client
subClient.language.java.namespace = this.language.java.namespace;
}
}
export class ServiceVersion extends Metadata {
constructor(name, description, initializer) {
super();
this.apply({
language: {
default: {
name: name,
description: description,
},
},
}, initializer);
}
}
export class PageableContinuationToken {
/**
* The parameter of the operation as continuationToken in API request.
*/
parameter;
// responseProperty and responseHeader is mutually exclusive
/**
* The reference to response body property of the operation as continuationToken in API request.
* Array because the property may be at "links.nextToken".
*/
responseProperty;
/**
* The reference to response header of the operation as continuationToken in API request.
*/
responseHeader;
constructor(parameter, responseProperty, responseHeader) {
this.parameter = parameter;
this.responseProperty = responseProperty;
this.responseHeader = responseHeader;
}
}
//# sourceMappingURL=client.js.map