Skip to content

Commit d13ad09

Browse files
committed
docs: update readme and docs
1 parent 89f78e8 commit d13ad09

File tree

3 files changed

+255
-59
lines changed

3 files changed

+255
-59
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# Hyrapi
1+
<div align="center">
2+
<h1>Hyrapi</h1>
3+
<div align="center">
4+
<img src="https://img.shields.io/badge/CLI-Rest%20API-green?style=flat-square" alt="Badge">
5+
<img src="https://img.shields.io/badge/Version-v1.1.0-orange?style=flat-square" alt="Badge">
6+
</div>
7+
</div>
28

39
Hyrapi is a CLI-based REST API client powered by a YAML collection file. It's designed to simplify making HTTP requests by organizing endpoints, headers, tokens, and parameters in a single configuration file.
410

@@ -58,7 +64,6 @@ variables:
5864
token: value
5965

6066
paths:
61-
6267
- endpoint: /incomes
6368
name: getIncomes
6469
method: GET

docs/collections.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Collections
2+
3+
## Servers
4+
5+
You can define multiple servers for different environments such as development, staging, or production.
6+
7+
```yaml
8+
servers:
9+
- url: http://localhost:3000/api/v1
10+
name: development
11+
description: Development server
12+
- url: http://example.com/api/v1
13+
name: staging
14+
description: Staging server
15+
```
16+
17+
## Variables
18+
19+
You can define global or environment-specific (local) variables.
20+
21+
### Global Variables
22+
23+
```yaml
24+
variables:
25+
key: key_value # Global variable
26+
```
27+
28+
### Local Variables (Per Environment)
29+
30+
You can define variables scoped to specific environments.
31+
32+
```yaml
33+
variables:
34+
development:
35+
token: key_value # Local variable, available only for the development environment
36+
```
37+
38+
To access variables, use this syntax:
39+
40+
```yaml
41+
paths:
42+
- endpoint: /posts
43+
name: getPosts
44+
auth:
45+
type: bearer
46+
token: "{{token}}"
47+
```
48+
49+
## Headers
50+
51+
To define request headers (such as `Content-Type`), you can configure them per path.
52+
53+
```yaml
54+
paths:
55+
- endpoint: /posts
56+
name: getPosts
57+
headers:
58+
Content-Type: application/json
59+
# Content-Type: application/x-www-form-urlencoded
60+
```
61+
62+
## Authentication
63+
64+
You can define authentication for each endpoint as follows:
65+
66+
### Bearer Token
67+
68+
```yaml
69+
paths:
70+
- endpoint: /posts
71+
name: getPosts
72+
auth:
73+
type: bearer
74+
token: "{{token}}"
75+
```
76+
77+
### Basic Auth
78+
79+
```yaml
80+
paths:
81+
- endpoint: /posts
82+
name: getPosts
83+
auth:
84+
type: basic
85+
username: "{{username}}"
86+
password: "{{password}}"
87+
```
88+
89+
### API Key (Header)
90+
91+
```yaml
92+
paths:
93+
- endpoint: /posts
94+
name: getPosts
95+
auth:
96+
type: apikey
97+
api_key: abc123
98+
api_key_header: X-API-Key
99+
```
100+
101+
This will send the header:
102+
`X-API-Key: abc123`
103+
104+
You can customize the header name using `api_key_header`.
105+
106+
### Digest Authentication
107+
108+
```yaml
109+
paths:
110+
- endpoint: /posts
111+
name: getPosts
112+
auth:
113+
type: digest
114+
username: admin
115+
password: secret
116+
```

0 commit comments

Comments
 (0)