//------------------------------------------------------------------ // Proxy Script Generated by Delphi Microservices Container 4.3.20 // Do not modify this code! // Generated at: 2025-04-26 18.25.01 //------------------------------------------------------------------ export class AuthRPCProxy { __baseUrl = ""; constructor(baseUrl) { this.__baseUrl = baseUrl; } get baseUrl() { return this.__baseUrl; } __getJsonRpcRequest(jsonrpcRequestMethod, params) { let json = this.__getJsonRpcNotification(jsonrpcRequestMethod, params); json["id"] = Math.trunc(Math.random() * 100000); return json; } __getJsonRpcNotification(jsonrpcRequestMethod, params) { return { "jsonrpc": "2.0", "method": jsonrpcRequestMethod, "params": params }; } __internalFetch(type, baseUrl, jsonrpcMethod, params) { let jsonbody = null; if (type === 'notification') { jsonbody = this.__getJsonRpcNotification(jsonrpcMethod, params); } else if (type === 'request') { jsonbody = this.__getJsonRpcRequest(jsonrpcMethod, params); } return fetch(baseUrl, { "method": "POST", "body": JSON.stringify(jsonbody), "headers": { "content-type": "application/json", "accept": "application/json" } }).then(data => { switch (data.status) { case 200: { return data.json(); } case 204: { //no content return null; } default: { return data.json(); } } }); } __jsonRpcResponsePromise(type, baseUrl, method, params) { switch (type) { case "request": { return new Promise((resolve, reject) => { this.__internalFetch('request', this.baseUrl, method, params).then(jsonresp => { if ("result" in jsonresp) { resolve(jsonresp.result) } else if ("error" in jsonresp) { reject(jsonresp.error) } else { throw new Error("Invalid JSON-RPC response"); } }); }) break; } case "notification": { return new Promise((resolve, reject) => { this.__internalFetch('notification', this.baseUrl, method, params).then(jsonresp => { if (jsonresp !== null && "error" in jsonresp) { reject(jsonresp.error); } else { resolve(); } }); }) break; } default: { throw new Error("JSON-RPC message must be 'request' or 'notification' [Actual: '" + type + '"]'); } } } // Following methods are automatically generated // Invokes [function GetLicenseInfo(const Token: string): TJsonObject] // Returns all the info about the current license. getLicenseInfo(token) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetLicenseInfo',{ "token": token }); } // Invokes [function CreateUser(const Token: string; const aUser: TJsonObject): TJsonObject] createUser(token, aUser) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'CreateUser',{ "token": token, "aUser": aUser }); } // Invokes [function UpdateUser(const Token: string; const UserID: Int64; const aUser: TJsonObject): TJsonObject] updateUser(token, userId, aUser) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'UpdateUser',{ "token": token, "userId": userId, "aUser": aUser }); } // Invokes [procedure ChangePassword(const Token: string; const UserID: Int64; const NewPassword: string)] changePassword(token, userId, newPassword) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'ChangePassword',{ "token": token, "userId": userId, "newPassword": newPassword }); } // Invokes [procedure DisableUser(const Token: string; const UserID: Int64)] disableUser(token, userId) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'DisableUser',{ "token": token, "userId": userId }); } // Invokes [procedure EnableUser(const Token: string; const UserID: Int64)] enableUser(token, userId) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'EnableUser',{ "token": token, "userId": userId }); } // Invokes [procedure DeleteUser(const Token: string; const UserID: Int64)] deleteUser(token, userId) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'DeleteUser',{ "token": token, "userId": userId }); } // Invokes [function DeleteUserByUserName(const Token: string; const UserName: string): TJsonObject] deleteUserByUserName(token, userName) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'DeleteUserByUserName',{ "token": token, "userName": userName }); } // Invokes [function GetUser(const Token: string; const UserID: Int64): TUser] getUser(token, userId) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetUser',{ "token": token, "userId": userId }); } // Invokes [function GetUsers(const Token: string; const Filter: TJsonObject): TJsonObject] getUsers(token, filter) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetUsers',{ "token": token, "filter": filter }); } // Invokes [function GetAudit(const Token: string; const Filter: TJsonObject): TJsonObject] getAudit(token, filter) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetAudit',{ "token": token, "filter": filter }); } // Invokes [function GetUsersCount(const Token: string; const Filter: TJsonObject): TJsonObject] getUsersCount(token, filter) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetUsersCount',{ "token": token, "filter": filter }); } // Invokes [function CreateContext(const Token: string; const SSOContext: TJsonObject): TJsonObject] createContext(token, ssocontext) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'CreateContext',{ "token": token, "ssocontext": ssocontext }); } // Invokes [procedure DeleteContext(const Token: string; const SSOContextID: Int64)] deleteContext(token, ssocontextId) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'DeleteContext',{ "token": token, "ssocontextId": ssocontextId }); } // Invokes [procedure UpdateContext(const Token: string; const SSOContextID: Int64; const SSOContext: TJsonObject)] updateContext(token, ssocontextId, ssocontext) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'UpdateContext',{ "token": token, "ssocontextId": ssocontextId, "ssocontext": ssocontext }); } // Invokes [function GetContexts(const Token: string; const RQLFilter: string): TJsonObject] getContexts(token, rqlfilter) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetContexts',{ "token": token, "rqlfilter": rqlfilter }); } // Invokes [function AddContextToUser(const Token: string; const UserID: Int64; const UserContext: TJsonObject): TJsonObject] addContextToUser(token, userId, userContext) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'AddContextToUser',{ "token": token, "userId": userId, "userContext": userContext }); } // Invokes [procedure UpdateContextToUser(const Token: string; const UserContextID: Int64; const UserContext: TJsonObject)] updateContextToUser(token, userContextId, userContext) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'UpdateContextToUser',{ "token": token, "userContextId": userContextId, "userContext": userContext }); } // Invokes [function GetUserContext(const Token: string; const UserContextID: Int64): TJsonObject] // Returns a single User-Context base on UserContextID getUserContext(token, userContextId) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetUserContext',{ "token": token, "userContextId": userContextId }); } // Invokes [function GetUserContexts(const Token: string; UserID: Int64): TJsonObject] // Returns all User-Contexts by UserId getUserContexts(token, userId) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetUserContexts',{ "token": token, "userId": userId }); } // Invokes [function GetUserContextsByName(const Token: string; const SSOContextName: string): TJsonObject] // Returns all User-Contexts by ContextName getUserContextsByName(token, ssocontextName) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetUserContextsByName',{ "token": token, "ssocontextName": ssocontextName }); } // Invokes [function GetAvailableContextsForUser(const Token: string; UserID: Int64): TJsonObject] // Returns all Contexts not associated with UserID getAvailableContextsForUser(token, userId) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetAvailableContextsForUser',{ "token": token, "userId": userId }); } // Invokes [function GetAvailableUsersForContext(const Token: string; ContextID: Int64): TJsonObject] // Returns all Users not associated with ContextID getAvailableUsersForContext(token, contextId) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetAvailableUsersForContext',{ "token": token, "contextId": contextId }); } // Invokes [procedure DeleteUserContext(const Token: string; const UserID: Int64; const SSOContextName: string)] // Removes the association between UserID and ContextName deleteUserContext(token, userId, ssocontextName) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'DeleteUserContext',{ "token": token, "userId": userId, "ssocontextName": ssocontextName }); } // Invokes [function GetAllMyContextInfoByContextName(const Token: string; SSOContextName: string): TJsonObject] getAllMyContextInfoByContextName(token, ssocontextName) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetAllMyContextInfoByContextName',{ "token": token, "ssocontextName": ssocontextName }); } // Invokes [function GetMyContextDataByContextName(const Token: string; SSOContextName: string): TJsonObject] getMyContextDataByContextName(token, ssocontextName) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetMyContextDataByContextName',{ "token": token, "ssocontextName": ssocontextName }); } // Invokes [function GetMySystemDataByContextName(const Token: string; SSOContextName: string): TJsonObject] getMySystemDataByContextName(token, ssocontextName) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetMySystemDataByContextName',{ "token": token, "ssocontextName": ssocontextName }); } // Invokes [function GetMyUserDataByContextName(const Token: string; SSOContextName: string): TJsonObject] getMyUserDataByContextName(token, ssocontextName) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetMyUserDataByContextName',{ "token": token, "ssocontextName": ssocontextName }); } // Invokes [procedure SetMyUserDataByContextName(const Token: string; const SSOContextName: string; const UserData: TJsonObject)] setMyUserDataByContextName(token, ssocontextName, userData) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'SetMyUserDataByContextName',{ "token": token, "ssocontextName": ssocontextName, "userData": userData }); } // Invokes [function GetCurrentAPIKeyForUser(const Token: string; const UserID: Int64): TJsonObject] getCurrentApikeyForUser(token, userId) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GetCurrentAPIKeyForUser',{ "token": token, "userId": userId }); } // Invokes [function GenerateAPIKeyForUser(const Token: string; const UserID: Int64): TJsonObject] generateApikeyForUser(token, userId) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'GenerateAPIKeyForUser',{ "token": token, "userId": userId }); } // Invokes [procedure ClearAPIKeyForUser(const Token: string; const UserID: Int64)] clearApikeyForUser(token, userId) { return this.__jsonRpcResponsePromise('notification', this.__baseUrl, 'ClearAPIKeyForUser',{ "token": token, "userId": userId }); } // Invokes [function Login(const UserName: string; const Password: string): TJsonObject] // Returns the JWT token which can be used to call all other methods. login(userName, password) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'Login',{ "userName": userName, "password": password }); } // Invokes [function RefreshToken(const Token: string): TJsonObject] // Extends the expiration time of a still-valid token. Clients must use the token returned instead of the previous one. refreshToken(token) { return this.__jsonRpcResponsePromise('request', this.__baseUrl, 'RefreshToken',{ "token": token }); } } //end