createInvite method

Future createInvite(
  1. String channelId, {
  2. int? maxAge,
  3. int? maxUses,
  4. bool? temporary,
  5. bool? unique,
  6. String? targetUser,
  7. String? targetUserType,
})

Implementation

Future createInvite(
  String channelId, {
  int? maxAge, //seconds
  int? maxUses,
  bool? temporary,
  bool? unique,
  String? targetUser,
  String? targetUserType,
}) {
  var endpoint = '/channels/$channelId/invites';
  return _http.request(
    endpoint,
    converter: _http.asNull,
    method: 'post',
    body: {
      ...insertNotNull('max_age', maxAge),
      ...insertNotNull('max_uses', maxUses),
      ...insertNotNull('temporary', temporary),
      ...insertNotNull('unique', unique),
      ...insertNotNull('target_user', targetUser),
      ...insertNotNull('target_user_type', targetUserType),
    },
  );
}