pl-api version bump

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-01-25 11:46:56 +01:00
parent 8ce3eec1b7
commit a61a311558
8 changed files with 69 additions and 8 deletions

View File

@ -60,6 +60,7 @@ import {
pollSchema,
relationshipSchema,
reportSchema,
rssFeedSchema,
ruleSchema,
scheduledStatusSchema,
scrobbleSchema,
@ -4965,6 +4966,35 @@ class PlApiClient {
this.#paginatedGet(`/api/v1/circles/${circleId}/statuses`, { params }, statusSchema),
};
public readonly rssFeedSubscriptions = {
/**
* Requires features{@link Features['rssFeedSubscriptions']}.
*/
fetchRssFeedSubscriptions: async () => {
const response = await this.request('/api/v1/pleroma/rss_feed_subscriptions');
return v.parse(filteredArray(rssFeedSchema), response.json);
},
/**
* Requires features{@link Features['rssFeedSubscriptions']}.
*/
createRssFeedSubscription: async (url: string) => {
const response = await this.request('/api/v1/rss_feed_subscriptions', { method: 'POST', body: { url } });
return v.parse(rssFeedSchema, response.json);
},
/**
* Requires features{@link Features['rssFeedSubscriptions']}.
*/
deleteRssFeedSubscription: async (url: string) => {
const response = await this.request<{}>('/api/v1/rss_feed_subscriptions', { method: 'DELETE', body: { url } });
return response.json;
},
};
/** Routes that are not part of any stable release */
public readonly experimental = {
admin: {

View File

@ -61,6 +61,7 @@ export * from './relationship';
export * from './relationship-severance-event';
export * from './report';
export * from './role';
export * from './rss-feed';
export * from './rule';
export * from './scheduled-status';
export * from './scrobble';

View File

@ -0,0 +1,19 @@
import * as v from 'valibot';
/**
* @category Schemas
*/
const rssFeedSchema = v.object({
id: v.string(),
url: v.string(),
title: v.fallback(v.nullable(v.string()), null),
description: v.fallback(v.nullable(v.string()), null),
image: v.fallback(v.nullable(v.string()), null),
});
/**
* @category Entity types
*/
type RssFeed = v.InferOutput<typeof rssFeedSchema>;
export { rssFeedSchema, type RssFeed };

View File

@ -11,6 +11,7 @@ import { mediaAttachmentSchema } from './media-attachment';
import { mentionSchema } from './mention';
import { pollSchema } from './poll';
import { previewCardSchema } from './preview-card';
import { rssFeedSchema } from './rss-feed';
import { tagSchema } from './tag';
import { translationSchema } from './translation';
import { datetimeSchema, filteredArray } from './utils';
@ -91,6 +92,7 @@ const baseStatusSchema = v.object({
event: v.fallback(v.nullable(statusEventSchema), null),
translation: v.fallback(v.union([v.nullable(translationSchema), v.literal(false)]), null),
rss_feed: v.fallback(v.nullable(rssFeedSchema), null),
content_map: v.fallback(v.nullable(v.record(v.string(), v.string())), null),
text_map: v.fallback(v.nullable(v.record(v.string(), v.string())), null),
@ -123,6 +125,7 @@ const preprocess = (status: any) => {
'event',
'translation',
'rss_feed',
])),
...(pick(status.friendica || {}, [
'dislikes_count',

View File

@ -1187,6 +1187,14 @@ const getFeatures = (instance: Instance) => {
v.software === GOTOSOCIAL,
]),
/**
* Ability to subscribe to RSS feeds.
* @see GET /api/v1/pleroma/rss_feed_subscriptions
* @see POST /api/v1/pleroma/rss_feed_subscriptions
* @see DELETE /api/v1/pleroma/rss_feed_subscriptions
*/
rssFeedSubscriptions: instance.api_versions['rss_feed_subscriptions.pleroma.pl-api'] >= 1,
/**
* Can schedule statuses to be posted at a later time.
* @see POST /api/v1/statuses

View File

@ -1,6 +1,6 @@
{
"name": "pl-api",
"version": "1.0.0-rc.18",
"version": "1.0.0-rc.19",
"type": "module",
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
"repository": {

View File

@ -101,7 +101,7 @@
"multiselect-react-dropdown": "^2.0.25",
"mutative": "^1.1.0",
"path-browserify": "^1.0.1",
"pl-api": "^1.0.0-rc.18",
"pl-api": "^1.0.0-rc.19",
"postcss": "^8.4.49",
"process": "^0.11.10",
"punycode": "^2.1.1",

View File

@ -7508,10 +7508,10 @@ pkg-dir@^4.1.0:
dependencies:
find-up "^4.0.0"
pl-api@^1.0.0-rc.18:
version "1.0.0-rc.18"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.18.tgz#8a95389dff03bee9acd10316bcdbcdd6fc57dcc4"
integrity sha512-H9cKi2vzbjj2C4/ieFxSFdGeDBk8EbiZZ2fIXGKEQscTh2YkHEyFibOoVo5hjegbMKMbTxKW5t9Kr8dlHtJEAw==
pl-api@^1.0.0-rc.19:
version "1.0.0-rc.19"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.19.tgz#561b982a7d5377b8f193368072ad15371c649bb4"
integrity sha512-1m9asR6RLq+jRSkk39ccl7TbkzoNDMJCdNgE08hA6FHecItfhMt2xM6FYUqV/Me4RzWUsnnswhuSNd4G2+D7uw==
dependencies:
blurhash "^2.0.5"
http-link-header "^1.1.3"
@ -7521,7 +7521,7 @@ pl-api@^1.0.0-rc.18:
object-to-formdata "^4.5.1"
query-string "^9.1.1"
semver "^7.6.3"
valibot "^1.0.0-beta.11"
valibot "^1.0.0-beta.12"
possible-typed-array-names@^1.0.0:
version "1.0.0"
@ -9714,7 +9714,7 @@ util@^0.12.5:
is-typed-array "^1.1.3"
which-typed-array "^1.1.2"
valibot@^1.0.0-beta.11, valibot@^1.0.0-beta.12:
valibot@^1.0.0-beta.12:
version "1.0.0-beta.12"
resolved "https://registry.yarnpkg.com/valibot/-/valibot-1.0.0-beta.12.tgz#7c0457c8b86b47c3b04fe66e990a589c79eae96a"
integrity sha512-j3WIxJ0pmUFMfdfUECn3YnZPYOiG0yHYcFEa/+RVgo0I+MXE3ToLt7gNRLtY5pwGfgNmsmhenGZfU5suu9ijUA==