chirpstack_api 3.8.1

ChirpStack Protobuf / gRPC API definitions.
Documentation
syntax = "proto3";

package api;

option go_package = "github.com/brocaar/chirpstack-api/go/v3/as/external/api";
option java_package = "io.chirpstack.api.as.external.api";

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";


// UserService is the service managing the user access.
service UserService {
	// Get user list.
	rpc List(ListUserRequest) returns (ListUserResponse) {
		option(google.api.http) = {
			get: "/api/users"
		};
	}

	// Get data for a particular user.
	rpc Get(GetUserRequest) returns (GetUserResponse) {
		option(google.api.http) = {
			get: "/api/users/{id}"
		};
	}

	// Create a new user.
	rpc Create(CreateUserRequest) returns (CreateUserResponse) {
		option(google.api.http) = {
			post: "/api/users"
			body: "*"
		};
	}

	// Update an existing user.
	rpc Update(UpdateUserRequest) returns (google.protobuf.Empty) {
		option(google.api.http) = {
			put: "/api/users/{user.id}"
			body: "*"
		};
	}

	// Delete a user.
	rpc Delete(DeleteUserRequest) returns (google.protobuf.Empty) {
		option(google.api.http) = {
			delete: "/api/users/{id}"
		};
	}

	// UpdatePassword updates a password.
	rpc UpdatePassword(UpdateUserPasswordRequest) returns (google.protobuf.Empty) {
		option(google.api.http) = {
			put: "/api/users/{user_id}/password"
			body: "*"
		};
	}

}

message User {
	// User ID.
	// Will be set automatically on create.
	int64 id = 1;

	// The session timeout, in minutes.
	int32 session_ttl = 3 [json_name = "sessionTTL"];

	// 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.
	// Will be set automatically on create.
	int64 id = 1;

	// Email of the user.
	string email = 2;

	// The session timeout, in minutes.
	int32 session_ttl = 3 [json_name = "sessionTTL"];

	// 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;

	// Created at timestamp.
	google.protobuf.Timestamp created_at = 8;

	// Last update timestamp.
	google.protobuf.Timestamp updated_at = 9;
}

message UserOrganization {
	// Organization ID.
	int64 organization_id = 1 [json_name = "organizationID"];

	// User is admin within the context of the organization.
    // 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 of the user.
	string password = 2;

	// Add the user to the following organizations.
	repeated UserOrganization organizations = 3;
}

message CreateUserResponse {
	// User ID.
	int64 id = 1;
}

message GetUserRequest {
	// User ID.
	int64 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 to update.
	User user = 1;
}

message DeleteUserRequest {
	// User ID.
	int64 id = 1;
}

message ListUserRequest {
	// Max number of user to return in the result-set.
	int64 limit = 1;

	// Offset in the result-set (for pagination).
	int64 offset = 2;
}

message ListUserResponse {
	// Total number of users.
	int64 total_count = 1;

	// Result-set.
	repeated UserListItem result = 2;
}

message UpdateUserPasswordRequest {
	// User ID.
	int64 user_id = 1;

	// New pasword.
	string password = 2;
}