createRandomID static method

Future<SuccessRandomIDResponseModel> createRandomID(
  1. String apiKey, {
  2. bool debugMode = kDebugMode,
})

Create a randomID GIPHY Random ID Endpoint allows GIPHY to generate a unique ID you can assign to each new user in your app. More info on Giphy documentation: https://developers.giphy.com/docs/api/endpoint#random-id

Implementation

static Future<SuccessRandomIDResponseModel> createRandomID(
  String apiKey, {
  bool debugMode = kDebugMode,
}) async {
  const baseUrl = GiphyAPIPath.baseUrl;

  final pathSegments = [
    GiphyAPIPath.version1,
    GiphyAPIPath.randomId,
  ];

  Map<String, dynamic> queryParameters = {
    'api_key': apiKey,
  };

  // Make the request

  final responseMap = await GiphyApiManager.get(
    baseUrl,
    pathSegments,
    queryParameters: queryParameters,
    debugMode: debugMode,
  );

  // Parse the response

  return SuccessRandomIDResponseModel.fromJson(responseMap);
}