nezutero / blobman

ところでブロブマン

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

blobman

Project structure

blobman
│
├── config.yaml
├── Dockerfile
├── docs
│   ├── LICENSE
│   ├── package.json
│   ├── package-lock.json
│   ├── spec
│   │   ├── components
│   │   │   ├── parameters
│   │   │   │   ├── pageLimitParam.yaml
│   │   │   │   ├── pageNumberParam.yaml
│   │   │   │   └── sortingParam.yaml
│   │   │   ├── README.md
│   │   │   └── schemas
│   │   │       ├── BlobKey.yaml
│   │   │       ├── BlobRequest.yaml
│   │   │       ├── Blob.yaml
│   │   │       ├── Errors.yaml
│   │   │       └── OwnerKey.yaml
│   │   ├── openapi.yaml
│   │   ├── paths
│   │   │   ├── blobs@{id}.yaml
│   │   │   └── blobs.yaml
│   │   └── README.md
│   ├── web
│   │   ├── favicon.png
│   │   ├── index.hbs
│   │   ├── index.html
│   │   └── redoc-config.yaml
│   ├── web_deploy
│   │   ├── favicon.png
│   │   ├── index.hbs
│   │   ├── index.html
│   │   ├── openapi.json
│   │   └── openapi.yaml
│   └── yarn.lock
├── generate.sh
├── go.mod
├── go.sum
├── internal
│   ├── assets
│   │   ├── main.go
│   │   └── migrations
│   │       └── 001_initial.sql
│   ├── cli
│   │   ├── main.go
│   │   └── migrate.go
│   ├── config
│   │   └── main.go
│   ├── data
│   │   ├── blobs.go
│   │   ├── owners.go
│   │   └── postgres
│   │       ├── blobs.go
│   │       └── owners.go
│   └── service
│       ├── handlers
│       │   ├── create_blob.go
│       │   ├── ctx.go
│       │   ├── delete_blob.go
│       │   ├── get_blob.go
│       │   └── get_blobs.go
│       ├── main.go
│       ├── requests
│       │   ├── create_blob.go
│       │   ├── delete_blob.go
│       │   ├── get_blob.go
│       │   └── get_blobs.go
│       └── router.go
├── main.go
├── README.md
└── resources
    ├── db.go
    ├── flag.go
    ├── included.go
    ├── model_blob_attributes.go
    ├── model_blob.go
    ├── model_blob_relationships.go
    ├── model_blob_request_attributes.go
    ├── model_blob_request.go
    ├── model_blob_request_relationships.go
    ├── model_details.go
    ├── model_key.go
    ├── model_links.go
    ├── model_relation_collection.go
    ├── model_relation.go
    └── model_resource_type.go

Installation

git clone https://github.com/kenjitheman/blobman

Usage

Get the black hole to make it work

cd docs
  • yarn
yarn install
yarn run build
  • npm
npm install
npm run build

Now you can see API docs on localhost:8080

Install golang dependencies

  • in project root
go mod tidy

CLI usage

Build it

export KV_VIPER_FILE="./config.yaml"
go build -o blobman .
usage: ./blobman [<flags>] <command> [<args> ...]

Flags:
  --help  Show context-sensitive help (also try --help-long and --help-man).

Commands:
  help [<command>...]
    Show help.

  run service
    run service

  migrate up
    migrate db up

  migrate down
    migrate db down

Examples

  • migrate up
./blobman migrate up
  • migrate down
./blobman migrate down
  • run blobman service
./blobman run service

Now you succesfully launched blobman

Blobman API Usage

Get List of Blobs

Request:

GET http://localhost:18080/integrations/blobman/blobs
Query Parameters:
- pageNumber: Page number for pagination
- pageLimit: Number of items per page
- sorting: Sorting options
{
  "filter": {
    "value": "arbitrary text"
  }
}

Response:

[
  {
    "id": "12345678",
    "attributes": {
      "value": "random_value_1"
    },
    "relationships": {
      "owner": "ce7cfb01-6fdf-47ce-82a8-26122eb0ab01"
    }
  },
  {
    "id": "12345679",
    "attributes": {
      "value": "random_value_2"
    },
    "relationships": {
      "owner": "ce7cfb01-6fdf-47ce-82a8-26122eb0ab02"
    }
  },
  // ... other blobs
]

Get a Specific Blob

Request:

GET http://localhost:18080/integrations/blobman/blobs/{id}

Response:

{
  "id": "12345678",
  "attributes": {
    "value": "random_value_1"
  },
  "relationships": {
    "owner": "ce7cfb01-6fdf-47ce-82a8-26122eb0ab01"
  }
}

Create a Blob

Request:

POST http://localhost:18080/integrations/blobman/blobs

Request Body:

{
  "data": {
    "attributes": {
      "value": "new_blob_value"
    },
    "relationships": {
      "owner": "ce7cfb01-6fdf-47ce-82a8-26122eb0ab03"
    }
  }
}

Response:

{
  "id": "newly_generated_blob_id",
  "attributes": {
    "value": "new_blob_value"
  },
  "relationships": {
    "owner": "ce7cfb01-6fdf-47ce-82a8-26122eb0ab03"
  }
}

Delete a Blob

Request:

DELETE http://localhost:18080/integrations/blobman/blobs/{id}

Response:

204 No Content

License

About

ところでブロブマン


Languages

Language:Go 92.1%Language:Shell 6.8%Language:Dockerfile 1.0%