apitoolbox

package
v0.0.0-...-7c66ffc Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package apitoolbox contains utility methods for the API services

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDataFilter

func ApplyDataFilter(req *apipb.ListMessagesRequest, dataFilter *datastore.DataFilter)

ApplyDataFilter creates a data filter instance from a apipb.ListMessagesRequest request object.

func EnsureTeamAdmin

func EnsureTeamAdmin(userID model.UserKey, id string, store storage.DataStore) (model.Team, error)

EnsureTeamAdmin ensures that the user is an admin of the team. The team will be retrieved from the storage implementation supplied. If the team ID is unknown a suitable gRPC error with an error code will be returned (InvalidArgument if the ID can't be converted into a model.TeamKey value, NotFound if the team doesn't exist or PermissionDenied if the user isn't an admin of the team)

func JSONMarshaler

func JSONMarshaler() jsonpb.Marshaler

JSONMarshaler returns a jsonpb.Marshaler instance with options compatible with the REST API.

func NewCollectionFirmwareConfigFromModel

func NewCollectionFirmwareConfigFromModel(m model.CollectionFirmwareMetadata) *apipb.CollectionFirmware

NewCollectionFirmwareConfigFromModel converts the model.CollectionFirmwareMetadata value into apipb.CollectionFirmware

func NewCollectionFromModel

func NewCollectionFromModel(c model.Collection) *apipb.Collection

NewCollectionFromModel returns an apipb.Collection instance from the model.Collection instance.

func NewDeviceFromModel

func NewDeviceFromModel(d model.Device, c model.Collection) *apipb.Device

NewDeviceFromModel converts model.Device into apipb.Device

func NewDownstreamMessage

func NewDownstreamMessage(msg *apipb.SendMessageRequest) (model.DownstreamMessage, error)

NewDownstreamMessage converts a SendMessageRequest into model.DownstreamMessage. If there is an error converting the message an error is returned. The error contains the appropriate status code.

func NewFieldMaskFromModel

func NewFieldMaskFromModel(m model.FieldMask) *apipb.FieldMask

NewFieldMaskFromModel converts a model.FieldMask into apipb.FieldMask

func NewFirmwareFromModel

func NewFirmwareFromModel(fw model.Firmware) *apipb.Firmware

NewFirmwareFromModel converts a model.Firmware entity into the corresponding apipb.Firmware type

func NewFirmwareMetadataFromModel

func NewFirmwareMetadataFromModel(m model.DeviceFirmwareMetadata) *apipb.FirmwareMetadata

NewFirmwareMetadataFromModel converts model.DeviceFirmwareMetadata into apipb.FirmwareMetadata

func NewInviteFromModel

func NewInviteFromModel(invite model.Invite) *apipb.Invite

NewInviteFromModel converts a model.Invite into an apipb.Invite type

func NewMemberFromModel

func NewMemberFromModel(teamID model.TeamKey, member model.Member) *apipb.Member

NewMemberFromModel creates an apipb.Member instace from a model.Member instance

func NewNetworkMetadataFromModel

func NewNetworkMetadataFromModel(m model.DeviceNetworkMetadata, fieldMask model.FieldMask) *apipb.NetworkMetadata

NewNetworkMetadataFromModel converts model.DeviceNetworkMetadata into apipb.NetworkMetadata

func NewOutputConfigFromAPI

func NewOutputConfigFromAPI(o *apipb.Output) model.OutputConfig

NewOutputConfigFromAPI generates a model config based on protobuffer request object

func NewOutputDataMessageFromModel

func NewOutputDataMessageFromModel(msg model.DataMessage, collection model.Collection) *apipb.OutputDataMessage

NewOutputDataMessageFromModel converts a model.DataMessage into the apipb.OutputDataMessage equivalent

func NewOutputFromModel

func NewOutputFromModel(o model.Output) *apipb.Output

NewOutputFromModel converts model.Output into apipb.Output

func NewOutputLogsFromModel

func NewOutputLogsFromModel(logs []model.OutputLogEntry) []*apipb.OutputLogEntry

NewOutputLogsFromModel returns the log entries converted to apipb types

func NewOutputStatusFromModel

func NewOutputStatusFromModel(collectionID string, outputID string, enabled bool, status model.OutputStatus) *apipb.OutputStatus

NewOutputStatusFromModel converts an internal status structure into the apipb equivalent.

func NewTeamFromModel

func NewTeamFromModel(team model.Team, includeMembers bool) *apipb.Team

NewTeamFromModel converts a model.Team into apipb.Team

func NewTokenFromModel

func NewTokenFromModel(token model.Token) *apipb.Token

NewTokenFromModel converts a model.Token into apipb.Token

func NewUserProfileFromUser

func NewUserProfileFromUser(user model.User) *apipb.UserProfile

NewUserProfileFromUser converts a model.User object into a UserProfile message

func SetFieldMask

func SetFieldMask(existing *model.FieldMask, new *apipb.FieldMask, system model.FieldMaskParameters) bool

SetFieldMask populates a model.FieldMask type with values from a apipb.FieldMask. It will return true if the model.FieldMask value changes.

func UnmarshalDataStoreMetadata

func UnmarshalDataStoreMetadata(metadata []byte, fieldMask model.FieldMask, payload []byte, created int64) (*apipb.OutputDataMessage, error)

UnmarshalDataStoreMetadata unmarshals a data store message from a binary

Types

This section is empty.

Jump to

Keyboard shortcuts

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