/// <summary>
        /// Gets Info.
        /// </summary>
        /// <param name="shortUrl">The short URL.</param>
        /// <returns>Task&lt;JObject&gt;.</returns>
        /// <exception cref="ArgumentNullException">shortUrl</exception>
        public Task <dynamic> GetInfo(string shortUrl)
        {
            if (shortUrl == null)
            {
                throw new ArgumentNullException(nameof(shortUrl));
            }
            var path  = util.createOwlyPath("url", "info");
            var query = Restler.GetQuery(null, new
            {
                apiKey = _connection.ApiKey,
                shortUrl
            });

            return(_connection.get(path, new { query }));
        }
        /// <summary>
        /// Gets the click stats.
        /// </summary>
        /// <param name="shortUrl">The short URL.</param>
        /// <param name="from">From.</param>
        /// <param name="to">To.</param>
        /// <returns>Task&lt;JObject&gt;.</returns>
        /// <exception cref="ArgumentNullException">shortUrl</exception>
        public Task <dynamic> GetClickStats(string shortUrl, DateTime?from, DateTime?to)
        {
            if (shortUrl == null)
            {
                throw new ArgumentNullException(nameof(shortUrl));
            }
            var path = util.createOwlyPath("url", "clickStats");
            //YYYY-MM-DD HH:mm:SS
            var query = Restler.GetQuery(null, new
            {
                apiKey = _connection.ApiKey,
                shortUrl,
                from = from?.ToString("yyyy-MM-dd HH:mm:ss"),
                to   = to?.ToString("yyyy-MM-dd HH:mm:ss")
            });

            return(_connection.get(path, new { query }));
        }
Exemple #3
0
        /// <summary>
        /// Finds the specified start time.
        /// </summary>
        /// <param name="startTime">The start time.</param>
        /// <param name="endTime">The end time.</param>
        /// <param name="socialProfileIds">The social profile ids.</param>
        /// <param name="options">The opts.</param>
        /// <returns>Task&lt;JObject&gt;.</returns>
        public Task <dynamic> FindAll(DateTime startTime, DateTime endTime, string[] socialProfileIds = null, dynamic options = null)
        {
            var path = util.createPath("messages");

            options = dyn.exp(options);
            var query = Restler.GetQuery(null, new
            {
                startTime = startTime.ToString("o"),
                endTime   = endTime.ToString("o"),
                state     = dyn.getProp <string>(options, "state"),
                limit     = dyn.getProp <string>(options, "limit"),
                cursor    = dyn.getProp <string>(options, "cursor"),
            });

            if (socialProfileIds != null)
            {
                query += string.Join(string.Empty, socialProfileIds.Select(x => $"&socialProfileIds=${Uri.EscapeDataString(x)}").ToArray());
            }
            options.query = query;
            return(_connection.get(path, options));
        }