Skip to content

Commit

Permalink
[Gateway] Scaffold the Gateway type (#57)
Browse files Browse the repository at this point in the history
Simply ran 
```
ignite scaffold map gateway --module gateway --signer address --no-message --index address --yes
```
  • Loading branch information
h5law authored Oct 13, 2023
1 parent 26ffa80 commit 0ec3f58
Show file tree
Hide file tree
Showing 16 changed files with 881 additions and 6 deletions.
210 changes: 210 additions & 0 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46634,6 +46634,167 @@ paths:
additionalProperties: {}
tags:
- Query
/pocket/gateway/gateway:
get:
operationId: PocketGatewayGatewayAll
responses:
'200':
description: A successful response.
schema:
type: object
properties:
gateway:
type: array
items:
type: object
properties:
address:
type: string
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
description: >-
PageResponse is to be embedded in gRPC response messages where
the

corresponding request message has used PageRequest.

message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.

It is less efficient than using key. Only one of offset or key
should

be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.

If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include

a count of the total number of items available for pagination in
UIs.

count_total is only respected when offset is used. It is ignored
when key

is set.
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
/pocket/gateway/gateway/{address}:
get:
summary: Queries a list of Gateway items.
operationId: PocketGatewayGateway
responses:
'200':
description: A successful response.
schema:
type: object
properties:
gateway:
type: object
properties:
address:
type: string
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: address
in: path
required: true
type: string
tags:
- Query
/pocket/gateway/params:
get:
summary: Parameters queries the parameters of the module.
Expand Down Expand Up @@ -75777,9 +75938,58 @@ definitions:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
pocket.gateway.Gateway:
type: object
properties:
address:
type: string
pocket.gateway.Params:
type: object
description: Params defines the parameters for the module.
pocket.gateway.QueryAllGatewayResponse:
type: object
properties:
gateway:
type: array
items:
type: object
properties:
address:
type: string
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
description: |-
PageResponse is to be embedded in gRPC response messages where the
corresponding request message has used PageRequest.

message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
pocket.gateway.QueryGetGatewayResponse:
type: object
properties:
gateway:
type: object
properties:
address:
type: string
pocket.gateway.QueryParamsResponse:
type: object
properties:
Expand Down
9 changes: 9 additions & 0 deletions proto/pocket/gateway/gateway.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";
package pocket.gateway;

option go_package = "pocket/x/gateway/types";

message Gateway {
string address = 1;
}

6 changes: 5 additions & 1 deletion proto/pocket/gateway/genesis.proto
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
syntax = "proto3";

package pocket.gateway;

import "gogoproto/gogo.proto";
import "pocket/gateway/params.proto";
import "pocket/gateway/gateway.proto";

option go_package = "pocket/x/gateway/types";

// GenesisState defines the gateway module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
Params params = 1 [(gogoproto.nullable) = false];
repeated Gateway gatewayList = 2 [(gogoproto.nullable) = false];
}

38 changes: 35 additions & 3 deletions proto/pocket/gateway/query.proto
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
syntax = "proto3";

package pocket.gateway;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "pocket/gateway/params.proto";
import "pocket/gateway/gateway.proto";

option go_package = "pocket/x/gateway/types";

// Query defines the gRPC querier service.
service Query {

// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
rpc Params (QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/pocket/gateway/params";

}

// Queries a list of Gateway items.
rpc Gateway (QueryGetGatewayRequest) returns (QueryGetGatewayResponse) {
option (google.api.http).get = "/pocket/gateway/gateway/{address}";

}
rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) {
option (google.api.http).get = "/pocket/gateway/gateway";

}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {

// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false];
}
}

message QueryGetGatewayRequest {
string address = 1;
}

message QueryGetGatewayResponse {
Gateway gateway = 1 [(gogoproto.nullable) = false];
}

message QueryAllGatewayRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

message QueryAllGatewayResponse {
repeated Gateway gateway = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

2 changes: 2 additions & 0 deletions x/gateway/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
}

cmd.AddCommand(CmdQueryParams())
cmd.AddCommand(CmdListGateway())
cmd.AddCommand(CmdShowGateway())
// this line is used by starport scaffolding # 1

return cmd
Expand Down
Loading

0 comments on commit 0ec3f58

Please sign in to comment.