update method

Future<UpdateOrganizationResponse> update({
  1. required UpdateOrganizationRequest data,
  2. required String organizationId,
})

Update an organization

name The name of the organization logo The logo of the organization metadata The metadata of the organization slug The slug of the organization

Implementation

Future<UpdateOrganizationResponse> update({
  required UpdateOrganizationRequest data,
  required String organizationId,
}) async {
  try {
    final response = await dio.post(
      "/organization/update",
      data: {
        "organizationId": organizationId,
        "data": data.toJson()..removeWhere((key, value) => value == null),
      },
      options: await getOptions(isTokenRequired: true),
    );
    return UpdateOrganizationResponse.fromJson(response.data);
  } catch (e) {
    final message = getErrorMessage(e);
    if (message == null) rethrow;
    throw message;
  }
}