createMembership method

Future<void> createMembership({
  1. required String agentSpaceId,
  2. required String applicationId,
  3. required MembershipType memberType,
  4. required String membershipId,
  5. MembershipConfig? config,
})

Creates a new membership, granting a user access to an agent space within an application.

Parameter agentSpaceId : The unique identifier of the agent space to grant access to.

Parameter applicationId : The unique identifier of the application that contains the agent space.

Parameter memberType : The type of member. Currently, only USER is supported.

Parameter membershipId : The unique identifier for the membership.

Parameter config : The configuration for the membership, such as the user role.

Implementation

Future<void> createMembership({
  required String agentSpaceId,
  required String applicationId,
  required MembershipType memberType,
  required String membershipId,
  MembershipConfig? config,
}) async {
  final $payload = <String, dynamic>{
    'agentSpaceId': agentSpaceId,
    'applicationId': applicationId,
    'memberType': memberType.value,
    'membershipId': membershipId,
    if (config != null) 'config': config,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/CreateMembership',
    exceptionFnMap: _exceptionFns,
  );
}