@@ -18,7 +18,7 @@ import config from "@/lib/config";
1818import { client } from "./api/client.gen" ;
1919import * as sdk from "./api/sdk.gen" ;
2020
21- const { getAppConfig, getAppInfo, postAuthLogin, postAuthChangePassword, postAuthSignup, postAuthValidateAuth, deleteAuthDeleteAccount, patchAuthUpdateUserProperty, getLinksCollections, postLinksCollections, putLinksCollectionsByCollectionId, postLinksTags, putLinksTagsByTagId, getLinksHomeGroups, postLinksHomeGroups, putLinksFoldersByFolderIdIcon, getLinksHome, getLinksFolders, postLinksFolders, getLinksItems, getLinksTags, postLinksItems, putLinksItemsByLinkId, deleteLinksItemsByLinkId, postLinksReorder, getIntegrations, postIntegrations, putIntegrationsById, deleteIntegrationsById, postIntegrationsTestEndpoint, getIntegrationsWidgetProperties, getWidgetsByIntegration, postIntegrationsConsumerData, getIntegrationsCaldavEvents, postIntegrationsProxyAction, getWidgets, getGlanceables, getGlanceablesByIntegration, getMonitoringStatus, postMonitoringStatus, getMonitors, getMonitorsById, putMonitorsById, postMonitors, deleteMonitorsById, getNewsFeedsById, getNewsFeedRecordsById, postNewsFeedRecords, getNewsSubscriptions, getNewsFeeds, getNewsFeedMetadata, postNewsFeedRefresh, postNewsFeedSubscribe, postNewsFeedUnsubscribe, postNewsFeedUpdate, postNewsFeedRecordsById, postNewsFixMissingTitles, getPageConfig, getPageConfigUserPages, putPageConfig, postPageConfigHome, postPageConfigMigrateLegacy, postPageConfigIntegrationData, getSearchItems, getSearchItemsFrequentlyUsed, postSearchItemsUsageStats, getLocations, getJobsPullIcons, postWallpapers, getNotifications, getNotificationsTopics, postNotificationsTopics, deleteNotificationsTopics, postNotificationsMarkAsRead, postNotificationsTest, getNotificationsTopicTokens, postNotificationsTopicTokens, deleteNotificationsTopicTokens, getNotificationsForwarders, postNotificationsForwarders, putNotificationsForwarders, deleteNotificationsForwarders } = sdk ;
21+ const { getAppConfig, getAppInfo, postAuthLogin, postAuthChangePassword, postAuthSignup, postAuthValidateAuth, deleteAuthDeleteAccount, patchAuthUpdateUserProperty, getLinksCollections, postLinksCollections, putLinksCollectionsByCollectionId, postLinksTags, putLinksTagsByTagId, getLinksHomeGroups, postLinksHomeGroups, putLinksFoldersByFolderIdIcon, getLinksHome, getLinksFolders, postLinksFolders, getLinksItems, getLinksTags, postLinksItems, putLinksItemsByLinkId, deleteLinksItemsByLinkId, postLinksReorder, getIntegrations, postIntegrations, putIntegrationsById, deleteIntegrationsById, postIntegrationsTestEndpoint, getIntegrationsWidgetProperties, getWidgetsByIntegration, postIntegrationsConsumerData, getIntegrationsCaldavEvents, postIntegrationsProxyAction, getWidgets, getGlanceables, getGlanceablesByIntegration, getMonitoringStatus, postMonitoringStatus, getMonitors, getMonitorsById, putMonitorsById, postMonitors, deleteMonitorsById, getNewsFeedRecordsById, postNewsFeedRecords, getNewsSubscriptions, getNewsFeeds, getNewsFeedMetadata, postNewsFeedRefresh, postNewsFeedSubscribe, postNewsFeedUnsubscribe, postNewsFeedUpdate, postNewsFeedRecordsById, postNewsFixMissingTitles, getPageConfig, getPageConfigUserPages, putPageConfig, postPageConfigHome, postPageConfigMigrateLegacy, postPageConfigIntegrationData, getSearchItems, getSearchItemsFrequentlyUsed, postSearchItemsUsageStats, getLocations, getJobsPullIcons, postWallpapers, getNotifications, getNotificationsTopics, postNotificationsTopics, deleteNotificationsTopics, postNotificationsMarkAsRead, postNotificationsTest, getNotificationsTopicTokens, postNotificationsTopicTokens, deleteNotificationsTopicTokens, getNotificationsForwarders, postNotificationsForwarders, putNotificationsForwarders, deleteNotificationsForwarders } = sdk ;
2222export * from "./api/sdk.gen" ;
2323export type { GenericObject , Error } from "./api/types.gen" ;
2424
@@ -65,6 +65,12 @@ export type MonitoringSshHostInput = {
6565 privateKey ?: string ;
6666} ;
6767
68+ export type NewsFeedPageResponse = {
69+ items : NewsFeedItem [ ] ;
70+ total : number ;
71+ limit : number ;
72+ } ;
73+
6874function stringifyError ( error : unknown ) {
6975 if ( typeof error === "string" ) return error ;
7076 if ( error && typeof error === "object" ) {
@@ -383,8 +389,13 @@ export async function updateMonitoringSshHostAction(auth: ActionAuth, hostId: st
383389
384390// --- News actions ---
385391
386- export async function getNewsFeedAction ( auth : ActionAuth , feedId ?: string | null ) : Promise < NewsFeedItem [ ] > {
387- return extractData ( await getNewsFeedsById ( { path : { id : feedId ?? "all" } , headers : authHeaders ( auth ) } ) ) as Promise < NewsFeedItem [ ] > ;
392+ export async function getNewsFeedAction ( auth : ActionAuth , feedId ?: string | null , limit ?: number ) : Promise < NewsFeedPageResponse > {
393+ return extractData ( await client . get ( {
394+ url : "/news/feeds/{id}" ,
395+ path : { id : feedId ?? "all" } ,
396+ query : limit ? { limit } : undefined ,
397+ headers : authHeaders ( auth ) ,
398+ } ) ) as Promise < NewsFeedPageResponse > ;
388399}
389400
390401export async function getNewsFeedRecordAction ( auth : ActionAuth , feedId ?: string | null ) : Promise < NewsFeedRecord | null > {
0 commit comments