def GetCapabilities(self, request, context): """ Get capabilities. Note that either request or context is used in the implementation of this method, but still added as parameters. The reason is that gRPC always sends both when making a function call and therefore we must include them to avoid error messages regarding too many parameters provided from the client. :param request: the request, not used in this method. :param context: the context, not used in this method. :return: the capabilities. """ logging.info('GetCapabilities') # Create an instance of the Capabilities grpc message # Enable(or disable) script evaluation # Set values for pluginIdentifier and pluginVersion capabilities = SSE.Capabilities(allowScript=True, pluginIdentifier='Qlik Rapid API Gateway - Partner Engineering', pluginVersion='v0.1.0') # If user defined functions supported, add the definitions to the message with open(self.function_definitions) as json_file: # Iterate over each function definition and add data to the capabilities grpc message for definition in json.load(json_file)['Functions']: function = capabilities.functions.add() function.name = definition['Name'] function.functionId = definition['Id'] function.functionType = definition['Type'] function.returnType = definition['ReturnType'] # Retrieve name and type of each parameter for param_name, param_type in sorted(definition['Params'].items()): function.params.add(name=param_name, dataType=param_type) logging.info('Adding to capabilities: {}({})'.format(function.name, [p.name for p in function.params])) return capabilities
def GetCapabilities(self, request, context): """ Get capabilities. Note that either request or context is used in the implementation of this method, but still added as parameters. The reason is that gRPC always sends both when making a function call and therefore we must include them to avoid error messages regarding too many parameters provided from the client. :param request: the request, not used in this method. :param context: the context, not used in this method. :return: the capabilities. """ logging.info('GetCapabilities') # Create an instance of the Capabilities grpc message # Enable(or disable) script evaluation # Set values for pluginIdentifier and pluginVersion capabilities = SSE.Capabilities( allowScript=True, pluginIdentifier='Full Script Support - Qlik', pluginVersion='v1.0.0-beta1') return capabilities