cvat icon indicating copy to clipboard operation
cvat copied to clipboard

[draft] Add query CLI command

Open zhiltsov-max opened this issue 1 year ago • 1 comments

This PR is just a PoC draft of a possible CLI command. Added a command to send arbitrary queries to API via CLI (something between raw CURL and GitHub's api command). It can accept data, query params, endpoint names, and output raw of formatted responses. The idea is to provide a universal CLI command for API interaction. It would help to reduce boilerplate SDK code for the commands outside of the current CLI scope.

Examples:

python samples/api_client.py --org myorg --host "app.cvat.ai" query --all-pages -o "webhoook_deliveries.json" /api/webhooks/xxx/deliveries page_size=100

Also implemented support for org and auth by tokens in the local env vars.

  • Fixed default port for localhost in SDK / CLI, automatic schema detection should work once again

Motivation and context

How has this been tested?

Checklist

  • [ ] I submit my changes into the develop branch
  • [ ] I have created a changelog fragment
  • [ ] I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] I have linked related issues (see GitHub docs)
  • [ ] I have increased versions of npm packages if it is necessary (cvat-canvas, cvat-core, cvat-data and cvat-ui)

License

  • [ ] I submit my code changes under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.

zhiltsov-max avatar Jan 04 '24 15:01 zhiltsov-max

Codecov Report

Merging #7320 (c9e8bd7) into develop (56f37ac) will decrease coverage by 0.04%. Report is 3 commits behind head on develop. The diff coverage is 50.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7320      +/-   ##
===========================================
- Coverage    82.98%   82.95%   -0.04%     
===========================================
  Files          373      373              
  Lines        39578    39603      +25     
  Branches      3689     3704      +15     
===========================================
+ Hits         32844    32852       +8     
- Misses        6734     6751      +17     
Components Coverage Δ
cvat-ui 78.42% <ø> (-0.06%) :arrow_down:
cvat-server 87.10% <50.00%> (-0.01%) :arrow_down:

codecov[bot] avatar Jan 04 '24 15:01 codecov[bot]