createOrReplaceProfile method

Future<KuzzleProfile> createOrReplaceProfile(
  1. String id,
  2. List<Map<String, dynamic>> policies, {
  3. bool? waitForRefresh,
})

Creates a new profile or, if the provided profile identifier already exists, replaces it.

Implementation

Future<KuzzleProfile> createOrReplaceProfile(
    String id, List<Map<String, dynamic>> policies,
    {bool? waitForRefresh}) async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'createOrReplaceProfile',
    uid: id,
    waitForRefresh: waitForRefresh,
    body: <String, dynamic>{
      'policies': policies,
    },
  ));

  return KuzzleProfile.fromKuzzleResponse(kuzzle, response);
}