ews

package module
v0.0.69 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 15 Imported by: 0

README

EWS Exchange Web Service

Latest release Build status Go Report Card Documentation

Package ews is currently a work in progress.

This package started as a fork of github.com/mhewedy/ews but has since then changed severely. Therefore it is not backwards compatible. See the UPGRADE guide for additional details.

go get github.com/soft-stech/go-ews
import "github.com/soft-stech/go-ews"

EWS operations reference

https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/ews-operations-in-exchange

License

Copyright © 2022 Abovo Media. All rights reserved.

Additional information can be found in the LICENSE file.

Documentation

Index

Constants

View Source
const (
	Exchange2010     Version = "Exchange2010"
	Exchange2013_SP1 Version = "Exchange2013_SP1"

	RequestError   errors.Kind = "request error"
	UnmarshalError errors.Kind = "unmarshal error"
)
View Source
const PanicNilBody = "body must be a non-nil value"

Variables

This section is empty.

Functions

func NewError

func NewError(resp *http.Response) error

Types

type CancelCalendarItemOperation added in v0.0.20

type CancelCalendarItemOperation struct {
	CreateItem ewsxml.CreateItem
	// contains filtered or unexported fields
}

func (*CancelCalendarItemOperation) Body added in v0.0.20

func (op *CancelCalendarItemOperation) Body() interface{}

func (*CancelCalendarItemOperation) Header added in v0.0.20

type CancelCalendarItemResponse added in v0.0.20

type CancelCalendarItemResponse struct {
	XMLName          xml.Name `xml:"CreateItemResponse"`
	ResponseMessages struct {
		XMLName            xml.Name `xml:"ResponseMessages"`
		CreateItemResponse ewsxml.CreateItemResponseMessage
	}
}

func CancelCalendarItem added in v0.0.20

type Client

type Client interface {
	Requester
	Log() Logger
	Url() string
	Username() string
	Do(req *Request) (*http.Response, error)
	ParseXML([]byte, interface{}) error
}

func NewClient

func NewClient(url string, ver Version, opts ...Option) (Client, error)

type CreateAttachmentOperation added in v0.0.54

type CreateAttachmentOperation struct {
	CreateAttachment struct {
		ewsxml.CreateAttachment
	}
	// contains filtered or unexported fields
}

func (*CreateAttachmentOperation) Body added in v0.0.54

func (op *CreateAttachmentOperation) Body() interface{}

func (*CreateAttachmentOperation) Header added in v0.0.54

func (op *CreateAttachmentOperation) Header() *ewsxml.Header

type CreateAttachmentResponse added in v0.0.54

type CreateAttachmentResponse struct {
	XMLName          xml.Name `xml:"CreateAttachmentResponse"`
	ResponseMessages struct {
		XMLName                          xml.Name `xml:"ResponseMessages"`
		CreateAttachmentsResponseMessage ewsxml.CreateAttachmentsResponseMessage
	}
}

func CreateAttachment added in v0.0.54

type CreateCalendarItemsResponse added in v0.0.4

type CreateCalendarItemsResponse struct {
	XMLName          xml.Name `xml:"CreateItemResponse"`
	ResponseMessages struct {
		XMLName                   xml.Name `xml:"ResponseMessages"`
		CreateItemResponseMessage ewsxml.CreateItemResponseMessage
	}
}

func CreateCalendarItems added in v0.0.4

type CreateFolderOperation added in v0.0.55

type CreateFolderOperation struct {
	CreateFolder ewsxml.CreateFolder
	// contains filtered or unexported fields
}

func (*CreateFolderOperation) Body added in v0.0.55

func (op *CreateFolderOperation) Body() interface{}

func (*CreateFolderOperation) Header added in v0.0.55

func (op *CreateFolderOperation) Header() *ewsxml.Header

type CreateFolderResponse added in v0.0.55

type CreateFolderResponse struct {
	XMLName          xml.Name `xml:"CreateFolderResponse"`
	ResponseMessages struct {
		XMLName                     xml.Name `xml:"ResponseMessages"`
		CreateFolderResponseMessage []ewsxml.CreateFolderResponseMessage
	}
}

func CreateCalendarFolder added in v0.0.55

func CreateCalendarFolder(ctx context.Context, req Requester, op *CreateFolderOperation) (*CreateFolderResponse, error)

type CreateItemCalendarItemsOperation added in v0.0.4

type CreateItemCalendarItemsOperation struct {
	CreateItem struct {
		ewsxml.CreateItem
	}
	// contains filtered or unexported fields
}

func (*CreateItemCalendarItemsOperation) Body added in v0.0.4

func (op *CreateItemCalendarItemsOperation) Body() interface{}

func (*CreateItemCalendarItemsOperation) Header added in v0.0.4

type DeleteAttachmentOperation added in v0.0.54

type DeleteAttachmentOperation struct {
	DeleteAttachment ewsxml.DeleteAttachment
	// contains filtered or unexported fields
}

func (*DeleteAttachmentOperation) Body added in v0.0.54

func (op *DeleteAttachmentOperation) Body() interface{}

func (*DeleteAttachmentOperation) Header added in v0.0.54

func (op *DeleteAttachmentOperation) Header() *ewsxml.Header

type DeleteAttachmentResponse added in v0.0.54

type DeleteAttachmentResponse struct {
	XMLName          xml.Name `xml:"DeleteAttachmentResponse"`
	ResponseMessages struct {
		XMLName                      xml.Name `xml:"ResponseMessages"`
		GetAttachmentResponseMessage ewsxml.DeleteAttachmentResponseMessage
	}
}

func DeleteAttachment added in v0.0.54

type DeleteFolderOperation added in v0.0.55

type DeleteFolderOperation struct {
	DeleteFolder ewsxml.DeleteFolder
	// contains filtered or unexported fields
}

func (*DeleteFolderOperation) Body added in v0.0.55

func (op *DeleteFolderOperation) Body() interface{}

func (*DeleteFolderOperation) Header added in v0.0.55

func (op *DeleteFolderOperation) Header() *ewsxml.Header

type DeleteFolderResponse added in v0.0.55

type DeleteFolderResponse struct {
	XMLName          xml.Name `xml:"DeleteFolderResponse"`
	ResponseMessages struct {
		XMLName                     xml.Name `xml:"ResponseMessages"`
		DeleteFolderResponseMessage []ewsxml.DeleteFolderResponseMessage
	}
}

func DeleteFolder added in v0.0.55

type DeleteItemCalendarItemsOperation added in v0.0.13

type DeleteItemCalendarItemsOperation struct {
	DeleteItem ewsxml.DeleteItem
	// contains filtered or unexported fields
}

func (*DeleteItemCalendarItemsOperation) Body added in v0.0.13

func (op *DeleteItemCalendarItemsOperation) Body() interface{}

func (*DeleteItemCalendarItemsOperation) Header added in v0.0.13

type DeleteItemCalendarItemsResponse added in v0.0.13

type DeleteItemCalendarItemsResponse struct {
	XMLName          xml.Name `xml:"DeleteItemResponse"`
	ResponseMessages struct {
		XMLName                   xml.Name `xml:"ResponseMessages"`
		DeleteItemResponseMessage ewsxml.DeleteItemResponseMessage
	}
}

func DeleteCalendarItems added in v0.0.13

type Fault

type Fault struct {
	Faultcode   string `xml:"faultcode"`
	Faultstring string `xml:"faultstring"`
	Detail      detail `xml:"detail"`
}

type FindFolderOperation added in v0.0.47

type FindFolderOperation struct {
	FindFolder ewsxml.FindFolder
	// contains filtered or unexported fields
}

func (*FindFolderOperation) Body added in v0.0.47

func (op *FindFolderOperation) Body() interface{}

func (*FindFolderOperation) Header added in v0.0.47

func (op *FindFolderOperation) Header() *ewsxml.Header

type FindFolderResponse added in v0.0.47

type FindFolderResponse struct {
	XMLName          xml.Name `xml:"FindFolderResponse"`
	ResponseMessages struct {
		XMLName                   xml.Name `xml:"ResponseMessages"`
		FindFolderResponseMessage []ewsxml.FindFolderResponseMessage
	}
}

func FindCalendarFolders added in v0.0.47

func FindCalendarFolders(ctx context.Context, req Requester, op *FindFolderOperation) (*FindFolderResponse, error)

type FindItemCalendarViewOperation

type FindItemCalendarViewOperation struct {
	FindItem struct {
		ewsxml.FindItem
		CalendarView ewsxml.CalendarView

		// https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/parentfolderids
		ParentFolderIds ewsxml.SendParentFolderIds
	}
	// contains filtered or unexported fields
}

func (*FindItemCalendarViewOperation) Body

func (op *FindItemCalendarViewOperation) Body() interface{}

func (*FindItemCalendarViewOperation) Header

type FindItemQueryStringOperation added in v0.0.42

type FindItemQueryStringOperation struct {
	FindItem struct {
		ewsxml.FindItem
		// https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/querystring-querystringtype
		QueryString string `xml:"m:QueryString"`
		SortOrder   ewsxml.SortOrder

		ParentFolderIds struct {
			DistinguishedFolderId ewsxml.DistinguishedFolderId `xml:"t:DistinguishedFolderId"`
		} `xml:"m:ParentFolderIds"`
	}
	// contains filtered or unexported fields
}

func (*FindItemQueryStringOperation) Body added in v0.0.42

func (op *FindItemQueryStringOperation) Body() interface{}

func (*FindItemQueryStringOperation) Header added in v0.0.42

type FindItemResponse added in v0.0.42

type FindItemResponse struct {
	XMLName          xml.Name `xml:"FindItemResponse"`
	ResponseMessages struct {
		XMLName                 xml.Name `xml:"ResponseMessages"`
		FindItemResponseMessage ewsxml.FindItemResponseMessage
	}
}

func SearchCalendarItem added in v0.0.42

func SearchCalendarItem(ctx context.Context, req Requester, op *FindItemQueryStringOperation) (*FindItemResponse, error)

type GetAttachmentOperation added in v0.0.25

type GetAttachmentOperation struct {
	GetAttachment ewsxml.GetAttachment
	// contains filtered or unexported fields
}

func (*GetAttachmentOperation) Body added in v0.0.25

func (op *GetAttachmentOperation) Body() interface{}

func (*GetAttachmentOperation) Header added in v0.0.25

func (op *GetAttachmentOperation) Header() *ewsxml.Header

type GetAttachmentResponse added in v0.0.25

type GetAttachmentResponse struct {
	XMLName          xml.Name `xml:"GetAttachmentResponse"`
	ResponseMessages struct {
		XMLName                      xml.Name `xml:"ResponseMessages"`
		GetAttachmentResponseMessage ewsxml.GetAttachmentResponseMessage
	}
}

func GetAttachments added in v0.0.25

type GetFolderOperation added in v0.0.44

type GetFolderOperation struct {
	GetFolder ewsxml.GetFolder
	// contains filtered or unexported fields
}

func (*GetFolderOperation) Body added in v0.0.44

func (op *GetFolderOperation) Body() interface{}

func (*GetFolderOperation) Header added in v0.0.44

func (op *GetFolderOperation) Header() *ewsxml.Header

type GetFolderResponse added in v0.0.44

type GetFolderResponse struct {
	XMLName          xml.Name `xml:"GetFolderResponse"`
	ResponseMessages struct {
		XMLName                  xml.Name `xml:"ResponseMessages"`
		GetFolderResponseMessage []ewsxml.GetFolderResponseMessage
	}
}

func GetCalendarFolders added in v0.0.44

func GetCalendarFolders(ctx context.Context, req Requester, op *GetFolderOperation) (*GetFolderResponse, error)

type GetItemCalendarItemsOperation added in v0.0.7

type GetItemCalendarItemsOperation struct {
	GetItem ewsxml.GetItem
	// contains filtered or unexported fields
}

func (*GetItemCalendarItemsOperation) Body added in v0.0.7

func (op *GetItemCalendarItemsOperation) Body() interface{}

func (*GetItemCalendarItemsOperation) Header added in v0.0.7

type GetItemCalendarItemsResponse added in v0.0.7

type GetItemCalendarItemsResponse struct {
	XMLName          xml.Name `xml:"GetItemResponse"`
	ResponseMessages struct {
		XMLName                xml.Name `xml:"ResponseMessages"`
		GetItemResponseMessage ewsxml.GetItemResponseMessage
	}
}

func GetCalendarItems added in v0.0.7

type GetRemindersOperation added in v0.0.31

type GetRemindersOperation struct {
	GetReminders struct {
		ewsxml.GetReminders
	}
	// contains filtered or unexported fields
}

func (*GetRemindersOperation) Body added in v0.0.31

func (op *GetRemindersOperation) Body() interface{}

func (*GetRemindersOperation) Header added in v0.0.31

func (op *GetRemindersOperation) Header() *ewsxml.Header

type GetRemindersResponse added in v0.0.31

type GetRemindersResponse struct {
	XMLName   xml.Name `xml:"GetRemindersResponse"`
	Reminders ewsxml.Reminders
}

func GetCalendarReminders added in v0.0.31

func GetCalendarReminders(ctx context.Context, req Requester, op *GetRemindersOperation) (*GetRemindersResponse, error)

type GetRoomListsOperation

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

func (*GetRoomListsOperation) Body

func (op *GetRoomListsOperation) Body() interface{}

func (*GetRoomListsOperation) Header

func (op *GetRoomListsOperation) Header() *ewsxml.Header

type GetRoomListsResponse

type GetRoomListsResponse struct {
	ewsxml.Response
	RoomLists struct {
		Address []ewsxml.Mailbox `xml:"Address"`
	} `xml:"RoomLists"`
}

type GetRoomsOperation

type GetRoomsOperation struct {
	GetRooms ewsxml.GetRooms
	// contains filtered or unexported fields
}

https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/getrooms-operation

func (*GetRoomsOperation) Body

func (op *GetRoomsOperation) Body() interface{}

func (*GetRoomsOperation) Header

func (op *GetRoomsOperation) Header() *ewsxml.Header

type GetRoomsResponse

type GetRoomsResponse struct {
	ewsxml.Response
	Rooms []struct {
		Name         string
		EmailAddress string
		RoutingType  ewsxml.RoutingType
		MailboxType  ewsxml.MailboxType
	} `xml:"Rooms>Room>Id"`
}

https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/getroomsresponse

type GetUserAvailabilityOperation added in v0.0.36

type GetUserAvailabilityOperation struct {
	GetUserAvailabilityRequest ewsxml.GetUserAvailabilityRequest
	// contains filtered or unexported fields
}

func (*GetUserAvailabilityOperation) Body added in v0.0.36

func (op *GetUserAvailabilityOperation) Body() interface{}

func (*GetUserAvailabilityOperation) Header added in v0.0.36

type GetUserAvailabilityResponse added in v0.0.36

type GetUserAvailabilityResponse struct {
	XMLName               xml.Name `xml:"GetUserAvailabilityResponse"`
	FreeBusyResponseArray ewsxml.FreeBusyResponseArray
	SuggestionsResponse   ewsxml.SuggestionsResponse
}

func GetUserAvailability added in v0.0.36

type GetUserConfigurationOperation added in v0.0.38

type GetUserConfigurationOperation struct {
	GetUserConfiguration ewsxml.GetUserConfiguration
	// contains filtered or unexported fields
}

func (*GetUserConfigurationOperation) Body added in v0.0.38

func (op *GetUserConfigurationOperation) Body() interface{}

func (*GetUserConfigurationOperation) Header added in v0.0.38

type GetUserConfigurationResponse added in v0.0.38

type GetUserConfigurationResponse struct {
	XMLName          xml.Name `xml:"GetUserConfigurationResponse"`
	ResponseMessages struct {
		XMLName                             xml.Name `xml:"ResponseMessages"`
		GetUserConfigurationResponseMessage ewsxml.GetUserConfigurationResponseMessage
	}
}

func GetUserConfiguration added in v0.0.38

type HTTPError

type HTTPError struct {
	Status     string
	StatusCode int
}

func (HTTPError) Error

func (s HTTPError) Error() string

type Logger

type Logger interface {
	Server(url string, ver Version)
	HttpRequest(req *http.Request, body []byte)
	HttpResponse(resp *http.Response, body []byte)
	Response(resp ewsxml.Response)
}

func DefaultLogger

func DefaultLogger() Logger

func NopLogger

func NopLogger() Logger

type MoveItemOperation added in v0.0.66

type MoveItemOperation struct {
	MoveItem struct {
		ewsxml.MoveItem
	}
	// contains filtered or unexported fields
}

func (*MoveItemOperation) Body added in v0.0.66

func (op *MoveItemOperation) Body() interface{}

func (*MoveItemOperation) Header added in v0.0.66

func (op *MoveItemOperation) Header() *ewsxml.Header

type MoveItemResponse added in v0.0.66

type MoveItemResponse struct {
	XMLName          xml.Name `xml:"MoveItemResponse"`
	ResponseMessages struct {
		XMLName                 xml.Name `xml:"ResponseMessages"`
		MoveItemResponseMessage ewsxml.MoveItemResponseMessage
	}
}

func MoveCalendarItems added in v0.0.66

func MoveCalendarItems(ctx context.Context, req Requester, op *MoveItemOperation) (*MoveItemResponse, error)

type Operation

type Operation interface {
	Header() *ewsxml.Header
	Body() interface{}
}

type Option

type Option func(c *client) error

func WithBasicAuth

func WithBasicAuth(user, pass string) Option

func WithDefaultLogger

func WithDefaultLogger() Option

func WithDefaultTransport

func WithDefaultTransport(skipTls bool) Option

func WithExchangeImpersonation added in v0.0.23

func WithExchangeImpersonation(v string) Option

func WithLogger

func WithLogger(l Logger) Option

func WithNTLM

func WithNTLM(skipTls bool) Option

func WithTimeout

func WithTimeout(t time.Duration) Option

WithTimeout sets the Timeout field on the http.Client.

func WithTransport

func WithTransport(t http.RoundTripper) Option

type Request

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

func NewOperationRequest

func NewOperationRequest(ctx context.Context, op Operation) *Request

func NewRequest

func NewRequest(ctx context.Context, head *ewsxml.Header, body interface{}) *Request

func (*Request) Body

func (r *Request) Body() interface{}

func (*Request) Header

func (r *Request) Header() *ewsxml.Header

func (*Request) WriteBody

func (r *Request) WriteBody(w io.Writer) error

type Requester

type Requester interface {
	// Request
	// Argument out must be of []byte or any type that xml.Marshal
	// successfully can handle.
	Request(req *Request, out interface{}) error
}

type RespondToCalendarItemOperation added in v0.0.26

type RespondToCalendarItemOperation struct {
	CreateItem struct {
		ewsxml.CreateItem
	}
	// contains filtered or unexported fields
}

func (*RespondToCalendarItemOperation) Body added in v0.0.26

func (op *RespondToCalendarItemOperation) Body() interface{}

func (*RespondToCalendarItemOperation) Header added in v0.0.26

type RespondToCalendarItemResponse added in v0.0.26

type RespondToCalendarItemResponse struct {
	XMLName          xml.Name `xml:"CreateItemResponse"`
	ResponseMessages struct {
		XMLName                   xml.Name `xml:"ResponseMessages"`
		CreateItemResponseMessage ewsxml.CreateItemResponseMessage
	}
}

func RespondToCalendarItem added in v0.0.26

type SendNotificationResponse added in v0.0.34

type SendNotificationResponse struct {
	XMLName          xml.Name `xml:"SendNotification"`
	ResponseMessages struct {
		XMLName                         xml.Name `xml:"ResponseMessages"`
		SendNotificationResponseMessage ewsxml.SendNotificationResponseMessage
	}
}

type SendNotificationResultOperation added in v0.0.35

type SendNotificationResultOperation struct {
	SendNotificationResult ewsxml.SendNotificationResult
	// contains filtered or unexported fields
}

func (*SendNotificationResultOperation) Body added in v0.0.35

func (op *SendNotificationResultOperation) Body() interface{}

func (*SendNotificationResultOperation) Header added in v0.0.35

type SoapError

type SoapError struct {
	Fault *Fault
}

func (SoapError) Error

func (s SoapError) Error() string

type SubscribeOperation added in v0.0.33

type SubscribeOperation struct {
	Subscribe ewsxml.Subscribe
	// contains filtered or unexported fields
}

func (*SubscribeOperation) Body added in v0.0.33

func (op *SubscribeOperation) Body() interface{}

func (*SubscribeOperation) Header added in v0.0.33

func (op *SubscribeOperation) Header() *ewsxml.Header

type SubscribeResponse added in v0.0.33

type SubscribeResponse struct {
	XMLName          xml.Name `xml:"SubscribeResponse"`
	ResponseMessages struct {
		XMLName                  xml.Name `xml:"ResponseMessages"`
		SubscribeResponseMessage ewsxml.SubscribeResponseMessage
	}
}

func SubscribeToNotifications added in v0.0.33

func SubscribeToNotifications(ctx context.Context, req Requester, op *SubscribeOperation) (*SubscribeResponse, error)

type UpdateCalendarItemResponse added in v0.0.8

type UpdateCalendarItemResponse struct {
	XMLName          xml.Name `xml:"UpdateItemResponse"`
	ResponseMessages struct {
		XMLName                   xml.Name `xml:"ResponseMessages"`
		UpdateItemResponseMessage ewsxml.UpdateItemResponseMessage
	}
}

func UpdateCalendarItems added in v0.0.8

type UpdateCalendarItemsOperation added in v0.0.8

type UpdateCalendarItemsOperation struct {
	UpdateItem struct {
		ewsxml.UpdateItem
	}
	// contains filtered or unexported fields
}

func (*UpdateCalendarItemsOperation) Body added in v0.0.8

func (op *UpdateCalendarItemsOperation) Body() interface{}

func (*UpdateCalendarItemsOperation) Header added in v0.0.8

type UpdateFolderOperation added in v0.0.56

type UpdateFolderOperation struct {
	UpdateFolder struct {
		ewsxml.UpdateFolder
	}
	// contains filtered or unexported fields
}

func (*UpdateFolderOperation) Body added in v0.0.56

func (op *UpdateFolderOperation) Body() interface{}

func (*UpdateFolderOperation) Header added in v0.0.56

func (op *UpdateFolderOperation) Header() *ewsxml.Header

type UpdateFolderResponse added in v0.0.56

type UpdateFolderResponse struct {
	XMLName          xml.Name `xml:"UpdateFolderResponse"`
	ResponseMessages struct {
		XMLName                     xml.Name `xml:"ResponseMessages"`
		UpdateFolderResponseMessage ewsxml.UpdateFolderResponseMessage
	}
}

func UpdateCalendarFolder added in v0.0.56

func UpdateCalendarFolder(ctx context.Context, req Requester, op *UpdateFolderOperation) (*UpdateFolderResponse, error)

type UpdateUserConfigurationOperation added in v0.0.38

type UpdateUserConfigurationOperation struct {
	UpdateUserConfiguration ewsxml.UpdateUserConfiguration
	// contains filtered or unexported fields
}

func (*UpdateUserConfigurationOperation) Body added in v0.0.38

func (op *UpdateUserConfigurationOperation) Body() interface{}

func (*UpdateUserConfigurationOperation) Header added in v0.0.38

type UpdateUserConfigurationResponse added in v0.0.38

type UpdateUserConfigurationResponse struct {
	XMLName          xml.Name `xml:"UpdateUserConfigurationResponse"`
	ResponseMessages struct {
		XMLName                                xml.Name `xml:"ResponseMessages"`
		UpdateUserConfigurationResponseMessage ewsxml.Response
	}
}

func UpdateUserConfiguration added in v0.0.38

type Version

type Version = ewsxml.Version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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