Skip to content

hero.heromodels #

http based RPC server


curl -s http://localhost:9933/ \
  -H 'Content-Type: application/json'

rpc discovery:

curl -s http://localhost:9933/ \
  -H 'Content-Type: application/json'

unix socket based RPC server

##echo '{"jsonrpc":"2.0","method":"rpc.discover","params":[],"id":1}' | nc -U /tmp/heromodels

##
nc -U /tmp/heromodels

##
{'jsonrpc':'2.0','method':'message_set','params':{'message':'Hello world!','parent':0,'author':42},'id':1}

needs to be on one line for openrpc to work

see lib/hero/heromodels/rpc/openrpc.json for the full openrpc specification

fn calendar_event_handle #

fn calendar_event_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn calendar_handle #

fn calendar_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn chat_group_handle #

fn chat_group_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn chat_message_handle #

fn chat_message_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn contact_handle #

fn contact_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn get #

fn get(name string) !&ModelsFactory

fn group_api_handler #

fn group_api_handler(rpcid int, servercontext map[string]string, actorname string, methodname string, params string) !jsonrpc.Response

fn group_handle #

fn group_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

CUSTOM FEATURES FOR GROUP

fn message_handle #

fn message_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn new #

fn new(args NewArgs) !&ModelsFactory

fn new_address #

fn new_address(args AddressArg) Address

Helper function to create a new address

fn new_coordinates #

fn new_coordinates(args CoordinatesArg) Coordinates

Helper function to create new coordinates

fn planning_handle #

fn planning_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn profile_handle #

fn profile_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn project_handle #

fn project_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn project_issue_handle #

fn project_issue_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn registration_desk_handle #

fn registration_desk_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn server_start #

fn server_start(args ServerArgs) !

fn tags_handle #

fn tags_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

fn user_handle #

fn user_handle(mut f ModelsFactory, rpcid int, servercontext map[string]string, userref UserRef, method string, params string) !Response

type Tags #

type Tags = db.Tags

Tags represents a collection of tag names with a unique ID This is the same as db.Tags but in the heromodels context

fn (Tags) type_name #

fn (self Tags) type_name() string

fn (Tags) example #

fn (self Tags) example(methodname string) (string, string)

return example rpc call and result for each methodname

enum AttendanceStatus #

enum AttendanceStatus {
	invited
	accepted
	declined
	tentative
}

enum ChatType #

enum ChatType {
	public_channel
	private_channel
	direct_message
	group_message
}

enum ContactStatus #

enum ContactStatus {
	active
	inactive
}

enum EventLocationCat #

enum EventLocationCat {
	online
	physical
	hybrid
}

enum EventPriority #

enum EventPriority {
	low
	normal
	urgent
}

enum EventStatus #

enum EventStatus {
	draft
	published
	cancelled
	completed
}

enum GroupRole #

enum GroupRole {
	reader
	writer
	admin
	owner
}

enum IssuePriority #

enum IssuePriority {
	lowest
	low
	medium
	high
	highest
	critical
}

enum IssueStatus #

enum IssueStatus {
	open
	in_progress
	blocked
	review
	testing
	done
	closed
}

enum IssueType #

enum IssueType {
	task
	story
	bug
	question
	epic
	subtask
}

enum LocationType #

enum LocationType {
	home
	work
	business
	delivery
	billing
	shipping
	other
}

LocationType represents different types of locations

enum MessageLinkType #

enum MessageLinkType {
	reply
	reference
	forward
	quote
}

enum MessageStatus #

enum MessageStatus {
	sent
	delivered
	read
	failed
	deleted
}

enum MessageType #

enum MessageType {
	text
	image
	file
	voice
	video
	system
	announcement
}

enum ProjectStatus #

enum ProjectStatus {
	planning
	active
	on_hold
	completed
	cancelled
}

enum UserStatus #

enum UserStatus {
	active
	inactive
	suspended
	pending
}

struct Address #

@[heap]
struct Address {
pub mut:
	street      string
	city        string
	state       string // Optional state/province
	postal_code string
	country     string
	company     string // Optional company name
}

Address represents a physical address

fn (Address) dump #

fn (self Address) dump(mut e encoder.Encoder) !

struct AddressArg #

@[params]
struct AddressArg {
pub mut:
	street      string
	city        string
	state       string
	postal_code string
	country     string
	company     string
}

struct Attendee #

struct Attendee {
pub mut:
	user_id             u32
	status_latest       AttendanceStatus
	attendance_required bool
	admin               bool // if set can manage the main elements of the event = description, can accept invitee...
	organizer           bool // if set means others can ask for support, doesn't mean is admin
	log                 []AttendeeLog
	location            string // optional if user wants to select a location
}

struct AttendeeLog #

struct AttendeeLog {
pub mut:
	timestamp u64
	status    AttendanceStatus
	remark    string
}

struct Calendar #

@[heap]
struct Calendar {
	db.Base
pub mut:
	events    []u32  // IDs of calendar events
	color     string // Hex color code
	timezone  string
	is_public bool
}

Calendar represents a collection of events

fn (Calendar) type_name #

fn (self Calendar) type_name() string

fn (Calendar) description #

fn (self Calendar) description(methodname string) string

return example rpc call and result for each methodname

fn (Calendar) example #

fn (self Calendar) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Calendar) dump #

fn (self Calendar) dump(mut e encoder.Encoder) !

struct CalendarArg #

@[params]
struct CalendarArg {
pub mut:
	id             u32
	name           string
	description    string
	color          string
	timezone       string
	is_public      bool
	events         []u32
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct CalendarEvent #

@[heap]
struct CalendarEvent {
	db.Base
pub mut:
	title              string
	start_time         i64   // Unix timestamp
	end_time           i64   // Unix timestamp
	registration_desks []u32 // link to registration mechanism, is where we track invitees, are not attendee unless accepted
	attendees          []Attendee
	docs               []EventDoc // link to docs
	calendar_id        u32        // Associated calendar
	status             EventStatus
	is_all_day         bool
	reminder_mins      []int  // Minutes before event for reminders
	color              string // Hex color code
	timezone           string
	priority           EventPriority
	public             bool
	locations          []EventLocation
	is_template        bool // not to be shown as real event, serves as placeholder e.g. for planning
}

CalendarEvent represents a single event in a calendar

fn (CalendarEvent) type_name #

fn (self CalendarEvent) type_name() string

fn (CalendarEvent) description #

fn (self CalendarEvent) description(methodname string) string

return example rpc call and result for each methodname

fn (CalendarEvent) example #

fn (self CalendarEvent) example(methodname string) (string, string)

return example rpc call and result for each methodname, so example for call and the result

fn (CalendarEvent) dump #

fn (self CalendarEvent) dump(mut e encoder.Encoder) !

struct CalendarEventArg #

@[params]
struct CalendarEventArg {
pub mut:
	id             u32
	name           string
	description    string
	title          string
	start_time     string // use ourtime module to go from string to epoch
	end_time       string // use ourtime module to go from string to epoch
	attendees      []u32  // IDs of user groups
	docs           []u32  // IDs of linked files or dirs
	calendar_id    u32    // Associated calendar
	status         EventStatus
	is_all_day     bool
	reminder_mins  []int  // Minutes before event for reminders
	color          string // Hex color code
	timezone       string
	priority       EventPriority // Added missing priority field
	is_template    bool          // Added missing is_template field
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct CalendarEventListArg #

@[params]
struct CalendarEventListArg {
pub mut:
	calendar_id u32
	status      EventStatus
	public      bool
	limit       int = 100 // Default limit is 100
}

struct ChatGroup #

@[heap]
struct ChatGroup {
	db.Base
pub mut:
	chat_type     ChatType
	last_activity i64
	is_archived   bool
	group_id      u32 // group linked to this chat group
}

ChatGroup represents a chat channel or conversation

fn (ChatGroup) type_name #

fn (self ChatGroup) type_name() string

fn (ChatGroup) description #

fn (self ChatGroup) description(methodname string) string

return example rpc call and result for each methodname

fn (ChatGroup) example #

fn (self ChatGroup) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (ChatGroup) dump #

fn (self ChatGroup) dump(mut e encoder.Encoder) !

struct ChatGroupArg #

@[params]
struct ChatGroupArg {
pub mut:
	id             u32
	name           string
	description    string
	chat_type      ChatType
	last_activity  i64
	is_archived    bool
	group_id       u32
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct ChatGroupListArg #

@[params]
struct ChatGroupListArg {
pub mut:
	chat_type   ChatType
	is_archived bool
	limit       int = 100 // Default limit is 100
}

struct ChatMessage #

@[heap]
struct ChatMessage {
	db.Base
pub mut:
	content         string
	chat_group_id   u32           // Associated chat group
	sender_id       u32           // User ID of sender
	parent_messages []MessageLink // Referenced/replied messages
	fs_files        []u32         // IDs of linked files
	message_type    MessageType
	status          MessageStatus
	reactions       []MessageReaction
	mentions        []u32 // User IDs mentioned in message
}

ChatMessage represents a message in a chat group

fn (ChatMessage) type_name #

fn (self ChatMessage) type_name() string

fn (ChatMessage) description #

fn (self ChatMessage) description(methodname string) string

return example rpc call and result for each methodname

fn (ChatMessage) example #

fn (self ChatMessage) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (ChatMessage) dump #

fn (self ChatMessage) dump(mut e encoder.Encoder) !

struct ChatMessageArg #

@[params]
struct ChatMessageArg {
pub mut:
	id              u32
	name            string
	description     string
	content         string
	chat_group_id   u32
	sender_id       u32
	parent_messages []MessageLink
	fs_files        []u32
	message_type    MessageType
	status          MessageStatus
	reactions       []MessageReaction
	mentions        []u32
	securitypolicy  u32
	tags            []string
	messages        []db.MessageArg
}

struct ChatMessageListArg #

@[params]
struct ChatMessageListArg {
pub mut:
	chat_group_id u32
	message_type  MessageType
	status        MessageStatus
	limit         int = 100 // Default limit is 100
}

struct Contact #

@[heap]
struct Contact {
	db.Base
pub mut:
	emails      []string
	user_id     u32 // id as is set in ledger, if 0 then we don't know
	phones      []string
	addresses   []string
	avatar_url  string
	bio         string
	timezone    string
	status      ContactStatus
	profile_ids []u32
}

Contact represents a person in the system

fn (Contact) type_name #

fn (self Contact) type_name() string

fn (Contact) description #

fn (self Contact) description(methodname string) string

return example rpc call and result for each methodname

fn (Contact) example #

fn (self Contact) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Contact) dump #

fn (self Contact) dump(mut e encoder.Encoder) !

struct ContactArg #

@[params]
struct ContactArg {
pub mut:
	id             u32
	name           string @[required]
	description    string
	emails         []string
	phones         []string
	addresses      []string
	avatar_url     string
	bio            string
	timezone       string
	status         ContactStatus
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct ContactListArg #

@[params]
struct ContactListArg {
pub mut:
	status ContactStatus
	limit  int = 100 // Default limit is 100
}

struct Coordinates #

@[heap]
struct Coordinates {
pub mut:
	latitude  f64
	longitude f64
	altitude  f64 // Optional altitude in meters
}

Coordinates represents GPS coordinates

fn (Coordinates) dump #

fn (self Coordinates) dump(mut e encoder.Encoder) !

fn (Coordinates) to_string #

fn (self Coordinates) to_string() string

Helper method to format coordinates as string

fn (Coordinates) is_valid #

fn (self Coordinates) is_valid() bool

Helper method to check if coordinates are set

struct CoordinatesArg #

@[params]
struct CoordinatesArg {
pub mut:
	latitude  f64
	longitude f64
	altitude  f64
}

struct DBCalendar #

struct DBCalendar {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBCalendar) new #

fn (mut self DBCalendar) new(args CalendarArg) !Calendar

get new calendar, not from the DB

fn (DBCalendar) set #

fn (mut self DBCalendar) set(o Calendar) !Calendar

fn (DBCalendar) delete #

fn (mut self DBCalendar) delete(id u32) !bool

fn (DBCalendar) exist #

fn (mut self DBCalendar) exist(id u32) !bool

fn (DBCalendar) get #

fn (mut self DBCalendar) get(id u32) !Calendar

fn (DBCalendar) list #

fn (mut self DBCalendar) list() ![]Calendar

struct DBCalendarEvent #

struct DBCalendarEvent {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBCalendarEvent) load #

fn (mut self DBCalendarEvent) load(mut o CalendarEvent, mut e encoder.Decoder) !

fn (DBCalendarEvent) new #

fn (mut self DBCalendarEvent) new(args CalendarEventArg) !CalendarEvent

get new calendar event, not from the DB

fn (DBCalendarEvent) set #

fn (mut self DBCalendarEvent) set(o CalendarEvent) !CalendarEvent

fn (DBCalendarEvent) delete #

fn (mut self DBCalendarEvent) delete(id u32) !bool

fn (DBCalendarEvent) exist #

fn (mut self DBCalendarEvent) exist(id u32) !bool

fn (DBCalendarEvent) get #

fn (mut self DBCalendarEvent) get(id u32) !CalendarEvent

fn (DBCalendarEvent) list #

fn (mut self DBCalendarEvent) list(args CalendarEventListArg) ![]CalendarEvent

struct DBChatGroup #

struct DBChatGroup {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBChatGroup) load #

fn (mut self DBChatGroup) load(mut o ChatGroup, mut e encoder.Decoder) !

fn (DBChatGroup) new #

fn (mut self DBChatGroup) new(args ChatGroupArg) !ChatGroup

get new chat group, not from the DB

fn (DBChatGroup) set #

fn (mut self DBChatGroup) set(o ChatGroup) !ChatGroup

fn (DBChatGroup) delete #

fn (mut self DBChatGroup) delete(id u32) !bool

fn (DBChatGroup) exist #

fn (mut self DBChatGroup) exist(id u32) !bool

fn (DBChatGroup) get #

fn (mut self DBChatGroup) get(id u32) !ChatGroup

fn (DBChatGroup) list #

fn (mut self DBChatGroup) list() ![]ChatGroup

struct DBChatMessage #

struct DBChatMessage {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBChatMessage) load #

fn (mut self DBChatMessage) load(mut o ChatMessage, mut e encoder.Decoder) !

fn (DBChatMessage) new #

fn (mut self DBChatMessage) new(args ChatMessageArg) !ChatMessage

get new chat message, not from the DB

fn (DBChatMessage) set #

fn (mut self DBChatMessage) set(o ChatMessage) !ChatMessage

fn (DBChatMessage) delete #

fn (mut self DBChatMessage) delete(id u32) !bool

fn (DBChatMessage) exist #

fn (mut self DBChatMessage) exist(id u32) !bool

fn (DBChatMessage) get #

fn (mut self DBChatMessage) get(id u32) !ChatMessage

fn (DBChatMessage) list #

fn (mut self DBChatMessage) list(args ChatMessageListArg) ![]ChatMessage

struct DBContact #

struct DBContact {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBContact) new #

fn (mut self DBContact) new(args ContactArg) !Contact

get new contact, not from the DB

fn (DBContact) set #

fn (mut self DBContact) set(o Contact) !Contact

fn (DBContact) delete #

fn (mut self DBContact) delete(id u32) !bool

fn (DBContact) exist #

fn (mut self DBContact) exist(id u32) !bool

fn (DBContact) get #

fn (mut self DBContact) get(id u32) !Contact

fn (DBContact) list #

fn (mut self DBContact) list(args ContactListArg) ![]Contact

struct DBGroup #

struct DBGroup {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBGroup) new #

fn (mut self DBGroup) new(args GroupArg) !Group

get new group, not from the DB

fn (DBGroup) set #

fn (mut self DBGroup) set(o_ Group) !Group

fn (DBGroup) delete #

fn (mut self DBGroup) delete(id u32) !bool

fn (DBGroup) exist #

fn (mut self DBGroup) exist(id u32) !bool

fn (DBGroup) get #

fn (mut self DBGroup) get(id u32) !Group

fn (DBGroup) list #

fn (mut self DBGroup) list(args GroupListArg) ![]Group

struct DBLocation #

struct DBLocation {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBLocation) new #

fn (mut self DBLocation) new(args LocationArg) !Location

get new location, not from the DB

fn (DBLocation) set #

fn (mut self DBLocation) set(o Location) !Location

fn (DBLocation) delete #

fn (mut self DBLocation) delete(id u32) !

fn (DBLocation) exist #

fn (mut self DBLocation) exist(id u32) !bool

fn (DBLocation) get #

fn (mut self DBLocation) get(id u32) !Location

fn (DBLocation) list #

fn (mut self DBLocation) list() ![]Location

struct DBMessages #

struct DBMessages {
pub mut:
	db &db.DB @[skip; str: skip]
}

////////TO BE GENERATED BY AI//////////////////////////////// /BASIC CRUD FUNCTIONS

fn (DBMessages) load #

fn (mut self DBMessages) load(mut o Message, mut e encoder.Decoder) !

fn (DBMessages) new #

fn (mut self DBMessages) new(args MessageArg) !Message

get new message, not from the DB

fn (DBMessages) set #

fn (mut self DBMessages) set(o Message) !Message

fn (DBMessages) delete #

fn (mut self DBMessages) delete(id u32) !bool

fn (DBMessages) exist #

fn (mut self DBMessages) exist(id u32) !bool

fn (DBMessages) get #

fn (mut self DBMessages) get(id u32) !Message

fn (DBMessages) list #

fn (mut self DBMessages) list(args MessageListArg) ![]Message

struct DBPlanning #

struct DBPlanning {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBPlanning) new #

fn (mut self DBPlanning) new(args PlanningArg) !Planning

get new calendar, not from the DB

fn (DBPlanning) set #

fn (mut self DBPlanning) set(o Planning) !Planning

fn (DBPlanning) delete #

fn (mut self DBPlanning) delete(id u32) !bool

fn (DBPlanning) exist #

fn (mut self DBPlanning) exist(id u32) !bool

fn (DBPlanning) get #

fn (mut self DBPlanning) get(id u32) !Planning

fn (DBPlanning) list #

fn (mut self DBPlanning) list(args PlanningListArg) ![]Planning

struct DBProfile #

struct DBProfile {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBProfile) new #

fn (mut self DBProfile) new(args ProfileArg) !Profile

get new profile, not from the DB

fn (DBProfile) set #

fn (mut self DBProfile) set(o Profile) !Profile

fn (DBProfile) delete #

fn (mut self DBProfile) delete(id u32) !bool

fn (DBProfile) exist #

fn (mut self DBProfile) exist(id u32) !bool

fn (DBProfile) get #

fn (mut self DBProfile) get(id u32) !Profile

fn (DBProfile) list #

fn (mut self DBProfile) list() ![]Profile

struct DBProject #

struct DBProject {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBProject) load #

fn (mut self DBProject) load(mut o Project, mut e encoder.Decoder) !

fn (DBProject) new #

fn (mut self DBProject) new(args ProjectArg) !Project

get new project, not from the DB

fn (DBProject) set #

fn (mut self DBProject) set(o Project) !Project

fn (DBProject) delete #

fn (mut self DBProject) delete(id u32) !bool

fn (DBProject) exist #

fn (mut self DBProject) exist(id u32) !bool

fn (DBProject) get #

fn (mut self DBProject) get(id u32) !Project

fn (DBProject) list #

fn (mut self DBProject) list(args ProjectListArg) ![]Project

struct DBProjectIssue #

struct DBProjectIssue {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBProjectIssue) load #

fn (mut self DBProjectIssue) load(mut o ProjectIssue, mut e encoder.Decoder) !

fn (DBProjectIssue) new #

fn (mut self DBProjectIssue) new(args ProjectIssueArg) !ProjectIssue

get new project issue, not from the DB

fn (DBProjectIssue) set #

fn (mut self DBProjectIssue) set(o ProjectIssue) !ProjectIssue

fn (DBProjectIssue) delete #

fn (mut self DBProjectIssue) delete(id u32) !bool

fn (DBProjectIssue) exist #

fn (mut self DBProjectIssue) exist(id u32) !bool

fn (DBProjectIssue) get #

fn (mut self DBProjectIssue) get(id u32) !ProjectIssue

fn (DBProjectIssue) list #

fn (mut self DBProjectIssue) list(args ProjectIssueListArg) ![]ProjectIssue

struct DBRegistrationDesk #

struct DBRegistrationDesk {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBRegistrationDesk) load #

fn (mut self DBRegistrationDesk) load(mut o RegistrationDesk, mut e encoder.Decoder) !

fn (DBRegistrationDesk) new #

fn (mut self DBRegistrationDesk) new(args RegistrationDeskArg) !RegistrationDesk

fn (DBRegistrationDesk) set #

fn (mut self DBRegistrationDesk) set(o RegistrationDesk) !RegistrationDesk

fn (DBRegistrationDesk) delete #

fn (mut self DBRegistrationDesk) delete(id u32) !bool

fn (DBRegistrationDesk) exist #

fn (mut self DBRegistrationDesk) exist(id u32) !bool

fn (DBRegistrationDesk) get #

fn (mut self DBRegistrationDesk) get(id u32) !RegistrationDesk

fn (DBRegistrationDesk) list #

fn (mut self DBRegistrationDesk) list(args RegistrationDeskListArg) ![]RegistrationDesk

struct DBTags #

struct DBTags {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBTags) get #

fn (mut self DBTags) get(id u32) !Tags

fn (DBTags) exist #

fn (mut self DBTags) exist(id u32) !bool

fn (DBTags) delete #

fn (mut self DBTags) delete(id u32) !bool

struct DBUser #

struct DBUser {
pub mut:
	db &db.DB @[skip; str: skip]
}

fn (DBUser) new #

fn (mut self DBUser) new(args UserArg) !User

get new user, not from the DB

fn (DBUser) set #

fn (mut self DBUser) set(o User) !User

fn (DBUser) delete #

fn (mut self DBUser) delete(id u32) !bool

fn (DBUser) exist #

fn (mut self DBUser) exist(id u32) !bool

fn (DBUser) get #

fn (mut self DBUser) get(id u32) !User

fn (DBUser) list #

fn (mut self DBUser) list(args UserListArg) ![]User

struct Education #

struct Education {
pub:
	school         string
	degree         string
	field_of_study string
	start_date     u64
	end_date       u64
	description    string
}

struct EventDoc #

struct EventDoc {
pub mut:
	fs_item u32
	cat     string // can be freely chosen, will always be made lowercase e.g. agenda
	public  bool   // everyone can see the file, otherwise only the organizers, attendees
}

struct EventLocation #

struct EventLocation {
pub mut:
	name        string
	description string
	cat         EventLocationCat
	docs        []EventDoc
}

struct Experience #

struct Experience {
pub:
	title       string
	company     string
	location    string
	start_date  u64
	end_date    u64
	current     bool
	description string
}

struct Group #

@[heap]
struct Group {
	db.Base
pub mut:
	members      []GroupMember
	subgroups    []u32 // IDs of child groups
	parent_group u32   // ID of parent group
	is_public    bool
}

Group represents a collection of users with roles and permissions

fn (Group) type_name #

fn (self Group) type_name() string

fn (Group) description #

fn (self Group) description(methodname string) string

return example rpc call and result for each methodname

fn (Group) example #

fn (self Group) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Group) dump #

fn (self Group) dump(mut e encoder.Encoder) !

fn (Group) load #

fn (mut o Group) load(mut e encoder.Decoder) !

fn (Group) add_member #

fn (mut self Group) add_member(user_id u32, role GroupRole)

struct GroupArg #

@[params]
struct GroupArg {
pub mut:
	id             u32
	name           string
	description    string
	members        []GroupMember
	subgroups      []u32
	parent_group   u32
	is_public      bool
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct GroupListArg #

@[params]
struct GroupListArg {
pub mut:
	is_public    bool
	parent_group u32
	limit        int = 100 // Default limit is 100
}

struct GroupMember #

struct GroupMember {
pub mut:
	user_id   u32 // are users as defined in ledger, each user needs to exist in the generic ledger
	role      GroupRole
	joined_at i64
}

struct Location #

@[heap]
struct Location {
	db.Base
pub mut:
	addresses     []Address   // Multiple addresses (home, work, etc.)
	coordinates   Coordinates // GPS coordinates
	timezone      string
	is_verified   bool
	location_type LocationType
}

Location represents a location entity that can contain multiple addresses

fn (Location) type_name #

fn (self Location) type_name() string

fn (Location) description #

fn (self Location) description(methodname string) string

return example rpc call and result for each methodname

fn (Location) example #

fn (self Location) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Location) dump #

fn (self Location) dump(mut e encoder.Encoder) !

fn (Location) add_address #

fn (mut self Location) add_address(address Address)

Helper method to add an address to a location

fn (Location) primary_address #

fn (self Location) primary_address() ?Address

Helper method to get the primary address (first address)

struct LocationArg #

@[params]
struct LocationArg {
pub mut:
	name          string
	description   string
	addresses     []Address
	coordinates   Coordinates
	timezone      string
	is_verified   bool
	location_type LocationType
}

struct Message #

@[heap]
struct Message {
	db.Base
pub mut:
	// id           u32
	subject  string
	message  string
	parent   u32   // id of parent message if any, 0 means none
	author   u32   // links to user
	to       []u32 // if message/message has been sent to someone specifically
	cc       []u32 // like to but then for cc
	send_log []SendLog
}

fn (Message) type_name #

fn (self Message) type_name() string

fn (Message) description #

fn (self Message) description(methodname string) string

return example rpc call and result for each methodname

fn (Message) example #

fn (self Message) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Message) dump #

fn (self Message) dump(mut e encoder.Encoder) !

struct MessageArg #

@[params]
struct MessageArg {
pub mut:
	id             u32
	subject        string
	message        string @[required]
	parent         u32
	author         u32
	to             []u32
	cc             []u32
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct MessageListArg #

@[params]
struct MessageListArg {
pub mut:
	parent u32
	author u32
	limit  int = 100 // Default limit is 100
}

struct MessageReaction #

struct MessageReaction {
pub mut:
	user_id   u32
	emoji     string
	timestamp i64
}

struct Milestone #

struct Milestone {
pub mut:
	name        string // allways to to_lower and trim_space
	description string
	due_date    i64
	completed   bool
	issues      []u32 // IDs of issues in this milestone
}

struct ModelsFactory #

@[heap]
struct ModelsFactory {
pub mut:
	calendar          DBCalendar
	calendar_event    DBCalendarEvent
	group             DBGroup
	user              DBUser
	project           DBProject
	project_issue     DBProjectIssue
	chat_group        DBChatGroup
	chat_message      DBChatMessage
	contact           DBContact
	profile           DBProfile
	planning          DBPlanning
	registration_desk DBRegistrationDesk
	messages          DBMessages
	tags              DBTags
	rpc_handler       &Handler
}

struct NewArgs #

@[params]
struct NewArgs {
pub mut:
	name  string = 'default'
	reset bool
	redis ?&redisclient.Redis
}

struct Planning #

@[heap]
struct Planning {
	db.Base
pub mut:
	color                string // Hex color code
	timezone             string
	is_public            bool
	calendar_template_id u32                      // link to calendarid which is relevant for this planning, this calendar event will be a template
	registration_desk_id u32                      // to arrange how we let people register, and track registrations
	autoschedule_rules   []PlanningRecurrenceRule // will automatically schedule, uses calendar_id as template
	invite_rules         []PlanningRecurrenceRule // times in which people can invite themselves
	attendees_required   []u32
	attendees_optional   []u32 // if we want to specify upfront
}

Planning, how do people or teams want to plan their time acls can be used to define who can change this planning

fn (Planning) type_name #

fn (self Planning) type_name() string

fn (Planning) description #

fn (self Planning) description(methodname string) string

return example rpc call and result for each methodname

fn (Planning) example #

fn (self Planning) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Planning) dump #

fn (self Planning) dump(mut e encoder.Encoder) !

struct PlanningArg #

@[params]
struct PlanningArg {
pub mut:
	id                   u32
	name                 string
	description          string
	color                string
	timezone             string
	is_public            bool
	calendar_template_id u32
	registration_desk_id u32
	autoschedule_rules   []PlanningRecurrenceRule
	invite_rules         []PlanningRecurrenceRule
	attendees_required   []u32
	attendees_optional   []u32
	securitypolicy       u32
	tags                 []string
	messages             []db.MessageArg
}

struct PlanningListArg #

@[params]
struct PlanningListArg {
pub mut:
	is_public            bool
	calendar_template_id u32
	registration_desk_id u32
	limit                int = 100 // Default limit is 100
}

struct PlanningRecurrenceRule #

struct PlanningRecurrenceRule {
pub mut:
	until       u64  // End date (Unix timestamp)
	by_weekday  []u8 // Days of week (0=Sunday)
	by_monthday []u8 // Days of month
	hour_from   u8   // Start hour (0-23)
	hour_to     u8   // End hour (0-23)
	duration    int  // Duration in minutes
	priority    u8   // Priority level (0-10)
}

fn (PlanningRecurrenceRule) dump #

fn (self PlanningRecurrenceRule) dump(mut e encoder.Encoder) !

fn (PlanningRecurrenceRule) load #

fn (mut self PlanningRecurrenceRule) load(mut e encoder.Decoder) !

struct Profile #

@[heap]
struct Profile {
	db.Base
pub mut:
	user_id  u32 // a user can have more than one profile
	summary  string
	headline string
	location string
	industry string
	// urls to profile pictures
	picture_url          string
	background_image_url string
	// contact info
	email   string
	phone   string
	website string
	// experience
	experience []Experience
	education  []Education
	skills     []string
	languages  []string
}

fn (Profile) type_name #

fn (self Profile) type_name() string

fn (Profile) description #

fn (self Profile) description(methodname string) string

return example rpc call and result for each methodname

fn (Profile) example #

fn (self Profile) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Profile) dump #

fn (self Profile) dump(mut e encoder.Encoder) !

struct ProfileArg #

@[params]
struct ProfileArg {
pub mut:
	name                 string
	description          string
	user_id              u32 // a user can have more than one profile
	summary              string
	headline             string
	location             string
	industry             string
	picture_url          string
	background_image_url string
	email                string
	phone                string
	website              string
	experience           []Experience
	education            []Education
	skills               []string
	languages            []string
	id                   u32
	securitypolicy       u32
	tags                 []string
	messages             []db.MessageArg
}

struct Project #

@[heap]
struct Project {
	db.Base
pub mut:
	swimlanes  []Swimlane
	milestones []Milestone
	fs_files   []u32 // IDs of linked files or dirs
	status     ProjectStatus
	start_date i64
	end_date   i64
}

Project represents a collection of issues organized in swimlanes

fn (Project) type_name #

fn (self Project) type_name() string

fn (Project) description #

fn (self Project) description(methodname string) string

return description for each methodname

fn (Project) example #

fn (self Project) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (Project) dump #

fn (self Project) dump(mut e encoder.Encoder) !

struct ProjectArg #

@[params]
struct ProjectArg {
pub mut:
	id             u32
	name           string
	description    string
	swimlanes      []Swimlane
	milestones     []Milestone
	issues         []string
	fs_files       []u32
	status         ProjectStatus
	start_date     string // Use ourtime module to convert to epoch
	end_date       string // Use ourtime module to convert to epoch
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct ProjectIssue #

@[heap]
struct ProjectIssue {
	db.Base
pub mut:
	title      string
	project_id u32 // Associated project
	issue_type IssueType
	priority   IssuePriority
	status     IssueStatus
	swimlane   string // Current swimlane, is string corresponds to name, need to be to_lower and trim_space
	assignees  []u32  // User IDs
	reporter   u32    // User ID who created the issue
	milestone  string // Associated milestone, is string corresponds to name, need to be to_lower and trim_space
	deadline   i64    // Unix timestamp
	estimate   int    // Story points or hours
	fs_files   []u32  // IDs of linked files
	parent_id  u32    // Parent issue ID (for sub-tasks)
	children   []u32  // Child issue IDs
}

ProjectIssue represents a task, story, bug, or question in a project

fn (ProjectIssue) type_name #

fn (self ProjectIssue) type_name() string

fn (ProjectIssue) description #

fn (self ProjectIssue) description(methodname string) string

return example rpc call and result for each methodname

fn (ProjectIssue) example #

fn (self ProjectIssue) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (ProjectIssue) dump #

fn (self ProjectIssue) dump(mut e encoder.Encoder) !

struct ProjectIssueArg #

@[params]
struct ProjectIssueArg {
pub mut:
	id             u32
	name           string
	description    string
	title          string
	project_id     u32
	issue_type     IssueType
	priority       IssuePriority
	status         IssueStatus
	swimlane       string
	assignees      []u32
	reporter       u32
	milestone      string
	deadline       string // Use ourtime module to convert to epoch
	estimate       int
	fs_files       []u32
	parent_id      u32
	children       []u32
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct ProjectIssueListArg #

@[params]
struct ProjectIssueListArg {
pub mut:
	project_id u32
	issue_type IssueType
	status     IssueStatus
	swimlane   string
	milestone  string
	limit      int = 100 // Default limit is 100
}

struct ProjectListArg #

@[params]
struct ProjectListArg {
pub mut:
	status ?ProjectStatus // Optional status filter
	limit  int = 100 // Default limit is 100
}

struct Registration #

struct Registration {
pub mut:
	user_id               u32
	accepted              bool // an administrator has accepted
	accepted_by           u32  // the user who did the acceptance
	timestamp             u64  // time when registration happened
	timestamp_acceptation u64  // when acceptation was done
}

struct RegistrationDesk #

@[heap]
struct RegistrationDesk {
	db.Base
pub mut:
	name                string
	description         string                       // probably in markdown
	fs_items            []RegistrationFileAttachment // link to docs
	white_list          []u32                        // users who can enter, if 1 specified then people need to be in this list
	white_list_accepted []u32                        // if in this list automatically accepted
	required_list       []u32                        // users who must be part of the event
	black_list          []u32                        // users not allowed
	start_time          u64  // time when users can start registration
	end_time            u64  // time when registration desk stops
	acceptance_required bool // if set then admins need to approve
	registrations       []Registration
}

fn (RegistrationDesk) type_name #

fn (self RegistrationDesk) type_name() string

fn (RegistrationDesk) description #

fn (self RegistrationDesk) description(methodname string) string

return example rpc call and result for each methodname

fn (RegistrationDesk) example #

fn (self RegistrationDesk) example(methodname string) (string, string)

return example rpc call and result for each methodname, so example for call and the result

fn (RegistrationDesk) dump #

fn (self RegistrationDesk) dump(mut e encoder.Encoder) !

struct RegistrationDeskArg #

@[params]
struct RegistrationDeskArg {
pub mut:
	id                  u32
	name                string
	description         string
	fs_items            []u32  // IDs of linked files or dirs
	white_list          []u32  // users who can enter, if 1 specified then people need to be in this list
	white_list_accepted []u32  // if in this list automatically accepted
	black_list          []u32  // users not allowed
	start_time          string // use ourtime module to go from string to epoch
	end_time            string // use ourtime module to go from string to epoch
	acceptance_required bool   // if set then admins need to approve
	securitypolicy      u32
	tags                []string
	messages            []db.MessageArg
}

struct RegistrationDeskListArg #

@[params]
struct RegistrationDeskListArg {
pub mut:
	name        string
	description string
	limit       int = 100 // Default limit is 100
}

struct RegistrationFileAttachment #

struct RegistrationFileAttachment {
pub mut:
	fs_item u32
	cat     string // can be freely chosen, will always be made lowercase e.g. agenda
	public  bool   // everyone can see the file, otherwise only the organizers, attendees
}

struct SendLog #

struct SendLog {
pub mut:
	to        []u32 // if message/message has been sent to someone specifically
	cc        []u32 // like to but then for cc
	status    SendStatus
	timestamp u64 // when was it done
}

struct ServerArgs #

@[params]
struct ServerArgs {
pub mut:
	port            int    = 8080
	host            string = 'localhost'
	auth_enabled    bool   = true
	cors_enabled    bool   = true
	reset           bool
	allowed_origins []string = ['*'] // Default allows all origins
	name            string
	crypto_client   ?&herocrypt.HeroCrypt
}

Start heromodels server using heroserver

struct Swimlane #

struct Swimlane {
pub mut:
	name        string // allways to to_lower and trim_space
	description string
	order       int
	color       string
	is_done     bool
}

struct User #

@[heap]
struct User {
	db.Base
pub mut:
	user_id     u32 // id as is set in ledger, if 0 then we don't know
	contact_id  u32 // if we have separate content info for this person
	status      UserStatus
	profile_ids []string
}

User represents a person in the system

fn (User) type_name #

fn (self User) type_name() string

fn (User) description #

fn (self User) description(methodname string) string

return example rpc call and result for each methodname

fn (User) example #

fn (self User) example(methodname string) (string, string)

return example rpc call and result for each methodname

fn (User) dump #

fn (self User) dump(mut e encoder.Encoder) !

struct UserArg #

@[params]
struct UserArg {
pub mut:
	id             u32
	name           string @[required]
	description    string
	user_id        u32
	contact_id     u32
	status         UserStatus
	profile_ids    []string
	securitypolicy u32
	tags           []string
	messages       []db.MessageArg
}

struct UserListArg #

@[params]
struct UserListArg {
pub mut:
	status UserStatus
	limit  int = 100 // Default limit is 100
}