示例#1
0
        /// <summary>
        /// Shortens the URL.
        /// </summary>
        /// <param name="longUrl">The long URL.</param>
        /// <returns>Task&lt;JObject&gt;.</returns>
        /// <exception cref="ArgumentNullException">longUrl</exception>
        public Task <dynamic> ShortenUrl(string longUrl)
        {
            if (longUrl == null)
            {
                throw new ArgumentNullException(nameof(longUrl));
            }

            var path  = util.createOwlyPath("url", "shorten");
            var query = Restler.GetQuery(null, new
            {
                apiKey = _connection.ApiKey,
                longUrl
            });

            return(_connection.get(path, new { query }));
        }
示例#2
0
        /// <summary>
        /// Shortens the URL.
        /// </summary>
        /// <param name="longUrl">The long URL.</param>
        /// <returns>Task&lt;JObject&gt;.</returns>
        public Task <dynamic> ShortenUrl(string longUrl)
        {
            var path = util.createOwlyPath("url", "shorten");

            return(_connection.get(path, new { longUrl }));
        }