getEmbeddedGraphResource method

Future<String?> getEmbeddedGraphResource(
  1. String apiKey,
  2. String customerId,
  3. String externalUserId,
  4. String type, {
  5. int? brandId,
})

Implementation

Future<String?> getEmbeddedGraphResource(
  String apiKey,
  String customerId,
  String externalUserId,
  String type, {
  int? brandId,
}) async {
  try {
    final payload = {
      'useExternal': true,
      'type': type,
    };

    if (brandId != null) {
      payload['brandId'] = brandId;
    }

    final result = await dio.post(
      '${Config.url}/graphs/$externalUserId/link',
      data: payload,
      options: Options(
        headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json',
          "x-api-key": apiKey,
          "x-customer": customerId,
        },
      ),
    );
    return result.data['link'];
  } catch (e) {
    return null;
  }
}