Skip to content

Commit

Permalink
api: Add band ID to list frequency plans request
Browse files Browse the repository at this point in the history
  • Loading branch information
cvetkovski98 committed Nov 16, 2023
1 parent cb059bb commit babcb17
Show file tree
Hide file tree
Showing 11 changed files with 360 additions and 296 deletions.
1 change: 1 addition & 0 deletions api/ttn/lorawan/v3/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,7 @@ PeerInfo
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `base_frequency` | [`uint32`](#uint32) | | Optional base frequency in MHz for hardware support (433, 470, 868 or 915) |
| `band_id` | [`string`](#string) | | Optional Band ID to filter the results. |

### <a name="ttn.lorawan.v3.ListFrequencyPlansResponse">Message `ListFrequencyPlansResponse`</a>

Expand Down
7 changes: 7 additions & 0 deletions api/ttn/lorawan/v3/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6707,6 +6707,13 @@
"required": false,
"type": "integer",
"format": "int64"
},
{
"name": "band_id",
"description": "Optional Band ID to filter the results.",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
Expand Down
2 changes: 2 additions & 0 deletions api/ttn/lorawan/v3/configuration_services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ message ListFrequencyPlansRequest {
};
// Optional base frequency in MHz for hardware support (433, 470, 868 or 915)
uint32 base_frequency = 1;
// Optional Band ID to filter the results.
string band_id = 2;
}

message FrequencyPlanDescription {
Expand Down
3 changes: 3 additions & 0 deletions pkg/frequencyplans/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func (s *RPCServer) ListFrequencyPlans(ctx context.Context, req *ttnpb.ListFrequ
if req.BaseFrequency != 0 && uint16(req.BaseFrequency) != desc.BaseFrequency {
continue
}
if req.BandId != "" && req.BandId != desc.BandID {
continue
}
res.FrequencyPlans = append(res.FrequencyPlans, &ttnpb.FrequencyPlanDescription{
Id: desc.ID,
BandId: desc.BandID,
Expand Down
7 changes: 7 additions & 0 deletions pkg/frequencyplans/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,11 @@ func TestRPCServer(t *testing.T) {
a.So(err, should.BeNil)
a.So(base915.FrequencyPlans, should.HaveLength, 2)
a.So(base915.FrequencyPlans, should.Resemble, expectedAll[:2])

bandAS, err := server.ListFrequencyPlans(context.Background(), &ttnpb.ListFrequencyPlansRequest{
BandId: "AS_923",
})
a.So(err, should.BeNil)
a.So(bandAS.FrequencyPlans, should.HaveLength, 1)
a.So(bandAS.FrequencyPlans[0], should.Resemble, expectedAll[1])
}
603 changes: 307 additions & 296 deletions pkg/ttnpb/configuration_services.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pkg/ttnpb/configuration_services.pb.paths.fm.go

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

10 changes: 10 additions & 0 deletions pkg/ttnpb/configuration_services.pb.setters.fm.go

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

2 changes: 2 additions & 0 deletions pkg/ttnpb/configuration_services.pb.validate.go

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

7 changes: 7 additions & 0 deletions pkg/ttnpb/configuration_services_flags.pb.go

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

12 changes: 12 additions & 0 deletions sdk/js/generated/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -10165,6 +10165,18 @@
"isoneof": false,
"oneofdecl": "",
"defaultValue": ""
},
{
"name": "band_id",
"description": "Optional Band ID to filter the results.",
"label": "",
"type": "string",
"longType": "string",
"fullType": "string",
"ismap": false,
"isoneof": false,
"oneofdecl": "",
"defaultValue": ""
}
]
},
Expand Down

0 comments on commit babcb17

Please sign in to comment.