libusermetrics

Typedefs | Enumerations | Functions
usermetricsinput.h File Reference
`#include <libusermetricsinput/UserMetricsInputExport.h>`
Include dependency graph for usermetricsinput.h:

Go to the source code of this file.

## Typedefs
typedef void * | UserMetricsInputMetricManager
| A central place for registering user metrics. More...
typedef void * | UserMetricsInputMetricParameters
| Parameters for constructing a metric. More...
typedef void * | UserMetricsInputMetric
| A single user metric, e.g. "number of e-mails today" or "photos taken today". More...
typedef void * | UserMetricsInputMetricUpdate
| A update to a user metric for a particular user. More...

## Enumerations
enum | USERMETRICSINPUT_METRICTYPE { METRIC_TYPE_USER, METRIC_TYPE_SYSTEM }

## Functions
USERMETRICSINPUT_EXPORT UserMetricsInputMetricManager | usermetricsinput_metricmanager_new ()
| Construct a new UserMetricsInputMetricManager. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricmanager_delete (UserMetricsInputMetricManager metricManager)
| Free a UserMetricsInputMetricManager. More...
USERMETRICSINPUT_EXPORT UserMetricsInputMetricParameters | usermetricsinput_metricparameters_new (const char *dataSourceId)
| Construct a new UserMetricsInputMetricParameters. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricparameters_set_format_string (UserMetricsInputMetricParameters metricParameter, const char *formatString)
| Set the string to print in the output API, e.g. "<b>%1</b> messages received today". More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricparameters_set_empty_data_string (UserMetricsInputMetricParameters metricParameter, const char *emptyDataString)
| set the string to print in the case of no data, e.g. "No messages received today" More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricparameters_set_text_domain (UserMetricsInputMetricParameters metricParameter, const char *textDomain)
| Set the translation domain. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricparameters_set_minimum (UserMetricsInputMetricParameters metricParameter, double minimum)
| Set the minimum display value for this metric. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricparameters_set_maximum (UserMetricsInputMetricParameters metricParameter, double maximum)
| Set the maximum display value for this metric. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricparameters_set_type (UserMetricsInputMetricParameters metricParameter, USERMETRICSINPUT_METRICTYPE metricType)
| Set the type of metric this is (user owned or system owned) More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricparameters_delete (UserMetricsInputMetricParameters metricParameters)
| Free a UserMetricsInputMetricParameters. More...
USERMETRICSINPUT_EXPORT UserMetricsInputMetric | usermetricsinput_metricmanager_add (UserMetricsInputMetricManager metricManager, UserMetricsInputMetricParameters metricParameters)
| Register a new UserMetricsInputMetric. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metric_increment (UserMetricsInputMetric metric, double amount, const char *username)
| Increment the "today" value for a simple user metric. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metric_update_today (UserMetricsInputMetric metric, double value, const char *username)
| Update the "today" value for a simple user metric. More...
USERMETRICSINPUT_EXPORT UserMetricsInputMetricUpdate | usermetricsinput_metric_update (UserMetricsInputMetric metric, const char *username)
| Create an update to a particular metric. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricupdate_delete (UserMetricsInputMetricUpdate metricUpdate)
| Free a UserMetricsInputMetric. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricupdate_add_data (UserMetricsInputMetricUpdate metricUpdate, double data)
| Add data to a UserMetricsInputMetricUpdate. More...
USERMETRICSINPUT_EXPORT void | usermetricsinput_metricupdate_add_null (UserMetricsInputMetricUpdate metricUpdate)
| Add unknown data to an update. More...

## Typedef Documentation

## ◆ UserMetricsInputMetric

typedef void* UserMetricsInputMetric

A single user metric, e.g. "number of e-mails today" or "photos taken today".

## ◆ UserMetricsInputMetricManager

typedef void* UserMetricsInputMetricManager

A central place for registering user metrics.

## ◆ UserMetricsInputMetricParameters

typedef void* UserMetricsInputMetricParameters

Parameters for constructing a metric.

## ◆ UserMetricsInputMetricUpdate

typedef void* UserMetricsInputMetricUpdate

A update to a user metric for a particular user.

## Enumeration Type Documentation

## ◆ USERMETRICSINPUT_METRICTYPE

enum USERMETRICSINPUT_METRICTYPE

Enumerator
METRIC_TYPE_USER |
METRIC_TYPE_SYSTEM |

## Function Documentation

## ◆ usermetricsinput_metric_increment()

USERMETRICSINPUT_EXPORT void usermetricsinput_metric_increment | ( | UserMetricsInputMetric | metric,
|  | double | amount,
|  | const char * | username
| ) |  |

Increment the "today" value for a simple user metric.

Parameters

  metric |
  amount | How much to increase the metric by - usually 1.
  username | The user to update the data for. If blank ("") then the current user is used.

Examples
  MetricManagerIncrementTodayCAPI.c.

## ◆ usermetricsinput_metric_update()

USERMETRICSINPUT_EXPORT UserMetricsInputMetricUpdate usermetricsinput_metric_update | ( | UserMetricsInputMetric | metric,
|  | const char * | username
| ) |  |

Create an update to a particular metric.

Parameters

  metric |
  username | The user to update the data for. If blank ("") then the current user is used.

Must be freed with usermetricsinput_metricupdate_delete - this is when the actual update will be sent to the storage service.

Examples
  MetricManagerAdvancedCAPI.c.

## ◆ usermetricsinput_metric_update_today()

USERMETRICSINPUT_EXPORT void usermetricsinput_metric_update_today | ( | UserMetricsInputMetric | metric,
|  | double | value,
|  | const char * | username
| ) |  |

Update the "today" value for a simple user metric.

Parameters

  metric |
  value | Today's value
  username | The user to update the data for. If blank ("") then the current user is used.

Examples
  MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricmanager_add()

USERMETRICSINPUT_EXPORT UserMetricsInputMetric usermetricsinput_metricmanager_add | ( | UserMetricsInputMetricManager | metricManager,
|  | UserMetricsInputMetricParameters | metricParameters
| ) |  |

Register a new UserMetricsInputMetric.

Parameters

  metricManager |
  metricParameters | The parameters of the metric to create

Do not attempt to delete this object.

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricmanager_delete()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricmanager_delete | ( | UserMetricsInputMetricManager | metricManager | ) |

Free a UserMetricsInputMetricManager.

Parameters

  metricManager | The UserMetricsInputMetricManager to free

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricmanager_new()

USERMETRICSINPUT_EXPORT UserMetricsInputMetricManager usermetricsinput_metricmanager_new | ( |  | ) |

Construct a new UserMetricsInputMetricManager.

Must be freed with usermetricsinput_metricmanager_delete

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricparameters_delete()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_delete | ( | UserMetricsInputMetricParameters | metricParameters | ) |

Free a UserMetricsInputMetricParameters.

Parameters

  metricParameters | The UserMetricsInputMetricManager to free

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricparameters_new()

USERMETRICSINPUT_EXPORT UserMetricsInputMetricParameters usermetricsinput_metricparameters_new | ( | const char * | dataSourceId | ) |

Construct a new UserMetricsInputMetricParameters.

Parameters

  dataSourceId | The unique ID of the data source, e.g. "facebook"

Must be freed with usermetricsinput_metricparameters_delete

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricparameters_set_empty_data_string()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_empty_data_string | ( | UserMetricsInputMetricParameters | metricParameter,
|  | const char * | emptyDataString
| ) |  |

set the string to print in the case of no data, e.g. "No messages received today"

Parameters

  metricParameter |
  emptyDataString |

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricparameters_set_format_string()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_format_string | ( | UserMetricsInputMetricParameters | metricParameter,
|  | const char * | formatString
| ) |  |

Set the string to print in the output API, e.g. "<b>%1</b> messages received today".

Parameters

  metricParameter |
  formatString |

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricparameters_set_maximum()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_maximum | ( | UserMetricsInputMetricParameters | metricParameter,
|  | double | maximum
| ) |  |

Set the maximum display value for this metric.

Parameters

  metricParameter |
  maximum |

## ◆ usermetricsinput_metricparameters_set_minimum()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_minimum | ( | UserMetricsInputMetricParameters | metricParameter,
|  | double | minimum
| ) |  |

Set the minimum display value for this metric.

Parameters

  metricParameter |
  minimum |

## ◆ usermetricsinput_metricparameters_set_text_domain()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_text_domain | ( | UserMetricsInputMetricParameters | metricParameter,
|  | const char * | textDomain
| ) |  |

Set the translation domain.

Parameters

  metricParameter |
  textDomain |

Examples
  MetricManagerAdvancedCAPI.c, MetricManagerIncrementTodayCAPI.c, and MetricManagerUpdateTodayCAPI.c.

## ◆ usermetricsinput_metricparameters_set_type()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricparameters_set_type | ( | UserMetricsInputMetricParameters | metricParameter,
|  | USERMETRICSINPUT_METRICTYPE | metricType
| ) |  |

Set the type of metric this is (user owned or system owned)

Parameters

  metricParameter |
  metricType |

## ◆ usermetricsinput_metricupdate_add_data()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_add_data | ( | UserMetricsInputMetricUpdate | metricUpdate,
|  | double | data
| ) |  |

Add data to a UserMetricsInputMetricUpdate.

Parameters

  metricUpdate | The UserMetricsInputMetricUpdate to add data to
  data | The double-valued data to add

Each call to this method appends a new day's data to the update. So the first call adds data for today, the second call adds data for yesterday, and so on.

Examples
  MetricManagerAdvancedCAPI.c.

## ◆ usermetricsinput_metricupdate_add_null()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_add_null | ( | UserMetricsInputMetricUpdate | metricUpdate | ) |

Add unknown data to an update.

Parameters

  metricUpdate | The UserMetricsInputMetricUpdate to add data to

If data is not known for a particular day, then null can be added.

## ◆ usermetricsinput_metricupdate_delete()

USERMETRICSINPUT_EXPORT void usermetricsinput_metricupdate_delete | ( | UserMetricsInputMetricUpdate | metricUpdate | ) |

Free a UserMetricsInputMetric.

Parameters

  metricUpdate | The UserMetricsInputMetric to free and dispatch

This will cause the update to be dispatched.

Examples
  MetricManagerAdvancedCAPI.c.