adcioCreateSuggestion function

Future<AdcioSuggestionRawData> adcioCreateSuggestion({
  1. required String placementId,
  2. String? baseUrl,
  3. int? birthYear,
  4. String? area,
  5. String? customerId,
  6. String? gender,
  7. Offset? placementPosition,
  8. ApiClient? apiClient,
  9. String? deviceId,
  10. String? sessionId,
})

ADCIO suggest placement service.

placementId is required.

You enter the registered placementId on the ADCIO Admin Page.

example code:

adcioSuggest(
  placementId: '9f9f9b00-dc16-41c7-a5cd-f9a788d3d481',
).then((value) {
  rawData = value;
  setState(() {});
});

Additionally, if there are user details such as customerId (similar to userId), age, gender, and information related to the space like area, as well as placementPosition, the accuracy of recommendation predictions can be further enhanced.

Implementation

Future<AdcioSuggestionRawData> adcioCreateSuggestion({
  required String placementId,
  String? baseUrl,
  int? birthYear,
  String? area,
  String? customerId,
  String? gender,
  Offset? placementPosition,
  ApiClient? apiClient,
  String? deviceId,
  String? sessionId,
}) async {
  final client = apiClient ?? ApiClient(baseUrl: baseUrl);

  AdcioAnalytics.clearImpressionHistory();

  return client.suggestion(
    sessionId: sessionId ?? SessionIdentifier().loadId(),
    deviceId: deviceId ?? await DeviceIdentifier().loadId(),
    placementId: placementId,
    fromAgent: false,
    birthYear: birthYear,
    area: area,
    customerId: customerId,
    gender: convertGender(gender)?.name,
    placementPositionX: placementPosition?.dx.toInt(),
    placementPositionY: placementPosition?.dy.toInt(),
  );
}