@microsoft.azure/autorest.incubator
Version:
AutoRest incubator project
54 lines • 2.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const media_types_1 = require("../../common/media-types");
const text_manipulation_1 = require("../../common/text-manipulation");
const expression_1 = require("../../csharp/code-dom/expression");
class Binary {
constructor(schema, isRequired) {
this.schema = schema;
this.isRequired = isRequired;
this.isXmlAttribute = false;
}
get declaration() {
return 'System.IO.Stream';
}
/** emits an expression to deserialize a property from a member inside a container */
deserializeFromContainerMember(mediaType, container, serializedName, defaultValue) {
if (mediaType === media_types_1.KnownMediaType.Stream) {
}
return expression_1.toExpression(`null /* deserializeFromContainerMember doesn't support '${mediaType}' ${__filename}*/`);
}
/** emits an expression to deserialze a container as the value itself. */
deserializeFromNode(mediaType, node, defaultValue) {
return expression_1.toExpression(`null /* deserializeFromNode doesn't support '${mediaType}' ${__filename}*/`);
}
/** emits an expression to deserialize content from a string */
deserializeFromString(mediaType, content, defaultValue) {
return undefined;
}
/** emits an expression serialize this to the value required by the container */
serializeToContent(mediaType, value) {
if (mediaType === media_types_1.KnownMediaType.Stream) {
return expression_1.toExpression(`new System.Net.Http.StreamContent(${value})`);
}
return expression_1.toExpression(`null /* serializeToNode doesn't support '${mediaType}' ${__filename}*/`);
}
serializeToNode(mediaType, value, serializedName) {
return expression_1.toExpression(`null /* serializeToNode doesn't support '${mediaType}' ${__filename}*/`);
}
/** emits the code required to serialize this into a container */
serializeToContainerMember(mediaType, value, container, serializedName) {
return `/* serializeToContainerMember doesn't support '${mediaType}' ${__filename}*/`;
}
validateValue(property) {
return ``;
}
validatePresence(property) {
if (this.isRequired) {
return `await listener.AssertNotNull(${text_manipulation_1.nameof(property.value)},${property});`.trim();
}
return ``;
}
}
exports.Binary = Binary;
//# sourceMappingURL=binary.js.map