Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: API metadata and Execute via LSP #48

Merged
merged 13 commits into from
Sep 8, 2024
Merged

Conversation

LinceMathew
Copy link
Contributor

@LinceMathew LinceMathew commented Sep 7, 2024

What type of MR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Doc Update
  • 🎨 Style
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ”₯ Performance Improvements
  • βœ… Test
  • πŸ€– Build
  • πŸ” CI
  • ⏩ Revert

Description

This merge request includes two major changes.

  1. Added API response time, status code, size of API in bytes for all API responses.
  2. We can execute an API request via LSP now, that will return the API response as a RPC Json along with the above mentioned meta data.

Important files to start review from

Mobile & Desktop Screenshots/Recordings

image

Added tests?

  • πŸ‘ yes
  • πŸ™… no, because they aren't needed
  • πŸ™‹ no, because I need help

Added to documentation?

If documentation update is there, then run make mkdocs once PR is in acceptable state.

  • πŸ““ make mkdocs
  • πŸ“œ README.md
  • πŸ™… no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

  • Update documentation
  • Update readme

[optional] What gif best describes this MR or how it makes you feel?

![alt text](URL of the GIF file)

@LinceMathew LinceMathew changed the title Feature/meta data Feature/meta data/ExecuteViaLSP Sep 7, 2024
@LinceMathew LinceMathew changed the title Feature/meta data/ExecuteViaLSP Feature/metadata/ExecuteViaLSP Sep 7, 2024
@LinceMathew LinceMathew changed the title Feature/metadata/ExecuteViaLSP Feature/metadata and Execute via LSP Sep 7, 2024
@LinceMathew LinceMathew changed the title Feature/metadata and Execute via LSP Feature: API metadata and Execute via LSP Sep 7, 2024
@LinceMathew LinceMathew added the enhancement New feature or request label Sep 7, 2024
@LinceMathew LinceMathew self-assigned this Sep 7, 2024
oldDir, _ := os.Getwd()
utils.ChangeWorkingDir(apiDir)
start := time.Now()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are checking time http request only ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the time difference between executing the API request

@@ -30,7 +30,7 @@ func RunVMCode(jsCode string, vm interface{}) {

// GenerateChainCode takes in an HTTP response body and comes up with some JS code to define the "magic variable" result.
func GenerateChainCode(httpRespBody string) string {
fmt.Println("WW: Value of httpRespBody is",httpRespBody)
// fmt.Println("WW: Value of httpRespBody is",httpRespBody)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

return HandleParsedFileHelper(parsedAPI, o, dir, vm)
func HandleParsedFile(parsedAPI *gabs.Container, o *lama2cmd.Opts, dir string) (httpie.ExResponse, *lama2cmd.Opts, []outputmanager.ResponseTime, []outputmanager.StatusCode, []outputmanager.ContentSize, error) {
vm := cmdexec.GetJSVm()
return HandleParsedFileHelper(parsedAPI, o, dir, vm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run go fmt ./...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

binary_name: "l2"
extra_files: LICENSE README.md
ldflags: -X main.version=${{ github.ref_name }}
build_flags: '-tags=cli'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add wasm build here its in release.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

@@ -60,7 +60,7 @@ func generateConvertedSippet(targetLangLib string, parsedAPI *gabs.Container) st
snippetArgs.SnippetCore = snippetcore
fmt.Println("Snippet args:", snippetArgs)
httpsnippetCode := PrepareHTTPSnippetGenerator(snippetArgs)
//fmt.Println("httpsnippetCode:", httpsnippetCode)
// fmt.Println("httpsnippetCode:", httpsnippetCode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rogueloop rogueloop merged commit eec29e7 into main Sep 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants