Пример #1
0
 /// <summary>
 /// Determines whether the specified <see cref="Cronofy.Channel"/> is
 /// equal to the current <see cref="Cronofy.Channel"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="Cronofy.Channel"/> to compare with the current
 /// <see cref="Cronofy.Channel"/>.
 /// </param>
 /// <returns>
 /// <c>true</c> if the specified <see cref="Cronofy.Channel"/> is equal
 /// to the current <see cref="Cronofy.Channel"/>; otherwise,
 /// <c>false</c>.
 /// </returns>
 public bool Equals(Channel other)
 {
     return other != null
         && this.Id == other.Id
         && this.CallbackUrl == other.CallbackUrl
         && object.Equals(this.Filters, other.Filters);
 }
        public static IEnumerable <Cronofy.Channel> GetChannels()
        {
            IEnumerable <Cronofy.Channel> channels = new Cronofy.Channel[0];

            try
            {
                channels = CronofyAccountRequest <IEnumerable <Cronofy.Channel> >(() => { return(AccountClient.GetChannels()); });
                LogHelper.Log("GetChannels success");
            }
            catch (CronofyException)
            {
                LogHelper.Log("GetChannels failure");
            }

            return(channels);
        }
        public static Cronofy.Channel CreateChannel(string path, bool onlyManaged, IEnumerable <string> calendarIds)
        {
            Cronofy.Channel channel = null;

            var builtChannel = new CreateChannelBuilder()
                               .CallbackUrl(path)
                               .OnlyManaged(onlyManaged)
                               .CalendarIds(calendarIds)
                               .Build();

            try
            {
                channel = CronofyAccountRequest <Cronofy.Channel>(() => { return(AccountClient.CreateChannel(builtChannel)); });
                LogHelper.Log(String.Format("CreateChannel success - path=`{0}` - onlyManaged=`{1}` - calendarIds=`{2}`", path, onlyManaged, String.Join(",", calendarIds)));
            }
            catch (CronofyException)
            {
                LogHelper.Log(String.Format("CreateChannel failure - path=`{0}` - onlyManaged=`{1}` - calendarIds=`{2}`", path, onlyManaged, String.Join(",", calendarIds)));
                throw;
            }

            return(channel);
        }