Skip to content

Commit

Permalink
feat: add new query APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Aug 1, 2023
1 parent 846b6b4 commit 96bbaf3
Show file tree
Hide file tree
Showing 9 changed files with 2,635 additions and 665 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build/
vendor/
.local
.task
coverage.out
38 changes: 38 additions & 0 deletions proto/greenfield/storage/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ service Query {
option (google.api.http).get = "/greenfield/storage/is_price_changed/{bucket_name}";
}

// Queries whether some members are in the group.
rpc QueryGroupMembersExist(QueryGroupMembersExistRequest) returns (QueryGroupMembersExistResponse) {
option (google.api.http).get = "/greenfield/storage/group_members_exist/{group_id}/{members}";
}

// Queries whether some groups are exist.
rpc QueryGroupsExist(QueryGroupsExistRequest) returns (QueryGroupsExistResponse) {
option (google.api.http).get = "/greenfield/storage/groups_exist/{group_owner}/{group_names}";
}

// Queries whether some groups are exist by id.
rpc QueryGroupsExistById(QueryGroupsExistByIdRequest) returns (QueryGroupsExistResponse) {
option (google.api.http).get = "/greenfield/storage/groups_exist_by_id/{group_ids}";
}

// this line is used by starport scaffolding # 2
}

Expand Down Expand Up @@ -356,4 +371,27 @@ message QueryIsPriceChangedResponse {
(gogoproto.nullable) = false
];
}

message QueryGroupMembersExistRequest {
string group_id = 1;
repeated string members = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

message QueryGroupMembersExistResponse {
map<string, bool> exists = 1;
}

message QueryGroupsExistRequest {
string group_owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated string group_names = 2;
}

message QueryGroupsExistByIdRequest {
repeated string group_ids = 1;
}

message QueryGroupsExistResponse {
map<string, bool> exists = 1;
}

// this line is used by starport scaffolding # 3
163 changes: 163 additions & 0 deletions swagger/static/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,155 @@ paths:
type: boolean
tags:
- Query
/greenfield/storage/group_members_exist/{group_id}/{members}:
get:
summary: Queries whether some members are in the group.
operationId: QueryGroupMembersExist
responses:
'200':
description: A successful response.
schema:
type: object
properties:
exists:
type: object
additionalProperties:
type: boolean
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: group_id
in: path
required: true
type: string
- name: members
in: path
required: true
type: array
items:
type: string
collectionFormat: csv
minItems: 1
tags:
- Query
/greenfield/storage/groups_exist/{group_owner}/{group_names}:
get:
summary: Queries whether some groups are exist.
operationId: QueryGroupsExist
responses:
'200':
description: A successful response.
schema:
type: object
properties:
exists:
type: object
additionalProperties:
type: boolean
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: group_owner
in: path
required: true
type: string
- name: group_names
in: path
required: true
type: array
items:
type: string
collectionFormat: csv
minItems: 1
tags:
- Query
/greenfield/storage/groups_exist_by_id/{group_ids}:
get:
summary: Queries whether some groups are exist by id.
operationId: QueryGroupsExistById
responses:
'200':
description: A successful response.
schema:
type: object
properties:
exists:
type: object
additionalProperties:
type: boolean
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: group_ids
in: path
required: true
type: array
items:
type: string
collectionFormat: csv
minItems: 1
tags:
- Query
/greenfield/storage/head_bucket/{bucket_name}:
get:
summary: Queries a bucket with specify name.
Expand Down Expand Up @@ -33742,6 +33891,13 @@ definitions:
value:
type: string
title: attributes
greenfield.storage.QueryGroupMembersExistResponse:
type: object
properties:
exists:
type: object
additionalProperties:
type: boolean
greenfield.storage.QueryGroupNFTResponse:
type: object
properties:
Expand Down Expand Up @@ -33770,6 +33926,13 @@ definitions:
value:
type: string
title: attributes
greenfield.storage.QueryGroupsExistResponse:
type: object
properties:
exists:
type: object
additionalProperties:
type: boolean
greenfield.storage.QueryHeadBucketExtraResponse:
type: object
properties:
Expand Down
Loading

0 comments on commit 96bbaf3

Please sign in to comment.