UNPKG

@itwin/ecschema-rpcinterface-common

Version:

Schema RPC Interface common interface

56 lines 3.12 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import { RpcInterface, RpcManager, RpcOperation, RpcResponseCacheControl } from "@itwin/core-common"; /*** * Defines an RPC interface to get schema information from a given iModel context. * Method @see getSchemaNames will return the names of schemas that live in this iModel. * The actual schemas can be downloaded using @see getSchemaJSON to get the schema as JSON props. * @internal */ export class ECSchemaRpcInterface extends RpcInterface { /** The version of the RPC Interface. */ static version = "2.0.0"; static interfaceName = "ECSchemaRpcInterface"; static interfaceVersion = ECSchemaRpcInterface.version; /** * Returns the RPC client instance for the frontend. * @returns A client to communicate with the RPC Interface. */ static getClient() { return RpcManager.getClientForInterface(ECSchemaRpcInterface); } /** * Returns an array of SchemaKeyProps that exists in the current iModel context. The client can call * SchemaKey.fromJson() to parse the props to a SchemaKey. * @param tokenProps The iModelToken props that hold the information which iModel is used. * @returns An array of SchemaKeyProps. */ async getSchemaKeys(_tokenProps) { return this.forward.apply(this, [arguments]); } /** * Gets the schema JSON for the current iModel context and returns the schema as a SchemaProps which * the client can call Schema.fromJson() to return a Schema. * @param tokenProps The iModelToken props that hold the information which iModel is used. * @param schemaName The name of the schema that shall be returned. * @returns The SchemaProps. */ async getSchemaJSON(_tokenProps, _schemaName) { return this.forward.apply(this, [arguments]); } } __decorate([ RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable) ], ECSchemaRpcInterface.prototype, "getSchemaKeys", null); __decorate([ RpcOperation.allowResponseCaching(RpcResponseCacheControl.Immutable) ], ECSchemaRpcInterface.prototype, "getSchemaJSON", null); //# sourceMappingURL=ECSchemaRpcInterface.js.map