Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 6 additions & 24 deletions packages/client/src/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import type { AppBskyFeedGetTimeline } from '@tsky/lexicons';
import { Actor } from '~/bsky/actor';
import type { RPCOptions } from '~/types';
import { Paginator } from '~/utils';
import {
MuteUnmuteActor,
MuteUnmuteActorList,
MuteUnmuteThread,
} from './mute_unmute';
import { Mute } from './mute';
import { Muted } from './muted';
import { Preferences } from './preferences';
import { Suggestion } from './suggestion';
import { Unmute } from './unmute';

export class User extends Actor {
get preferences() {
Expand Down Expand Up @@ -58,26 +55,11 @@ export class User extends Actor {
return new Suggestion(this.client);
}

/** ----- */

/**
* Mute or unmute a thread
*/
thread(thread: string) {
return new MuteUnmuteThread(this.client, thread);
get mute() {
return new Mute(this.client);
}

/**
* Mute or unmute an actor
*/
actor(identifier: string) {
return new MuteUnmuteActor(this.client, identifier);
}

/**
* Mute or unmute an actor list
*/
actorList(identifier: string) {
return new MuteUnmuteActorList(this.client, identifier);
get unmute() {
return new Unmute(this.client);
}
}
1 change: 1 addition & 0 deletions packages/client/src/user/mute/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './mute';
37 changes: 37 additions & 0 deletions packages/client/src/user/mute/mute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Client } from '~/tsky/client';
import type { RPCOptions } from '~/types';

export class Mute {
constructor(private client: Client) {}

/**
* Creates a mute relationship for the specified account. Mutes are private in Bluesky.
*/
actor(identifier: string, options: RPCOptions = {}) {
return this.client.call('app.bsky.graph.muteActor', {
data: { actor: identifier },
...options,
});
}

/**
* Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky.
*/
thread(identifier: string, options: RPCOptions = {}) {
return this.client.call('app.bsky.graph.muteThread', {
data: { root: identifier },
...options,
});
}

/**
* Mute an entire list (specified by AT-URI) of actors. This creates a mute relationship for all actors
* on the specified list. Mutes are private on Bluesky.
*/
actorList(identifier: string, options: RPCOptions = {}) {
return this.client.call('app.bsky.graph.muteActorList', {
data: { list: identifier },
...options,
});
}
}
29 changes: 0 additions & 29 deletions packages/client/src/user/mute_unmute/actor.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/client/src/user/mute_unmute/index.ts

This file was deleted.

31 changes: 0 additions & 31 deletions packages/client/src/user/mute_unmute/list.ts

This file was deleted.

29 changes: 0 additions & 29 deletions packages/client/src/user/mute_unmute/thread.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/client/src/user/unmute/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './unmute';
37 changes: 37 additions & 0 deletions packages/client/src/user/unmute/unmute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Client } from '~/tsky/client';
import type { RPCOptions } from '~/types';

export class Unmute {
constructor(private client: Client) {}

/**
* Unmutes the specified account.
*/
actor(identifier: string, options: RPCOptions = {}) {
return this.client.call('app.bsky.graph.unmuteActor', {
data: { actor: identifier },
...options,
});
}

/**
* Unmutes the specified thread.
*/
thread(identifier: string, options: RPCOptions = {}) {
return this.client.call('app.bsky.graph.unmuteThread', {
data: { root: identifier },
...options,
});
}

/**
* Unmute an entire list (specified by AT-URI) of actors. This removes the mute relationship for all actors
* on the specified list.
*/
actorList(identifier: string, options: RPCOptions = {}) {
return this.client.call('app.bsky.graph.unmuteActorList', {
data: { list: identifier },
...options,
});
}
}
Loading