/** * Copyright since 2025 Mifos Initiative * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { Injectable, inject } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; import { Observable } from 'rxjs'; export interface RbiFeedItem { id: number; title: string; link: string; description: string; pubDate: any; // Fineract returns [year,month,day,hour,min,sec] array category: string; fetchedOn?: any; openProjectWpId?: number; // OpenProject work package ID openProjectWpStatus?: string; openProjectWpProgress?: number; } @Injectable({ providedIn: 'root' }) export class RbiCircularsService { private http = inject(HttpClient); getAll(category?: string): Observable { let params = new HttpParams(); if (category) { params = params.set('category', category); } return this.http.get('/rbi-feeds', { params }); } getById(id: number): Observable { return this.http.get(`/rbi-feeds/${id}`); } triggerFetch(): Observable { return this.http.post('/rbi-feeds/fetch', {}); } /** * Members and share capital per share type for one financial year, with the year before alongside. * * @param financialYear the year the FY opens in — 2025 means FY 2025-26. */ getShareCapitalReturn(financialYear: number): Observable { return this.http.get('/shareproducts/capital-return', { params: new HttpParams().set('financialYear', String(financialYear)) }); } /** Financial years that actually have share activity, newest first, for the year picker. */ getShareCapitalReturnYears(): Observable { return this.http.get('/shareproducts/capital-return/financial-years'); } }