Beispiel #1
0
        /// <summary>
        /// Retrieves the ably service time
        /// </summary>
        /// <returns></returns>
        public DateTimeOffset Time()
        {
            var request = RestMethods.CreateGetRequest("/time");

            request.SkipAuthentication = true;
            var response = RestMethods.ExecuteRequest <List <long> >(request);

            return(response.First().FromUnixTimeInMilliseconds());
        }
Beispiel #2
0
        /// <summary>
        /// Retrieves the stats for the application based on a custom query. It should be used with <see cref="DataRequestQuery"/>.
        /// It is mainly because of the way a PaginatedResource defines its queries. For retrieving Stats with special parameters use <see cref="RestClient.Stats(StatsDataRequestQuery query)"/>
        /// </summary>
        /// <example>
        /// var client = new RestClient("validkey");
        /// var stats = client.Stats();
        /// var nextPage = cliest.Stats(stats.NextQuery);
        /// </example>
        /// <param name="query"><see cref="DataRequestQuery"/> and <see cref="StatsDataRequestQuery"/></param>
        /// <returns></returns>
        public IPaginatedResource <Stats> Stats(DataRequestQuery query)
        {
            query.Validate();

            var request = RestMethods.CreateGetRequest("/stats");

            request.AddQueryParameters(query.GetParameters());

            return(RestMethods.ExecuteRequest <PaginatedResource <Stats> >(request));
        }