forked from andlabs/ews
-
Notifications
You must be signed in to change notification settings - Fork 29
/
get_room_lists.go
50 lines (39 loc) · 1.02 KB
/
get_room_lists.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package ews
import "encoding/xml"
type GetRoomListsRequest struct {
XMLName struct{} `xml:"m:GetRoomLists"`
}
type GetRoomListsResponse struct {
Response
RoomLists RoomLists `xml:"RoomLists"`
}
type RoomLists struct {
Address []EmailAddress `xml:"Address"`
}
type ItemId struct {
Id string `xml:"Id,attr"`
ChangeKey string `xml:"ChangeKey,attr"`
}
type getRoomListsResponseEnvelop struct {
XMLName struct{} `xml:"Envelope"`
Body getRoomListsResponseBody `xml:"Body"`
}
type getRoomListsResponseBody struct {
GetRoomListsResponse GetRoomListsResponse `xml:"GetRoomListsResponse"`
}
func GetRoomLists(c Client) (*GetRoomListsResponse, error) {
xmlBytes, err := xml.MarshalIndent(&GetRoomListsRequest{}, "", " ")
if err != nil {
return nil, err
}
bb, err := c.SendAndReceive(xmlBytes)
if err != nil {
return nil, err
}
var soapResp getRoomListsResponseEnvelop
err = xml.Unmarshal(bb, &soapResp)
if err != nil {
return nil, err
}
return &soapResp.Body.GetRoomListsResponse, nil
}