apimodels

package
v1.2.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-or-later DMRHub - Run a DMR network server in a single binary Copyright (C) 2023-2026 Jacob McSwain

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

The source code is available at <https://github.com/USA-RedDragon/DMRHub>

SPDX-License-Identifier: AGPL-3.0-or-later DMRHub - Run a DMR network server in a single binary Copyright (C) 2023-2026 Jacob McSwain

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

The source code is available at <https://github.com/USA-RedDragon/DMRHub>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthLogin

type AuthLogin struct {
	Username string `json:"username"`
	Callsign string `json:"callsign"`
	Password string `json:"password" binding:"required"`
}

type ConfigResponse added in v1.2.8

type ConfigResponse struct {
	config.Config
	Secrets SecretStatus `json:"secrets"`
}

type NetCheckInResponse added in v1.2.36

type NetCheckInResponse struct {
	CallID     uint               `json:"call_id"`
	User       WSCallResponseUser `json:"user"`
	RepeaterID uint               `json:"repeater_id"`
	StartTime  time.Time          `json:"start_time"`
}

NetCheckInResponse represents a single check-in (call) during a net.

func NewNetCheckInResponseFromCall added in v1.2.36

func NewNetCheckInResponseFromCall(call *models.Call) NetCheckInResponse

NewNetCheckInResponseFromCall builds a NetCheckInResponse from a models.Call.

type NetPatch added in v1.2.36

type NetPatch struct {
	Showcase *bool `json:"showcase,omitempty"`
}

NetPatch is the request body for updating a net (admin only).

type NetResponse added in v1.2.36

type NetResponse struct {
	ID              uint                    `json:"id"`
	TalkgroupID     uint                    `json:"talkgroup_id"`
	Talkgroup       WSCallResponseTalkgroup `json:"talkgroup"`
	StartedByUser   WSCallResponseUser      `json:"started_by_user"`
	ScheduledNetID  *uint                   `json:"scheduled_net_id,omitempty"`
	StartTime       time.Time               `json:"start_time"`
	EndTime         *time.Time              `json:"end_time,omitempty"`
	DurationMinutes *uint                   `json:"duration_minutes,omitempty"`
	Description     string                  `json:"description"`
	Active          bool                    `json:"active"`
	Showcase        bool                    `json:"showcase"`
	CheckInCount    int                     `json:"check_in_count"`
}

NetResponse is the API response for a net session.

func NewNetResponseFromNet added in v1.2.36

func NewNetResponseFromNet(net *models.Net, checkInCount int) NetResponse

NewNetResponseFromNet converts a models.Net into a NetResponse.

type NetStartPost added in v1.2.36

type NetStartPost struct {
	TalkgroupID     uint   `json:"talkgroup_id" binding:"required"`
	Description     string `json:"description"`
	DurationMinutes *uint  `json:"duration_minutes,omitempty"`
}

NetStartPost is the request body for starting an ad-hoc net.

type POSTConfig added in v1.0.66

type POSTConfig struct {
	config.Config
	Secret       *string `json:"secret,omitempty"`
	PasswordSalt *string `json:"password-salt,omitempty"`
	HIBPAPIKey   *string `json:"hibp-api-key,omitempty"`
	SMTP         struct {
		config.SMTP
		Password *string `json:"password,omitempty"`
	}
	Database struct {
		config.Database
		Password *string `json:"password,omitempty"`
	}
	Redis struct {
		config.Redis
		Password *string `json:"password,omitempty"`
	}
}

func (POSTConfig) ToConfig added in v1.0.66

func (p POSTConfig) ToConfig(c *config.Config, fallback *config.Config)

type PeerPatch added in v1.2.36

type PeerPatch struct {
	IP      *string `json:"ip"`
	Port    *int    `json:"port"`
	Ingress *bool   `json:"ingress"`
	Egress  *bool   `json:"egress"`
}

type PeerPost added in v1.0.35

type PeerPost struct {
	ID      uint   `json:"id" binding:"required"`
	OwnerID uint   `json:"owner" binding:"required"`
	IP      string `json:"ip" binding:"required"`
	Port    int    `json:"port"`
	Ingress bool   `json:"ingress"`
	Egress  bool   `json:"egress"`
}

type PeerRulePost added in v1.2.36

type PeerRulePost struct {
	Direction    bool `json:"direction"`
	SubjectIDMin uint `json:"subject_id_min"`
	SubjectIDMax uint `json:"subject_id_max" binding:"required"`
}

type RepeaterPatch added in v1.2.22

type RepeaterPatch struct {
	SimplexRepeater *bool `json:"simplex_repeater"`
}

type RepeaterPost

type RepeaterPost struct {
	RadioID         uint   `json:"id" binding:"required"`
	Type            string `json:"type"`
	SimplexRepeater bool   `json:"simplex_repeater"`
}

type RepeaterTalkgroupsPost

type RepeaterTalkgroupsPost struct {
	TS1StaticTalkgroups []models.Talkgroup `json:"ts1_static_talkgroups"`
	TS2StaticTalkgroups []models.Talkgroup `json:"ts2_static_talkgroups"`
	TS1DynamicTalkgroup models.Talkgroup   `json:"ts1_dynamic_talkgroup"`
	TS2DynamicTalkgroup models.Talkgroup   `json:"ts2_dynamic_talkgroup"`
}

type ScheduledNetPatch added in v1.2.36

type ScheduledNetPatch struct {
	Name            *string `json:"name,omitempty"`
	Description     *string `json:"description,omitempty"`
	DayOfWeek       *int    `json:"day_of_week,omitempty"`
	TimeOfDay       *string `json:"time_of_day,omitempty"`
	Timezone        *string `json:"timezone,omitempty"`
	DurationMinutes *uint   `json:"duration_minutes,omitempty"`
	Enabled         *bool   `json:"enabled,omitempty"`
	Showcase        *bool   `json:"showcase,omitempty"`
}

ScheduledNetPatch is the request body for updating a scheduled net.

type ScheduledNetPost added in v1.2.36

type ScheduledNetPost struct {
	TalkgroupID     uint   `json:"talkgroup_id" binding:"required"`
	Name            string `json:"name" binding:"required"`
	Description     string `json:"description"`
	DayOfWeek       int    `json:"day_of_week" binding:"min=0,max=6"`
	TimeOfDay       string `json:"time_of_day" binding:"required"`
	Timezone        string `json:"timezone" binding:"required"`
	DurationMinutes *uint  `json:"duration_minutes,omitempty"`
	Enabled         *bool  `json:"enabled,omitempty"`
	Showcase        *bool  `json:"showcase,omitempty"`
}

ScheduledNetPost is the request body for creating a scheduled net.

type ScheduledNetResponse added in v1.2.36

type ScheduledNetResponse struct {
	ID              uint                    `json:"id"`
	TalkgroupID     uint                    `json:"talkgroup_id"`
	Talkgroup       WSCallResponseTalkgroup `json:"talkgroup"`
	CreatedByUser   WSCallResponseUser      `json:"created_by_user"`
	Name            string                  `json:"name"`
	Description     string                  `json:"description"`
	CronExpression  string                  `json:"cron_expression"`
	DayOfWeek       int                     `json:"day_of_week"`
	TimeOfDay       string                  `json:"time_of_day"`
	Timezone        string                  `json:"timezone"`
	DurationMinutes *uint                   `json:"duration_minutes,omitempty"`
	Enabled         bool                    `json:"enabled"`
	Showcase        bool                    `json:"showcase"`
	NextRun         *time.Time              `json:"next_run,omitempty"`
	CreatedAt       time.Time               `json:"created_at"`
}

ScheduledNetResponse is the API response for a scheduled net.

func NewScheduledNetResponseFromScheduledNet added in v1.2.36

func NewScheduledNetResponseFromScheduledNet(sn *models.ScheduledNet) ScheduledNetResponse

NewScheduledNetResponseFromScheduledNet converts a models.ScheduledNet into a ScheduledNetResponse.

type SecretStatus added in v1.2.8

type SecretStatus struct {
	SecretSet       bool `json:"secretSet"`
	PasswordSaltSet bool `json:"passwordSaltSet"`
	SMTPPasswordSet bool `json:"smtpPasswordSet"`
}

type TalkgroupAdminAction

type TalkgroupAdminAction struct {
	UserIDs []uint `json:"user_ids"`
}

type TalkgroupPatch

type TalkgroupPatch struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type TalkgroupPost

type TalkgroupPost struct {
	ID          uint   `json:"id" binding:"required"`
	Name        string `json:"name" binding:"required"`
	Description string `json:"description" binding:"required"`
}

type UserPatch

type UserPatch struct {
	Callsign string `json:"callsign"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type UserRegistration

type UserRegistration struct {
	DMRId    uint   `json:"id" binding:"required"`
	Callsign string `json:"callsign" binding:"required"`
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

func (*UserRegistration) IsValidUsername

func (r *UserRegistration) IsValidUsername() (bool, string)

type WSCallResponse added in v1.0.15

type WSCallResponse struct {
	ID            uint                    `json:"id"`
	User          WSCallResponseUser      `json:"user"`
	StartTime     time.Time               `json:"start_time"`
	Duration      time.Duration           `json:"duration"`
	Active        bool                    `json:"active"`
	TimeSlot      bool                    `json:"time_slot"`
	GroupCall     bool                    `json:"group_call"`
	RepeaterID    uint                    `json:"repeater_id"`
	IsToTalkgroup bool                    `json:"is_to_talkgroup"`
	ToTalkgroup   WSCallResponseTalkgroup `json:"to_talkgroup"`
	IsToUser      bool                    `json:"is_to_user"`
	ToUser        WSCallResponseUser      `json:"to_user"`
	IsToRepeater  bool                    `json:"is_to_repeater"`
	ToRepeater    WSCallResponseRepeater  `json:"to_repeater"`
	Loss          float32                 `json:"loss"`
	Jitter        float32                 `json:"jitter"`
	BER           float32                 `json:"ber"`
	RSSI          float32                 `json:"rssi"`
}

func NewWSCallResponseFromCall added in v1.2.27

func NewWSCallResponseFromCall(call *models.Call) WSCallResponse

NewWSCallResponseFromCall converts a models.Call into a WSCallResponse suitable for JSON serialisation over WebSocket or pubsub channels.

type WSCallResponseRepeater added in v1.0.15

type WSCallResponseRepeater struct {
	RadioID  uint   `json:"id"`
	Callsign string `json:"callsign"`
}

type WSCallResponseTalkgroup added in v1.0.15

type WSCallResponseTalkgroup struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type WSCallResponseUser added in v1.0.15

type WSCallResponseUser struct {
	ID       uint   `json:"id"`
	Callsign string `json:"callsign"`
}

type WSNetCheckInResponse added in v1.2.36

type WSNetCheckInResponse struct {
	NetID     uint               `json:"net_id"`
	CallID    uint               `json:"call_id"`
	User      WSCallResponseUser `json:"user"`
	StartTime time.Time          `json:"start_time"`
	Duration  time.Duration      `json:"duration"`
}

WSNetCheckInResponse is sent over WebSocket when a check-in occurs during an active net.

type WSNetEventResponse added in v1.2.36

type WSNetEventResponse struct {
	NetID       uint                    `json:"net_id"`
	TalkgroupID uint                    `json:"talkgroup_id"`
	Talkgroup   WSCallResponseTalkgroup `json:"talkgroup"`
	Event       string                  `json:"event"` // "started" or "stopped"
	Active      bool                    `json:"active"`
	StartTime   time.Time               `json:"start_time"`
	EndTime     *time.Time              `json:"end_time,omitempty"`
}

WSNetEventResponse is sent over WebSocket when a net starts or stops.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL