Example #1
0
        public Group CreateGroup( Group group ) {
			Silanis.ESL.API.Group apiGroup = new GroupConverter( group ).ToAPIGroupWithoutMembers();
            apiGroup = apiClient.CreateGroup( apiGroup );
            Group sdkGroup = new GroupConverter( apiGroup ).ToSDKGroup();
            foreach ( GroupMember groupMember in group.Members ) {
                AddMember( sdkGroup.Id, groupMember );
            }
            return sdkGroup;
        }
Example #2
0
        public Group GetGroup( GroupId groupId ) {
            string path = template.UrlFor (UrlTemplate.GROUPS_ID_PATH)
                .Replace ("{groupId}", groupId.Id)
                    .Build ();

            try {
                string response = restClient.Get(path);
                Silanis.ESL.API.Group apiGroup = JsonConvert.DeserializeObject<Silanis.ESL.API.Group> (response, settings);
                Group sdkGroup = new GroupConverter( apiGroup ).ToSDKGroup();
                return sdkGroup;
            } catch (Exception e) {
                throw new EslException ("Failed to retrieve group." + " Exception: " + e.Message);
            }
        }
Example #3
0
        public Group CreateGroup( Group group ) {
            string path = template.UrlFor (UrlTemplate.GROUPS_PATH).Build ();
			Silanis.ESL.API.Group apiGroup = new GroupConverter( group ).ToAPIGroupWithoutMembers();
            try {
                string json = JsonConvert.SerializeObject (apiGroup, settings);
                string response = restClient.Post(path, json);              
                Silanis.ESL.API.Group apiResponse = JsonConvert.DeserializeObject<Silanis.ESL.API.Group> (response);
                Group sdkGroup = new GroupConverter( apiResponse ).ToSDKGroup();
				foreach ( GroupMember groupMember in group.Members ) {
					InviteMember( sdkGroup.Id, groupMember );
				}
                return sdkGroup;
            } catch (Exception e) {
                throw new EslException ("Failed to create new group." + " Exception: " + e.Message);
            }
        }
Example #4
0
 public Group UpdateGroup( Group group, GroupId groupId ) {
     Silanis.ESL.API.Group apiGroup = new GroupConverter( group ).ToAPIGroup();
     apiGroup = apiClient.UpdateGroup( apiGroup, groupId.Id );
     Group sdkGroup = new GroupConverter( apiGroup ).ToSDKGroup();
     return sdkGroup;
 }
Example #5
0
 public Group GetGroup( GroupId groupId ) {
     Silanis.ESL.API.Group apiGroup = apiClient.GetGroup(groupId.Id);
     Group sdkGroup = new GroupConverter( apiGroup ).ToSDKGroup();
     return sdkGroup;
 }