diff --git a/content/api/realtime-sdk/statistics.textile b/content/api/realtime-sdk/statistics.textile deleted file mode 100644 index 1ef356f00a..0000000000 --- a/content/api/realtime-sdk/statistics.textile +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: Statistics -meta_description: "Realtime Client Library SDK API reference section for the stats object." -meta_keywords: "Ably, Ably realtime, API Reference, Realtime SDK, stats, statistics" -section: api -languages: - - javascript - - nodejs - - ruby - - java - - swift - - objc - - csharp -redirect_from: - - /docs/api/versions/v1.1/realtime-sdk/statistics - - /docs/api/versions/v1.0/realtime-sdk/statistics - - /docs/api/versions/v0.8/realtime-sdk/statistics ---- - -h6(#stats). stats - -bq(definition). - jsall: stats(Object params?): Promise<"PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":#stats-type>> - ruby: "Deferrable":/docs/api/realtime-sdk/types#deferrable stats(Hash options) -> yields "PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":#stats-type> - java: "PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":#stats-type> stats("Param":#param[] options) - swift,objc: stats(query: ARTStatsQuery?, callback: ("ARTPaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"ARTStats":#stats-type>?, ARTErrorInfo?) -> Void) throws - csharp: Task<"PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":/docs/api/realtime-sdk/types#status>> StatsAsync("StatsRequestParams":#stats-request-params query) - -This call queries the "REST @/stats@ API":/docs/api/rest-api#stats and retrieves your application's usage statistics. A "PaginatedResult":/docs/api/realtime-sdk/types#paginated-result is returned, containing an array of "Stats":#stats-type for the first page of results. "PaginatedResult":/docs/api/realtime-sdk/types#paginated-result objects are iterable providing a means to page through historical statistics. "See an example set of raw stats returned via the REST API":/docs/metadata-stats/stats#metrics. - -<%= partial partial_version('realtime/_stats') %> - -h2(#related-types). Related types - -h3(#stats-type). - default: Stats object - objc,swift: ARTStats - java: io.ably.lib.types.Stats - ruby: Ably::Models::Stats - csharp: IO.Ably.Stats - -<%= partial partial_version('types/_stats') %> - -h3(#stats-request-params). - csharp: IO.Ably.StatsRequestParams - -blang[csharp]. - <%= partial partial_version('types/_history_request_params'), indent: 2, skip_first_indent: true %> - -h3(#stats-granularity). - objc,swift: ARTStatsGranularity - jsall: StatsIntervalGranularity - csharp: StatsIntervalGranularity - -<%= partial partial_version('types/_stats_granularity') %> - -h3(#param). - java: io.ably.lib.types.Param - -blang[java]. - <%= partial partial_version('types/_param'), indent: 2, skip_first_indent: true %> diff --git a/src/pages/docs/api/realtime-sdk/statistics.mdx b/src/pages/docs/api/realtime-sdk/statistics.mdx new file mode 100644 index 0000000000..d1ac9bba10 --- /dev/null +++ b/src/pages/docs/api/realtime-sdk/statistics.mdx @@ -0,0 +1,417 @@ +--- +title: Statistics +meta_description: "Realtime Client Library SDK API reference section for the stats object." +meta_keywords: "Ably, Ably realtime, API Reference, Realtime SDK, stats, statistics" +redirect_from: + - /docs/api/versions/v1.1/realtime-sdk/statistics + - /docs/api/versions/v1.0/realtime-sdk/statistics + - /docs/api/versions/v0.8/realtime-sdk/statistics +--- + +## Methods + +### stats + + + +`stats(Object params?): Promise>` + + + + + +`Deferrable stats(Hash options) → yields PaginatedResult` + + + + + +`PaginatedResult stats(Param[] options)` + + + + + +`stats(query: ARTStatsQuery?, callback: (ARTPaginatedResult?, ARTErrorInfo?) -> Void) throws` + + + + + +`Task> StatsAsync(StatsRequestParams query)` + + + +This call queries the [REST `/stats` API](/docs/api/rest-api#stats) and retrieves your application's usage statistics. A [PaginatedResult](/docs/api/realtime-sdk/types#paginated-result) is returned, containing an array of [Stats](#stats-type) for the first page of results. [PaginatedResult](/docs/api/realtime-sdk/types#paginated-result) objects are iterable providing a means to page through historical statistics. [See an example set of raw stats returned via the REST API](/docs/metadata-stats/stats#metrics). + +#### Parameters + + + +| Parameter | Description | Type | +|-----------|-------------|------| +| queryparamsoptions | An optional object containing the query parameters used to specify which statistics are retrieved. If not specified the default parameters will be used | [`StatsRequestParams`](#stats-request-params)[`Param[]`](#param)Object | + + + + + +| Parameter | Description | Type | +|-----------|-------------|------| +| options | An optional object containing the query parameters | Hash | +| &block | yields a `PaginatedResult` object | Block | + + + + + +| Parameter | Description | Type | +|-----------|-------------|------| +| query | An optional object containing the query parameters | `ARTStatsQuery` | +| callback | called with a ARTPaginatedResult<[ARTStats](/docs/api/rest-sdk/types#stats)> object or an error | Callback | + + + +#### `ARTStatsQuery` properties`StatsRequestParams` properties`params` properties`options` parameters + +The following options, as defined in the [REST `/stats` API](/docs/api/rest-api#stats) endpoint, are permitted: + + + +| Property | Description | Type | +|----------|-------------|------| +| start | Earliest time in milliseconds since the epoch for any stats retrieved.
_Default: beginning of time_ | `Number` | +| end | Latest time in milliseconds since the epoch for any stats retrieved.
_Default: current time_ | `Number` | +| direction | `forwards` or `backwards`.
_Default: `backwards`_ | `String` | +| limit | Maximum number of stats to retrieve up to 1,000.
_Default: `100`_ | `Number` | +| unit | `minute`, `hour`, `day` or `month`. Based on the unit selected, the given start or end times are rounded down to the start of the relevant interval depending on the unit granularity of the query.
_Default: `minute`_ | [`StatsIntervalGranularity`](/docs/api/realtime-sdk/types#stats-granularity) | + +
+ + + +| Property | Description | Type | +|----------|-------------|------| +| :start | Earliest `Time` or time in milliseconds since the epoch for any stats retrieved.
_Default: beginning of time_ | `Int` or `Time` | +| :end | Latest `Time` or time in milliseconds since the epoch for any stats retrieved.
_Default: current time_ | `Int` or `Time` | +| :direction | `:forwards` or `:backwards`.
_Default: `:backwards`_ | `Symbol` | +| :limit | Maximum number of stats to retrieve up to 1,000.
_Default: `100`_ | `Integer` | +| :unit | `:minute`, `:hour`, `:day` or `:month`. Based on the unit selected, the given start or end times are rounded down to the start of the relevant interval depending on the unit granularity of the query.
_Default: `:minute`_ | `Symbol` | + +
+ + + +| Property | Description | Type | +|----------|-------------|------| +| start | Earliest time in milliseconds since the epoch for any stats retrieved.
_Default: beginning of time_ | `Long` | +| end | Latest time in milliseconds since the epoch for any stats retrieved.
_Default: current time_ | `Long` | +| direction | `forwards` or `backwards`.
_Default: `backwards`_ | `String` | +| limit | Maximum number of stats to retrieve up to 1,000.
_Default: `100`_ | `Integer` | +| unit | `minute`, `hour`, `day` or `month`. Based on the unit selected, the given start or end times are rounded down to the start of the relevant interval depending on the unit granularity of the query.
_Default: `minute`_ | `String` | + +
+ + + +| Property | Description | Type | +|----------|-------------|------| +| start | Earliest time in milliseconds since the epoch for any stats retrieved.
_Default: beginning of time_ | `Long` | +| end | Latest time in milliseconds since the epoch for any stats retrieved.
_Default: current time_ | `Long` | +| direction | `forwards` or `backwards`.
_Default: `backwards`_ | `String` | +| limit | Maximum number of stats to retrieve up to 1,000.
_Default: `100`_ | `Integer` | +| unit | `minute`, `hour`, `day` or `month`. Based on the unit selected, the given start or end times are rounded down to the start of the relevant interval depending on the unit granularity of the query.
_Default: `minute`_ | [`ARTStatsGranularity`](/docs/api/realtime-sdk/types#stats-granularity) | + +
+ + + +| Property | Description | Type | +|----------|-------------|------| +| Start | Earliest `DateTimeOffset` or time in milliseconds since the epoch for any stats retrieved.
_Default: beginning of time_ | `DateTimeOffset` | +| End | Latest `DateTimeOffset` or time in milliseconds since the epoch for any stats retrieved.
_Default: current time_ | `DateTimeOffset` | +| Direction | `forwards` or `backwards`.
_Default: `backwards`_ | `Direction` enum | +| Limit | Maximum number of stats to retrieve up to 1,000.
_Default: `100`_ | `Integer` | +| Unit | `minute`, `hour`, `day` or `month`. Based on the unit selected, the given start or end times are rounded down to the start of the relevant interval depending on the unit granularity of the query.
_Default: `minute`_ | [`StatsIntervalGranularity`](/docs/api/realtime-sdk/types#stats-granularity) enum | + +
+ + + +#### Returns + +Returns a promise. On success, the promise is fulfilled with a [PaginatedResult](/docs/api/realtime-sdk/types#paginated-result) object containing an array of [Stats](/docs/api/realtime-sdk/types#stats) objects. On failure, the promise is rejected with an [ErrorInfo](/docs/api/realtime-sdk/types#error-info) object. + + + + + +#### Callback result + +On success, `result` contains a [PaginatedResult](#paginated-result) encapsulating an array of [Stats](/docs/api/realtime-sdk/types#stats) objects corresponding to the current page of results. [PaginatedResult](#paginated-result) supports pagination using [next](#paginated-result) and [first](#paginated-result) methods. + +On failure to retrieve stats, `err` contains an [ErrorInfo](#error-info) object with an error response as defined in the [Ably REST API](/docs/api/rest-api#common) documentation. + + + + + +#### Returns + +On success, the returned [PaginatedResult](#paginated-result) encapsulates an array of [Stats](/docs/api/realtime-sdk/types#stats) objects corresponding to the current page of results. [PaginatedResult](#paginated-result) supports pagination using [next](#paginated-result) and [first](#paginated-result) methods. + +Failure to retrieve the stats will raise an [AblyException](/docs/api/realtime-sdk/types#ably-exception) + + + + + +#### Returns + +Returns a `Task` which needs to be awaited. + +On success, the returned [PaginatedResult](#paginated-result) encapsulates an array of [Stats](/docs/api/realtime-sdk/types#stats) objects corresponding to the current page of results. [PaginatedResult](#paginated-result) supports pagination using [NextAsync](#paginated-result) and [FirstAsync](#paginated-result) methods. + +Failure to retrieve the stats will raise an [AblyException](/docs/api/realtime-sdk/types#ably-exception) + + + + + +#### Returns + +A [Deferrable](/docs/api/realtime-sdk/types#deferrable) object is returned from the stats method. + +On success, the registered success callbacks for the [Deferrable](/docs/api/realtime-sdk/types#deferrable) and any block provided to the method yields a [PaginatedResult](#paginated-result) that encapsulates an array of [Stats](/docs/api/realtime-sdk/types#stats) objects corresponding to the current page of results. [PaginatedResult](#paginated-result) supports pagination using [next](#paginated-result) and [first](#paginated-result) methods. + +Failure to retrieve the stats will trigger the errback callbacks of the [Deferrable](/docs/api/realtime-sdk/types#deferrable) with an [ErrorInfo](#error-info) object containing an error response as defined in the [Ably REST API](/docs/api/rest-api#common) documentation. + + + +## Related types
+ +### ARTStats io.ably.lib.types.Stats Ably::Models::Stats IO.Ably.Stats Stats object + +A `Stats` object represents an application's statistics for the specified interval and time period. Ably aggregates statistics globally for all accounts and applications, and makes these available both through our [statistics API](/docs/metadata-stats/stats) as well as your [application dashboard](https://ably.com/dashboard). + + + +Please note that most attributes of the `Stats` type below contain references to further stats types. This documentation is not exhaustive for all stats types, and as such, links to the stats types below will take you to the [Ruby library stats documentation](https://www.rubydoc.info/gems/ably/Ably/Models/Stats) which contains exhaustive stats documentation. Ruby and Python however uses `under_score` case instead of the default `camelCase` in most languages, so please bear that in mind. + + + +#### MembersAttributesProperties + + + +| Property | Description | Type | +|----------|-------------|------| +| unit | The length of the interval that this statistic covers, such as `:minute`, `:hour`, `:day`, `:month` | [`Stats::GRANULARITY`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats#GRANULARITY-constant) | +| interval_granularity | Deprecated alias for `unit`; scheduled to be removed in version 2.x client library versions | [`Stats::GRANULARITY`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats#GRANULARITY-constant) | +| interval_id | The UTC time at which the time period covered by this `Stats` object starts. For example, an interval ID value of "2018-03-01:10" in a `Stats` object whose `unit` is `day` would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All `Stats` objects, except those whose `unit` is `minute`, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the `unit` by looking at the resolution of the `intervalId`. `Stats` objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02" | `String` | +| interval_time | A `Time` object representing the parsed `interval_id` (the UTC time at which the time period covered by this `Stats` object starts) | `Time` | +| all | Aggregate count of both `inbound` and `outbound` message stats | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| api_requests | Breakdown of API requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| channels | Breakdown of channel related stats such as min, mean and peak channels | [`ResourceCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ResourceCount) | +| connections | Breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections | [`ConnectionTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ConnectionTypes) | +| inbound | Statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| outbound | Statistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| persisted | Messages persisted and later retrieved via the [history API](/docs/storage-history/history) | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| token_requests | Breakdown of Ably Token requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| push | Detailed stats on push notifications, see [our Push documentation](/push) for more details | `PushStats` | + + + + + +| Property | Description | Type | +|----------|-------------|------| +| unit | The length of the interval that this statistic covers, such as `'minute'`, `'hour'`, `'day'`, `'month'` | `String` | +| intervalId | The UTC time at which the time period covered by this `Stats` object starts. For example, an interval ID value of "2018-03-01:10" in a `Stats` object whose `unit` is `day` would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All `Stats` objects, except those whose `unit` is `minute`, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the `unit` by looking at the resolution of the `intervalId`. `Stats` objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02" | `String` | +| all | Aggregate count of both `inbound` and `outbound` message stats | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| apiRequests | Breakdown of API requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| channels | Breakdown of channel related stats such as min, mean and peak channels | [`ResourceCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ResourceCount) | +| connections | Breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections | [`ConnectionTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ConnectionTypes) | +| inbound | Statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| outbound | Statistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| persisted | Messages persisted and later retrieved via the [history API](/docs/storage-history/history) | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| tokenRequests | Breakdown of Ably Token requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| push | Detailed stats on push notifications, see [our Push documentation](/push) for more details | `PushStats` | + + + + + +| Property | Description | Type | +|----------|-------------|------| +| unit | The length of the interval that this statistic covers, such as `'minute'`, `'hour'`, `'day'`, `'month'` | `ARTStatsGranularity` | +| intervalGranularity | Deprecated alias for `unit`; scheduled to be removed in version 2.x client library versions | `ARTStatsGranularity` | +| intervalId | The UTC time at which the time period covered by this `Stats` object starts. For example, an interval ID value of "2018-03-01:10" in a `Stats` object whose `unit` is `day` would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All `Stats` objects, except those whose `unit` is `minute`, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the `unit` by looking at the resolution of the `intervalId`. `Stats` objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02" | `String` | +| all | Aggregate count of both `inbound` and `outbound` message stats | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| apiRequests | Breakdown of API requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| channels | Breakdown of channel related stats such as min, mean and peak channels | [`ResourceCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ResourceCount) | +| connections | Breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections | [`ConnectionTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ConnectionTypes) | +| inbound | Statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| outbound | Statistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| persisted | Messages persisted and later retrieved via the [history API](/docs/storage-history/history) | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| tokenRequests | Breakdown of Ably Token requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| push | Detailed stats on push notifications, see [our Push documentation](/push) for more details | `PushStats` | + + + + + +| Property | Description | Type | +|----------|-------------|------| +| unit | The length of the interval that this statistic covers, such as `Minute`, `Hour`, `Day`, `Month` | [`StatsIntervalGranularity`](/docs/api/realtime-sdk/types#stats-granularity) enum | +| intervalGranularity | Deprecated alias for `unit`; scheduled to be removed in version 2.x client library versions | [`StatsIntervalGranularity`](/docs/api/realtime-sdk/types#stats-granularity) enum | +| IntervalId | The UTC time at which the time period covered by this `Stats` object starts. For example, an interval ID value of "2018-03-01:10" in a `Stats` object whose `unit` is `day` would indicate that the period covered is "2018-03-01:10 .. 2018-03-01:11". All `Stats` objects, except those whose `unit` is `minute`, have an interval ID with resolution of one hour and the time period covered will always begin and end at a UTC hour boundary. For this reason it is not possible to infer the `unit` by looking at the resolution of the `intervalId`. `Stats` objects covering an individual minute will have an interval ID indicating that time; for example "2018-03-01:10:02" | `String` | +| IntervalTime | A `DateTimeOffset` object representing the parsed `IntervalId` (the UTC time at which the time period covered by this `Stats` object starts) | `DateTimeOffset` | +| All | Aggregate count of both `inbound` and `outbound` message stats | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| ApiRequests | Breakdown of API requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| Channels | Breakdown of channel related stats such as min, mean and peak channels | [`ResourceCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ResourceCount) | +| Connections | Breakdown of connection related stats such as min, mean and peak connections for TLS and non-TLS connections | [`ConnectionTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/ConnectionTypes) | +| Inbound | Statistics such as count and data for all inbound messages received over REST and Realtime connections, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| Outbound | Statistics such as count and data for all outbound messages retrieved via REST history requests, received over Realtime connections, or pushed with Webhooks, organized into normal channel messages or presence messages | [`MessageTraffic`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTraffic) | +| Persisted | Messages persisted and later retrieved via the [history API](/docs/storage-history/history) | [`MessageTypes`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/MessageTypes) | +| TokenRequests | Breakdown of Ably Token requests received via the Ably REST API | [`RequestCount`](https://www.rubydoc.info/gems/ably/Ably/Models/Stats/RequestCount) | +| Push | Detailed stats on [push notifications](/push) | `PushStats` | + + + + + +| Property | Description | Type | +|----------|-------------|------| +| appId | The ID of the Ably application the statistics relate to | `String` | +| entries | The statistics for the requested time interval and time period. The `schema` property provides further information | `Partial>` | +| inProgress | Optional. For entries that are still in progress, such as the current month, the last sub-interval included in the stats entry. In the format `yyyy-mm-dd:hh:mm:ss` | `String` | +| intervalId | The UTC time period that the stats coverage begins at. If `unit` was requested as `minute` this will be in the format `YYYY-mm-dd:HH:MM`, if `hour` it will be `YYYY-mm-dd:HH`, if `day` it will be `YYYY-mm-dd:00` and if `month` it will be `YYYY-mm-01:00` | `String` | +| schema | The URL of a JSON schema describing the structure of the `Stats` object | `String` | + + + + + +### IO.Ably.StatsRequestParams + +`StatsRequestParams` is a type that encapsulates the parameters for a stats query. For example usage see [Realtime#Stats](/docs/metadata-stats/stats). + +#### Members + +| Property | Description | Type | +|----------|-------------|------| +| Start | The start of the queried interval.
_Default: `null`_ | `DateTimeOffset` | +| End | The end of the queried interval.
_Default: `null`_ | `DateTimeOffset` | +| Limit | Limits the number of items returned by history or stats.
_Default: `null`_ | `Integer` | +| Direction | Enum which is either `Forwards` or `Backwards`.
_Default: `Backwards`_ | `Direction` enum | +| ExtraParameters | Optionally any extra query parameters that may be passed to the query. This is mainly used internally by the library to manage paging.
_Default: `null`_ | `Dictionary` | + + + +### ARTStatsGranularity
StatsIntervalGranularity + + +`StatsIntervalGranularity` is an enum specifying the granularity of a [Stats interval](/docs/api/rest-sdk/statistics#stats-type). + + + +```javascript +const StatsIntervalGranularity = [ + 'minute', + 'hour', + 'day', + 'month' +] +``` + + + + + +```nodejs +const StatsIntervalGranularity = [ + 'minute', + 'hour', + 'day', + 'month' +] +``` + + + + + + +`ARTStatsGranularity` is an enum specifying the granularity of a [ARTStats interval](/docs/api/rest-sdk/statistics#stats-type). + + + + +```objc +typedef NS_ENUM(NSUInteger, ARTStatsGranularity) { + ARTStatsGranularityMinute, + ARTStatsGranularityHour, + ARTStatsGranularityDay, + ARTStatsGranularityMonth +}; +``` + + + + + + + + + +```swift +enum ARTStatsGranularity : UInt { + case Minute + case Hour + case Day + case Month +} +``` + + + + + + + + + + +`StatsIntervalGranularity` is an enum specifying the granularity of a [Stats interval](/docs/api/rest-sdk/statistics#stats-type). + + +```csharp +public enum StatsIntervalGranularity +{ + Minute, + Hour, + Day, + Month +} +``` + + + + + + +### io.ably.lib.types.Param + +`Param` is a type encapsulating a key/value pair. This type is used frequently in method parameters allowing key/value pairs to be used more flexible, see [Channel history](/docs/api/realtime-sdk/history#channel-history) for an example. + +Please note that `key` and `value` attributes are always strings. If an `Integer` or other value type is expected, then you must coerce that type into a `String`. + +#### Members + +| Property | Description | Type | +|----------|-------------|------| +| key | The key value | `String` | +| value | The value associated with the `key` | `String` | + +