exchange

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2017 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package exchange is used as a CalendarService in BusyBee.

It is not recommended to use this package outside of BusyBee. To use with BusyBee make sure to import this package. You can do so by adding the following:

import _ "github.com/dixonwille/busybee/exchange"

But since you will need the Configuration Struct it may just be easier to use it like normal.

Index

Constants

View Source
const (
	//DateTimeFormat is the format used for request and responses from the server.
	DateTimeFormat = "2006-01-02T15:04:05"
)

Variables

This section is empty.

Functions

func New

func New(conf interface{}, bb *busybee.BusyBee) (busybee.InEventer, error)

New creates a new Exchange Calendar service for BusyBee for consumption. conf holds information on how to create the new instance. Keys that must exist are as follows:

* host - holds the host for the exchange service * user - username to sign in to exchange with * pass - password for the username to sign in to exchange

func NewConf added in v0.1.2

func NewConf() interface{}

NewConf creates a new Exchange configuration using the passed in values.

Types

type CalendarEvent

type CalendarEvent struct {
	StartTime string `xml:"StartTime"`
	EndTime   string `xml:"EndTime"`
	BusyType  string `xml:"BusyType"`
}

CalendarEvent is the start and end time in the requested time zone. Also returns whether they are busy or not at those times.

type Conf added in v0.1.2

type Conf struct {
	Host string `quest:"What is the exchange host?"`
	User string `quest:"What is your exchange username?"`
	Pass string `quest:"What is your exchange password?,encrypt,pass"`
}

Conf holds all the needed information to create a new exchange service.

type Exchange

type Exchange struct {
	// contains filtered or unexported fields
}

Exchange is of type CalendarService and is used to communicate with an Exchange server.

func (*Exchange) InEvent

func (e *Exchange) InEvent(uid string) (bool, error)

InEvent returns whether the specified uid is in an event or not.

type FreeBusyResponse

type FreeBusyResponse struct {
	CalendarEvents []CalendarEvent `xml:"FreeBusyView>CalendarEventArray>CalendarEvent"`
}

FreeBusyResponse holds all the Calendar Events for a single user.

type FreeBusyViewOptions

type FreeBusyViewOptions struct {
	StartTime                       string `xml:"t:TimeWindow>t:StartTime"`
	EndTime                         string `xml:"t:TimeWindow>t:EndTime"`
	MergedFreeBusyIntervalInMinutes int    `xml:"t:MergedFreeBusyIntervalInMinutes"`
	RequestedView                   string `xml:"t:RequestedView"`
}

FreeBusyViewOptions lets the server know how you want to view the data that will be returned. I only care if there is something going on now and if you are busy for it. So I return the minimum required.

type GetUserAvailabilityRequest

type GetUserAvailabilityRequest struct {
	Xmlns               string              `xml:"xmlns,attr"`
	T                   string              `xml:"xmlns:t,attr"`
	TimeZone            TimeZone            `xml:"t:TimeZone"`
	MailboxDataArray    MailboxDataArray    `xml:"MailboxDataArray"`
	FreeBusyViewOptions FreeBusyViewOptions `xml:"t:FreeBusyViewOptions"`
}

GetUserAvailabilityRequest is the soap request we want to make.

type MailboxData

type MailboxData struct {
	Address          string `xml:"t:Email>t:Address"`
	AttendeeType     string `xml:"t:AttendeeType"`
	ExcludeConflicts bool   `xml:"t:ExcludeConflicts"`
}

MailboxData is a single entry in MailboxDataArray. It holds information like which user you want to look up.

type MailboxDataArray

type MailboxDataArray struct {
	MailboxData []MailboxData `xml:"t:MailboxData"`
}

MailboxDataArray is the overall structure for each individual email address.

type RequestEnvelope

type RequestEnvelope struct {
	XMLName                    xml.Name                   `xml:"soap:Envelope"`
	Xsi                        string                     `xml:"xmlns:xsi,attr"`
	Xsd                        string                     `xml:"xmlns:xsd,attr"`
	Soap                       string                     `xml:"xmlns:soap,attr"`
	T                          string                     `xml:"xmlns:t,attr"`
	GetUserAvailabilityRequest GetUserAvailabilityRequest `xml:"soap:Body>GetUserAvailabilityRequest"`
}

RequestEnvelope is the main structure of our exchange soap request.

func NewRequestEnvelope

func NewRequestEnvelope(startTime, endTime time.Time, addresses ...string) *RequestEnvelope

NewRequestEnvelope creates the entire request for us. It is highly recommended to use this method first then update values as needed. There are a lot of default values that this creates which is enough for what we need it to do.

func (*RequestEnvelope) Encode

func (req *RequestEnvelope) Encode(writer io.Writer) error

Encode turns this request into a soap+xml that the server can understand.

type ResponseEnvelope

type ResponseEnvelope struct {
	XMLName           xml.Name           `xml:"Envelope"`
	FreeBusyResponses []FreeBusyResponse `xml:"Body>GetUserAvailabilityResponse>FreeBusyResponseArray>FreeBusyResponse"`
}

ResponseEnvelope is the highest level element. There is a single FreeBusyResponse for each user specified in the request.

func (*ResponseEnvelope) Decode

func (res *ResponseEnvelope) Decode(reader io.Reader) error

Decode reads from reader and writes it into the model.

type TimeZone

type TimeZone struct {
	Xmlns        string       `xml:"xmlns,attr"`
	Bias         int          `xml:"Bias"`
	StandardTime TimeZoneTime `xml:"StandardTime"`
	DaylightTime TimeZoneTime `xml:"DaylightTime"`
}

TimeZone is used to tell the server information about our timezone.

type TimeZoneTime

type TimeZoneTime struct {
	Bias      int    `xml:"Bias"`
	Time      string `xml:"Time"`
	DayOrder  int    `xml:"DayOrder"`
	Month     int    `xml:"Month"`
	DayOfWeek string `xml:"DayOfWeek"`
}

TimeZoneTime is shared structure for StandardTime and DaylightTime.

Jump to

Keyboard shortcuts

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