Categorygithub.com/dravenk/webthing-go
modulepackage
0.0.0-20240325111517-30ee7c09b90e
Repository: https://github.com/dravenk/webthing-go.git
Documentation: pkg.go.dev

# README

Web of Things


GitHub forks GitHub version GoDoc Codacy Badge travis Go Report Card codebeat badge Build Status

USAGE

This library fully supports Web Thing REST API.You can start building your Web of Thing by looking at single-thing.

Download and import

This package name is called webthing. This project is called webthing-go to keep the naming consistent with the implementation of other languages. You just need to import this package the way golang normally imports a package.

go get -u -v github.com/dravenk/webthing-go
import (
 "github.com/dravenk/webthing-go"
)

Create Thing

// Create a Lamp.
thing := webthing.NewThing("urn:dev:ops:my-thing-1234",
 "Lamp",
 []string{"OnOffSwitch", "Light"},
 "A web connected thing")

For more information on Creating Webthing, please check the wiki Create-Thing

Example

cd $GOPATH/src/github.com/dravenk/webthing-go
go run examples/single-thing/single-thing.go

You can also run a sample with docker:

docker run -ti --name single-thing -p 8888:8888 dravenk/webthing

For more information on Run Example, please check the wiki Run-Example

RESOURCES

# Packages

No description provided by the author

# Functions

BaseHandle Base handler that is initialized with a list of things.
NewAction Initialize the object.
NewAvailableAction Initialize the object.
NewAvailableEvent Initialize the object.
NewEvent Initialize the object.
NewMultipleThings Initialize the container.
NewProperty Initialize the object.
NewSingleThing Initialize the container.
NewThing create a thing.
No description provided by the author
NewValue Initialize the object.
NewWebThingServer Initialize the WebThingServer.
Timestamp Get the current time.

# Structs

Action An Action represents an individual action on a thing.
ActionHandle Handle a request to /actions/<action_name>.
ActionIDHandle Handle a request to /actions/<action_name>/<action_id>.
ActionsHandle Handle a request to /actions.
AvailableAction Class to describe an action available to be taken.
AvailableEvent Class to describe an event available for subscription.
Event An Event represents an individual event from a thing.
EventHandle handle a request to /events.
EventObject An event object describes a kind of event which may be emitted by a device.
EventsHandle a request to /events.
Link base link struct.
MultipleThings A container for multiple things.
PropertiesHandle Handle a request to /properties.
Property Initialize the object.
PropertyHandle a request to /properties/<property>.
PropertyObject A property object describes an attribute of a Thing and is indexed by a property id.
SingleThing A container for a single thing.
Thing A Web Thing struct.
ThingHandle Handle a request to thing.
ThingMember thingmember.
ThingServer Web Thing Server.
ThingsHandle things struct.
Value A property value.

# Interfaces

Actioner Customize the methods that the action must implement.
DeleteInterface Implementation of http Delete menthod.
GetInterface Implementation of http Get menthod.
PostInterface Implementation of http Post menthod.
PutInterface Implementation of http Put menthod.
ThingsType Container of Things Type.