UNPKG

@zohocrm/typescript-sdk-2.1

Version:
115 lines (111 loc) 5.37 kB
/** Copyright (c) 2021, ZOHO CORPORATION PRIVATE LIMITED All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. **/ import { UserSignature } from './user_signature'; import { Environment } from '../routes/dc/environment'; import { Token } from '../models/authenticator/token'; import { RequestProxy } from './request_proxy'; import { SDKConfig } from './sdk_config'; import { TokenStore } from '../models/authenticator/store/token_store'; import * as LoggerFile from './logger/logger'; /** * The class to initialize Zoho CRM SDK. */ export declare class Initializer { private static LOCAL; static initializer: Initializer; private _environment; private _store; private _user; private _token; static jsonDetails: { [key: string]: { [key: string]: any; }; }; private _resourcePath; private _requestProxy; private _sdkConfig; /** * The method is to initialize the SDK. * @param {UserSignature} user - A UserSignature class instance represents the CRM user. * @param {Environment} environment - A Environment class instance containing the CRM API base URL and Accounts URL. * @param {Token} token - A Token class instance containing the OAuth client application information. * @param {TokenStore} store - A TokenStore class instance containing the token store information. * @param {SDKConfig} sdkConfig - A SDKConfig class instance containing the configuration. * @param {String} resourcePath - A String containing the absolute directory path to store user specific JSON files containing module fields information. * @param {LoggerFile.Logger} logger - A Logger class instance containing the log file path and Logger type. * @param {RequestProxy} proxy - A RequestProxy class instance containing the proxy properties of the user. * @throws {SDKException} */ static initialize(user: UserSignature, environment: Environment, token: Token, store: TokenStore, sdkConfig: SDKConfig, resourcePath: string, logger: LoggerFile.Logger, proxy?: RequestProxy): Promise<void>; /** * This method to get record field and class details. * @param filePath A String containing the file path. * @returns A JSON representing the class information details. */ static getJSON(filePath: string): any; /** * This method is to get Initializer class instance. * @returns A Initializer class instance representing the SDK configuration details. */ static getInitializer(): Promise<Initializer>; /** * This method is to switch the different user in SDK environment. * @param {UserSignature} user - A UserSignature class instance represents the CRM user. * @param {Environment} environment - A Environment class instance containing the CRM API base URL and Accounts URL. * @param {Token} token - A Token class instance containing the OAuth client application information. * @param {SDKConfig} sdkConfig - A SDKConfig instance representing the configuration * @param {RequestProxy} proxy - A RequestProxy class instance containing the proxy properties. */ static switchUser(user: UserSignature, environment: Environment, token: Token, sdkConfig: SDKConfig, proxy?: RequestProxy): Promise<void>; /** * This is a getter method to get API environment. * @returns A Environment representing the API environment. */ getEnvironment(): Environment; /** * This is a getter method to get Token Store. * @returns A TokenStore class instance containing the token store information. */ getStore(): TokenStore; /** * This is a getter method to get CRM User. * @returns A User class instance representing the CRM user. */ getUser(): UserSignature; /** * This is a getter method to get Proxy information. * @returns {RequestProxy} A RequestProxy class instance representing the API Proxy information. */ getRequestProxy(): RequestProxy | undefined; /** * This is a getter method to get OAuth client application information. * @returns {Token} A Token class instance representing the OAuth client application information. */ getToken(): Token; /** * This is a getter method to get resourcePath value. * @returns {string} A String value representing the resourcePath. */ getResourcePath(): string; /** * This is a getter method to get the SDK Configuration * @returns {SDKConfig} A SDKConfig instance representing the configuration */ getSDKConfig(): SDKConfig; static removeUserConfiguration(user: UserSignature, environment: Environment): Promise<void>; getEncodedKey(user: UserSignature, environment: Environment): Promise<string>; private toString; toUTF8Array(str: string): number[]; }