Code generation for methods
From here, you can generate and publish code for various methods/APIs in different languages.
- From the left hand side menu, navigate to Code > Methods.
- Select the language, organization, service, and version for which you want to generate the code for the methods. After you make the selection, the list of methods should be visible.
- Click the Show button to view the generated code instantly. Previously generated code is retrieved from our cache, ensuring faster access without needing to fetch it from LLMs again.
Generate code for a method
Code can only be generated for methods that have not yet been published. Once a method is published, new code cannot be generated again. Therefore, ensure that the generated code is suitable for production use before publishing.
- Look for methods where the Generate button is available.
- A popup drawer will open, displaying the generated code once the process is complete.
- If you need to modify the generated code, please provide a prompt. Click Publish to make the code available to others through our VSC Plugin or Agents.
Generate code for all methods at once
The Generate All button allows you to generate code for all methods that have not yet been processed. This operation can take time, depending on the number of methods listed in the API.
Additionally, as the code for each method is generated, it is immediately published and made available to others.
Update method name
If the input spec file lacks method names or contains names that are too long, Swytchcode’s AI attempts to generate or summarize them. As a result, the suggested method names may not always be ideal.
In such cases, you can manually edit the method names. It’s important to use meaningful names, as the AI relies on them to generate the corresponding method effectively.