示例#1
0
        /// <summary>
        /// Returns a List of <see cref="Archive"/> objects, representing archives that are both
        /// both completed and in-progress, for your API key.
        /// </summary>
        /// <param name="offset">
        /// The index offset of the first archive. 0 is offset of the most recently started archive.
        /// 1 is the offset of the archive that started prior to the most recent archive.
        /// </param>
        /// <param name="count">
        /// The number of archives to be returned. The maximum number of archives returned is 1000.
        /// </param>
        /// <returns>A List of <see cref="Archive"/> objects.</returns>
        public ArchiveList ListArchives(int offset = 0, int count = 0, string sessionId = "")
        {
            if (count < 0)
            {
                throw new OpenTokArgumentException("count cannot be smaller than 0");
            }
            string url = string.Format("v2/project/{0}/archive?offset={1}", this.ApiKey, offset);

            if (count > 0)
            {
                url = string.Format("{0}&count={1}", url, count);
            }
            if (!string.IsNullOrEmpty(sessionId))
            {
                if (!OpenTokUtils.ValidateSession(sessionId))
                {
                    throw new OpenTokArgumentException("Session Id is not valid");
                }
                url = $"{url}&sessionId={sessionId}";
            }
            string      response     = Client.Get(url);
            JObject     archives     = JObject.Parse(response);
            JArray      archiveArray = (JArray)archives["items"];
            ArchiveList archiveList  = new ArchiveList(archiveArray.ToObject <List <Archive> >(), (int)archives["count"]);

            return(archiveList);
        }
示例#2
0
        /**
         * Returns a List of Archive objects, representing archives that are both
         * both completed and in-progress, for your API key.
         *
         * @param offset The index offset of the first archive. 0 is offset of the most recently
         * started archive. 1 is the offset of the archive that started prior to the most recent
         * archive.
         *
         * @param count The number of archives to be returned. The maximum number of archives
         * returned is 1000.
         *
         * @return A List of Archive objects.
         */
        public ArchiveList ListArchives(int offset, int count)
        {
            if (count < 0)
            {
                throw new OpenTokArgumentException("count cannot be smaller than 1");
            }
            string url = string.Format("v2/project/{0}/archive?offset={1}", this.ApiKey, offset);

            if (count > 0)
            {
                url = string.Format("{0}&count={1}", url, count);
            }
            string      response     = Client.Get(url);
            JObject     archives     = JObject.Parse(response);
            JArray      archiveArray = (JArray)archives["items"];
            ArchiveList archiveList  = new ArchiveList(archiveArray.ToObject <List <Archive> >(), (int)archives["count"]);

            return(archiveList);
        }