Skip to content

barzin144/Zus

Folders and files

NameName
Last commit message
Last commit date
Oct 28, 2024
Jan 12, 2025
Jan 12, 2025
Jun 30, 2024
Jun 8, 2024
Jun 8, 2024
Jan 12, 2025
Jul 2, 2024
Aug 4, 2024
Jun 8, 2024

Repository files navigation

Zus Zus CLI Tool

NuGet Package: zus Mutation Build Test

Table of Contents

Installation

dotnet tool install --global zus

Send Request

Get

zus send get https://example.com/posts/1
Options Description example
-a, --auth Authentication Bearer Token zus send get https://example.com/posts/1 -a eyJhbGciOi==
-n, --name Name for saving the request zus send get https://example.com/posts/1 -n posts
-s, --save-response Save response zus send get https://example.com/posts/1 -s
-h, --header Add header to request, format: Key:Value,Key:Value and wrap your data in single or double quote. zus send get https://example.com/posts/1 -h 'api-key:abc'
-p, --pre-request Pre-request name zus send get https://example.com/posts/1 -p login
-f, --force Overwrite the existing request with same name zus send get https://example.com/posts/1 -n posts -f

Post

zus send post http://example/api/Account/Login -x -d "username:zus,password:123456" //form-urlencoded format
zus send post http://example/api/Account/Login -j -d "username:zus,password:123456" //json format
zus send post http://example/api/Account/Login -d '{"username": "zus", "password": "123456"}' //string format
Options Description
-d, --data Data format: Key:Value,Key:Value and wrap your data in single or double quote. Data will be sent in string format by default. By adding -x flag change format to form-urlencoded or -j for Json format
-a, --auth Authentication Bearer Token
-n, --name Name for saving the request
-s, --save-response Save response
-h, --header Add header to request, format: Key:Value,Key:Value and wrap your data in single quote or double quote.
-x, --form-format Convert Key:Value data to form-urlencoded format
-j, --json-format Convert Key:Value data to json format
-p, --pre-request Pre-request name
-f, --force Overwrite the existing request with same name

Pre-Request

zus send post http://example/api/Account/Login -n login -d "username:zus,password:123456"
//response: { "accessToken": "eyJhbGciOiJI..." }

zus send post http://example/api/Account/UpdateProfile -p login -a "{pr.accessToken}" -j -d "name:zus-tool"

zus send get http://example/api/Product/1 -n product
//response: { "id": "ABC123", name: "PC" }
zus send post http://example/api/Product/Update -p product -j -d "product_id:{pr.id},name:laptop"

zus send post http://example/api/Account/GetToken -n get-token -j -d "username:zus,password:123456"
//response: "eyJhbGciOiJI..."

zus send post http://example/api/Account/UpdateProfile -p get-token -a "{pr.$}" -j -d "name:zus-tool"

zus send post http://example/api/Account/UpdateProfile -p get-token -d "name:{var.name}"

{pr.KEY_OF_RESPONSE_OBJECT} will be replaced with Pre-request response data.(If Pre-request response data is Json)

{pr.$} will be replaced with Pre-request response data.(If Pre-request response data is String)

{var.VARIABLE_NAME} will be replaced with value of saved variable.

Resend

Send a saved request.

zus resend login

Variable

Manage variables.

List

zus var list

Delete

zus var delete SAVED_NAME

Request

Access to saved requests.

List

zus request list

Delete

zus request delete SAVED_NAME

Base64

Encode

zus base64 my_text
zus base64 -f FILE_PATH

output: bXlfdGV4dA==

Decode

zus dbase64 bXlfdGV4dA==
zus dbase64 -f bXlfdGV4dA== //store decoded data into txt file

output: my_text

SHA256

zus sha256 my_text

output: wK5CFkMfgStqjLvxe/h7zaqzNISGyy2xWP9dN893UEI=

GUID

zus guid

Epoch Time Converter

zus dt 1734895248

output: UTC: Sunday, December 22, 2024 7:20:48 PM +00:00

output: Local: Monday, December 23, 2024 3:20:48 AM +08:00

JWT Decoder

image

With Secret

zus djwt eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ilp1cyBDTEkgVG9vbCIsImlhdCI6MTUxNjIzOTAyMn0.9BmMva7XRwYtaNkvmobWNNQX8lHyGnSyVRuzgCjEcIY my_secret
{
  "alg": "HS256",
  "typ": "JWT"
}
{
  "sub": "1234567890",
  "name": "Zus CLI Tool",
  "iat": 1516239022
}
Signature Verified

Without Secret

zus djwt eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ilp1cyBDTEkgVG9vbCIsImlhdCI6MTUxNjIzOTAyMn0.9BmMva7XRwYtaNkvmobWNNQX8lHyGnSyVRuzgCjEcIY
{
  "alg": "HS256",
  "typ": "JWT"
}
{
  "sub": "1234567890",
  "name": "Zus CLI Tool",
  "iat": 1516239022
}
Invalid Signature