/// <summary> /// Initializes a new instance of the <see cref="T:Switchvox.CallLogs.Search"/> class for searches where multiple search criteria can be specified. /// </summary> /// <param name="startDate">The minimum date to search from.</param> /// <param name="endDate">The maximum date to search to.</param> /// <param name="searchData">A <see cref="Switchvox.CallLogs.Search.MultiItemSearchData"/> value representing the type of data this request will search for.</param> /// <param name="dataValues">An array of one or more values to search for that correspond with the type of data specified in <paramref name="searchData"/></param> /// <param name="sortOrder">How the response will be sorted</param> /// <param name="itemsPerPage">The maximum number of records to be returned by the response. An additional <paramref name="itemsPerPage"/> number of records can be retrieved by making additional requests and modifying the <paramref name="pageNumber"/></param> /// <param name="pageNumber">The page number of call record results to return.</param> public Search(DateTime startDate, DateTime endDate, MultiItemSearchData searchData, string[] dataValues, SortOrder sortOrder = SortOrder.Desc, int itemsPerPage = 50, int pageNumber = 1) : base("switchvox.callLogs.search") { if (dataValues.Length == 0) throw new ArgumentException("At least one value must be specified"); var searchDataElms = GetMultiItemSearchDataElms(searchData, dataValues); ConstructXml(startDate, endDate, searchDataElms, sortOrder, itemsPerPage, pageNumber); }
private XElement GetMultiItemSearchDataElms(MultiItemSearchData searchData, string[] data) { XElement xml; switch(searchData) { case MultiItemSearchData.AccountIds: xml = GetElmsForGroup("account_ids", "account_id", data); break; case MultiItemSearchData.ChannelGroupIds: xml = GetElmsForGroup("channel_group_ids", "channel_group_id", data); break; case MultiItemSearchData.IAXProviderIds: xml = GetElmsForGroup("iax_provider_ids", "iax_provider_id", data); break; case MultiItemSearchData.SIPProviderIds: xml = GetElmsForGroup("sip_provider_ids", "sip_provider_id", data); break; default: throw new NotImplementedException("No handler for the value " + searchData.ToString() + " has been implemented."); } return xml; }