@microsoft/kiota-abstractions
Version:
Core abstractions for kiota generated libraries in TypeScript and JavaScript
101 lines • 5.53 kB
TypeScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
import type { SerializationWriter } from "./serializationWriter.js";
import type { SerializationWriterFactory } from "./serializationWriterFactory.js";
import type { Parsable } from "./parsable.js";
import type { ModelSerializerFunction } from "./serializationFunctionTypes.js";
/** This factory holds a list of all the registered factories for the various types of nodes. */
export declare class SerializationWriterFactoryRegistry implements SerializationWriterFactory {
/**
* The content type for JSON data.
*/
private readonly jsonContentType;
getValidContentType(): string;
/** List of factories that are registered by content type. */
contentTypeAssociatedFactories: Map<string, SerializationWriterFactory>;
getSerializationWriter(contentType: string): SerializationWriter;
/**
* Registers the default serializer to the registry.
* @param type the class of the factory to be registered.
*/
registerDefaultSerializer(type: new () => SerializationWriterFactory): void;
/**
* Serializes a parsable object into a buffer
* @param value the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a buffer containing the serialized value
*/
serializeToJson<T extends Parsable>(value: T, serializationFunction: ModelSerializerFunction<T>): ArrayBuffer;
/**
* Serializes a parsable object into a string representation
* @param value the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a string representing the serialized value
*/
serializeToJsonAsString<T extends Parsable>(value: T, serializationFunction: ModelSerializerFunction<T>): string;
/**
* Serializes a collection of parsable objects into a buffer
* @param values the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a string representing the serialized value
*/
serializeCollectionToJson<T extends Parsable>(values: T[], serializationFunction: ModelSerializerFunction<T>): ArrayBuffer;
/**
* Serializes a collection of parsable objects into a string representation
* @param values the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a string representing the serialized value
*/
serializeCollectionToJsonAsString<T extends Parsable>(values: T[], serializationFunction: ModelSerializerFunction<T>): string;
/**
* Serializes a parsable object into a buffer
* @param contentType the content type to serialize to
* @param value the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a buffer containing the serialized value
*/
serialize<T extends Parsable>(contentType: string, value: T, serializationFunction: ModelSerializerFunction<T>): ArrayBuffer;
/**
* Serializes a parsable object into a string representation
* @param contentType the content type to serialize to
* @param value the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a string representing the serialized value
*/
serializeToString<T extends Parsable>(contentType: string, value: T, serializationFunction: ModelSerializerFunction<T>): string;
/**
* Serializes a collection of parsable objects into a buffer
* @param contentType the content type to serialize to
* @param values the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a string representing the serialized value
*/
serializeCollection<T extends Parsable>(contentType: string, values: T[], serializationFunction: ModelSerializerFunction<T>): ArrayBuffer;
/**
* Serializes a collection of parsable objects into a string representation
* @param contentType the content type to serialize to
* @param values the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns a string representing the serialized value
*/
serializeCollectionToString<T extends Parsable>(contentType: string, values: T[], serializationFunction: ModelSerializerFunction<T>): string;
/**
* Gets a serialization writer for a given content type
* @param contentType the content type to serialize to
* @param value the value to serialize
* @param serializationFunction the serialization function for the model type
* @returns the serialization writer for the given content type
*/
getSerializationFactoryWriter(contentType: string, value: unknown, serializationFunction: unknown): SerializationWriter;
/**
* Gets a string value from a buffer
* @param buffer the buffer to get a string from
* @returns the string representation of the buffer
*/
getStringValueFromBuffer(buffer: ArrayBuffer): string;
}
//# sourceMappingURL=serializationWriterFactoryRegistry.d.ts.map