UNPKG

@azure/search-documents

Version:

Azure client library to use Cognitive Search for node.js and browser.

159 lines 5 kB
/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; /** Class containing SynonymMaps operations. */ export class SynonymMapsImpl { /** * Initialize a new instance of the class SynonymMaps class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Creates a new synonym map or updates a synonym map if it already exists. * @param synonymMapName The name of the synonym map to create or update. * @param synonymMap The definition of the synonym map to create or update. * @param options The options parameters. */ createOrUpdate(synonymMapName, synonymMap, options) { return this.client.sendOperationRequest({ synonymMapName, synonymMap, options }, createOrUpdateOperationSpec); } /** * Deletes a synonym map. * @param synonymMapName The name of the synonym map to delete. * @param options The options parameters. */ delete(synonymMapName, options) { return this.client.sendOperationRequest({ synonymMapName, options }, deleteOperationSpec); } /** * Retrieves a synonym map definition. * @param synonymMapName The name of the synonym map to retrieve. * @param options The options parameters. */ get(synonymMapName, options) { return this.client.sendOperationRequest({ synonymMapName, options }, getOperationSpec); } /** * Lists all synonym maps available for a search service. * @param options The options parameters. */ list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Creates a new synonym map. * @param synonymMap The definition of the synonym map to create. * @param options The options parameters. */ create(synonymMap, options) { return this.client.sendOperationRequest({ synonymMap, options }, createOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const createOrUpdateOperationSpec = { path: "/synonymmaps('{synonymMapName}')", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.SynonymMap, }, 201: { bodyMapper: Mappers.SynonymMap, }, default: { bodyMapper: Mappers.ErrorResponse, }, }, requestBody: Parameters.synonymMap, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.endpoint, Parameters.synonymMapName], headerParameters: [ Parameters.contentType, Parameters.accept, Parameters.ifMatch, Parameters.ifNoneMatch, Parameters.prefer, ], mediaType: "json", serializer, }; const deleteOperationSpec = { path: "/synonymmaps('{synonymMapName}')", httpMethod: "DELETE", responses: { 204: {}, 404: {}, default: { bodyMapper: Mappers.ErrorResponse, }, }, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.endpoint, Parameters.synonymMapName], headerParameters: [ Parameters.accept, Parameters.ifMatch, Parameters.ifNoneMatch, ], serializer, }; const getOperationSpec = { path: "/synonymmaps('{synonymMapName}')", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SynonymMap, }, default: { bodyMapper: Mappers.ErrorResponse, }, }, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.endpoint, Parameters.synonymMapName], headerParameters: [Parameters.accept], serializer, }; const listOperationSpec = { path: "/synonymmaps", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ListSynonymMapsResult, }, default: { bodyMapper: Mappers.ErrorResponse, }, }, queryParameters: [Parameters.apiVersion, Parameters.select], urlParameters: [Parameters.endpoint], headerParameters: [Parameters.accept], serializer, }; const createOperationSpec = { path: "/synonymmaps", httpMethod: "POST", responses: { 201: { bodyMapper: Mappers.SynonymMap, }, default: { bodyMapper: Mappers.ErrorResponse, }, }, requestBody: Parameters.synonymMap, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.endpoint], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer, }; //# sourceMappingURL=synonymMaps.js.map