api: Add back rust/proto directory.

This needs to be tracked by git to make cargo publish work. If this
folder is in the .gitignore, then cargo publish will ignore this folder
as well and the publish command will fail because of missing .proto
files. If we would temporarily remove / rename the .gitignore file, then
cargo publish will error because the git state is dirty.
This commit is contained in:
Orne Brocaar 2024-04-04 15:55:59 +01:00
parent b3ba23f32c
commit 6ef100c9b7
21 changed files with 6432 additions and 1 deletions

1
api/rust/.gitignore vendored
View File

@ -1 +0,0 @@
/proto

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,581 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProto";
option csharp_namespace = "Chirpstack.Api";
import "common/common.proto";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/empty.proto";
// DeviceService is the service providing API methods for managing devices.
service DeviceService {
// Create the given device.
rpc Create(CreateDeviceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post : "/api/devices"
body : "*"
};
}
// Get returns the device for the given DevEUI.
rpc Get(GetDeviceRequest) returns (GetDeviceResponse) {
option (google.api.http) = {
get : "/api/devices/{dev_eui}"
};
}
// Update the given device.
rpc Update(UpdateDeviceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put : "/api/devices/{device.dev_eui}"
body : "*"
};
}
// Delete the device with the given DevEUI.
rpc Delete(DeleteDeviceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/devices/{dev_eui}"
};
}
// Get the list of devices.
rpc List(ListDevicesRequest) returns (ListDevicesResponse) {
option (google.api.http) = {
get : "/api/devices"
};
}
// Create the given device-keys.
rpc CreateKeys(CreateDeviceKeysRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post : "/api/devices/{device_keys.dev_eui}/keys"
body : "*"
};
}
// Get the device-keys for the given DevEUI.
rpc GetKeys(GetDeviceKeysRequest) returns (GetDeviceKeysResponse) {
option (google.api.http) = {
get : "/api/devices/{dev_eui}/keys"
};
}
// Update the given device-keys.
rpc UpdateKeys(UpdateDeviceKeysRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put : "/api/devices/{device_keys.dev_eui}/keys"
body : "*"
};
}
// Delete the device-keys for the given DevEUI.
rpc DeleteKeys(DeleteDeviceKeysRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/devices/{dev_eui}/keys"
};
}
// FlushDevNonces flushes the OTAA device nonces.
rpc FlushDevNonces(FlushDevNoncesRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/devices/{dev_eui}/dev-nonces"
};
}
// Activate (re)activates the device with the given parameters (for ABP or for
// importing OTAA activations).
rpc Activate(ActivateDeviceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post : "/api/devices/{device_activation.dev_eui}/activate"
body : "*"
};
}
// Deactivate de-activates the device.
rpc Deactivate(DeactivateDeviceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/devices/{dev_eui}/activation"
};
}
// GetActivation returns the current activation details of the device (OTAA or
// ABP).
rpc GetActivation(GetDeviceActivationRequest)
returns (GetDeviceActivationResponse) {
option (google.api.http) = {
get : "/api/devices/{dev_eui}/activation"
};
}
// GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into
// account.
rpc GetRandomDevAddr(GetRandomDevAddrRequest)
returns (GetRandomDevAddrResponse) {
option (google.api.http) = {
post : "/api/devices/{dev_eui}/get-random-dev-addr"
};
}
// GetMetrics returns the device metrics.
// Note that this requires a device-profile with codec and measurements
// configured.
rpc GetMetrics(GetDeviceMetricsRequest) returns (GetDeviceMetricsResponse) {
option (google.api.http) = {
get : "/api/devices/{dev_eui}/metrics"
};
}
// GetLinkMetrics returns the device link metrics.
// This includes uplinks, downlinks, RSSI, SNR, etc...
rpc GetLinkMetrics(GetDeviceLinkMetricsRequest)
returns (GetDeviceLinkMetricsResponse) {
option (google.api.http) = {
get : "/api/devices/{dev_eui}/link-metrics"
};
}
// Enqueue adds the given item to the downlink queue.
rpc Enqueue(EnqueueDeviceQueueItemRequest)
returns (EnqueueDeviceQueueItemResponse) {
option (google.api.http) = {
post : "/api/devices/{queue_item.dev_eui}/queue"
body : "*"
};
}
// FlushQueue flushes the downlink device-queue.
rpc FlushQueue(FlushDeviceQueueRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/devices/{dev_eui}/queue"
};
}
// GetQueue returns the downlink device-queue.
rpc GetQueue(GetDeviceQueueItemsRequest)
returns (GetDeviceQueueItemsResponse) {
option (google.api.http) = {
get : "/api/devices/{dev_eui}/queue"
};
}
// GetNextFCntDown returns the next FCntDown to use for enqueing encrypted
// downlinks. The difference with the DeviceActivation f_cont_down is that
// this method takes potential existing queue-items into account.
rpc GetNextFCntDown(GetDeviceNextFCntDownRequest)
returns (GetDeviceNextFCntDownResponse) {
option (google.api.http) = {
post : "/api/devices/{dev_eui}/get-next-f-cnt-down"
body : "*"
};
}
}
message Device {
// DevEUI (EUI64).
string dev_eui = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Application ID (UUID).
string application_id = 4;
// Device-profile ID (UUID).
string device_profile_id = 5;
// Skip frame-counter checks (this is insecure, but could be helpful for
// debugging).
bool skip_fcnt_check = 6;
// Device is disabled.
bool is_disabled = 7;
// Variables (user defined).
// These variables can be used together with integrations to store tokens /
// secrets that must be configured per device. These variables are not
// exposed in the event payloads.
map<string, string> variables = 8;
// Tags (user defined).
// These tags can be used to add additional information to the device.
// These tags are exposed in all the integration events.
map<string, string> tags = 9;
// JoinEUI (optional, EUI64).
// This field will be automatically set / updated on OTAA. However, in some
// cases it must be pre-configured. For example to allow OTAA using a Relay.
// In this case the Relay needs to know the JoinEUI + DevEUI combinations
// of the devices for which it needs to forward uplinks.
string join_eui = 10;
}
message DeviceStatus {
// The device margin status
// -32..32: The demodulation SNR ration in dB
int32 margin = 1;
// Device is connected to an external power source.
bool external_power_source = 2;
// Device battery level as a percentage.
// -1 when the battery level is not available.
float battery_level = 3;
}
message DeviceListItem {
// DevEUI (EUI64).
string dev_eui = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
// Name.
string name = 5;
// Description.
string description = 6;
// Device-profile ID (UUID).
string device_profile_id = 7;
// Device-profile name.
string device_profile_name = 8;
// Device status.
DeviceStatus device_status = 9;
}
message DeviceKeys {
// DevEUI (EUI64).
string dev_eui = 1;
// Network root key (128 bit).
// Note: For LoRaWAN 1.0.x, use this field for the LoRaWAN 1.0.x 'AppKey`!
string nwk_key = 2;
// Application root key (128 bit).
// Note: This field only needs to be set for LoRaWAN 1.1.x devices!
string app_key = 3;
}
message CreateDeviceRequest {
// Device object.
Device device = 1;
}
message GetDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceResponse {
// Device object.
Device device = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
// Device status.
DeviceStatus device_status = 5;
// Enabled device class.
common.DeviceClass class_enabled = 6;
}
message UpdateDeviceRequest {
// Device object.
Device device = 1;
}
message DeleteDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message ListDevicesRequest {
// Max number of devices to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Application ID (UUID) to filter devices on.
string application_id = 4;
// Multicst-group ID (UUID) to filter devices on.
string multicast_group_id = 5;
}
message ListDevicesResponse {
// Total number of devices.
uint32 total_count = 1;
// Result-set.
repeated DeviceListItem result = 2;
}
message CreateDeviceKeysRequest {
// Device-keys object.
DeviceKeys device_keys = 1;
}
message GetDeviceKeysRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceKeysResponse {
// Device-keys object.
DeviceKeys device_keys = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceKeysRequest {
// Device-keys object.
DeviceKeys device_keys = 1;
}
message DeleteDeviceKeysRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message DeviceActivation {
// Device EUI (EUI64).
string dev_eui = 1;
// Device address (HEX encoded).
string dev_addr = 2;
// Application session key (HEX encoded).
string app_s_key = 3;
// Network session encryption key (HEX encoded).
string nwk_s_enc_key = 4;
// Serving network session integrity key (HEX encoded).
string s_nwk_s_int_key = 8;
// Forwarding network session integrity key (HEX encoded).
string f_nwk_s_int_key = 9;
// Uplink frame-counter.
uint32 f_cnt_up = 5;
// Downlink network frame-counter.
uint32 n_f_cnt_down = 6;
// Downlink application frame-counter.
uint32 a_f_cnt_down = 10;
}
message ActivateDeviceRequest {
// Device activation object.
DeviceActivation device_activation = 1;
}
message DeactivateDeviceRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceActivationRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetDeviceActivationResponse {
// Device activation object.
DeviceActivation device_activation = 1;
// Join-Server context.
// A non-empty value indicatest that ChirpStack does not have access to
// the AppSKey and that the encryption / decryption of the payloads is
// the responsibility of the end-application.
common.JoinServerContext join_server_context = 2;
}
message GetRandomDevAddrRequest {
// DevEUI (EUI64).
string dev_eui = 1;
}
message GetRandomDevAddrResponse {
// DevAddr.
string dev_addr = 1;
}
message GetDeviceMetricsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetDeviceMetricsResponse {
map<string, common.Metric> metrics = 1;
map<string, DeviceState> states = 2;
}
message DeviceState {
// Name.
string name = 2;
// Value.
string value = 3;
}
message GetDeviceLinkMetricsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetDeviceLinkMetricsResponse {
// Packets received from the device.
common.Metric rx_packets = 1;
// RSSI (as reported by the gateway(s)).
common.Metric gw_rssi = 2;
// SNR (as reported by the gateway(s)).
common.Metric gw_snr = 3;
// Packets received by frequency.
common.Metric rx_packets_per_freq = 4;
// Packets received by DR.
common.Metric rx_packets_per_dr = 5;
// Errors.
common.Metric errors = 6;
}
message DeviceQueueItem {
// ID (UUID).
// This is automatically generated on enqueue.
string id = 1;
// Device EUI (EUI64).
string dev_eui = 2;
// Confirmed.
bool confirmed = 3;
// FPort (must be > 0).
uint32 f_port = 4;
// Data.
// Or use the json_object field when a codec has been configured.
bytes data = 5;
// Only use this when a codec has been configured that can encode this
// object to bytes.
google.protobuf.Struct object = 6;
// Is pending.
// This is set by ChirpStack to true when the downlink is pending (e.g. it
// has been sent, but a confirmation is still pending).
bool is_pending = 7;
// Downlink frame-counter.
// Do not set this for plain-text data payloads. It will be automatically set
// by ChirpStack when the payload has been sent as downlink.
uint32 f_cnt_down = 8;
// Is encrypted.
// This must be set to true if the end-application has already encrypted
// the data payload. In this case, the f_cnt_down field must be set to
// the corresponding frame-counter which has been used during the encryption.
bool is_encrypted = 9;
}
message EnqueueDeviceQueueItemRequest { DeviceQueueItem queue_item = 1; }
message EnqueueDeviceQueueItemResponse {
// ID (UUID).
string id = 1;
}
message FlushDeviceQueueRequest {
// Device EUI (EUI64).
string dev_eui = 1;
}
message GetDeviceQueueItemsRequest {
// Device EUI (EUI64).
string dev_eui = 1;
// Return only the count, not the result-set.
bool count_only = 2;
}
message GetDeviceQueueItemsResponse {
// Total number of queue items.
uint32 total_count = 1;
// Result-set.
repeated DeviceQueueItem result = 2;
}
message FlushDevNoncesRequest {
// Device EUI (EUI64).
string dev_eui = 1;
}
message GetDeviceNextFCntDownRequest {
// Device EUI (EUI64).
string dev_eui = 1;
}
message GetDeviceNextFCntDownResponse {
// FCntDown.
uint32 f_cnt_down = 1;
}

View File

@ -0,0 +1,527 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
enum CodecRuntime {
// None.
NONE = 0;
// Cayenne LPP.
CAYENNE_LPP = 1;
// JavaScript.
JS = 2;
}
enum MeasurementKind {
// Unknown (in which case it is not tracked).
UNKNOWN = 0;
// Incrementing counters that never decrease (these are not reset on each
// reading).
COUNTER = 1;
// Counters that do get reset upon reading.
ABSOLUTE = 2;
// E.g. a temperature value.
GAUGE = 3;
// E.g. a firmware version, true / false value.
STRING = 4;
}
enum CadPeriodicity {
// 1 second.
SEC_1 = 0;
// 500 milliseconds
MS_500 = 1;
// 250 milliseconds
MS_250 = 2;
// 100 milliseconds
MS_100 = 3;
// 50 milliseconds
MS_50 = 4;
// 20 milliseconds
MS_20 = 5;
}
enum SecondChAckOffset {
// 0 kHz.
KHZ_0 = 0;
// 200 kHz.
KHZ_200 = 1;
// 400 kHz.
KHZ_400 = 2;
// 800 kHz.
KHZ_800 = 3;
// 1600 kHz.
KHZ_1600 = 4;
// 3200 kHz.
KHZ_3200 = 5;
}
enum RelayModeActivation {
// Disable the relay mode.
DISABLE_RELAY_MODE = 0;
// Enable the relay model.
ENABLE_RELAY_MODE = 1;
// Dynamic.
DYNAMIC = 2;
// End-device controlled.
END_DEVICE_CONTROLLED = 3;
}
// DeviceProfileService is the service providing API methods for managing
// device-profiles.
service DeviceProfileService {
// Create the given device-profile.
rpc Create(CreateDeviceProfileRequest) returns (CreateDeviceProfileResponse) {
option (google.api.http) = {
post : "/api/device-profiles"
body : "*"
};
}
// Get the device-profile for the given ID.
rpc Get(GetDeviceProfileRequest) returns (GetDeviceProfileResponse) {
option (google.api.http) = {
get : "/api/device-profiles/{id}"
};
}
// Update the given device-profile.
rpc Update(UpdateDeviceProfileRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put : "/api/device-profiles/{device_profile.id}"
body : "*"
};
}
// Delete the device-profile with the given ID.
rpc Delete(DeleteDeviceProfileRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/device-profiles/{id}"
};
}
// List the available device-profiles.
rpc List(ListDeviceProfilesRequest) returns (ListDeviceProfilesResponse) {
option (google.api.http) = {
get : "/api/device-profiles"
};
}
// List available ADR algorithms.
rpc ListAdrAlgorithms(google.protobuf.Empty)
returns (ListDeviceProfileAdrAlgorithmsResponse) {
option (google.api.http) = {
get : "/api/device-profiles/adr-algorithms"
};
}
}
message DeviceProfile {
// Device-profile ID (UUID).
// Note: on create this will be automatically generated.
string id = 1;
// Tenant ID (UUID).
string tenant_id = 2;
// Name.
string name = 3;
// Description.
string description = 26;
// Region.
common.Region region = 4;
// LoRaWAN mac-version.
common.MacVersion mac_version = 5;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 6;
// ADR algorithm ID.
string adr_algorithm_id = 7;
// Payload codec runtime.
CodecRuntime payload_codec_runtime = 8;
// Payload codec script.
string payload_codec_script = 9;
// Flush queue on device activation.
bool flush_queue_on_activate = 10;
// Uplink interval (seconds).
// This defines the expected uplink interval which the device uses for
// communication. If the uplink interval has expired and no uplink has
// been received, the device is considered inactive.
uint32 uplink_interval = 11;
// Device-status request interval (times / day).
// This defines the times per day that ChirpStack will request the
// device-status from the device.
uint32 device_status_req_interval = 12;
// Supports OTAA.
bool supports_otaa = 13;
// Supports Class B.
bool supports_class_b = 14;
// Supports Class-C.
bool supports_class_c = 15;
// Class-B timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement
// from the device (if requested).
uint32 class_b_timeout = 16;
// Class-B ping-slots per beacon period.
// Valid options are: 0 - 7.
//
// The actual number of ping-slots per beacon period equals to 2^k.
uint32 class_b_ping_slot_nb_k = 17;
// Class-B ping-slot DR.
uint32 class_b_ping_slot_dr = 18;
// Class-B ping-slot freq (Hz).
uint32 class_b_ping_slot_freq = 19;
// Class-C timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement
// from the device (if requested).
uint32 class_c_timeout = 20;
// RX1 delay (for ABP).
uint32 abp_rx1_delay = 21;
// RX1 DR offset (for ABP).
uint32 abp_rx1_dr_offset = 22;
// RX2 DR (for ABP).
uint32 abp_rx2_dr = 23;
// RX2 frequency (for ABP, Hz).
uint32 abp_rx2_freq = 24;
// Tags (user defined).
// These tags can be used to add additional information the the
// device-profile. These tags are exposed in all the integration events of
// devices using this device-profile.
map<string, string> tags = 25;
// Measurements.
// If defined, ChirpStack will visualize these metrics in the web-interface.
map<string, Measurement> measurements = 27;
// Auto-detect measurements.
// If set to true, measurements will be automatically added based on the
// keys of the decoded payload. In cases where the decoded payload contains
// random keys in the data, you want to set this to false.
bool auto_detect_measurements = 28;
// Region configuration ID.
// If set, devices will only use the associated region. If let blank, then
// devices will use all regions matching the selected common-name. Note
// that multiple region configurations can exist for the same common-name,
// e.g. to provide an 8 channel and 16 channel configuration for the US915
// band.
string region_config_id = 29;
// Device is a Relay device.
// Enable this in case the device is a Relay. A Relay device implements TS011
// and is able to relay data from relay capable devices.
// See for more information the TS011 specification.
bool is_relay = 30;
// Device is a Relay end-device.
// Enable this in case the device is an end-device that can operate under a
// Relay. Please refer to the TS011 specification for more information.
bool is_relay_ed = 31;
// End-device only accept data through relay.
// Only accept data for this device through a relay. This setting is useful
// for testing as in case of a test-setup, the end-device is usually within
// range of the gateway.
bool relay_ed_relay_only = 32;
// Relay must be enabled.
bool relay_enabled = 33;
// Relay CAD periodicity.
CadPeriodicity relay_cad_periodicity = 34;
// Relay default channel index.
// Valid values are 0 and 1, please refer to the RP002 specification for
// the meaning of these values.
uint32 relay_default_channel_index = 35;
// Relay second channel frequency (Hz).
uint32 relay_second_channel_freq = 36;
// Relay second channel DR.
uint32 relay_second_channel_dr = 37;
// Relay second channel ACK offset.
SecondChAckOffset relay_second_channel_ack_offset = 38;
// Relay end-device activation mode.
RelayModeActivation relay_ed_activation_mode = 39;
// Relay end-device smart-enable level.
uint32 relay_ed_smart_enable_level = 40;
// Relay end-device back-off (in case it does not receive WOR ACK frame).
// 0 = Always send a LoRaWAN uplink
// 1..63 = Send a LoRaWAN uplink after X WOR frames without a WOR ACK
uint32 relay_ed_back_off = 41;
// Relay end-device uplink limit bucket size.
//
// This field indicates the multiplier to determine the bucket size
// according to the following formula:
// BucketSize TOKEN = _reload_rate x _bucket_size
//
// Valid values (0 - 3):
// 0 = 1
// 1 = 2
// 2 = 4
// 3 = 12
uint32 relay_ed_uplink_limit_bucket_size = 42;
// Relay end-device uplink limit reload rate.
//
// Valid values:
// * 0 - 62 = X tokens every hour
// * 63 = no limitation
uint32 relay_ed_uplink_limit_reload_rate = 43;
// Relay join-request limit reload rate.
//
// Valid values:
// * 0 - 126 = X tokens every hour
// * 127 = no limitation
uint32 relay_join_req_limit_reload_rate = 44;
// Relay notify limit reload rate.
//
// Valid values:
// * 0 - 126 = X tokens every hour
// * 127 = no limitation
uint32 relay_notify_limit_reload_rate = 45;
// Relay global uplink limit reload rate.
//
// Valid values:
// * 0 - 126 = X tokens every hour
// * 127 = no limitation
uint32 relay_global_uplink_limit_reload_rate = 46;
// Relay overall limit reload rate.
//
// Valid values:
// * 0 - 126 = X tokens every hour
// * 127 = no limitation
uint32 relay_overall_limit_reload_rate = 47;
// Relay join-request limit bucket size.
//
// This field indicates the multiplier to determine the bucket size
// according to the following formula:
// BucketSize TOKEN = _reload_rate x _bucket_size
//
// Valid values (0 - 3):
// 0 = 1
// 1 = 2
// 2 = 4
// 3 = 12
uint32 relay_join_req_limit_bucket_size = 48;
// Relay notify limit bucket size.
//
// This field indicates the multiplier to determine the bucket size
// according to the following formula:
// BucketSize TOKEN = _reload_rate x _bucket_size
//
// Valid values (0 - 3):
// 0 = 1
// 1 = 2
// 2 = 4
// 3 = 12
uint32 relay_notify_limit_bucket_size = 49;
// Relay globak uplink limit bucket size.
//
// This field indicates the multiplier to determine the bucket size
// according to the following formula:
// BucketSize TOKEN = _reload_rate x _bucket_size
//
// Valid values (0 - 3):
// 0 = 1
// 1 = 2
// 2 = 4
// 3 = 12
uint32 relay_global_uplink_limit_bucket_size = 50;
// Relay overall limit bucket size.
//
// This field indicates the multiplier to determine the bucket size
// according to the following formula:
// BucketSize TOKEN = _reload_rate x _bucket_size
//
// Valid values (0 - 3):
// 0 = 1
// 1 = 2
// 2 = 4
// 3 = 12
uint32 relay_overall_limit_bucket_size = 51;
// Allow roaming.
//
// If set to true, it means that the device is allowed to use roaming.
bool allow_roaming = 52;
}
message Measurement {
// Name (user defined).
string name = 2;
// Kind.
MeasurementKind kind = 3;
}
message DeviceProfileListItem {
// Device-profile ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Region.
common.Region region = 5;
// LoRaWAN mac-version.
common.MacVersion mac_version = 6;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 7;
// Supports OTAA.
bool supports_otaa = 8;
// Supports Class-B.
bool supports_class_b = 9;
// Supports Class-C.
bool supports_class_c = 10;
}
message CreateDeviceProfileRequest {
// Object to create.
DeviceProfile device_profile = 1;
}
message CreateDeviceProfileResponse {
// ID (UUID).
string id = 1;
}
message GetDeviceProfileRequest {
// ID (UUID).
string id = 1;
}
message GetDeviceProfileResponse {
// Device-profile object.
DeviceProfile device_profile = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceProfileRequest {
// Device-profile object.
DeviceProfile device_profile = 1;
}
message DeleteDeviceProfileRequest {
// ID (UUID).
string id = 1;
}
message ListDeviceProfilesRequest {
// Max number of device-profiles to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
// Tenant ID to list the device-profiles for.
string tenant_id = 4;
}
message ListDeviceProfilesResponse {
// Total number of device-profiles.
uint32 total_count = 1;
// Result-set.
repeated DeviceProfileListItem result = 2;
}
message ListDeviceProfileAdrAlgorithmsResponse {
// Total number of algorithms.
uint32 total_count = 1;
// Result-set.
repeated AdrAlgorithmListItem result = 2;
}
message AdrAlgorithmListItem {
// Algorithm ID.
string id = 1;
// Algorithm name.
string name = 2;
}

View File

@ -0,0 +1,244 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileTemplateProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
import "api/device_profile.proto";
// DeviceProfileTemplateService is the service providing API methods for managing device-profile templates.
service DeviceProfileTemplateService {
// Create the given device-profile template.
rpc Create(CreateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
post: "/api/device-profile-templates"
body: "*"
};
}
// Get the device-profile template for the given ID.
rpc Get(GetDeviceProfileTemplateRequest) returns (GetDeviceProfileTemplateResponse) {
option(google.api.http) = {
get: "/api/device-profile-templates/{id}"
};
}
// Update the given device-profile template.
rpc Update(UpdateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
put: "/api/device-profile-templates/{device_profile_template.id}"
body: "*"
};
}
// Delete the device-profile template with the given ID.
rpc Delete(DeleteDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/device-profile-templates/{id}"
};
}
// List the available device-profile templates.
rpc List(ListDeviceProfileTemplatesRequest) returns (ListDeviceProfileTemplatesResponse) {
option(google.api.http) = {
get: "/api/device-profile-templates"
};
}
}
message DeviceProfileTemplate {
// Device-profile template ID.
string id = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Vendor.
string vendor = 4;
// Firmware.
string firmware = 5;
// Region.
common.Region region = 6;
// LoRaWAN mac-version.
common.MacVersion mac_version = 7;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 8;
// ADR algorithm ID.
string adr_algorithm_id = 9;
// Payload codec runtime.
CodecRuntime payload_codec_runtime = 10;
// Payload codec script.
string payload_codec_script = 11;
// Flush queue on device activation.
bool flush_queue_on_activate = 12;
// Uplink interval (seconds).
// This defines the expected uplink interval which the device uses for
// communication. When the uplink interval has expired and no uplink has
// been received, the device is considered inactive.
uint32 uplink_interval = 13;
// Device-status request interval (times / day).
// This defines the times per day that ChirpStack will request the device-status
// from the device.
uint32 device_status_req_interval = 14;
// Supports OTAA.
bool supports_otaa = 15;
// Supports Class B.
bool supports_class_b = 16;
// Supports Class-C.
bool supports_class_c = 17;
// Class-B timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_b_timeout = 18;
// Class-B ping-slots per beacon period.
// Valid options are: 0 - 7.
//
// The actual number of ping-slots per beacon period equals to 2^k.
uint32 class_b_ping_slot_nb_k = 19;
// Class-B ping-slot DR.
uint32 class_b_ping_slot_dr = 20;
// Class-B ping-slot freq (Hz).
uint32 class_b_ping_slot_freq = 21;
// Class-C timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_c_timeout = 22;
// RX1 delay (for ABP).
uint32 abp_rx1_delay = 23;
// RX1 DR offset (for ABP).
uint32 abp_rx1_dr_offset = 24;
// RX2 DR (for ABP).
uint32 abp_rx2_dr = 25;
// RX2 frequency (for ABP, Hz).
uint32 abp_rx2_freq = 26;
// User defined tags.
map<string, string> tags = 27;
// Measurements.
// If defined, ChirpStack will visualize these metrics in the web-interface.
map<string, Measurement> measurements = 28;
// Auto-detect measurements.
// If set to true, measurements will be automatically added based on the
// keys of the decoded payload. In cases where the decoded payload contains
// random keys in the data, you want to set this to false.
bool auto_detect_measurements = 29;
}
message DeviceProfileTemplateListItem {
// Device-profile template ID.
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Vendor.
string vendor = 5;
// Firmware.
string firmware = 6;
// Region.
common.Region region = 7;
// LoRaWAN mac-version.
common.MacVersion mac_version = 8;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 9;
// Supports OTAA.
bool supports_otaa = 10;
// Supports Class-B.
bool supports_class_b = 11;
// Supports Class-C.
bool supports_class_c = 12;
}
message CreateDeviceProfileTemplateRequest {
// Object to create.
DeviceProfileTemplate device_profile_template = 1;
}
message GetDeviceProfileTemplateRequest {
// ID.
string id = 1;
}
message GetDeviceProfileTemplateResponse {
// Device-profile template object.
DeviceProfileTemplate device_profile_template = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceProfileTemplateRequest {
// Object to update.
DeviceProfileTemplate device_profile_template = 1;
}
message DeleteDeviceProfileTemplateRequest {
// ID.
string id = 1;
}
message ListDeviceProfileTemplatesRequest {
// Max number of device-profile templates to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
}
message ListDeviceProfileTemplatesResponse {
// Total number of device-profile templates.
uint32 total_count = 1;
// Result-set.
repeated DeviceProfileTemplateListItem result = 2;
}

View File

@ -0,0 +1,257 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
// GatewayService is the service providing API methods for managing gateways.
service GatewayService {
// Create creates the given gateway.
rpc Create(CreateGatewayRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
post: "/api/gateways"
body: "*"
};
}
// Get returns the gateway for the given Gateway ID.
rpc Get(GetGatewayRequest) returns (GetGatewayResponse) {
option(google.api.http) = {
get: "/api/gateways/{gateway_id}"
};
}
// Update updates the given gateway.
rpc Update(UpdateGatewayRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
put: "/api/gateways/{gateway.gateway_id}"
body: "*"
};
}
// Delete deletes the gateway matching the given Gateway ID.
rpc Delete(DeleteGatewayRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/gateways/{gateway_id}"
};
}
// Get the list of gateways.
rpc List(ListGatewaysRequest) returns (ListGatewaysResponse) {
option(google.api.http) = {
get: "/api/gateways"
};
}
// Generate client-certificate for the gateway.
rpc GenerateClientCertificate(GenerateGatewayClientCertificateRequest) returns (GenerateGatewayClientCertificateResponse) {
option(google.api.http) = {
post: "/api/gateways/{gateway_id}/generate-certificate"
};
}
// GetMetrics returns the gateway metrics.
rpc GetMetrics(GetGatewayMetricsRequest) returns (GetGatewayMetricsResponse) {
option(google.api.http) = {
get: "/api/gateways/{gateway_id}/metrics"
};
}
}
enum GatewayState {
// The gateway has never sent any stats.
NEVER_SEEN = 0;
// Online.
ONLINE = 1;
// Offline.
OFFLINE = 2;
}
message Gateway {
// Gateway ID (EUI64).
string gateway_id = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Gateway location.
common.Location location = 4;
// Tenant ID (UUID).
string tenant_id = 5;
// Tags.
map<string, string> tags = 6;
// Metadata (provided by the gateway).
map<string, string> metadata = 7;
// Stats interval (seconds).
// This defines the expected interval in which the gateway sends its
// statistics.
uint32 stats_interval = 8;
}
message GatewayListItem {
// Tenant ID.
string tenant_id = 1;
// Gateway ID (EUI64).
string gateway_id = 2;
// Name.
string name = 3;
// Description.
string description = 4;
// Location.
common.Location location = 5;
// Gateway properties.
map<string, string> properties = 6;
// Created at timestamp.
google.protobuf.Timestamp created_at = 7;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 8;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 9;
// Gateway state.
// Please note that the state of the gateway is driven by the stats
// packages that are sent by the gateway.
GatewayState state = 10;
}
message CreateGatewayRequest {
// Gateway object.
Gateway gateway = 1;
}
message GetGatewayRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message GetGatewayResponse {
// Gateway object.
Gateway gateway = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 4;
}
message UpdateGatewayRequest {
// Gateway object.
Gateway gateway = 1;
}
message DeleteGatewayRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message ListGatewaysRequest {
// Max number of gateways to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name (optional).
string search = 3;
// Tenant ID (UUID) to filter gateways on.
// To list all gateways as a global admin user, this field can be left blank.
string tenant_id = 4;
// Multicast-group ID (UUID) to filter gateways on.
string multicast_group_id = 5;
}
message ListGatewaysResponse {
// Total number of gateways.
uint32 total_count = 1;
// Result-set.
repeated GatewayListItem result = 2;
}
message GenerateGatewayClientCertificateRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message GenerateGatewayClientCertificateResponse {
// TLS certificate.
string tls_cert = 1;
// TLS key.
string tls_key = 2;
// CA certificate.
string ca_cert = 3;
// Expires at defines the expiration date of the certificate.
google.protobuf.Timestamp expires_at = 4;
}
message GetGatewayMetricsRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetGatewayMetricsResponse {
// RX packets.
common.Metric rx_packets = 1;
// TX packets.
common.Metric tx_packets = 2;
// TX packets / frequency.
common.Metric tx_packets_per_freq = 3;
// RX packets / frequency.
common.Metric rx_packets_per_freq = 4;
// TX packets / DR.
common.Metric tx_packets_per_dr = 5;
// RX packets / DR.
common.Metric rx_packets_per_dr = 6;
// TX packets per status.
common.Metric tx_packets_per_status = 7;
}

View File

@ -0,0 +1,424 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "InternalProto";
option csharp_namespace = "Chirpstack.Api";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
import "api/user.proto";
// InternalService is the service providing API endpoints for internal usage.
service InternalService {
// Log in a user
rpc Login(LoginRequest) returns (LoginResponse) {}
// Get the current user's profile
rpc Profile(google.protobuf.Empty) returns (ProfileResponse) {}
// Perform a global search.
rpc GlobalSearch(GlobalSearchRequest) returns (GlobalSearchResponse) {}
// CreateApiKey creates the given API key.
rpc CreateApiKey(CreateApiKeyRequest) returns (CreateApiKeyResponse) {}
// DeleteApiKey deletes the API key.
rpc DeleteApiKey(DeleteApiKeyRequest) returns (google.protobuf.Empty) {}
// ListApiKeys lists the available API keys.
rpc ListApiKeys(ListApiKeysRequest) returns (ListApiKeysResponse) {}
// Get the global settings.
rpc Settings(google.protobuf.Empty) returns (SettingsResponse) {}
// OpenId Connect login.
rpc OpenIdConnectLogin(OpenIdConnectLoginRequest)
returns (OpenIdConnectLoginResponse) {}
// OAuth2 login.
rpc OAuth2Login(OAuth2LoginRequest) returns (OAuth2LoginResponse) {}
// GetDevicesSummary returns an aggregated summary of the devices.
rpc GetDevicesSummary(GetDevicesSummaryRequest)
returns (GetDevicesSummaryResponse) {}
// GetGatewaysSummary returns an aggregated summary of the gateways.
rpc GetGatewaysSummary(GetGatewaysSummaryRequest)
returns (GetGatewaysSummaryResponse) {}
// Stream frame for the given Gateway ID.
rpc StreamGatewayFrames(StreamGatewayFramesRequest) returns (stream LogItem) {
}
// Stream frames for the given Device EUI.
rpc StreamDeviceFrames(StreamDeviceFramesRequest) returns (stream LogItem) {}
// Stream events for the given Device EUI.
rpc StreamDeviceEvents(StreamDeviceEventsRequest) returns (stream LogItem) {}
// ListRegions lists the available (configured) regions.
rpc ListRegions(google.protobuf.Empty) returns (ListRegionsResponse) {}
// GetRegion returns the region details for the given region.
rpc GetRegion(GetRegionRequest) returns (GetRegionResponse) {}
// GetVersion returns the ChirpStack version.
rpc GetVersion(google.protobuf.Empty) returns (GetVersionResponse) {}
}
message ApiKey {
// API key ID.
// This value will be automatically generated on create.
string id = 1;
// Name.
string name = 2;
// Is global admin key.
bool is_admin = 3;
// Tenant ID.
// In case the API key is intended to manage resources under a single tenant.
string tenant_id = 4;
}
message CreateApiKeyRequest {
// The API key to create.
ApiKey api_key = 1;
}
message CreateApiKeyResponse {
// API key ID.
string id = 1;
// API token for authentication API requests.
string token = 2;
}
message DeleteApiKeyRequest {
// API key ID.
string id = 1;
}
message ListApiKeysRequest {
// Max number of items to return.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// Return only admin keys.
bool is_admin = 3;
// Filter on tenant ID.
string tenant_id = 4;
}
message ListApiKeysResponse {
// Total number of API keys.
uint32 total_count = 1;
repeated ApiKey result = 2;
}
// Defines a tenant to which the user is associated.
message UserTenantLink {
// Created at timestamp.
google.protobuf.Timestamp created_at = 1;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 2;
// Tenant ID.
string tenant_id = 3;
// User is admin within the context of this tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 4;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 5;
// User is able to modify gateways.
bool is_gateway_admin = 6;
}
message LoginRequest {
// Email of the user.
string email = 1;
// Password of the user.
string password = 2;
}
message LoginResponse {
// The JWT tag to be used to access chirpstack-application-server interfaces.
string jwt = 1;
}
message ProfileResponse {
// User object.
User user = 1;
// Tenants to which the user is associated.
repeated UserTenantLink tenants = 3;
}
message GlobalSearchRequest {
// Search query.
string search = 1;
// Max number of results to return.
int64 limit = 2;
// Offset offset of the result-set (for pagination).
int64 offset = 3;
}
message GlobalSearchResponse { repeated GlobalSearchResult result = 1; }
message GlobalSearchResult {
// Record kind.
string kind = 1;
// Search score.
float score = 2;
// Organization id.
string tenant_id = 3;
// Organization name.
string tenant_name = 4;
// Application id.
string application_id = 5;
// Application name.
string application_name = 6;
// Device DevEUI (hex encoded).
string device_dev_eui = 7;
// Device name.
string device_name = 8;
// Gateway MAC (hex encoded).
string gateway_id = 9;
// Gateway name.
string gateway_name = 10;
}
message SettingsResponse {
// OpenId Connect settings.
OpenIdConnect openid_connect = 1;
// OAuth2 settings.
OAuth2 oauth2 = 2;
}
message OpenIdConnect {
// Enable OpenId Connect authentication.
bool enabled = 1;
// Login url.
string login_url = 2;
// Login label.
string login_label = 3;
// Logout url.
string logout_url = 4;
// Login redirect.
bool login_redirect = 5;
}
message OAuth2 {
// OAuth2 is enabled.
bool enabled = 1;
// Login url.
string login_url = 2;
// Login label.
string login_label = 3;
// Logout url.
string logout_url = 4;
// Login redirect.
bool login_redirect = 5;
}
message OpenIdConnectLoginRequest {
// OpenId Connect callback code.
string code = 1;
// OpenId Connect callback state.
string state = 2;
}
message OpenIdConnectLoginResponse {
// Token to use for authentication.
string token = 1;
}
message OAuth2LoginRequest {
// OAuth2 callback code.
string code = 1;
// OAuth2 callback state.
string state = 2;
}
message OAuth2LoginResponse {
// Token to use for authentication.
string token = 1;
}
message GetDevicesSummaryRequest {
// Tenant ID (UUID).
string tenant_id = 1;
}
message GetDevicesSummaryResponse {
// Active count.
uint32 active_count = 1;
// Inactive count.
uint32 inactive_count = 2;
// per data-rate count.
// Devices that have never been seen are excluded.
map<uint32, uint32> dr_count = 3;
// Never seen count.
uint32 never_seen_count = 4;
}
message GetGatewaysSummaryRequest {
// Tenant ID (UUID).
string tenant_id = 1;
}
message GetGatewaysSummaryResponse {
// Online count.
uint32 online_count = 1;
// Offline count.
uint32 offline_count = 2;
// Never seen count.
uint32 never_seen_count = 3;
}
message LogItem {
// ID.
string id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Message.
string description = 3;
// Body.
string body = 4;
// Properties.
map<string, string> properties = 5;
}
message StreamGatewayFramesRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
}
message StreamDeviceFramesRequest {
// Device EUI.
string dev_eui = 1;
}
message StreamDeviceEventsRequest {
// Device EUI.
string dev_eui = 1;
}
message ListRegionsResponse {
// Configured regions.
repeated RegionListItem regions = 1;
}
message RegionListItem {
// ID.
string id = 1;
// Region.
common.Region region = 2;
// Description.
string description = 3;
}
message GetRegionRequest {
// Region ID.
string id = 1;
}
message GetRegionResponse {
// ID.
string id = 1;
// Region.
common.Region region = 2;
// User information.
string user_info = 3;
// Uplink channels.
repeated RegionChannel uplink_channels = 4;
// RX1 delay.
uint32 rx1_delay = 5;
// RX1 data-rate offset.
uint32 rx1_dr_offset = 6;
// RX2 DR.
uint32 rx2_dr = 7;
// RX2 frequency.
uint32 rx2_frequency = 8;
// Class-B ping-slot DR.
uint32 class_b_ping_slot_dr = 9;
// Class-B ping-slot frequency.
uint32 class_b_ping_slot_frequency = 10;
// Region description.
string description = 11;
}
message RegionChannel {
// Frequency (Hz).
uint32 frequency = 1;
// Min DR.
uint32 dr_min = 2;
// Max DR.
uint32 dr_max = 3;
}
message GetVersionResponse {
// version
string version = 1;
}

View File

@ -0,0 +1,327 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "MulticastGroupProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
// MulticastGroupService is the service managing multicast-groups.
service MulticastGroupService {
// Create the given multicast group.
rpc Create(CreateMulticastGroupRequest) returns (CreateMulticastGroupResponse) {
option(google.api.http) = {
post: "/api/multicast-groups"
body: "*"
};
}
// Get returns the multicast group for the given ID.
rpc Get(GetMulticastGroupRequest) returns (GetMulticastGroupResponse) {
option(google.api.http) = {
get: "/api/multicast-groups/{id}"
};
}
// Update the given multicast group.
rpc Update(UpdateMulticastGroupRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
put: "/api/multicast-groups/{multicast_group.id}"
body: "*"
};
}
// Delete the multicast-group with the given ID.
rpc Delete(DeleteMulticastGroupRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/multicast-groups/{id}"
};
}
// List the available multicast groups.
rpc List(ListMulticastGroupsRequest) returns (ListMulticastGroupsResponse) {
option(google.api.http) = {
get: "/api/multicast-groups"
};
}
// Add a device to the multicast group.
rpc AddDevice(AddDeviceToMulticastGroupRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
post: "/api/multicast-groups/{multicast_group_id}/devices"
body: "*"
};
}
// Remove a device from the multicast group.
rpc RemoveDevice(RemoveDeviceFromMulticastGroupRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/multicast-groups/{multicast_group_id}/devices/{dev_eui}"
};
}
// Add a gateway to the multicast group.
rpc AddGateway(AddGatewayToMulticastGroupRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
post: "/api/multicast-groups/{multicast_group_id}/gateways"
body: "*"
};
}
// Remove a gateway from the multicast group.
rpc RemoveGateway(RemoveGatewayFromMulticastGroupRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/multicast-groups/{multicast_group_id}/gateways/{gateway_id}"
};
}
// Add the given item to the multicast group queue.
rpc Enqueue(EnqueueMulticastGroupQueueItemRequest) returns (EnqueueMulticastGroupQueueItemResponse) {
option(google.api.http) = {
post: "/api/multicast-groups/{queue_item.multicast_group_id}/queue"
body: "*"
};
}
// Flush the queue for the given multicast group.
rpc FlushQueue(FlushMulticastGroupQueueRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/multicast-groups/{multicast_group_id}/queue"
};
}
// List the items in the multicast group queue.
rpc ListQueue(ListMulticastGroupQueueRequest) returns (ListMulticastGroupQueueResponse) {
option(google.api.http) = {
get: "/api/multicast-groups/{multicast_group_id}/queue"
};
}
}
enum MulticastGroupType {
// Class C.
CLASS_C = 0;
// Class-B.
CLASS_B = 1;
}
enum MulticastGroupSchedulingType {
// Delay.
// If multicast downlinks must be sent through multiple gateways, then
// these will be sent one by one with a delay between each gateway.
DELAY = 0;
// Time.
// If multicast downlinks must be sent through multiple gateways, then
// these will be sent simultaneously using GPS time synchronization.
// Note that this does require GPS time-synchronized LoRa gateways.
GPS_TIME = 1;
}
message MulticastGroup {
// ID (UUID).
// This will be generated automatically on create.
string id = 1;
// Name.
string name = 2;
// Application ID.
// After creation, this can not be updated.
string application_id = 3;
// Region.
common.Region region = 4;
// Multicast address (HEX encoded DevAddr).
string mc_addr = 5;
// Multicast network session key (HEX encoded AES128 key).
string mc_nwk_s_key = 6;
// Multicast application session key (HEX encoded AES128 key).
string mc_app_s_key = 7;
// Frame-counter.
uint32 f_cnt = 8;
// Multicast group type.
MulticastGroupType group_type = 9;
// Data-rate.
uint32 dr = 10;
// Frequency (Hz).
uint32 frequency = 11;
// Ping-slot period (only for Class-B).
// Deprecated: use class_b_ping_slot_nb_k.
uint32 class_b_ping_slot_period = 12;
// Class-B ping-slots per beacon period (only for Class-B).
// Valid options are: 0 - 7;
//
// The actual number of ping-slots per beacon period equals to 2^k.
uint32 class_b_ping_slot_nb_k = 14;
// Scheduling type (only for Class-C).
MulticastGroupSchedulingType class_c_scheduling_type = 13;
}
message MulticastGroupListItem {
// ID.
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Region.
common.Region region = 5;
// Multicast group type.
MulticastGroupType group_type = 6;
}
message CreateMulticastGroupRequest {
// Multicast group to create.
MulticastGroup multicast_group = 1;
}
message CreateMulticastGroupResponse {
// ID of created multicast group (UUID).
string id = 1;
}
message GetMulticastGroupRequest {
// Multicast group ID.
string id = 1;
}
message GetMulticastGroupResponse {
// Multicast group object.
MulticastGroup multicast_group = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateMulticastGroupRequest {
// Multicast group object to update.
MulticastGroup multicast_group = 1;
}
message DeleteMulticastGroupRequest {
// Multicast group iD.
string id = 1;
}
message ListMulticastGroupsRequest {
// Max number of multicast groups to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
// Application ID to list the multicast groups for.
string application_id = 4;
}
message ListMulticastGroupsResponse {
// Total number of multicast groups.
uint32 total_count = 1;
// Result-test.
repeated MulticastGroupListItem result = 2;
}
message AddDeviceToMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Device EUI (HEX encoded).
string dev_eui = 2;
}
message RemoveDeviceFromMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Device EUI (HEX encoded).
string dev_eui = 2;
}
message AddGatewayToMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Gateway ID (HEX encoded).
string gateway_id = 2;
}
message RemoveGatewayFromMulticastGroupRequest {
// Multicast group ID.
string multicast_group_id = 1;
// Gateway ID (HEX encoded).
string gateway_id = 2;
}
message MulticastGroupQueueItem {
// Multicast group ID.
string multicast_group_id = 1;
// Downlink frame-counter.
// This will be automatically set on enqueue.
uint32 f_cnt = 2;
// FPort (must be > 0).
uint32 f_port = 3;
// Payload.
bytes data = 4;
}
message EnqueueMulticastGroupQueueItemRequest {
// Multicast queue-item to enqueue.
MulticastGroupQueueItem queue_item = 1;
}
message EnqueueMulticastGroupQueueItemResponse {
// Frame-counter of the enqueued payload.
uint32 f_cnt = 1;
}
message FlushMulticastGroupQueueRequest {
// Multicast group ID.
string multicast_group_id = 1;
}
message ListMulticastGroupQueueRequest {
// Multicast group ID.
string multicast_group_id = 1;
}
message ListMulticastGroupQueueResponse {
repeated MulticastGroupQueueItem items = 1;
}

View File

@ -0,0 +1,119 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "RelayProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// RelayService is the service providing API methos for managing relays.
service RelayService {
// List lists the relays for the given application id.
rpc List(ListRelaysRequest) returns (ListRelaysResponse) {
option(google.api.http) = {
get: "/api/relays"
};
}
// AddDevice adds the given device to the relay.
rpc AddDevice(AddRelayDeviceRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
post: "/api/relays/{relay_dev_eui}/devices"
body: "*"
};
}
// RemoveDevice removes the given device from the relay.
rpc RemoveDevice(RemoveRelayDeviceRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/relays/{relay_dev_eui}/devices/{dev_eui}"
};
};
// ListDevices lists the devices for the given relay.
rpc ListDevices(ListRelayDevicesRequest) returns (ListRelayDevicesResponse) {
option(google.api.http) = {
get: "/api/relays/{relay_dev_eui}/devices"
};
};
}
message RelayListItem {
// DevEUI (EUI64).
string dev_eui = 1;
// Name.
string name = 2;
}
message ListRelaysRequest {
// Max number of devices to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// Application ID (UUID).
string application_id = 3;
}
message ListRelaysResponse {
// Total number of relays.
uint32 total_count = 1;
// Result-set.
repeated RelayListItem result = 2;
}
message AddRelayDeviceRequest {
// Relay DevEUI (EUI64).
string relay_dev_eui = 1;
// Device DevEUI (EUI64).
string device_dev_eui = 2;
}
message RemoveRelayDeviceRequest {
// Relay DevEUI (EUI64).
string relay_dev_eui = 1;
// Device DevEUI (EUI64).
string device_dev_eui = 2;
}
message ListRelayDevicesRequest {
// Max number of multicast groups to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// Relay DevEUI (EUI64).
string relay_dev_eui = 3;
}
message RelayDeviceListItem {
// DevEUI (EUI64).
string dev_eui = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Device name.
string name = 3;
}
message ListRelayDevicesResponse {
// Total number of devices.
uint32 total_count = 1;
// Result-set.
repeated RelayDeviceListItem result = 2;
}

View File

@ -0,0 +1,326 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "TenantProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// TenantService is the service providing API methods for managing tenants.
service TenantService {
// Create a new tenant.
rpc Create(CreateTenantRequest) returns (CreateTenantResponse) {
option (google.api.http) = {
post : "/api/tenants"
body : "*"
};
}
// Get the tenant for the given ID.
rpc Get(GetTenantRequest) returns (GetTenantResponse) {
option (google.api.http) = {
get : "/api/tenants/{id}"
};
}
// Update the given tenant.
rpc Update(UpdateTenantRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put : "/api/tenants/{tenant.id}"
body : "*"
};
}
// Delete the tenant with the given ID.
rpc Delete(DeleteTenantRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/tenants/{id}"
};
}
// Get the list of tenants.
rpc List(ListTenantsRequest) returns (ListTenantsResponse) {
option (google.api.http) = {
get : "/api/tenants"
};
}
// Add an user to the tenant.
// Note: the user must already exist.
rpc AddUser(AddTenantUserRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post : "/api/tenants/{tenant_user.tenant_id}/users"
body : "*"
};
}
// Get the the tenant user for the given tenant and user IDs.
rpc GetUser(GetTenantUserRequest) returns (GetTenantUserResponse) {
option (google.api.http) = {
get : "/api/tenants/{tenant_id}/users/{user_id}"
};
}
// Update the given tenant user.
rpc UpdateUser(UpdateTenantUserRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put : "/api/tenants/{tenant_user.tenant_id}/users/{tenant_user.user_id}"
body : "*"
};
}
// Delete the given tenant user.
rpc DeleteUser(DeleteTenantUserRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete : "/api/tenants/{tenant_id}/users/{user_id}"
};
}
// Get the list of tenant users.
rpc ListUsers(ListTenantUsersRequest) returns (ListTenantUsersResponse) {
option (google.api.http) = {
get : "/api/tenants/{tenant_id}/users"
};
}
}
message Tenant {
// Tenant ID (UUID).
// Note: this value will be automatically generated on create.
string id = 1;
// Tenant name,
string name = 2;
// Tenant description.
string description = 3;
// Can the tenant create and "own" Gateways?
bool can_have_gateways = 4;
// Max. gateway count for tenant.
// When set to 0, the tenant can have unlimited gateways.
uint32 max_gateway_count = 5;
// Max. device count for tenant.
// When set to 0, the tenant can have unlimited devices.
uint32 max_device_count = 6;
// Private gateways (uplink).
// If enabled, then uplink messages will not be shared with other tenants.
bool private_gateways_up = 7;
// Private gateways (downlink).
// If enabled, then other tenants will not be able to schedule downlink
// messages through the gateways of this tenant. For example, in case you
// do want to share uplinks with other tenants (private_gateways_up=false),
// but you want to prevent other tenants from using gateway airtime.
bool private_gateways_down = 8;
// Tags (user defined).
// These tags can be used to add additional information to the tenant. These
// tags are NOT exposed in the integration events.
map<string, string> tags = 9;
}
message TenantListItem {
// Tenant ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Tenant name.
string name = 4;
// Can the tenant create and "own" Gateways?
bool can_have_gateways = 5;
// Private gateways (uplink).
bool private_gateways_up = 6;
// Private gateways (downlink).
bool private_gateways_down = 9;
// Max gateway count.
// 0 = unlimited.
uint32 max_gateway_count = 7;
// Max device count.
// 0 = unlimited.
uint32 max_device_count = 8;
}
message CreateTenantRequest {
// Tenant object to create.
Tenant tenant = 1;
}
message CreateTenantResponse {
// Tenant ID.
string id = 1;
}
message GetTenantRequest {
// Tenant ID.
string id = 1;
}
message GetTenantResponse {
// Tenant object.
Tenant tenant = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateTenantRequest {
// Tenant object.
Tenant tenant = 1;
}
message DeleteTenantRequest {
// Tenant ID.
string id = 1;
}
message ListTenantsRequest {
// Max number of tenants to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
// If set, the given string will be used to search on name.
string search = 3;
// If set, filters the result set to the tenants of the user.
// Only global API keys are able to filter by this field.
string user_id = 4;
}
message ListTenantsResponse {
// Total number of tenants.
uint32 total_count = 1;
// Result-set.
repeated TenantListItem result = 2;
}
message TenantUser {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 3;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 4;
// User is able to modify gateways.
bool is_gateway_admin = 5;
// Email (only used on get and when adding a user to a tenant).
string email = 6;
}
message TenantUserListItem {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
// Created at timestamp.
google.protobuf.Timestamp created_at = 3;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 4;
// Email.
string email = 5;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 6;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 7;
// User is able to modify gateways.
bool is_gateway_admin = 8;
}
message AddTenantUserRequest {
// Tenant user object.
TenantUser tenant_user = 1;
}
message GetTenantUserRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
}
message GetTenantUserResponse {
// Tenant user object.
TenantUser tenant_user = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateTenantUserRequest {
// Tenant user object.
TenantUser tenant_user = 1;
}
message DeleteTenantUserRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// User ID (UUID).
string user_id = 2;
}
message ListTenantUsersRequest {
// Tenant ID (UUID).
string tenant_id = 1;
// Max number of tenants to return in the result-set.
uint32 limit = 2;
// Offset in the result-set (for pagination).
uint32 offset = 3;
}
message ListTenantUsersResponse {
// Total number of tenants.
uint32 total_count = 1;
// Result-set.
repeated TenantUserListItem result = 2;
}

182
api/rust/proto/chirpstack/api/user.proto vendored Normal file
View File

@ -0,0 +1,182 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "UserProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
// UserService is the service providing API methods for managing users.
service UserService {
// Create a new user.
rpc Create(CreateUserRequest) returns (CreateUserResponse) {
option(google.api.http) = {
post: "/api/users"
body: "*"
};
}
// Get the user for the given ID.
rpc Get(GetUserRequest) returns (GetUserResponse) {
option(google.api.http) = {
get: "/api/users/{id}"
};
}
// Update the given user.
rpc Update(UpdateUserRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
put: "/api/users/{user.id}"
body: "*"
};
}
// Delete the user with the given ID.
rpc Delete(DeleteUserRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
delete: "/api/users/{id}"
};
}
// Get the list of users.
rpc List(ListUsersRequest) returns (ListUsersResponse) {
option(google.api.http) = {
get: "/api/users"
};
}
// Update the password for the given user.
rpc UpdatePassword(UpdateUserPasswordRequest) returns (google.protobuf.Empty) {
option(google.api.http) = {
post: "/api/users/{user_id}/password"
body: "*"
};
}
}
message User {
// User ID (UUID).
// Will be set automatically on create.
string id = 1;
// Set to true to make the user a global administrator.
bool is_admin = 4;
// Set to false to disable the user.
bool is_active = 5;
// E-mail of the user.
string email = 6;
// Optional note to store with the user.
string note = 7;
}
message UserListItem {
// User ID (UUID).
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Email of the user.
string email = 4;
// Set to true to make the user a global administrator.
bool is_admin = 5;
// Set to false to disable the user.
bool is_active = 6;
}
message UserTenant {
// Tenant ID.
string tenant_id = 1;
// User is admin within the context of the tenant.
// There is no need to set the is_device_admin and is_gateway_admin flags.
bool is_admin = 2;
// User is able to modify device related resources (applications,
// device-profiles, devices, multicast-groups).
bool is_device_admin = 3;
// User is able to modify gateways.
bool is_gateway_admin = 4;
}
message CreateUserRequest {
// User object to create.
User user = 1;
// Password to set for the user.
string password = 2;
// Add the user to the following tenants.
repeated UserTenant tenants = 3;
}
message CreateUserResponse {
// User ID.
string id = 1;
}
message GetUserRequest {
// User ID.
string id = 1;
}
message GetUserResponse {
// User object.
User user = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateUserRequest {
// User object.
User user = 1;
}
message DeleteUserRequest {
// User ID.
string id = 1;
}
message ListUsersRequest {
// Max number of tenants to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
}
message ListUsersResponse {
// Total number of users.
uint32 total_count = 1;
// Result-set.
repeated UserListItem result = 2;
}
message UpdateUserPasswordRequest {
// User ID.
string user_id = 1;
// Password to set.
string password = 2;
}

View File

@ -0,0 +1,232 @@
syntax = "proto3";
package common;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/common";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option csharp_namespace = "Chirpstack.Common";
import "google/protobuf/timestamp.proto";
enum Modulation {
// LoRa
LORA = 0;
// FSK
FSK = 1;
// LR-FHSS
LR_FHSS = 2;
}
enum Region {
// EU868
EU868 = 0;
// US915
US915 = 2;
// CN779
CN779 = 3;
// EU433
EU433 = 4;
// AU915
AU915 = 5;
// CN470
CN470 = 6;
// AS923
AS923 = 7;
// AS923 with -1.80 MHz frequency offset
AS923_2 = 12;
// AS923 with -6.60 MHz frequency offset
AS923_3 = 13;
// (AS923 with -5.90 MHz frequency offset).
AS923_4 = 14;
// KR920
KR920 = 8;
// IN865
IN865 = 9;
// RU864
RU864 = 10;
// ISM2400 (LoRaWAN 2.4 GHz)
ISM2400 = 11;
}
enum MType {
// JoinRequest.
JOIN_REQUEST = 0;
// JoinAccept.
JOIN_ACCEPT = 1;
// UnconfirmedDataUp.
UNCONFIRMED_DATA_UP = 2;
// UnconfirmedDataDown.
UNCONFIRMED_DATA_DOWN = 3;
// ConfirmedDataUp.
CONFIRMED_DATA_UP = 4;
// ConfirmedDataDown.
CONFIRMED_DATA_DOWN = 5;
// RejoinRequest.
REJOIN_REQUEST = 6;
// Proprietary.
PROPRIETARY = 7;
}
enum MacVersion {
LORAWAN_1_0_0 = 0;
LORAWAN_1_0_1 = 1;
LORAWAN_1_0_2 = 2;
LORAWAN_1_0_3 = 3;
LORAWAN_1_0_4 = 4;
LORAWAN_1_1_0 = 5;
}
enum RegParamsRevision {
A = 0;
B = 1;
RP002_1_0_0 = 2;
RP002_1_0_1 = 3;
RP002_1_0_2 = 4;
RP002_1_0_3 = 5;
}
enum LocationSource {
// Unknown.
UNKNOWN = 0;
// GPS.
GPS = 1;
// Manually configured.
CONFIG = 2;
// Geo resolver (TDOA).
GEO_RESOLVER_TDOA = 3;
// Geo resolver (RSSI).
GEO_RESOLVER_RSSI = 4;
// Geo resolver (GNSS).
GEO_RESOLVER_GNSS = 5;
// Geo resolver (WIFI).
GEO_RESOLVER_WIFI = 6;
}
enum Aggregation {
// Hour.
HOUR = 0;
// Day.
DAY = 1;
// Month.
MONTH = 2;
}
enum MetricKind {
// Incrementing counters that never decrease (these are not reset on each
// reading).
COUNTER = 0;
// Counters that do get reset upon reading.
ABSOLUTE = 1;
// E.g. a temperature value.
GAUGE = 2;
}
enum Regulation {
// Unknown.
REGULATION_UNKNOWN = 0;
// ETSI EN 300 220.
ETSI_EN_300_220 = 1;
}
message Location {
// Latitude.
double latitude = 1;
// Longitude.
double longitude = 2;
// Altitude.
double altitude = 3;
// Location source.
LocationSource source = 4;
// Accuracy.
float accuracy = 5;
}
message KeyEnvelope {
// KEK label.
string kek_label = 1;
// AES key (when the kek_label is set, this value must first be decrypted).
bytes aes_key = 2;
}
message Metric {
// Name.
string name = 1;
// Timestamps.
repeated google.protobuf.Timestamp timestamps = 2;
// Datasets.
repeated MetricDataset datasets = 3;
// Kind.
MetricKind kind = 4;
}
message MetricDataset {
// Label.
string label = 1;
// Data.
// Each value index corresponds with the same timestamp index of the Metric.
repeated float data = 2;
}
enum DeviceClass {
// Class-A.
CLASS_A = 0;
// Class-B.
CLASS_B = 1;
// Class-C.
CLASS_C = 2;
}
// Join-Server context.
message JoinServerContext {
// Session-key ID.
string session_key_id = 1;
// AppSKey envelope.
KeyEnvelope app_s_key = 2;
}

746
api/rust/proto/chirpstack/gw/gw.proto vendored Normal file
View File

@ -0,0 +1,746 @@
syntax = "proto3";
package gw;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/gw";
option java_package = "io.chirpstack.api.gw";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
option csharp_namespace = "Chirpstack.Gateway";
import "common/common.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
enum CodeRate {
CR_UNDEFINED = 0;
CR_4_5 = 1; // LoRa
CR_4_6 = 2;
CR_4_7 = 3;
CR_4_8 = 4;
CR_3_8 = 5; // LR-FHSS
CR_2_6 = 6;
CR_1_4 = 7;
CR_1_6 = 8;
CR_5_6 = 9;
CR_LI_4_5 = 10; // LoRa 2.4 gHz
CR_LI_4_6 = 11;
CR_LI_4_8 = 12;
}
enum DownlinkTiming {
// Send the downlink immediately.
IMMEDIATELY = 0;
// Send downlink at the given delay (based on provided context).
DELAY = 1;
// Send at given GPS epoch value.
GPS_EPOCH = 2;
}
enum FineTimestampType {
// No fine-timestamp available.
NONE = 0;
// Encrypted fine-timestamp.
ENCRYPTED = 1;
// Plain fine-timestamp.
PLAIN = 2;
}
enum CRCStatus {
// No CRC.
NO_CRC = 0;
// Bad CRC.
BAD_CRC = 1;
// CRC OK.
CRC_OK = 2;
}
enum TxAckStatus {
// Ignored (when a previous item was already emitted).
IGNORED = 0;
// Packet has been programmed for downlink.
OK = 1;
// Rejected because it was already too late to program this packet for
// downlink.
TOO_LATE = 2;
// Rejected because downlink packet timestamp is too much in advance.
TOO_EARLY = 3;
// Rejected because there was already a packet programmed in requested
// timeframe.
COLLISION_PACKET = 4;
// Rejected because there was already a beacon planned in requested timeframe.
COLLISION_BEACON = 5;
// Rejected because requested frequency is not supported by TX RF chain.
TX_FREQ = 6;
// Rejected because requested power is not supported by gateway.
TX_POWER = 7;
// Rejected because GPS is unlocked, so GPS timestamp cannot be used.
GPS_UNLOCKED = 8;
// Downlink queue is full.
QUEUE_FULL = 9;
// Internal error.
INTERNAL_ERROR = 10;
// Duty-cycle overflow.
DUTY_CYCLE_OVERFLOW = 11;
}
message Modulation {
oneof parameters {
// LoRa modulation information.
LoraModulationInfo lora = 3;
// FSK modulation information.
FskModulationInfo fsk = 4;
// LR-FHSS modulation information.
LrFhssModulationInfo lr_fhss = 5;
}
}
message UplinkTxInfoLegacy {
// Frequency (Hz).
uint32 frequency = 1;
// Modulation.
common.Modulation modulation = 2;
oneof modulation_info {
// LoRa modulation information.
LoraModulationInfo lora_modulation_info = 3;
// FSK modulation information.
FskModulationInfo fsk_modulation_info = 4;
// LR-FHSS modulation information.
LrFhssModulationInfo lr_fhss_modulation_info = 5;
}
}
message UplinkTxInfo {
// Frequency (Hz).
uint32 frequency = 1;
// Modulation.
Modulation modulation = 2;
}
message LoraModulationInfo {
// Bandwidth.
uint32 bandwidth = 1;
// Speading-factor.
uint32 spreading_factor = 2;
// Code-rate.
string code_rate_legacy = 3;
// Code-rate.
CodeRate code_rate = 5;
// Polarization inversion.
bool polarization_inversion = 4;
// Preamble length (for TX).
uint32 preamble = 6;
// No CRC (for TX).
// If true, do not send a CRC in the packet.
bool no_crc = 7;
}
message FskModulationInfo {
// Frequency deviation.
uint32 frequency_deviation = 1;
// FSK datarate (bits / sec).
uint32 datarate = 2;
}
message LrFhssModulationInfo {
// Operating channel width (OCW) in Hz.
uint32 operating_channel_width = 1;
// Code-rate.
// Deprecated: use code_rate.
string code_rate_legacy = 2;
// Code-rate.
CodeRate code_rate = 4;
// Hopping grid number of steps.
uint32 grid_steps = 3;
}
message EncryptedFineTimestamp {
// AES key index used for encrypting the fine timestamp.
uint32 aes_key_index = 1;
// Encrypted 'main' fine-timestamp (ns precision part of the timestamp).
bytes encrypted_ns = 2;
// FPGA ID.
bytes fpga_id = 3;
}
message PlainFineTimestamp {
// Full timestamp.
google.protobuf.Timestamp time = 1;
}
message GatewayStats {
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 17;
// Gateway time.
google.protobuf.Timestamp time = 2;
// Gateway location.
common.Location location = 3;
// Gateway configuration version (this maps to the config_version sent
// by ChirpStack to the gateway).
string config_version = 4;
// Number of radio packets received.
uint32 rx_packets_received = 5;
// Number of radio packets received with valid PHY CRC.
uint32 rx_packets_received_ok = 6;
// Number of downlink packets received for transmission.
uint32 tx_packets_received = 7;
// Number of downlink packets emitted.
uint32 tx_packets_emitted = 8;
// Additional gateway meta-data.
map<string, string> metadata = 10;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 12;
// Rx packets per frequency.
map<uint32, uint32> rx_packets_per_frequency = 13;
// Tx packets per modulation parameters.
repeated PerModulationCount tx_packets_per_modulation = 14;
// Rx packets per modulation parameters.
repeated PerModulationCount rx_packets_per_modulation = 15;
// Tx packets per status.
map<string, uint32> tx_packets_per_status = 16;
// Duty-cycle statistics (Concentratord only).
DutyCycleStats duty_cycle_stats = 18;
}
message PerModulationCount {
// Modulation.
Modulation modulation = 1;
// Count.
uint32 count = 2;
}
message DutyCycleStats {
// Implemented regulation.
common.Regulation regulation = 1;
// Bands.
repeated DutyCycleBand bands = 2;
}
message DutyCycleBand {
// Band name.
string name = 1;
// Min frequency for this band.
uint32 frequency_min = 2;
// Max frequency for this band.
uint32 frequency_max = 3;
// Max. allowed load.
google.protobuf.Duration load_max = 4;
// Tracked load (within the window of the regionlation).
google.protobuf.Duration load_tracked = 5;
}
message UplinkRxInfoLegacy {
// Gateway ID.
bytes gateway_id = 1;
// RX time (only set when the gateway has a GPS module).
google.protobuf.Timestamp time = 2;
// RX time since GPS epoch (only set when the gateway has a GPS module).
google.protobuf.Duration time_since_gps_epoch = 3;
// RSSI.
int32 rssi = 5;
// LoRa SNR.
double lora_snr = 6;
// Channel.
uint32 channel = 7;
// RF Chain.
uint32 rf_chain = 8;
// Board.
uint32 board = 9;
// Antenna.
uint32 antenna = 10;
// Location.
common.Location location = 11;
// Fine-timestamp type.
FineTimestampType fine_timestamp_type = 12;
// Fine-timestamp data.
oneof fine_timestamp {
// Encrypted fine-timestamp data.
EncryptedFineTimestamp encrypted_fine_timestamp = 13;
// Plain fine-timestamp data.
PlainFineTimestamp plain_fine_timestamp = 14;
}
// Gateway specific context.
bytes context = 15;
// Uplink ID (UUID bytes).
// Unique and random ID which can be used to correlate the uplink across
// multiple logs.
bytes uplink_id = 16;
// CRC status.
CRCStatus crc_status = 17;
// Optional meta-data map.
map<string, string> metadata = 18;
}
message UplinkRxInfo {
// Gateway ID.
string gateway_id = 1;
// Uplink ID.
uint32 uplink_id = 2;
// Gateway RX time (set if the gateway has a GNSS module).
google.protobuf.Timestamp gw_time = 3;
// Network Server RX time (set by the NS on receiving the uplink).
google.protobuf.Timestamp ns_time = 17;
// RX time as time since GPS epoch (set if the gateway has a GNSS module).
google.protobuf.Duration time_since_gps_epoch = 4;
// Fine-timestamp.
// This timestamp can be used for TDOA based geolocation.
google.protobuf.Duration fine_time_since_gps_epoch = 5;
// RSSI.
int32 rssi = 6;
// SNR.
// Note: only available for LoRa modulation.
float snr = 7;
// Channel.
uint32 channel = 8;
// RF chain.
uint32 rf_chain = 9;
// Board.
uint32 board = 10;
// Antenna.
uint32 antenna = 11;
// Location.
common.Location location = 12;
// Gateway specific context.
// This value must be returned to the gateway on (Class-A) downlink.
bytes context = 13;
// Additional gateway meta-data.
map<string, string> metadata = 15;
// CRC status.
CRCStatus crc_status = 16;
}
message DownlinkTxInfoLegacy {
// Gateway ID.
// Deprecated: replaced by gateway_id in DownlinkFrame.
bytes gateway_id = 1;
// TX frequency (in Hz).
uint32 frequency = 5;
// TX power (in dBm EIRP).
int32 power = 6;
// Modulation.
common.Modulation modulation = 7;
oneof modulation_info {
// LoRa modulation information.
LoraModulationInfo lora_modulation_info = 8;
// FSK modulation information.
FskModulationInfo fsk_modulation_info = 9;
}
// The board identifier for emitting the frame.
uint32 board = 10;
// The antenna identifier for emitting the frame.
uint32 antenna = 11;
// Timing defines the downlink timing to use.
DownlinkTiming timing = 12;
oneof timing_info {
// Immediately timing information.
ImmediatelyTimingInfo immediately_timing_info = 13;
// Context based delay timing information.
DelayTimingInfo delay_timing_info = 14;
// GPS Epoch timing information.
GPSEpochTimingInfo gps_epoch_timing_info = 15;
}
// Gateway specific context.
// In case of a Class-A downlink, this contains a copy of the uplink context.
bytes context = 16;
}
message DownlinkTxInfo {
// TX frequency (in Hz).
uint32 frequency = 1;
// TX power (in dBm EIRP).
int32 power = 2;
// Modulation.
Modulation modulation = 3;
// The board identifier for emitting the frame.
uint32 board = 4;
// The antenna identifier for emitting the frame.
uint32 antenna = 5;
// Timing.
Timing timing = 6;
// Gateway specific context.
// In case of a Class-A downlink, this contains a copy of the uplink context.
bytes context = 7;
}
message Timing {
oneof parameters {
// Immediately timing information.
ImmediatelyTimingInfo immediately = 1;
// Context based delay timing information.
DelayTimingInfo delay = 2;
// GPS Epoch timing information.
GPSEpochTimingInfo gps_epoch = 3;
}
}
message ImmediatelyTimingInfo {
// Not implemented yet.
}
message DelayTimingInfo {
// Delay (duration).
// The delay will be added to the gateway internal timing, provided by the
// context object.
google.protobuf.Duration delay = 1;
}
message GPSEpochTimingInfo {
// Duration since GPS Epoch.
google.protobuf.Duration time_since_gps_epoch = 1;
}
message UplinkFrame {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data (deprecated).
UplinkTxInfoLegacy tx_info_legacy = 2;
// RX meta-data (deprecated).
UplinkRxInfoLegacy rx_info_legacy = 3;
// Tx meta-data.
UplinkTxInfo tx_info = 4;
// Rx meta-data.
UplinkRxInfo rx_info = 5;
}
message UplinkFrameSet {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
UplinkTxInfo tx_info = 2;
// RX meta-data set.
repeated UplinkRxInfo rx_info = 3;
}
message DownlinkFrame {
// Downlink ID.
uint32 downlink_id = 3;
// Downlink ID (UUID).
// Deprecated: use downlink_id.
bytes downlink_id_legacy = 4;
// Downlink frame items.
// This makes it possible to send multiple downlink opportunities to the
// gateway at once (e.g. RX1 and RX2 in LoRaWAN). The first item has the
// highest priority, the last the lowest. The gateway will emit at most
// one item.
repeated DownlinkFrameItem items = 5;
// Gateway ID.
// Deprecated: use gateway_id
bytes gateway_id_legacy = 6;
// Gateway ID.
string gateway_id = 7;
}
message DownlinkFrameItem {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data (deprecated).
DownlinkTxInfoLegacy tx_info_legacy = 2;
// Tx meta-data.
DownlinkTxInfo tx_info = 3;
}
message DownlinkTxAck {
// Gateway ID (deprecated).
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Downlink ID.
uint32 downlink_id = 2;
// Downlink ID (deprecated).
bytes downlink_id_legacy = 4;
// Downlink frame items.
// This list has the same length as the request and indicates which
// downlink frame has been emitted of the requested list (or why it failed).
// Note that at most one item has a positive acknowledgement.
repeated DownlinkTxAckItem items = 5;
}
message DownlinkTxAckItem {
// The Ack status of this item.
TxAckStatus status = 1;
}
message GatewayConfiguration {
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 5;
// Configuration version.
string version = 2;
// Channels.
repeated ChannelConfiguration channels = 3;
// Stats interval.
google.protobuf.Duration stats_interval = 4;
}
message ChannelConfiguration {
// Frequency (Hz).
uint32 frequency = 1;
// Modulation (deprecated).
common.Modulation modulation_legacy = 2;
oneof modulation_config {
// LoRa modulation config.
LoraModulationConfig lora_modulation_config = 3;
// FSK modulation config.
FskModulationConfig fsk_modulation_config = 4;
}
// Board index.
uint32 board = 5;
// Demodulator index (of the given board).
uint32 demodulator = 6;
}
message LoraModulationConfig {
// Bandwidth (kHz).
// Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Spreading-factors.
repeated uint32 spreading_factors = 2;
}
message FskModulationConfig {
// Bandwidth (kHz).
// Deprecated: use bandwidth.
uint32 bandwidth_legacy = 1;
// Bandwidth (Hz).
uint32 bandwidth = 3;
// Bitrate.
uint32 bitrate = 2;
}
message GatewayCommandExecRequest {
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Command to execute.
// This command must be pre-configured in the LoRa Gateway Bridge
// configuration.
string command = 2;
// Execution request ID.
// The same will be returned when the execution of the command has
// completed.
uint32 exec_id = 7;
// Standard input.
bytes stdin = 4;
// Environment variables.
map<string, string> environment = 5;
}
message GatewayCommandExecResponse {
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 6;
// Execution request ID.
uint32 exec_id = 7;
// Standard output.
bytes stdout = 3;
// Standard error.
bytes stderr = 4;
// Error message.
string error = 5;
}
// RawPacketForwarderEvent contains a raw packet-forwarder event.
// It can be used to access packet-forwarder features that are not (fully)
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderEvent {
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Payload contains the raw payload.
bytes payload = 3;
}
// RawPacketForwarderEvent contains a raw packet-forwarder command.
// It can be used to access packet-forwarder features that are not (fully)
// integrated with the ChirpStack Gateway Bridge.
message RawPacketForwarderCommand {
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 4;
// Payload contains the raw payload.
bytes payload = 3;
}
// ConnState contains the connection state of a gateway.
message ConnState {
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;
// Gateway ID.
string gateway_id = 3;
enum State {
OFFLINE = 0;
ONLINE = 1;
}
State state = 2;
}

View File

@ -0,0 +1,350 @@
syntax = "proto3";
package integration;
option go_package = "github.com/brocaar/chirpstack/api/go/v4/integration";
option java_package = "io.chirpstack.api.integration";
option java_multiple_files = true;
option java_outer_classname = "IntegrationProto";
option csharp_namespace = "Chirpstack.Integration";
import "common/common.proto";
import "gw/gw.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
enum LogLevel {
// Info.
INFO = 0;
// Warning.
WARNING = 1;
// Error.
ERROR = 2;
}
enum LogCode {
// Unknown type.
UNKNOWN = 0;
// Error related to the downlink payload size.
// Usually seen when the payload exceeded the maximum allowed payload size.
DOWNLINK_PAYLOAD_SIZE = 1;
// Uplink codec error.
UPLINK_CODEC = 2;
// Downlink codec error.
DOWNLINK_CODEC = 3;
// OTAA error.
OTAA = 4;
// Uplink frame-counter was reset.
UPLINK_F_CNT_RESET = 5;
// Uplink MIC error.
UPLINK_MIC = 6;
// Uplink frame-counter retransmission.
UPLINK_F_CNT_RETRANSMISSION = 7;
// Downlink gateway error.
DOWNLINK_GATEWAY = 8;
// Relay new end-device.
RELAY_NEW_END_DEVICE = 9;
// Downlink frame-counter.
F_CNT_DOWN = 10;
}
// Device information.
message DeviceInfo {
// Tenant ID (UUID).
string tenant_id = 1;
// Tenant name.
string tenant_name = 2;
// Application ID (UUID).
string application_id = 3;
// Application name.
string application_name = 4;
// Device-profile ID (UUID).
string device_profile_id = 5;
// Device-profile name.
string device_profile_name = 6;
// Device name.
string device_name = 7;
// Device EUI.
string dev_eui = 8;
// Device class.
common.DeviceClass device_class_enabled = 10;
// Device-profile and device tags.
map<string, string> tags = 9;
}
// Uplink relay RX information.
message UplinkRelayRxInfo {
// Relay DevEUI.
string dev_eui = 1;
// Frequency.
uint32 frequency = 2;
// Data-rate.
uint32 dr = 3;
// SNR.
int32 snr = 4;
// RSSI.
int32 rssi = 5;
// WOR channel.
uint32 wor_channel = 6;
}
// UplinkEvent is the message sent when an uplink payload has been received.
message UplinkEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device information.
DeviceInfo device_info = 3;
// Device address.
string dev_addr = 4;
// Device has ADR bit set.
bool adr = 5;
// Data-rate.
uint32 dr = 6;
// Frame counter.
uint32 f_cnt = 7;
// Frame port.
uint32 f_port = 8;
// Uplink was of type confirmed.
bool confirmed = 9;
// FRMPayload data.
bytes data = 10;
// Note that this is only set when a codec is configured in the Device
// Profile.
google.protobuf.Struct object = 11;
// Receiving gateway RX info.
repeated gw.UplinkRxInfo rx_info = 12;
// TX info.
gw.UplinkTxInfo tx_info = 13;
// Relay info.
UplinkRelayRxInfo relay_rx_info = 14;
// Join-Server context.
// A non-empty value indicatest that ChirpStack does not have access to
// the AppSKey and that the encryption / decryption of the payloads is
// the responsibility of the end-application.
common.JoinServerContext join_server_context = 15;
}
// JoinEvent is the message sent when a device joined the network.
// Note: this event is sent at the first uplink after OTAA.
message JoinEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Device address.
string dev_addr = 4;
// Relay info.
UplinkRelayRxInfo relay_rx_info = 5;
// Join-Server context.
// A non-empty value indicatest that ChirpStack does not have access to
// the AppSKey and that the encryption / decryption of the payloads is
// the responsibility of the end-application.
common.JoinServerContext join_server_context = 6;
}
// AckEvent is the message sent when a confirmation on a confirmed downlink
// has been received -or- when the downlink timed out.
message AckEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Downlink queue item ID (UUID).
string queue_item_id = 4;
// Frame was acknowledged.
bool acknowledged = 5;
// Downlink frame counter to which the acknowledgement relates.
uint32 f_cnt_down = 6;
}
// TxAckEvent is the message sent when a downlink was acknowledged by the
// gateway for transmission. As a downlink can be scheduled in the future, this
// event does not confirm that the message has already been transmitted.
message TxAckEvent {
// Downlink ID.
uint32 downlink_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Downlink queue item ID (UUID).
string queue_item_id = 4;
// Downlink frame-counter.
uint32 f_cnt_down = 5;
// Gateway ID.
string gateway_id = 6;
// TX info.
gw.DownlinkTxInfo tx_info = 7;
}
// LogEvent is the message sent when a device-related log was sent.
message LogEvent {
// Timestamp.
google.protobuf.Timestamp time = 1;
// Device info.
DeviceInfo device_info = 2;
// Log level.
LogLevel level = 3;
// Log code.
LogCode code = 4;
// Description message.
string description = 5;
// Context map.
map<string, string> context = 6;
}
// StatusEvent is the message sent when a device-status mac-command was sent
// by the device.
message StatusEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// The demodulation signal-to-noise ratio in dB for the last successfully
// received device-status request by the Network Server.
int32 margin = 5;
// Device is connected to an external power source.
bool external_power_source = 6;
// Battery level is not available.
bool battery_level_unavailable = 7;
// Battery level.
float battery_level = 8;
}
// LocationEvent is the message sent when a geolocation resolve was returned.
message LocationEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Location.
common.Location location = 4;
}
// IntegrationEvent is the message that can be sent by an integration.
// It allows for sending events which are provided by an external integration
// which are "not native" to ChirpStack.
message IntegrationEvent {
// Deduplication ID (UUID).
string deduplication_id = 1;
// Timestamp.
google.protobuf.Timestamp time = 2;
// Device info.
DeviceInfo device_info = 3;
// Integration name.
string integration_name = 4;
// Event type.
string event_type = 5;
// Struct containing the event object.
google.protobuf.Struct object = 6;
}
// DownlinkCommand is the command to enqueue a downlink payload for the given
// device.
message DownlinkCommand {
// ID (UUID).
// If left blank, a random UUID will be generated.
string id = 1;
// Device EUI (EUI64).
string dev_eui = 2;
// Confirmed.
bool confirmed = 3;
// FPort (must be > 0).
uint32 f_port = 4;
// Data.
// Or use the json_object field when a codec has been configured.
bytes data = 5;
// Only use this when a codec has been configured that can encode this
// object to bytes.
google.protobuf.Struct object = 6;
}

View File

@ -0,0 +1,410 @@
syntax = "proto3";
package internal;
import "common/common.proto";
import "gw/gw.proto";
import "google/protobuf/timestamp.proto";
message DeviceSession {
// Device address.
bytes dev_addr = 2;
// LoRaWAN mac-version.
common.MacVersion mac_version = 4;
// FNwkSIntKey.
bytes f_nwk_s_int_key = 5;
// SNwkSIntKey.
bytes s_nwk_s_int_key = 6;
// NwkSEncKey.
bytes nwk_s_enc_key = 7;
// AppSKey envelope.
common.KeyEnvelope app_s_key = 8;
// JS Session Key ID.
bytes js_session_key_id = 42;
// Uplink frame-counter.
uint32 f_cnt_up = 9;
// Downlink frame-counter (ns).
uint32 n_f_cnt_down = 10;
// Downlink frame-counter (as).
uint32 a_f_cnt_down = 11;
// Frame-counter holding the last confirmed downlink frame (n_f_cnt_down or
// a_f_cnt_down).
uint32 conf_f_cnt = 12;
// Skip uplink frame-counter validation.
bool skip_f_cnt_check = 13;
// RX1 delay.
uint32 rx1_delay = 14;
// RX1 data-rate offset.
uint32 rx1_dr_offset = 15;
// RX2 data-rate.
uint32 rx2_dr = 16;
// RX2 frequency.
uint32 rx2_frequency = 17;
// Enabled uplink channels.
repeated uint32 enabled_uplink_channel_indices = 18;
// Extra user-defined uplink channels.
map<uint32, DeviceSessionChannel> extra_uplink_channels = 19;
// Class-B ping-slot data-rate.
uint32 class_b_ping_slot_dr = 20;
// Class-B ping-slot frequency.
uint32 class_b_ping_slot_freq = 21;
// Class-B ping-slot nb.
uint32 class_b_ping_slot_nb = 22;
// Nb. transmissions.
uint32 nb_trans = 23;
// TXPowerIndex which the node is using. The possible values are defined
// by the lorawan/band package and are region specific. By default it is
// assumed that the node is using TXPower 0. This value is controlled by
// the ADR engine.
uint32 tx_power_index = 24;
// DR defines the (last known) data-rate at which the node is operating.
// This value is controlled by the ADR engine.
uint32 dr = 25;
// ADR defines if the device has ADR enabled.
bool adr = 26;
// MaxSupportedTXPowerIndex defines the maximum supported tx-power index
// by the node, or 0 when not set.
uint32 max_supported_tx_power_index = 27;
// MinSupportedTXPowerIndex defines the minimum supported tx-power index
// by the node (default 0).
uint32 min_supported_tx_power_index = 28;
// Pending rejoin device-session contains a device-session which has not
// yet been activated by the device (by sending a first uplink).
DeviceSession pending_rejoin_device_session = 29;
// Uplink history for ADR (last 20 uplink transmissions).
// This table is reset in case one of parameters has changed:
// * DR
// * TxPower
// * NbTrans
repeated UplinkAdrHistory uplink_adr_history = 30;
// Mac-command error count.
map<uint32, uint32> mac_command_error_count = 31;
// Last device-status request.
google.protobuf.Timestamp last_device_status_request = 32;
// RejoinRequestEnabled defines if the rejoin-request is enabled on the
// device.
bool rejoin_request_enabled = 33;
// RejoinRequestMaxCountN defines the 2^(C+4) uplink message interval for
// the rejoin-request.
uint32 rejoin_request_max_count_n = 34;
// RejoinRequestMaxTimeN defines the 2^(T+10) time interval (seconds)
// for the rejoin-request.
uint32 rejoin_request_max_time_n = 35;
// Rejoin counter (RJCount0).
// This counter is reset to 0 after each successful join-accept.
uint32 rejoin_count_0 = 36;
// Uplink dwell time.
bool uplink_dwell_time_400ms = 37;
// Downlink dwell time.
bool downlink_dwell_time_400ms = 38;
// Uplink max. EIRP index.
uint32 uplink_max_eirp_index = 39;
// Region configuration ID.
string region_config_id = 40;
// Relay state.
Relay relay = 41;
}
message UplinkAdrHistory {
// Uplink frame-counter.
uint32 f_cnt = 1;
// Max SNR (of deduplicated frames received by one or multiple gateways).
float max_snr = 2;
// Max RSSI.
int32 max_rssi = 5;
// TX Power (as known by the network-server).
uint32 tx_power_index = 3;
// Number of receiving gateways.
uint32 gateway_count = 4;
}
message Relay {
// Devices provisioned on the relay.
repeated RelayDevice devices = 1;
// Filter list.
repeated RelayFilter filters = 2;
// Relay is enabled.
bool enabled = 3;
// CAD periodicity.
uint32 cad_periodicity = 4;
// Default channel index.
uint32 default_channel_index = 5;
// Second channel freq.
uint32 second_channel_freq = 6;
// Second channel DR.
uint32 second_channel_dr = 7;
// Second channel ACK offset.
uint32 second_channel_ack_offset = 8;
// End-device activation mode.
uint32 ed_activation_mode = 9;
// End-device smart-enable level.
uint32 ed_smart_enable_level = 10;
// End-device back-off.
uint32 ed_back_off = 11;
// Join-request limit reload rate.
uint32 join_req_limit_reload_rate = 12;
// Notify limit reload rate.
uint32 notify_limit_reload_rate = 13;
// Global uplink limit reload rate.
uint32 global_uplink_limit_reload_rate = 14;
// Overall limit reload rate.
uint32 overall_limit_reload_rate = 15;
// Join-request limit bucket size.
uint32 join_req_limit_bucket_size = 16;
// Notify limit bucket size.
uint32 notify_limit_bucket_size = 17;
// Global uplink limit bucket size.
uint32 global_uplink_limit_bucket_size = 18;
// Overall limit bucket size.
uint32 overall_limit_bucket_size = 19;
// End-device must communicate through relay only.
// This is stored in the device-session as we need to validate on retrieving
// the device-session.
bool ed_relay_only = 20;
// End-device WFCnt.
// This holds the last known WFCnt value. ChirpStack will periodically read
// this value from the Relay.
uint32 w_f_cnt = 21;
}
message RelayDevice {
// Index (used for filter and uplink filters).
// This must be between 0 - 15.
uint32 index = 1;
// JoinEUI (EUI64).
bytes join_eui = 2;
// DevEUI (EUI64).
bytes dev_eui = 3;
// DevAddr.
bytes dev_addr = 4;
// RootWorSKey.
bytes root_wor_s_key = 5;
// Provisioned.
bool provisioned = 6;
// Uplink limit bucket size.
uint32 uplink_limit_bucket_size = 7;
// Uplink limit reload rate.
uint32 uplink_limit_reload_rate = 8;
// Timestamp of the last WFCnt request.
// Note that ChirpStack periodically requests the WFCnt from the relay.
google.protobuf.Timestamp w_f_cnt_last_request = 9;
}
message RelayFilter {
// Index.
// This must be between 0 - 15.
uint32 index = 1;
// Action.
// * 0: No Rule
// * 1: Forward
// * 2: Filter
uint32 action = 2;
// DevEUI (EUI64).
bytes dev_eui = 3;
// JoinEUI (EUI64).
bytes join_eui = 4;
// Provisioned.
bool provisioned = 5;
}
message DeviceSessionChannel {
// Frequency Hz.
uint32 frequency = 1;
// Min. data-rate.
uint32 min_dr = 2;
// Max. data-rate.
uint32 max_dr = 3;
}
message DeviceGatewayRxInfo {
// DevEUI (EUI64).
bytes dev_eui = 1;
// Data-rate.
uint32 dr = 2;
// Gateway RxInfo elements.
repeated DeviceGatewayRxInfoItem items = 3;
}
message DeviceGatewayRxInfoItem {
// Gateway ID (EUI64).
bytes gateway_id = 1;
// RSSI.
int32 rssi = 2;
// LoRa SNR.
float lora_snr = 3;
// Antenna.
uint32 antenna = 4;
// Board.
uint32 board = 5;
// Context blob.
bytes context = 6;
// Gateway is private (uplink).
bool is_private_up = 7;
// Gateway is private (downlink).
bool is_private_down = 8;
// Tenant ID (UUID).
bytes tenant_id = 9;
}
message DownlinkFrame {
// Downlink ID.
uint32 downlink_id = 1;
// DevEUI.
bytes dev_eui = 2;
// Device queue item ID.
bytes device_queue_item_id = 3;
// Multicast Group ID.
bytes multicast_group_id = 4;
// Multicast queue item ID.
bytes multicast_group_queue_item_id = 5;
// Downlink frames.
gw.DownlinkFrame downlink_frame = 6;
// Encrypted FOpts (LoRaWAN 1.1).
bool encrypted_fopts = 8;
// Network session encryption key (for FOpts and FRMPayload mac-commands).
bytes nwk_s_enc_key = 9;
// NFCntDown (for decrypting mac-commands).
uint32 n_f_cnt_down = 10;
// AFCntDown (for decrypting FRMPayload in case of Relay).
uint32 a_f_cnt_down = 11;
// DevEUI of relayed device.
bytes dev_eui_relayed = 12;
}
message LoraCloudGeolocBuffer {
// Uplinks in buffer.
repeated LoraCloudGeolocBufferUplink uplinks = 1;
}
message LoraCloudGeolocBufferUplink {
// RxInfo set for a single uplink.
repeated gw.UplinkRxInfo rx_info = 1;
}
message PassiveRoamingDeviceSession {
// Session ID (UUID).
// Unfortunately we can not use the DevEUI as unique identifier
// as the PRStartAns DevEUI field is optional.
bytes session_id = 1;
// NetID of the hNS.
bytes net_id = 2;
// DevAddr of the device.
bytes dev_addr = 3;
// DevEUI of the device (optional).
bytes dev_eui = 4;
// LoRaWAN 1.1.
bool lorawan_1_1 = 5;
// LoRaWAN 1.0 NwkSKey / LoRaWAN 1.1 FNwkSIntKey.
bytes f_nwk_s_int_key = 6;
// Lifetime.
google.protobuf.Timestamp lifetime = 7;
// Uplink frame-counter.
uint32 f_cnt_up = 8;
// Validate MIC.
bool validate_mic = 9;
}

View File

@ -0,0 +1,24 @@
syntax = "proto3";
package stream;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";
option java_package = "io.chirpstack.api.stream";
option java_multiple_files = true;
option java_outer_classname = "ApiRequestProto";
option csharp_namespace = "Chirpstack.Stream";
import "google/protobuf/timestamp.proto";
import "common/common.proto";
import "gw/gw.proto";
message ApiRequestLog {
// API service name.
string service = 1;
// API method name.
string method = 2;
// Metadata.
map<string, string> metadata = 3;
}

View File

@ -0,0 +1,40 @@
syntax = "proto3";
package stream;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";
option java_package = "io.chirpstack.api.stream";
option java_multiple_files = true;
option java_outer_classname = "BackendInterfacesProto";
option csharp_namespace = "Chirpstack.Stream";
import "google/protobuf/timestamp.proto";
message BackendInterfacesRequest {
// Sender ID.
string sender_id = 1;
// Receiver ID.
string receiver_id = 2;
// Timestamp.
google.protobuf.Timestamp time = 3;
// Transaction ID.
uint32 transaction_id = 4;
// Message-type.
string message_type = 5;
// Result code.
string result_code = 6;
// Request body.
string request_body = 7;
// Request error.
string request_error = 8;
// Response body.
string response_body = 9;
}

View File

@ -0,0 +1,74 @@
syntax = "proto3";
package stream;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";
option java_package = "io.chirpstack.api.stream";
option java_multiple_files = true;
option java_outer_classname = "FrameProto";
option csharp_namespace = "Chirpstack.Stream";
import "google/protobuf/timestamp.proto";
import "common/common.proto";
import "gw/gw.proto";
message UplinkFrameLog {
// PHYPayload.
bytes phy_payload = 1;
// TX meta-data.
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRxInfo rx_info = 3;
// Message type.
common.MType m_type = 4;
// Device address (optional).
string dev_addr = 5;
// Device EUI (optional).
string dev_eui = 6;
// Time.
google.protobuf.Timestamp time = 7;
// Plaintext f_opts mac-commands.
bool plaintext_f_opts = 8;
// Plaintext frm_payload.
bool plaintext_frm_payload = 9;
}
message DownlinkFrameLog {
// Time.
google.protobuf.Timestamp time = 1;
// PHYPayload.
bytes phy_payload = 2;
// TX meta-data.
gw.DownlinkTxInfo tx_info = 3;
// Downlink ID.
uint32 downlink_id = 4;
// Gateway ID (EUI64).
string gateway_id = 5;
// Message type.
common.MType m_type = 6;
// Device address (optional).
string dev_addr = 7;
// Device EUI (optional).
string dev_eui = 8;
// Plaintext f_opts mac-commands.
bool plaintext_f_opts = 9;
// Plaintext frm_payload.
bool plaintext_frm_payload = 10;
}

View File

@ -0,0 +1,61 @@
syntax = "proto3";
package stream;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/stream";
option java_package = "io.chirpstack.api.stream";
option java_multiple_files = true;
option java_outer_classname = "MetaProto";
option csharp_namespace = "Chirpstack.Stream";
import "common/common.proto";
import "gw/gw.proto";
message UplinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// TX meta-data.
gw.UplinkTxInfo tx_info = 2;
// RX meta-data.
repeated gw.UplinkRxInfo rx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
}
message DownlinkMeta {
// Device EUI (EUI64).
string dev_eui = 1;
// Multicast Group ID (UUID).
string multicast_group_id = 2;
// TX meta-data.
gw.DownlinkTxInfo tx_info = 3;
// PHYPayload byte count.
uint32 phy_payload_byte_count = 4;
// MAC-Command byte count.
uint32 mac_command_byte_count = 5;
// Application payload byte count.
uint32 application_payload_byte_count = 6;
// Message type.
common.MType message_type = 7;
// Gateway ID (EUI64).
string gateway_id = 8;
}

View File

@ -0,0 +1,31 @@
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@ -0,0 +1,379 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines the HTTP configuration for an API service. It contains a list of
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
// to one or more HTTP REST API methods.
message Http {
// A list of HTTP configuration rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated HttpRule rules = 1;
// When set to true, URL path parameters will be fully URI-decoded except in
// cases of single segment matches in reserved expansion, where "%2F" will be
// left encoded.
//
// The default behavior is to not decode RFC 6570 reserved characters in multi
// segment matches.
bool fully_decode_reserved_expansion = 2;
}
// # gRPC Transcoding
//
// gRPC Transcoding is a feature for mapping between a gRPC method and one or
// more HTTP REST endpoints. It allows developers to build a single API service
// that supports both gRPC APIs and REST APIs. Many systems, including [Google
// APIs](https://github.com/googleapis/googleapis),
// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
// and use it for large scale production services.
//
// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
// how different portions of the gRPC request message are mapped to the URL
// path, URL query parameters, and HTTP request body. It also controls how the
// gRPC response message is mapped to the HTTP response body. `HttpRule` is
// typically specified as an `google.api.http` annotation on the gRPC method.
//
// Each mapping specifies a URL path template and an HTTP method. The path
// template may refer to one or more fields in the gRPC request message, as long
// as each field is a non-repeated field with a primitive (non-message) type.
// The path template controls how fields of the request message are mapped to
// the URL path.
//
// Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/{name=messages/*}"
// };
// }
// }
// message GetMessageRequest {
// string name = 1; // Mapped to URL path.
// }
// message Message {
// string text = 1; // The resource content.
// }
//
// This enables an HTTP REST to gRPC mapping as below:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
//
// Any fields in the request message which are not bound by the path template
// automatically become HTTP query parameters if there is no HTTP request body.
// For example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get:"/v1/messages/{message_id}"
// };
// }
// }
// message GetMessageRequest {
// message SubMessage {
// string subfield = 1;
// }
// string message_id = 1; // Mapped to URL path.
// int64 revision = 2; // Mapped to URL query parameter `revision`.
// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
// }
//
// This enables a HTTP JSON to RPC mapping as below:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
// "foo"))`
//
// Note that fields which are mapped to URL query parameters must have a
// primitive type or a repeated primitive type or a non-repeated message type.
// In the case of a repeated type, the parameter can be repeated in the URL
// as `...?param=A&param=B`. In the case of a message type, each field of the
// message is mapped to a separate parameter, such as
// `...?foo.a=A&foo.b=B&foo.c=C`.
//
// For HTTP methods that allow a request body, the `body` field
// specifies the mapping. Consider a REST update method on the
// message resource collection:
//
// service Messaging {
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "message"
// };
// }
// }
// message UpdateMessageRequest {
// string message_id = 1; // mapped to the URL
// Message message = 2; // mapped to the body
// }
//
// The following HTTP JSON to RPC mapping is enabled, where the
// representation of the JSON in the request body is determined by
// protos JSON encoding:
//
// HTTP | gRPC
// -----|-----
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
// "123456" message { text: "Hi!" })`
//
// The special name `*` can be used in the body mapping to define that
// every field not bound by the path template should be mapped to the
// request body. This enables the following alternative definition of
// the update method:
//
// service Messaging {
// rpc UpdateMessage(Message) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "*"
// };
// }
// }
// message Message {
// string message_id = 1;
// string text = 2;
// }
//
//
// The following HTTP JSON to RPC mapping is enabled:
//
// HTTP | gRPC
// -----|-----
// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
// "123456" text: "Hi!")`
//
// Note that when using `*` in the body mapping, it is not possible to
// have HTTP parameters, as all fields not bound by the path end in
// the body. This makes this option more rarely used in practice when
// defining REST APIs. The common usage of `*` is in custom methods
// which don't use the URL at all for transferring data.
//
// It is possible to define multiple HTTP methods for one RPC by using
// the `additional_bindings` option. Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/messages/{message_id}"
// additional_bindings {
// get: "/v1/users/{user_id}/messages/{message_id}"
// }
// };
// }
// }
// message GetMessageRequest {
// string message_id = 1;
// string user_id = 2;
// }
//
// This enables the following two alternative HTTP JSON to RPC mappings:
//
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
// "123456")`
//
// ## Rules for HTTP mapping
//
// 1. Leaf request fields (recursive expansion nested messages in the request
// message) are classified into three categories:
// - Fields referred by the path template. They are passed via the URL path.
// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
// are passed via the HTTP
// request body.
// - All other fields are passed via the URL query parameters, and the
// parameter name is the field path in the request message. A repeated
// field can be represented as multiple query parameters under the same
// name.
// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
// query parameter, all fields
// are passed via URL path and HTTP request body.
// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
// request body, all
// fields are passed via URL path and URL query parameters.
//
// ### Path template syntax
//
// Template = "/" Segments [ Verb ] ;
// Segments = Segment { "/" Segment } ;
// Segment = "*" | "**" | LITERAL | Variable ;
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
// FieldPath = IDENT { "." IDENT } ;
// Verb = ":" LITERAL ;
//
// The syntax `*` matches a single URL path segment. The syntax `**` matches
// zero or more URL path segments, which must be the last part of the URL path
// except the `Verb`.
//
// The syntax `Variable` matches part of the URL path as specified by its
// template. A variable template must not contain other variables. If a variable
// matches a single path segment, its template may be omitted, e.g. `{var}`
// is equivalent to `{var=*}`.
//
// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
// contains any reserved character, such characters should be percent-encoded
// before the matching.
//
// If a variable contains exactly one path segment, such as `"{var}"` or
// `"{var=*}"`, when such a variable is expanded into a URL path on the client
// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
// server side does the reverse decoding. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{var}`.
//
// If a variable contains multiple path segments, such as `"{var=foo/*}"`
// or `"{var=**}"`, when such a variable is expanded into a URL path on the
// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
// The server side does the reverse decoding, except "%2F" and "%2f" are left
// unchanged. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{+var}`.
//
// ## Using gRPC API Service Configuration
//
// gRPC API Service Configuration (service config) is a configuration language
// for configuring a gRPC service to become a user-facing product. The
// service config is simply the YAML representation of the `google.api.Service`
// proto message.
//
// As an alternative to annotating your proto file, you can configure gRPC
// transcoding in your service config YAML files. You do this by specifying a
// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
// effect as the proto annotation. This can be particularly useful if you
// have a proto that is reused in multiple services. Note that any transcoding
// specified in the service config will override any matching transcoding
// configuration in the proto.
//
// Example:
//
// http:
// rules:
// # Selects a gRPC method and applies HttpRule to it.
// - selector: example.v1.Messaging.GetMessage
// get: /v1/messages/{message_id}/{sub.subfield}
//
// ## Special notes
//
// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
// proto to JSON conversion must follow the [proto3
// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
//
// While the single segment variable follows the semantics of
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
// Expansion, the multi segment variable **does not** follow RFC 6570 Section
// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
// does not expand special characters like `?` and `#`, which would lead
// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
// for multi segment variables.
//
// The path variables **must not** refer to any repeated or mapped field,
// because client libraries are not capable of handling such variable expansion.
//
// The path variables **must not** capture the leading "/" character. The reason
// is that the most common use case "{var}" does not capture the leading "/"
// character. For consistency, all path variables must share the same behavior.
//
// Repeated message fields must not be mapped to URL query parameters, because
// no client library can support such complicated mapping.
//
// If an API needs to use a JSON array for request or response body, it can map
// the request or response body to a repeated field. However, some gRPC
// Transcoding implementations may not support this feature.
message HttpRule {
// Selects a method to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// Determines the URL pattern is matched by this rules. This pattern can be
// used with any of the {get|put|post|delete|patch} methods. A custom method
// can be defined using the 'custom' field.
oneof pattern {
// Maps to HTTP GET. Used for listing and getting information about
// resources.
string get = 2;
// Maps to HTTP PUT. Used for replacing a resource.
string put = 3;
// Maps to HTTP POST. Used for creating a resource or performing an action.
string post = 4;
// Maps to HTTP DELETE. Used for deleting a resource.
string delete = 5;
// Maps to HTTP PATCH. Used for updating a resource.
string patch = 6;
// The custom pattern is used for specifying an HTTP method that is not
// included in the `pattern` field, such as HEAD, or "*" to leave the
// HTTP method unspecified for this rule. The wild-card rule is useful
// for services that provide content to Web (HTML) clients.
CustomHttpPattern custom = 8;
}
// The name of the request field whose value is mapped to the HTTP request
// body, or `*` for mapping all request fields not captured by the path
// pattern to the HTTP body, or omitted for not having any HTTP request body.
//
// NOTE: the referred field must be present at the top-level of the request
// message type.
string body = 7;
// Optional. The name of the response field whose value is mapped to the HTTP
// response body. When omitted, the entire response message will be used
// as the HTTP response body.
//
// NOTE: The referred field must be present at the top-level of the response
// message type.
string response_body = 12;
// Additional HTTP bindings for the selector. Nested bindings must
// not contain an `additional_bindings` field themselves (that is,
// the nesting may only be one level deep).
repeated HttpRule additional_bindings = 11;
}
// A custom pattern is used for defining custom HTTP verb.
message CustomHttpPattern {
// The name of this custom HTTP verb.
string kind = 1;
// The path matched by this custom verb.
string path = 2;
}