Skip to content

Commit

Permalink
Merge pull request #538 from fairDataSociety/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
asabya authored Aug 29, 2023
2 parents 08a8734 + 781e0c9 commit eb05d8b
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 39 deletions.
17 changes: 9 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/btcsuite/btcd v0.22.3
github.com/c-bata/go-prompt v0.2.6
github.com/dustin/go-humanize v1.0.1
github.com/ethereum/go-ethereum v1.12.0
github.com/ethereum/go-ethereum v1.12.2
github.com/ethersphere/bee v1.16.1
github.com/ethersphere/bmt v0.1.4
github.com/fairdatasociety/fairOS-dfs-utils v0.0.0-20221230123929-aec4ed8b854d
Expand All @@ -16,7 +16,7 @@ require (
github.com/gorilla/mux v1.8.0
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/websocket v1.5.0
github.com/hashicorp/golang-lru v0.6.0
github.com/hashicorp/golang-lru v1.0.2
github.com/klauspost/pgzip v1.2.6
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/mitchellh/go-homedir v1.1.0
Expand All @@ -32,8 +32,8 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/wealdtech/go-ens/v3 v3.5.5
go.uber.org/goleak v1.2.1
golang.org/x/crypto v0.9.0
golang.org/x/term v0.8.0
golang.org/x/crypto v0.12.0
golang.org/x/term v0.11.0
gopkg.in/yaml.v2 v2.4.0
resenje.org/jsonhttp v0.2.3
)
Expand All @@ -60,7 +60,7 @@ require (
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down Expand Up @@ -103,10 +103,11 @@ require (
github.com/wealdtech/go-multicodec v1.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.7.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
52 changes: 31 additions & 21 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pkg/api/kv_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type KVExportRequest struct {
// @Produce json
// @Param export_request body KVExportRequest true "kv export info"
// @Param Cookie header string true "cookie parameter"
// @Success 200 {object} []map[string]interface{}
// @Success 200 {object} []map[string][]map[string]string
// @Failure 400 {object} response
// @Failure 500 {object} response
// @Router /v1/kv/export [Post]
Expand Down Expand Up @@ -111,7 +111,7 @@ func (h *Handler) KVExportHandler(w http.ResponseWriter, r *http.Request) {
jsonhttp.InternalServerError(w, &response{Message: "kv export: " + err.Error()})
return
}
var items []map[string]interface{}
var items []map[string]string
var i int64
for i = 0; i < noOfRows; i++ {
if itr == nil {
Expand All @@ -121,11 +121,11 @@ func (h *Handler) KVExportHandler(w http.ResponseWriter, r *http.Request) {
if !ok {
break
}
item := map[string]interface{}{}
item := map[string]string{}
item[itr.StringKey()] = string(itr.Value())
items = append(items, item)
}
resp := map[string]interface{}{}
resp := map[string][]map[string]string{}
resp["items"] = items
w.Header().Set("Content-Type", "application/json")
jsonhttp.OK(w, &resp)
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func (h *Handler) PublicPodGetFileHandler(w http.ResponseWriter, r *http.Request
// @Tags public
// @Accept json
// @Produce json
// @Param ref path string true "pod sharing reference"
// @Param file path string true "file location in the pod"
// @Success 200 {array} byte
// @Failure 400 {object} response
// @Failure 500 {object} response
Expand Down
4 changes: 1 addition & 3 deletions pkg/api/user_del.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ type UserDeleteRequest struct {
//
// @Summary Delete user for ENS based authentication
// @Description deletes user info from swarm
//
// @ID user-delete-v2
//
// @ID user-delete-v2
// @Tags user
// @Produce json
// @Param UserDeleteRequest body UserDeleteRequest true "user delete request"
Expand Down
30 changes: 29 additions & 1 deletion swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,22 @@ const docTemplate = `{
"public"
],
"summary": "download file from a shared pod",
"parameters": [
{
"type": "string",
"description": "pod sharing reference",
"name": "ref",
"in": "path",
"required": true
},
{
"type": "string",
"description": "file location in the pod",
"name": "file",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -2461,7 +2477,15 @@ const docTemplate = `{
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
Expand Down Expand Up @@ -3214,6 +3238,7 @@ const docTemplate = `{
],
"summary": "Open pod",
"operationId": "pod-open-async-handler",
"deprecated": true,
"parameters": [
{
"description": "pod name and user password",
Expand Down Expand Up @@ -4439,6 +4464,9 @@ const docTemplate = `{
"api.UserSignupResponse": {
"type": "object",
"properties": {
"accessToken": {
"type": "string"
},
"address": {
"type": "string"
},
Expand Down
30 changes: 29 additions & 1 deletion swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,22 @@
"public"
],
"summary": "download file from a shared pod",
"parameters": [
{
"type": "string",
"description": "pod sharing reference",
"name": "ref",
"in": "path",
"required": true
},
{
"type": "string",
"description": "file location in the pod",
"name": "file",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -2452,7 +2468,15 @@
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
"additionalProperties": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
Expand Down Expand Up @@ -3205,6 +3229,7 @@
],
"summary": "Open pod",
"operationId": "pod-open-async-handler",
"deprecated": true,
"parameters": [
{
"description": "pod name and user password",
Expand Down Expand Up @@ -4430,6 +4455,9 @@
"api.UserSignupResponse": {
"type": "object",
"properties": {
"accessToken": {
"type": "string"
},
"address": {
"type": "string"
},
Expand Down
21 changes: 20 additions & 1 deletion swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ definitions:
type: object
api.UserSignupResponse:
properties:
accessToken:
type: string
address:
type: string
message:
Expand Down Expand Up @@ -606,6 +608,17 @@ paths:
- application/json
description: PublicPodFilePathHandler is the api handler to download file from
a shared pod
parameters:
- description: pod sharing reference
in: path
name: ref
required: true
type: string
- description: file location in the pod
in: path
name: file
required: true
type: string
produces:
- application/json
responses:
Expand Down Expand Up @@ -2167,7 +2180,12 @@ paths:
description: OK
schema:
items:
additionalProperties: true
additionalProperties:
items:
additionalProperties:
type: string
type: object
type: array
type: object
type: array
"400":
Expand Down Expand Up @@ -2672,6 +2690,7 @@ paths:
post:
consumes:
- application/json
deprecated: true
description: PodOpenAsyncHandler is the api handler to open pod asynchronously
operationId: pod-open-async-handler
parameters:
Expand Down

0 comments on commit eb05d8b

Please sign in to comment.