import '../blocs/organization/organization_state.dart';
import 'api_client.dart';

class OrgApi {
  final ApiClient _apiClient;

  OrgApi(this._apiClient);

  Future<List<Organization>> getOrganizations() async {
    return await _apiClient.getList(
      '/orgs',
      fromJson: (data) => Organization.fromJson(data),
    );
  }

  Future<Organization> createOrganization(String name) async {
    return await _apiClient.post(
      '/orgs',
      data: {'name': name},
      fromJson: (data) => Organization.fromJson(data),
    );
  }
}
