Serverless code for your project. Write code in any language you have experience with or choose from dozens of pre-written built-in functions.
CodeMash Code service allows you to add your own custom functions or CodeMash provided functions which can later be used in various triggers, scheduled tasks, or called through API.
To start using Code API you first need to enable code service in your CodeMash dashboard.
Features included in code service:
Providers - the ability to add your own functions from external providers.
Functions - executing your own custom pieces of code.
CodeMash functions - using CodeMash implemented functions.
Using SDK
If you decide to use one of our provided SDK, the following code shows how to initialize code service.
var projectId =Guid.Parse("{YOUR_PROJECT_ID}");var apiKey ="{YOUR_SECRET_KEY}";var client =newCodeMashClient(apiKey, projectId);var codeService =newCodeMashCodeService(client);
The following are examples of code SDK using different languages and frameworks.
usingSystem;usingCodeMash.Client;usingCodeMash.Code.Services;usingIsidos.CodeMash.ServiceContracts;namespaceConsoleApplication{classProgram {staticvoidMain(string[] args) { // 1. Get your Project ID and Secret Keyvar projectId =Guid.Parse("{YOUR_PROJECT_ID}");var apiKey ="{YOUR_SECRET_KEY}"; // 2. Create a general client for API callsvar client =newCodeMashClient(apiKey, projectId); // 3. Create a service objectvar codeService =newCodeMashCodeService(client); // 4. Call an API methodcodeService.ExecuteFunction(newExecuteFunctionRequest { Id =Guid.Parse("{YOUR_FUNCTION_ID}") }); } }}