version 1
This commit is contained in:
parent
4aeec1f70f
commit
5734f13675
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 r0r-5chach
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
# Radikle
|
||||||
|
Radikle is a Kotlin library that provides an interface for interacting with the radicle-httpd JSON API.
|
||||||
|
The library uses Retrofit for network requests and Jackson for parsing JSON responses into Kotlin data classes.
|
||||||
|
|
||||||
|
/raw endpoint handling is still under development.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Simple interface for interacting with the radicle-httpd JSON API.
|
||||||
|
- Provides access to the v1 API through the RadicleApi class.
|
||||||
|
- Uses Retrofit for HTTP requests and Jackson for JSON parsing.
|
||||||
|
- Unit tests are written for all endpoints, except raw endpoints.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1) Clone the repository:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/yourusername/radikle.git
|
||||||
|
```
|
||||||
|
|
||||||
|
2) Install dependencies and build the project using Gradle:
|
||||||
|
```bash
|
||||||
|
./gradlew build
|
||||||
|
```
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
The main entry point into Radikle is through the `RadicleApi` class. You pass a base URL to the constructor, and you can access the v1 API via the v1() function.
|
||||||
|
|
||||||
|
## Example usage:
|
||||||
|
```kotlin
|
||||||
|
val api = RadicleApi("https://api.radicle.xyz").v1()
|
||||||
|
|
||||||
|
// Get a response from /
|
||||||
|
val response = v1Api.getRoot()
|
||||||
|
```
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
Unit tests are written for all API endpoints except the raw endpoints. To run tests, use:
|
||||||
|
```bash
|
||||||
|
./gradlew test
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
1) Fork the repository.
|
||||||
|
2) Create a new branch for your changes.
|
||||||
|
3) Commit your changes.
|
||||||
|
4) Push to your fork and open a pull request.
|
||||||
|
|
||||||
|
# Issues
|
||||||
|
Please use the issues to report bugs, request features, or ask questions.
|
||||||
|
|
||||||
|
# License
|
||||||
|
This project is licensed under the MIT License.
|
||||||
|
|
@ -22,26 +22,26 @@ interface RadicleV1Service {
|
||||||
suspend fun getFileByCanonicalHead(
|
suspend fun getFileByCanonicalHead(
|
||||||
@Path("rid") rid: String,
|
@Path("rid") rid: String,
|
||||||
@Path("path") path: String
|
@Path("path") path: String
|
||||||
) //TODO: IO Types
|
): NotImplementedError //TODO: IO Types
|
||||||
|
|
||||||
@GET("/raw/{rid}/blobs/{oid}")
|
@GET("/raw/{rid}/blobs/{oid}")
|
||||||
suspend fun getFileByOID(
|
suspend fun getFileByOID(
|
||||||
@Path("rid") rid: String,
|
@Path("rid") rid: String,
|
||||||
@Path("oid") oid: String
|
@Path("oid") oid: String
|
||||||
) //TODO: IO Types
|
): NotImplementedError //TODO: IO Types
|
||||||
|
|
||||||
@GET("/{rid}/{request}")
|
@GET("/{rid}/{request}")
|
||||||
suspend fun getGit(
|
suspend fun getGit(
|
||||||
@Path("rid") rid: String,
|
@Path("rid") rid: String,
|
||||||
@Path("request") request: String
|
@Path("request") request: String
|
||||||
) //TODO: IO Types
|
): NotImplementedError //TODO: IO Types
|
||||||
|
|
||||||
@GET("/raw/{rid}/{sha}/{path}")
|
@GET("/raw/{rid}/{sha}/{path}")
|
||||||
suspend fun getFileByCommit(
|
suspend fun getFileByCommit(
|
||||||
@Path("rid") rid: String,
|
@Path("rid") rid: String,
|
||||||
@Path("sha") sha: String,
|
@Path("sha") sha: String,
|
||||||
@Path("path") path: String
|
@Path("path") path: String
|
||||||
) //TODO: IO Types
|
): NotImplementedError //TODO: IO Types
|
||||||
|
|
||||||
@GET(V1)
|
@GET(V1)
|
||||||
suspend fun getInfo(): ApiInfo
|
suspend fun getInfo(): ApiInfo
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue