Skip to content

Commit

Permalink
feat(ecocredit): query batches by credit class name (#885)
Browse files Browse the repository at this point in the history
* feat: query batches by class

* chore: comments

* chore: add test case

* chore: conflicts

Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
  • Loading branch information
technicallyty and technicallyty authored Mar 15, 2022
1 parent 9819ea5 commit f0faf4c
Show file tree
Hide file tree
Showing 8 changed files with 2,374 additions and 332 deletions.
1,734 changes: 1,479 additions & 255 deletions api/regen/ecocredit/v1/query.pulsar.go

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions api/regen/ecocredit/v1/query_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions proto/regen/ecocredit/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ service Query {
"/regen/ecocredit/v1/projects/{project_id}/batches";
}

// BatchesByClass queries all batches issued from a given class.
rpc BatchesByClass(QueryBatchesByClassRequest) returns (QueryBatchesByClassResponse) {
option (google.api.http).get =
"/regen/ecocredit/v1/classes/{class_id}/batches";
}

// BatchInfo queries for information on a credit batch.
rpc BatchInfo(QueryBatchInfoRequest) returns (QueryBatchInfoResponse) {
option (google.api.http).get =
Expand Down Expand Up @@ -192,6 +198,26 @@ message QueryBatchesResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryBatchesByClassRequest is the Query/BatchesByClass request type.
message QueryBatchesByClassRequest {

// class_id is the unique ID of the class to query.
string class_id = 1;

// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryBatchesByClassResponse is the Query/BatchesByClass response type.
message QueryBatchesByClassResponse {

// batches are the fetched credit batches within the project.
repeated BatchInfo batches = 1;

// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryBatchInfoRequest is the Query/BatchInfo request type.
message QueryBatchInfoRequest {

Expand Down
Loading

0 comments on commit f0faf4c

Please sign in to comment.