/* * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ import * as msRest from "@azure/ms-rest-js"; import * as Models from "../models"; import * as Mappers from "../models/teradataTableDataMappers"; import * as Parameters from "../models/parameters"; import { TeradataConnectorContext } from "../teradataConnectorContext"; /** Class representing a TeradataTableData. */ export class TeradataTableData { private readonly client: TeradataConnectorContext; /** * Create a TeradataTableData. * @param {TeradataConnectorContext} client Reference to the service client. */ constructor(client: TeradataConnectorContext) { this.client = client; } /** * This operation gets rows from a table. * @summary Get rows * @param table Name of Teradata table * @param [options] The optional parameters * @returns Promise */ getItems(table: string, options?: Models.TeradataTableDataGetItemsOptionalParams): Promise; /** * @param table Name of Teradata table * @param callback The callback */ getItems(table: string, callback: msRest.ServiceCallback): void; /** * @param table Name of Teradata table * @param options The optional parameters * @param callback The callback */ getItems(table: string, options: Models.TeradataTableDataGetItemsOptionalParams, callback: msRest.ServiceCallback): void; getItems(table: string, options?: Models.TeradataTableDataGetItemsOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { table, options }, getItemsOperationSpec, callback) as Promise; } /** * This operation inserts a new row into a table. * @summary Insert row * @param table Name of table * @param item Row to insert into the specified table * @param [options] The optional parameters * @returns Promise */ postItem(table: string, item: { [propertyName: string]: Models.Item }, options?: msRest.RequestOptionsBase): Promise; /** * @param table Name of table * @param item Row to insert into the specified table * @param callback The callback */ postItem(table: string, item: { [propertyName: string]: Models.Item }, callback: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): void; /** * @param table Name of table * @param item Row to insert into the specified table * @param options The optional parameters * @param callback The callback */ postItem(table: string, item: { [propertyName: string]: Models.Item }, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): void; postItem(table: string, item: { [propertyName: string]: Models.Item }, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>, callback?: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): Promise { return this.client.sendOperationRequest( { table, item, options }, postItemOperationSpec, callback) as Promise; } /** * This operation deletes a row from a table. * @summary Delete row * @param table Name of table * @param id Unique identifier of the row to delete * @param [options] The optional parameters * @returns Promise */ deleteItem(table: string, id: string, options?: msRest.RequestOptionsBase): Promise; /** * @param table Name of table * @param id Unique identifier of the row to delete * @param callback The callback */ deleteItem(table: string, id: string, callback: msRest.ServiceCallback): void; /** * @param table Name of table * @param id Unique identifier of the row to delete * @param options The optional parameters * @param callback The callback */ deleteItem(table: string, id: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; deleteItem(table: string, id: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { table, id, options }, deleteItemOperationSpec, callback); } /** * This operation gets a row from a table. * @summary Get row * @param table Name of Teradata table * @param id Unique identifier of the row to retrieve * @param [options] The optional parameters * @returns Promise */ getItem(table: string, id: string, options?: msRest.RequestOptionsBase): Promise; /** * @param table Name of Teradata table * @param id Unique identifier of the row to retrieve * @param callback The callback */ getItem(table: string, id: string, callback: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): void; /** * @param table Name of Teradata table * @param id Unique identifier of the row to retrieve * @param options The optional parameters * @param callback The callback */ getItem(table: string, id: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): void; getItem(table: string, id: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>, callback?: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): Promise { return this.client.sendOperationRequest( { table, id, options }, getItemOperationSpec, callback) as Promise; } /** * This operation updates an existing row in a table. * @summary Update row * @param table Name of table * @param id Unique identifier of the row to update * @param item Row with updated values * @param [options] The optional parameters * @returns Promise */ patchItem(table: string, id: string, item: { [propertyName: string]: Models.Item }, options?: msRest.RequestOptionsBase): Promise; /** * @param table Name of table * @param id Unique identifier of the row to update * @param item Row with updated values * @param callback The callback */ patchItem(table: string, id: string, item: { [propertyName: string]: Models.Item }, callback: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): void; /** * @param table Name of table * @param id Unique identifier of the row to update * @param item Row with updated values * @param options The optional parameters * @param callback The callback */ patchItem(table: string, id: string, item: { [propertyName: string]: Models.Item }, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): void; patchItem(table: string, id: string, item: { [propertyName: string]: Models.Item }, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>, callback?: msRest.ServiceCallback<{ [propertyName: string]: Models.Item }>): Promise { return this.client.sendOperationRequest( { table, id, item, options }, patchItemOperationSpec, callback) as Promise; } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); const getItemsOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "apim/teradata/{connectionId}/datasets/default/tables/{table}/items", urlParameters: [ Parameters.connectionId, Parameters.table ], queryParameters: [ Parameters.filter, Parameters.orderby, Parameters.top, Parameters.skip, Parameters.select ], responses: { 200: { bodyMapper: Mappers.ItemsList }, default: {} }, serializer }; const postItemOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "apim/teradata/{connectionId}/datasets/default/tables/{table}/items", urlParameters: [ Parameters.connectionId, Parameters.table ], requestBody: { parameterPath: "item", mapper: { required: true, serializedName: "item", type: { name: "Dictionary", value: { type: { name: "Composite", className: "Item", additionalProperties: { type: { name: "Object" } } } } } } }, responses: { 200: { bodyMapper: { serializedName: "parsedResponse", type: { name: "Dictionary", value: { type: { name: "Composite", className: "Item", additionalProperties: { type: { name: "Object" } } } } } } }, default: {} }, serializer }; const deleteItemOperationSpec: msRest.OperationSpec = { httpMethod: "DELETE", path: "apim/teradata/{connectionId}/datasets/default/tables/{table}/items/{id}", urlParameters: [ Parameters.connectionId, Parameters.table, Parameters.id ], responses: { 200: {}, default: {} }, serializer }; const getItemOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "apim/teradata/{connectionId}/datasets/default/tables/{table}/items/{id}", urlParameters: [ Parameters.connectionId, Parameters.table, Parameters.id ], responses: { 200: { bodyMapper: { serializedName: "parsedResponse", type: { name: "Dictionary", value: { type: { name: "Composite", className: "Item", additionalProperties: { type: { name: "Object" } } } } } } }, default: {} }, serializer }; const patchItemOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "apim/teradata/{connectionId}/datasets/default/tables/{table}/items/{id}", urlParameters: [ Parameters.connectionId, Parameters.table, Parameters.id ], requestBody: { parameterPath: "item", mapper: { required: true, serializedName: "item", type: { name: "Dictionary", value: { type: { name: "Composite", className: "Item", additionalProperties: { type: { name: "Object" } } } } } } }, responses: { 200: { bodyMapper: { serializedName: "parsedResponse", type: { name: "Dictionary", value: { type: { name: "Composite", className: "Item", additionalProperties: { type: { name: "Object" } } } } } } }, default: {} }, serializer };