Add dummy relationships endpoint
This commit is contained in:
parent
64102699ac
commit
acabc7c4ad
|
@ -59,6 +59,31 @@ const accountSearchController: AppController = async (c) => {
|
||||||
return c.json([]);
|
return c.json([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const relationshipsController: AppController = (c) => {
|
||||||
|
const ids = c.req.queries('id[]');
|
||||||
|
|
||||||
|
if (!ids) {
|
||||||
|
return c.json({ error: 'Missing `id[]` query parameters.' }, 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = ids.map((id) => ({
|
||||||
|
id,
|
||||||
|
following: false,
|
||||||
|
showing_reblogs: false,
|
||||||
|
notifying: false,
|
||||||
|
followed_by: false,
|
||||||
|
blocking: false,
|
||||||
|
blocked_by: false,
|
||||||
|
muting: false,
|
||||||
|
muting_notifications: false,
|
||||||
|
requested: false,
|
||||||
|
domain_blocking: false,
|
||||||
|
endorsed: false,
|
||||||
|
}));
|
||||||
|
|
||||||
|
return c.json(result);
|
||||||
|
};
|
||||||
|
|
||||||
/** Resolve a bech32 or NIP-05 identifier to an account. */
|
/** Resolve a bech32 or NIP-05 identifier to an account. */
|
||||||
async function lookupAccount(value: string): Promise<Event<0> | undefined> {
|
async function lookupAccount(value: string): Promise<Event<0> | undefined> {
|
||||||
console.log(`Looking up ${value}`);
|
console.log(`Looking up ${value}`);
|
||||||
|
@ -70,4 +95,10 @@ async function lookupAccount(value: string): Promise<Event<0> | undefined> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { accountController, accountLookupController, accountSearchController, credentialsController };
|
export {
|
||||||
|
accountController,
|
||||||
|
accountLookupController,
|
||||||
|
accountSearchController,
|
||||||
|
credentialsController,
|
||||||
|
relationshipsController,
|
||||||
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
accountLookupController,
|
accountLookupController,
|
||||||
accountSearchController,
|
accountSearchController,
|
||||||
credentialsController,
|
credentialsController,
|
||||||
|
relationshipsController,
|
||||||
} from './api/accounts.ts';
|
} from './api/accounts.ts';
|
||||||
import { appCredentialsController, createAppController } from './api/apps.ts';
|
import { appCredentialsController, createAppController } from './api/apps.ts';
|
||||||
import { emptyArrayController, emptyObjectController } from './api/fallback.ts';
|
import { emptyArrayController, emptyObjectController } from './api/fallback.ts';
|
||||||
|
@ -40,6 +41,7 @@ app.post('/oauth/revoke', emptyObjectController);
|
||||||
app.get('/api/v1/accounts/verify_credentials', requireAuth, credentialsController);
|
app.get('/api/v1/accounts/verify_credentials', requireAuth, credentialsController);
|
||||||
app.get('/api/v1/accounts/search', accountSearchController);
|
app.get('/api/v1/accounts/search', accountSearchController);
|
||||||
app.get('/api/v1/accounts/lookup', accountLookupController);
|
app.get('/api/v1/accounts/lookup', accountLookupController);
|
||||||
|
app.get('/api/v1/accounts/relationships', relationshipsController);
|
||||||
app.get('/api/v1/accounts/:pubkey{[0-9a-f]{64}}', accountController);
|
app.get('/api/v1/accounts/:pubkey{[0-9a-f]{64}}', accountController);
|
||||||
|
|
||||||
app.get('/api/v1/statuses/:id{[0-9a-f]{64}}', statusController);
|
app.get('/api/v1/statuses/:id{[0-9a-f]{64}}', statusController);
|
||||||
|
|
Loading…
Reference in New Issue