Implement notifications

This commit is contained in:
Paul Frazee 2022-10-03 10:53:36 -05:00
parent b05a334dcb
commit c7d7e152a0
16 changed files with 456 additions and 81 deletions

View file

@ -6969,6 +6969,7 @@ __export(src_exports, {
TodoSocialFollow: () => follow_exports,
TodoSocialGetFeed: () => getFeed_exports,
TodoSocialGetLikedBy: () => getLikedBy_exports,
TodoSocialGetNotificationCount: () => getNotificationCount_exports,
TodoSocialGetNotifications: () => getNotifications_exports,
TodoSocialGetPostThread: () => getPostThread_exports,
TodoSocialGetProfile: () => getProfile_exports,
@ -6978,6 +6979,7 @@ __export(src_exports, {
TodoSocialLike: () => like_exports,
TodoSocialMediaEmbed: () => mediaEmbed_exports,
TodoSocialPost: () => post_exports,
TodoSocialPostNotificationsSeen: () => postNotificationsSeen_exports,
TodoSocialProfile: () => profile_exports,
TodoSocialRepost: () => repost_exports,
default: () => src_default
@ -10307,12 +10309,15 @@ var methodSchemas = [
encoding: "application/json",
schema: {
type: "object",
required: ["username", "did", "password"],
required: ["username", "email", "password"],
properties: {
email: {
type: "string"
},
username: {
type: "string"
},
did: {
inviteCode: {
type: "string"
},
password: {
@ -10325,10 +10330,16 @@ var methodSchemas = [
encoding: "application/json",
schema: {
type: "object",
required: ["jwt"],
required: ["jwt", "username", "did"],
properties: {
jwt: {
type: "string"
},
username: {
type: "string"
},
did: {
type: "string"
}
}
}
@ -11114,6 +11125,24 @@ var methodSchemas = [
}
}
},
{
lexicon: 1,
id: "todo.social.getNotificationCount",
type: "query",
parameters: {},
output: {
encoding: "application/json",
schema: {
type: "object",
required: ["count"],
properties: {
count: {
type: "number"
}
}
}
}
},
{
lexicon: 1,
id: "todo.social.getNotifications",
@ -11143,7 +11172,14 @@ var methodSchemas = [
$defs: {
notification: {
type: "object",
required: ["uri", "author", "record", "isRead", "indexedAt"],
required: [
"uri",
"author",
"reason",
"record",
"isRead",
"indexedAt"
],
properties: {
uri: {
type: "string",
@ -11151,7 +11187,7 @@ var methodSchemas = [
},
author: {
type: "object",
required: ["did", "name", "displayName"],
required: ["did", "name"],
properties: {
did: {
type: "string"
@ -11165,6 +11201,13 @@ var methodSchemas = [
}
}
},
reason: {
type: "string",
$comment: "Expected values are 'like', 'repost', 'follow', 'badge', 'mention' and 'reply'."
},
reasonSubject: {
type: "string"
},
record: {
type: "object"
},
@ -11647,6 +11690,30 @@ var methodSchemas = [
}
}
}
},
{
lexicon: 1,
id: "todo.social.postNotificationsSeen",
type: "procedure",
description: "Notify server that the user has seen notifications",
parameters: {},
input: {
encoding: "application/json",
schema: {
type: "object",
required: ["seenAt"],
properties: {
seenAt: {
type: "string",
format: "date-time"
}
}
}
},
output: {
encoding: "application/json",
schema: {}
}
}
];
@ -11894,9 +11961,9 @@ function toKnownErr20(e) {
return e;
}
// src/types/todo/social/getNotifications.ts
var getNotifications_exports = {};
__export(getNotifications_exports, {
// src/types/todo/social/getNotificationCount.ts
var getNotificationCount_exports = {};
__export(getNotificationCount_exports, {
toKnownErr: () => toKnownErr21
});
function toKnownErr21(e) {
@ -11905,9 +11972,9 @@ function toKnownErr21(e) {
return e;
}
// src/types/todo/social/getPostThread.ts
var getPostThread_exports = {};
__export(getPostThread_exports, {
// src/types/todo/social/getNotifications.ts
var getNotifications_exports = {};
__export(getNotifications_exports, {
toKnownErr: () => toKnownErr22
});
function toKnownErr22(e) {
@ -11916,9 +11983,9 @@ function toKnownErr22(e) {
return e;
}
// src/types/todo/social/getProfile.ts
var getProfile_exports = {};
__export(getProfile_exports, {
// src/types/todo/social/getPostThread.ts
var getPostThread_exports = {};
__export(getPostThread_exports, {
toKnownErr: () => toKnownErr23
});
function toKnownErr23(e) {
@ -11927,9 +11994,9 @@ function toKnownErr23(e) {
return e;
}
// src/types/todo/social/getRepostedBy.ts
var getRepostedBy_exports = {};
__export(getRepostedBy_exports, {
// src/types/todo/social/getProfile.ts
var getProfile_exports = {};
__export(getProfile_exports, {
toKnownErr: () => toKnownErr24
});
function toKnownErr24(e) {
@ -11938,9 +12005,9 @@ function toKnownErr24(e) {
return e;
}
// src/types/todo/social/getUserFollowers.ts
var getUserFollowers_exports = {};
__export(getUserFollowers_exports, {
// src/types/todo/social/getRepostedBy.ts
var getRepostedBy_exports = {};
__export(getRepostedBy_exports, {
toKnownErr: () => toKnownErr25
});
function toKnownErr25(e) {
@ -11949,9 +12016,9 @@ function toKnownErr25(e) {
return e;
}
// src/types/todo/social/getUserFollows.ts
var getUserFollows_exports = {};
__export(getUserFollows_exports, {
// src/types/todo/social/getUserFollowers.ts
var getUserFollowers_exports = {};
__export(getUserFollowers_exports, {
toKnownErr: () => toKnownErr26
});
function toKnownErr26(e) {
@ -11960,6 +12027,28 @@ function toKnownErr26(e) {
return e;
}
// src/types/todo/social/getUserFollows.ts
var getUserFollows_exports = {};
__export(getUserFollows_exports, {
toKnownErr: () => toKnownErr27
});
function toKnownErr27(e) {
if (e instanceof XRPCError) {
}
return e;
}
// src/types/todo/social/postNotificationsSeen.ts
var postNotificationsSeen_exports = {};
__export(postNotificationsSeen_exports, {
toKnownErr: () => toKnownErr28
});
function toKnownErr28(e) {
if (e instanceof XRPCError) {
}
return e;
}
// src/types/todo/social/badge.ts
var badge_exports = {};
@ -12126,34 +12215,44 @@ var SocialNS = class {
throw toKnownErr20(e);
});
}
getNotificationCount(params, data, opts) {
return this._service.xrpc.call("todo.social.getNotificationCount", params, data, opts).catch((e) => {
throw toKnownErr21(e);
});
}
getNotifications(params, data, opts) {
return this._service.xrpc.call("todo.social.getNotifications", params, data, opts).catch((e) => {
throw toKnownErr21(e);
throw toKnownErr22(e);
});
}
getPostThread(params, data, opts) {
return this._service.xrpc.call("todo.social.getPostThread", params, data, opts).catch((e) => {
throw toKnownErr22(e);
throw toKnownErr23(e);
});
}
getProfile(params, data, opts) {
return this._service.xrpc.call("todo.social.getProfile", params, data, opts).catch((e) => {
throw toKnownErr23(e);
throw toKnownErr24(e);
});
}
getRepostedBy(params, data, opts) {
return this._service.xrpc.call("todo.social.getRepostedBy", params, data, opts).catch((e) => {
throw toKnownErr24(e);
throw toKnownErr25(e);
});
}
getUserFollowers(params, data, opts) {
return this._service.xrpc.call("todo.social.getUserFollowers", params, data, opts).catch((e) => {
throw toKnownErr25(e);
throw toKnownErr26(e);
});
}
getUserFollows(params, data, opts) {
return this._service.xrpc.call("todo.social.getUserFollows", params, data, opts).catch((e) => {
throw toKnownErr26(e);
throw toKnownErr27(e);
});
}
postNotificationsSeen(params, data, opts) {
return this._service.xrpc.call("todo.social.postNotificationsSeen", params, data, opts).catch((e) => {
throw toKnownErr28(e);
});
}
};
@ -12522,6 +12621,7 @@ var RepostRecord = class {
TodoSocialFollow,
TodoSocialGetFeed,
TodoSocialGetLikedBy,
TodoSocialGetNotificationCount,
TodoSocialGetNotifications,
TodoSocialGetPostThread,
TodoSocialGetProfile,
@ -12531,6 +12631,7 @@ var RepostRecord = class {
TodoSocialLike,
TodoSocialMediaEmbed,
TodoSocialPost,
TodoSocialPostNotificationsSeen,
TodoSocialProfile,
TodoSocialRepost
});

File diff suppressed because one or more lines are too long

View file

@ -21,6 +21,7 @@ import * as TodoSocialBadge from './types/todo/social/badge';
import * as TodoSocialFollow from './types/todo/social/follow';
import * as TodoSocialGetFeed from './types/todo/social/getFeed';
import * as TodoSocialGetLikedBy from './types/todo/social/getLikedBy';
import * as TodoSocialGetNotificationCount from './types/todo/social/getNotificationCount';
import * as TodoSocialGetNotifications from './types/todo/social/getNotifications';
import * as TodoSocialGetPostThread from './types/todo/social/getPostThread';
import * as TodoSocialGetProfile from './types/todo/social/getProfile';
@ -30,6 +31,7 @@ import * as TodoSocialGetUserFollows from './types/todo/social/getUserFollows';
import * as TodoSocialLike from './types/todo/social/like';
import * as TodoSocialMediaEmbed from './types/todo/social/mediaEmbed';
import * as TodoSocialPost from './types/todo/social/post';
import * as TodoSocialPostNotificationsSeen from './types/todo/social/postNotificationsSeen';
import * as TodoSocialProfile from './types/todo/social/profile';
import * as TodoSocialRepost from './types/todo/social/repost';
export * as TodoAdxCreateAccount from './types/todo/adx/createAccount';
@ -54,6 +56,7 @@ export * as TodoSocialBadge from './types/todo/social/badge';
export * as TodoSocialFollow from './types/todo/social/follow';
export * as TodoSocialGetFeed from './types/todo/social/getFeed';
export * as TodoSocialGetLikedBy from './types/todo/social/getLikedBy';
export * as TodoSocialGetNotificationCount from './types/todo/social/getNotificationCount';
export * as TodoSocialGetNotifications from './types/todo/social/getNotifications';
export * as TodoSocialGetPostThread from './types/todo/social/getPostThread';
export * as TodoSocialGetProfile from './types/todo/social/getProfile';
@ -63,6 +66,7 @@ export * as TodoSocialGetUserFollows from './types/todo/social/getUserFollows';
export * as TodoSocialLike from './types/todo/social/like';
export * as TodoSocialMediaEmbed from './types/todo/social/mediaEmbed';
export * as TodoSocialPost from './types/todo/social/post';
export * as TodoSocialPostNotificationsSeen from './types/todo/social/postNotificationsSeen';
export * as TodoSocialProfile from './types/todo/social/profile';
export * as TodoSocialRepost from './types/todo/social/repost';
export declare class Client {
@ -119,12 +123,14 @@ export declare class SocialNS {
constructor(service: ServiceClient);
getFeed(params: TodoSocialGetFeed.QueryParams, data?: TodoSocialGetFeed.InputSchema, opts?: TodoSocialGetFeed.CallOptions): Promise<TodoSocialGetFeed.Response>;
getLikedBy(params: TodoSocialGetLikedBy.QueryParams, data?: TodoSocialGetLikedBy.InputSchema, opts?: TodoSocialGetLikedBy.CallOptions): Promise<TodoSocialGetLikedBy.Response>;
getNotificationCount(params: TodoSocialGetNotificationCount.QueryParams, data?: TodoSocialGetNotificationCount.InputSchema, opts?: TodoSocialGetNotificationCount.CallOptions): Promise<TodoSocialGetNotificationCount.Response>;
getNotifications(params: TodoSocialGetNotifications.QueryParams, data?: TodoSocialGetNotifications.InputSchema, opts?: TodoSocialGetNotifications.CallOptions): Promise<TodoSocialGetNotifications.Response>;
getPostThread(params: TodoSocialGetPostThread.QueryParams, data?: TodoSocialGetPostThread.InputSchema, opts?: TodoSocialGetPostThread.CallOptions): Promise<TodoSocialGetPostThread.Response>;
getProfile(params: TodoSocialGetProfile.QueryParams, data?: TodoSocialGetProfile.InputSchema, opts?: TodoSocialGetProfile.CallOptions): Promise<TodoSocialGetProfile.Response>;
getRepostedBy(params: TodoSocialGetRepostedBy.QueryParams, data?: TodoSocialGetRepostedBy.InputSchema, opts?: TodoSocialGetRepostedBy.CallOptions): Promise<TodoSocialGetRepostedBy.Response>;
getUserFollowers(params: TodoSocialGetUserFollowers.QueryParams, data?: TodoSocialGetUserFollowers.InputSchema, opts?: TodoSocialGetUserFollowers.CallOptions): Promise<TodoSocialGetUserFollowers.Response>;
getUserFollows(params: TodoSocialGetUserFollows.QueryParams, data?: TodoSocialGetUserFollows.InputSchema, opts?: TodoSocialGetUserFollows.CallOptions): Promise<TodoSocialGetUserFollows.Response>;
postNotificationsSeen(params: TodoSocialPostNotificationsSeen.QueryParams, data?: TodoSocialPostNotificationsSeen.InputSchema, opts?: TodoSocialPostNotificationsSeen.CallOptions): Promise<TodoSocialPostNotificationsSeen.Response>;
}
export declare class BadgeRecord {
_service: ServiceClient;

View file

@ -6,12 +6,15 @@ export interface CallOptions {
encoding: 'application/json';
}
export interface InputSchema {
email: string;
username: string;
did: string;
inviteCode?: string;
password: string;
}
export interface OutputSchema {
jwt: string;
username: string;
did: string;
}
export interface Response {
success: boolean;

View file

@ -0,0 +1,16 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
}
export declare type InputSchema = undefined;
export interface OutputSchema {
count: number;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

View file

@ -15,8 +15,10 @@ export interface Notification {
author: {
did: string;
name: string;
displayName: string;
displayName?: string;
};
reason: string;
reasonSubject?: string;
record: {};
isRead: boolean;
indexedAt: string;

View file

@ -0,0 +1,19 @@
import { Headers } from '@adxp/xrpc';
export interface QueryParams {
}
export interface CallOptions {
headers?: Headers;
encoding: 'application/json';
}
export interface InputSchema {
seenAt: string;
}
export interface OutputSchema {
[k: string]: unknown;
}
export interface Response {
success: boolean;
headers: Headers;
data: OutputSchema;
}
export declare function toKnownErr(e: any): any;

File diff suppressed because one or more lines are too long