Users can set the timeout period using environment variables `LINGLONG_CONNECT_TIMEOUT`. Signed-off-by: ice909 <gaochang1@uniontech.com> |
||
|---|---|---|
| .. | ||
| .openapi-generator | ||
| api | ||
| external | ||
| include | ||
| model | ||
| src | ||
| unit-test | ||
| .openapi-generator-ignore | ||
| CMakeLists.txt | ||
| Packing.cmake | ||
| README.md | ||
| libcurl.licence | ||
| uncrustify-rules.cfg | ||
README.md
C API client for linglong
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI spec from a remote server, you can easily generate an API client.
- API version: 1.0.0
- Package version:
- Generator version: 7.8.0
- Build package: org.openapitools.codegen.languages.CLibcurlClientCodegen For more information, please visit https://linglong.dev
Installation
You'll need the curl 7.58.0 package in order to build the API. To have code formatted nicely, you also need to have uncrustify version 0.67 or later.
Prerequisites
Install the curl 7.58.0 package with the following command on Linux.
sudo apt remove curl
wget http://curl.haxx.se/download/curl-7.58.0.tar.gz
tar -xvf curl-7.58.0.tar.gz
cd curl-7.58.0/
./configure
make
sudo make install
Install the uncrustify 0.67 package with the following command on Linux.
git clone https://github.com/uncrustify/uncrustify.git
cd uncrustify
mkdir build
cd build
cmake ..
make
sudo make install
Compile the sample:
This will compile the generated code and create a library in the build folder which has to be linked to the codes where API will be used.
mkdir build
cd build
// To install library to specific location, use following commands
cmake -DCMAKE_INSTALL_PREFIX=/pathtolocation ..
// for normal install use following command
cmake ..
make
sudo make install
How to use compiled library
Considering the test/source code which uses the API is written in main.c(respective api include is written and all objects necessary are defined and created)
To compile main.c(considering the file is present in build folder) use following command -L - location of the library(not required if cmake with normal installation is performed) -l library name
gcc main.c -L. -llinglong -o main
Once compiled, you can run it with ./main
Note: You don't need to specify includes for models and include folder separately as they are path linked. You just have to import the api.h file in your code, the include linking will work.
Documentation for API Endpoints
All URIs are relative to http://localhost
| Category | Method | HTTP request | Description |
|---|---|---|---|
| ClientAPI | ClientAPI_apiV1ReposGet | GET /api/v1/repos | 查看仓库列表 |
| ClientAPI | ClientAPI_fuzzySearchApp | POST /api/v0/apps/fuzzysearchapp | 模糊查找App |
| ClientAPI | ClientAPI_getRepo | GET /api/v1/repos/{repo} | 查看仓库信息 |
| ClientAPI | ClientAPI_newUploadTaskID | POST /api/v1/upload-tasks | generate a new upload task id |
| ClientAPI | ClientAPI_refDelete | DELETE /api/v1/repos/{repo}/refs/{channel}/{app_id}/{version}/{arch}/{module} | delete a ref from repo |
| ClientAPI | ClientAPI_searchApp | GET /api/v2/search/apps | 查找App |
| ClientAPI | ClientAPI_signIn | POST /api/v1/sign-in | 登陆帐号 |
| ClientAPI | ClientAPI_uploadTaskFile | PUT /api/v1/upload-tasks/{task_id}/tar | upload tgz file to upload task |
| ClientAPI | ClientAPI_uploadTaskInfo | GET /api/v1/upload-tasks/{task_id}/status | get upload task status |
| ClientAPI | ClientAPI_uploadTaskLayerFile | PUT /api/v1/upload-tasks/{task_id}/layer | upload layer file to upload task |
Documentation for Models
- _api_v1_repos_get_200_response_t
- api_json_result_t
- api_upload_task_file_resp_t
- api_upload_task_layer_file_resp_t
- apiv2_json_error_t
- apiv2_search_app_response_t
- fuzzy_search_app_200_response_t
- get_repo_200_response_t
- new_upload_task_id_200_response_t
- request_auth_t
- request_fuzzy_search_req_t
- request_register_struct_t
- response_new_upload_task_resp_t
- response_sign_in_t
- response_upload_task_resp_t
- response_upload_task_status_info_t
- schema_new_upload_task_req_t
- schema_repo_info_t
- sign_in_200_response_t
- upload_task_info_200_response_t
Documentation for Authorization
Authentication schemes defined for the API:
Token
-
Type: API key
-
API key parameter name: X-Token
-
Location: HTTP header