-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Cesare Naldi <[email protected]>
- Loading branch information
1 parent
e8ea090
commit 497d6ff
Showing
6 changed files
with
393 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { | ||
CreateFollowRequest, | ||
CreateUnfollowRequest, | ||
FollowResult, | ||
UnfollowResult, | ||
} from '@lens-protocol/graphql'; | ||
import { FollowMutation, UnfollowMutation } from '@lens-protocol/graphql'; | ||
import type { ResultAsync } from '@lens-protocol/types'; | ||
|
||
import type { SessionClient } from '../clients'; | ||
import type { UnauthenticatedError, UnexpectedError } from '../errors'; | ||
|
||
/** | ||
* Follow an Account | ||
* | ||
* ```ts | ||
* const result = await follow(sessionClient, { | ||
* account: evmAddress('0x90c8c68d0Abfb40D4fCD72316A65e42161520BC3') | ||
* }); | ||
* ``` | ||
* | ||
* @param client - The session client for the authenticated Account. | ||
* @param request - The mutation request. | ||
* @returns Tiered transaction result. | ||
*/ | ||
export function follow( | ||
client: SessionClient, | ||
request: CreateFollowRequest, | ||
): ResultAsync<FollowResult, UnexpectedError | UnauthenticatedError> { | ||
return client.mutation(FollowMutation, { request }); | ||
} | ||
|
||
/** | ||
* Unfollow an Account | ||
* | ||
* ```ts | ||
* const result = await unfollow(sessionClient, { | ||
* account: evmAddress('0x90c8c68d0Abfb40D4fCD72316A65e42161520BC3') | ||
* }); | ||
* ``` | ||
* | ||
* @param client - The session client for the authenticated Account. | ||
* @param request - The mutation request. | ||
* @returns Tiered transaction result. | ||
*/ | ||
export function unfollow( | ||
client: SessionClient, | ||
request: CreateUnfollowRequest, | ||
): ResultAsync<UnfollowResult, UnexpectedError | UnauthenticatedError> { | ||
return client.mutation(UnfollowMutation, { request }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export * from './account'; | ||
export * from './app'; | ||
export * from './authentication'; | ||
export * from './follow'; | ||
export * from './post'; | ||
export * from './posts'; | ||
export * from './transactions'; |
Oops, something went wrong.