UNPKG

@microsoft.azure/autorest.incubator

Version:
50 lines 2.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const project_1 = require("../../csharp/code-dom/project"); const api_class_1 = require("./operation/api-class"); const namespace_1 = require("./model/namespace"); const namespace_2 = require("./operation/namespace"); const namespace_3 = require("./support/namespace"); const json_serializer_1 = require("../../csharp/lowlevel-generator/support/json-serializer"); const import_1 = require("../../csharp/code-dom/import"); class Project extends project_1.Project { constructor(state) { super(); this.state = state; this.storagePipeline = false; this.jsonSerialization = true; this.xmlSerialization = false; this.defaultPipeline = true; this.emitSignals = true; state.project = this; // add project namespace } async init() { await super.init(); const service = this.state.service; this.storagePipeline = await service.GetValue('use-storage-pipeline') || false; if (this.storagePipeline) { this.emitSignals = false; this.jsonSerialization = false; this.xmlSerialization = true; this.defaultPipeline = false; } this.addNamespace(this.serviceNamespace = new namespace_2.ServiceNamespace(this.state)); // add support namespace this.addNamespace(this.supportNamespace = new namespace_3.SupportNamespace(this.serviceNamespace, this.state)); // add model classes this.addNamespace(this.modelsNamespace = new namespace_1.ModelsNamespace(this.serviceNamespace, this.state.model.schemas, this.state.path('components', 'schemas'))); // create API class new api_class_1.ApiClass(this.serviceNamespace, this.state); if (this.jsonSerialization) { // create serialization support new json_serializer_1.JsonSerializerClass(this.supportNamespace, this.state); } this.modelsNamespace.addUsing(new import_1.Import(this.supportNamespace.fullName)); // abort now if we have any errors. this.state.checkpoint(); return this; } } exports.Project = Project; //# sourceMappingURL=project.js.map