Documentation ¶
Index ¶
- Constants
- Variables
- type ACLResponse
- type ACLUpdateRequest
- type AccessStats
- type AssignRFIDRequest
- type ChartCol
- type ChartOptions
- type ChartRow
- type Claims
- type Communication
- type Credentials
- type DeleteMemberRequest
- type EndpointSuccess
- type InfoResponse
- type LogMessage
- type MQTTRequest
- type Member
- type MemberAccess
- type MemberChurn
- type MemberCount
- type MemberLevel
- type MemberRequest
- type MemberResource
- type MemberResourceRelation
- type MemberResourceRelationUpdateRequest
- type MembersResourceRelation
- type NewMember
- type OpenResourceRequest
- type Payment
- type RegisterResourceRequest
- type ReportChart
- type Resource
- type ResourceDeleteRequest
- type ResourceRequest
- type Tier
- type TokenResponse
- type UpdateMemberRequest
- type UserResponse
- type VersionResponse
Constants ¶
const ( ActiveStatus = "ACTIVE" CanceledStatus = "CANCELLED" SuspendedStatus = "SUSPENDED" )
Variables ¶
var MemberLevelFromAmount = map[int64]MemberLevel{ 0: Inactive, 1: Credited, 30: Classic, 35: Standard, 50: Premium, }
MemberLevelFromAmount convert amount to MemberLevel
var MemberLevelToAmount = map[MemberLevel]int64{ Inactive: 0, Credited: 1, Classic: 30, Standard: 35, Premium: 50, }
MemberLeveltoAmount convert MemberLevel to amount
var MemberLevelToStr = map[MemberLevel]string{ Inactive: "Inactive", Credited: "Credited", Classic: "Classic", Standard: "Standard", Premium: "Premium", }
MemberLevelToStr convert MemberLevel to string
Functions ¶
This section is empty.
Types ¶
type ACLResponse ¶
type ACLResponse struct { Hash string `json:"acl"` // Name of the resource - this should match what we have in the database // so we know which acl to compare it with Name string `json:"name"` }
ACLResponse Response from a resource that is a hash of the ACL that the
resource has stored
type ACLUpdateRequest ¶
type ACLUpdateRequest struct {
ACL []string `json:"acl"`
}
ACLUpdateRequest is the json object we send to a resource when pushing an update
type AccessStats ¶
type AssignRFIDRequest ¶
AssignRFIDRequest -- request to associate an rfid to a member
type ChartOptions ¶
type ChartOptions struct { Title string `json:"title"` CurveType string `json:"curveType"` PieHole float64 `json:"pieHole"` Legend string `json:"legend"` }
ChartOptions -- config option for the chart
type ChartRow ¶
type ChartRow struct {
MemberLevel, MemberCount interface{}
}
ChartRow -- chart row info
type Claims ¶
type Claims struct { Email string `json:"email"` jwt.StandardClaims }
Claims -- auth claims
type Communication ¶
type Communication struct { ID int `json:"id"` Name string `json:"name"` Subject string `json:"subject"` FrequencyThrottle int `json:"frequencyThrottle"` Template string `json:"template"` }
Communication defines an email communication
type Credentials ¶
type Credentials struct { // Password - the user's password // required: true // example: string Password string `json:"password"` // Email - the users email // required: true // example: string Email string `json:"email"` }
Credentials Create a struct that models the structure of a user, both in the request body, and in the DB
type DeleteMemberRequest ¶
type EndpointSuccess ¶
type EndpointSuccess struct {
Ack bool `json:"ack"`
}
EndpointSuccess -- success response
type InfoResponse ¶
type InfoResponse struct { // Info Message // // Example: hello, world! Message string `json:"message"` }
InfoResponse -- response of info request
type LogMessage ¶
type MQTTRequest ¶
type Member ¶
type Member struct { ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` RFID string `json:"rfid"` Level uint8 `json:"memberLevel"` Resources []MemberResource `json:"resources"` SubscriptionID string `json:"subscriptionID"` }
Member -- a member of the makerspace
type MemberAccess ¶
type MemberAccess struct { Email string ResourceAddress string ResourceName string Name string RFID string }
MemberAccess represents that a member has access to a certain resource.
this will get pushed to a device.
type MemberChurn ¶
type MemberChurn struct {
Churn int `json:"churn"`
}
type MemberCount ¶
type MemberLevel ¶
type MemberLevel int
MemberLevel enum
const ( // Inactive $0 Inactive MemberLevel = iota + 1 // Credited $1 Credited // Classic $30 Classic // Standard $35 Standard // Premium $50 Premium )
type MemberRequest ¶
type MemberResource ¶
MemberResource a resource that a member belongs to
type MemberResourceRelation ¶
type MemberResourceRelation struct { ID string `json:"id"` MemberID string `json:"memberID"` ResourceID string `json:"resourceID"` }
MemberResourceRelation - a relationship between resources and members
type MemberResourceRelationUpdateRequest ¶
type MemberResourceRelationUpdateRequest struct { // ID of the Resource // required: true // example: string ID string `json:"resourceID"` // Email - this will be the member's email address // Name of the Resource // required: true // example: email Email string `json:"email"` }
MemberResourceRelationUpdateRequest -- update or delete a resource for a member
type MembersResourceRelation ¶
type MembersResourceRelation struct { // ID of the Resource // required: true // example: string ID string `json:"resourceID"` // Emails - list of member's email address // required: true // example: [] Emails []string `json:"emails"` }
MembersResourceRelation -- update or delete a resource for multiple members
type OpenResourceRequest ¶
type OpenResourceRequest struct { // Name of the Resource // required: true // example: string Name string `json:"name"` }
OpenResourceRequest -- request to associate an rfid to a member
type RegisterResourceRequest ¶
type RegisterResourceRequest struct { // Name of the Resource // required: true // example: string Name string `json:"name"` // Address of the Resource. i.e. where it can be found on the network // required: true // example: string Address string `json:"address"` // Default state of the Resource // required: false // example: true IsDefault bool `json:"isDefault"` }
RegisterResourceRequest a resource that can accept an access control list
type ReportChart ¶
type ReportChart struct { Options ChartOptions `json:"options"` Type string `json:"type"` Rows [][]interface{} `json:"rows"` Cols []ChartCol `json:"cols"` }
ReportChart - deliver information to the frontend so that
we can display a monthly payment chart
type Resource ¶
type Resource struct { // UniqueID of the Resource // required: true // example: string ID string `json:"id"` // Name of the Resource // required: true // example: string Name string `json:"name"` // Address of the Resource. i.e. where it can be found on the network // required: true // example: string Address string `json:"address"` // Default state of the Resource // required: true // example: true IsDefault bool `json:"isDefault"` LastHeartBeat time.Time `json:"lastHeartBeat"` }
Resource a resource that can accept an access control list
type ResourceDeleteRequest ¶
type ResourceDeleteRequest struct { // UniqueID of the Resource // required: true // example: string ID string `json:"id"` }
ResourceDeleteRequest - request for deleting a resource
type ResourceRequest ¶
type ResourceRequest struct { // UniqueID of the Resource // required: true // example: string ID string `json:"id"` // Name of the Resource // required: true // example: string Name string `json:"name"` // Address of the Resource. i.e. where it can be found on the network // required: true // example: string Address string `json:"address"` // Default state of the Resource // required: true // example: true IsDefault bool `json:"isDefault"` }
ResourceRequest a resource that can accept an access control list
type TokenResponse ¶
type TokenResponse struct { // login response to send token string // // Example: <TOKEN_STRING> Token string `json:"token"` }
TokenResponse -- for json response of signin
type UpdateMemberRequest ¶
type UpdateMemberRequest struct { FullName string `json:"fullName"` SubscriptionID string `json:"subscriptionID"` }
UpdateMemberRequest -- request to update a member
type UserResponse ¶
type UserResponse struct { // Email - user's Email // example: string Email string `json:"email"` Resources []Resource `json:"resources"` }
UserResponse - a user object that we can send as json