createOrganizationMembershipWithHttpInfo method

Future<Response> createOrganizationMembershipWithHttpInfo(
  1. String organizationId,
  2. CreateOrganizationMembershipRequest createOrganizationMembershipRequest
)

Create a new organization membership

Adds a user as a member to the given organization. Only users in the same instance as the organization can be added as members. This organization will be the user's active organization (https://clerk.com/docs/organizations/overview#active-organization) the next time they create a session, presuming they don't explicitly set a different organization as active before then.

Note: This method returns the HTTP Response.

Parameters:

Implementation

Future<http.Response> createOrganizationMembershipWithHttpInfo(
  String organizationId,
  CreateOrganizationMembershipRequest createOrganizationMembershipRequest,
) async {
  // ignore: prefer_const_declarations
  final path = r'/organizations/{organization_id}/memberships'
      .replaceAll('{organization_id}', organizationId);

  // ignore: prefer_final_locals
  Object? postBody = createOrganizationMembershipRequest;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/json'];

  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}