-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1060 from lens-protocol/juan/T-23563-react-add-se…
…cond-batch-of-missing-methods-for-fetch
- Loading branch information
Showing
27 changed files
with
656 additions
and
10 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
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,2 +1,5 @@ | ||
export * from './useAccount'; | ||
export * from './useAccountManagers'; | ||
export * from './useAccounts'; | ||
export * from './useAccountsBlocked'; | ||
export * from './useAccountsBulk'; |
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
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,44 @@ | ||
import type { AccountManager, AccountManagersRequest, Paginated } from '@lens-protocol/graphql'; | ||
import { AccountManagersQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type AccountManagersArgs = AccountManagersRequest; | ||
|
||
/** | ||
* Fetch Account Managers. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useAccountManagers({ suspense: true }); | ||
* ``` | ||
*/ | ||
export function useAccountManagers( | ||
args: AccountManagersArgs & Suspendable, | ||
): SuspenseResult<Paginated<AccountManager>>; | ||
|
||
/** | ||
* Fetch Account Managers. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useAccountManagers(); | ||
* ``` | ||
*/ | ||
export function useAccountManagers( | ||
args?: AccountManagersArgs, | ||
): ReadResult<Paginated<AccountManager>>; | ||
|
||
export function useAccountManagers({ | ||
suspense = false, | ||
...request | ||
}: AccountManagersArgs & { suspense?: boolean } = {}): SuspendableResult< | ||
Paginated<AccountManager> | ||
> { | ||
return useSuspendableQuery({ | ||
document: AccountManagersQuery, | ||
variables: { request }, | ||
suspense: suspense, | ||
}); | ||
} |
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,44 @@ | ||
import type { AccountBlocked, AccountsBlockedRequest, Paginated } from '@lens-protocol/graphql'; | ||
import { AccountsBlockedQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type AccountsBlockedArgs = AccountsBlockedRequest; | ||
|
||
/** | ||
* Fetch Blocked Accounts. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useAccountsBlocked({ suspense: true }); | ||
* ``` | ||
*/ | ||
export function useAccountsBlocked( | ||
args: AccountsBlockedArgs & Suspendable, | ||
): SuspenseResult<Paginated<AccountBlocked>>; | ||
|
||
/** | ||
* Fetch Blocked Accounts. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useAccountsBlocked(); | ||
* ``` | ||
*/ | ||
export function useAccountsBlocked( | ||
args?: AccountsBlockedArgs, | ||
): ReadResult<Paginated<AccountBlocked>>; | ||
|
||
export function useAccountsBlocked({ | ||
suspense = false, | ||
...request | ||
}: AccountsBlockedArgs & { suspense?: boolean } = {}): SuspendableResult< | ||
Paginated<AccountBlocked> | ||
> { | ||
return useSuspendableQuery({ | ||
document: AccountsBlockedQuery, | ||
variables: { request }, | ||
suspense: suspense, | ||
}); | ||
} |
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,43 @@ | ||
import type { Account, AccountsBulkRequest } from '@lens-protocol/graphql'; | ||
import { AccountsBulkQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type AccountsBulkArgs = AccountsBulkRequest; | ||
|
||
/** | ||
* Fetch Accounts in Bulk. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useAccountsBulk({ | ||
* addresses: [evmAddress('0x…'), evmAddress('0x…')], | ||
* suspense: true | ||
* }); | ||
* ``` | ||
*/ | ||
export function useAccountsBulk(args: AccountsBulkArgs & Suspendable): SuspenseResult<Account[]>; | ||
|
||
/** | ||
* Fetch Accounts in Bulk. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useAccountsBulk({ | ||
* addresses: [evmAddress('0x…'), evmAddress('0x…')] | ||
* }); | ||
* ``` | ||
*/ | ||
export function useAccountsBulk(args: AccountsBulkArgs): ReadResult<Account[]>; | ||
|
||
export function useAccountsBulk({ | ||
suspense = false, | ||
...request | ||
}: AccountsBulkArgs & { suspense?: boolean }): SuspendableResult<Account[]> { | ||
return useSuspendableQuery({ | ||
document: AccountsBulkQuery, | ||
variables: { request }, | ||
suspense: suspense, | ||
}); | ||
} |
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 @@ | ||
export * from './useFeed'; |
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,38 @@ | ||
import type { Feed, FeedRequest } from '@lens-protocol/graphql'; | ||
import { FeedQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type FeedArgs = FeedRequest; | ||
|
||
/** | ||
* Fetch a single Feed. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useFeed({ feed: evmAddress('0x…'), suspense: true }); | ||
* ``` | ||
*/ | ||
export function useFeed(args: FeedArgs & Suspendable): SuspenseResult<Feed | null>; | ||
|
||
/** | ||
* Fetch a single Feed. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useFeed({ feed: evmAddress('0x…') }); | ||
* ``` | ||
*/ | ||
export function useFeed(args: FeedArgs): ReadResult<Feed | null>; | ||
|
||
export function useFeed({ | ||
suspense = false, | ||
...request | ||
}: FeedArgs & { suspense?: boolean }): SuspendableResult<Feed | null> { | ||
return useSuspendableQuery({ | ||
document: FeedQuery, | ||
variables: { request }, | ||
suspense, | ||
}); | ||
} |
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,3 @@ | ||
export * from './useFollowers'; | ||
export * from './useFollowersYouKnow'; | ||
export * from './useFollowing'; |
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,40 @@ | ||
import type { Follower, FollowersRequest, Paginated } from '@lens-protocol/graphql'; | ||
import { FollowersQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type FollowersArgs = FollowersRequest; | ||
|
||
/** | ||
* Fetch followers accounts. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useFollowers({ account: evmAddress('0x…'), suspense: true }); | ||
* ``` | ||
*/ | ||
export function useFollowers( | ||
args: FollowersArgs & Suspendable, | ||
): SuspenseResult<Paginated<Follower>>; | ||
|
||
/** | ||
* Fetch followers accounts. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useFollowers({ account: evmAddress('0x…') }); | ||
* ``` | ||
*/ | ||
export function useFollowers(args: FollowersArgs): ReadResult<Paginated<Follower>>; | ||
|
||
export function useFollowers({ | ||
suspense = false, | ||
...request | ||
}: FollowersArgs & { suspense?: boolean }): SuspendableResult<Paginated<Follower>> { | ||
return useSuspendableQuery({ | ||
document: FollowersQuery, | ||
variables: { request }, | ||
suspense: suspense, | ||
}); | ||
} |
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,47 @@ | ||
import type { Follower, FollowersYouKnowRequest, Paginated } from '@lens-protocol/graphql'; | ||
import { FollowersYouKnowQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type FollowersYouKnowArgs = FollowersYouKnowRequest; | ||
|
||
/** | ||
* Fetch followers you know. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useFollowersYouKnow({ | ||
* observer: evmAddress('0x…'), | ||
* target: evmAddress('0x…'), | ||
* suspense: true | ||
* }); | ||
* ``` | ||
*/ | ||
export function useFollowersYouKnow( | ||
args: FollowersYouKnowArgs & Suspendable, | ||
): SuspenseResult<Paginated<Follower>>; | ||
|
||
/** | ||
* Fetch followers you know. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useFollowersYouKnow({ | ||
* observer: evmAddress('0x…'), | ||
* target: evmAddress('0x…'), | ||
* }); | ||
* ``` | ||
*/ | ||
export function useFollowersYouKnow(args: FollowersYouKnowArgs): ReadResult<Paginated<Follower>>; | ||
|
||
export function useFollowersYouKnow({ | ||
suspense = false, | ||
...request | ||
}: FollowersYouKnowArgs & { suspense?: boolean }): SuspendableResult<Paginated<Follower>> { | ||
return useSuspendableQuery({ | ||
document: FollowersYouKnowQuery, | ||
variables: { request }, | ||
suspense: suspense, | ||
}); | ||
} |
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,40 @@ | ||
import type { Following, FollowingRequest, Paginated } from '@lens-protocol/graphql'; | ||
import { FollowingQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type FollowingArgs = FollowingRequest; | ||
|
||
/** | ||
* Fetch accounts following. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useFollowing({ account: evmAddress('0x…'), suspense: true }); | ||
* ``` | ||
*/ | ||
export function useFollowing( | ||
args: FollowingArgs & Suspendable, | ||
): SuspenseResult<Paginated<Following>>; | ||
|
||
/** | ||
* Fetch accounts following. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useFollowing({ account: evmAddress('0x…') }); | ||
* ``` | ||
*/ | ||
export function useFollowing(args: FollowingArgs): ReadResult<Paginated<Following>>; | ||
|
||
export function useFollowing({ | ||
suspense = false, | ||
...request | ||
}: FollowingArgs & { suspense?: boolean }): SuspendableResult<Paginated<Following>> { | ||
return useSuspendableQuery({ | ||
document: FollowingQuery, | ||
variables: { request }, | ||
suspense: suspense, | ||
}); | ||
} |
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 @@ | ||
export * from './useGraph'; |
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,38 @@ | ||
import type { Graph, GraphRequest } from '@lens-protocol/graphql'; | ||
import { GraphQuery } from '@lens-protocol/graphql'; | ||
|
||
import type { ReadResult, Suspendable, SuspendableResult, SuspenseResult } from '../helpers'; | ||
import { useSuspendableQuery } from '../helpers'; | ||
|
||
export type GraphArgs = GraphRequest; | ||
|
||
/** | ||
* Fetch a single Graph. | ||
* | ||
* This signature supports React Suspense: | ||
* | ||
* ```tsx | ||
* const { data } = useGraph({ graph: evmAddress('0x…'), suspense: true }); | ||
* ``` | ||
*/ | ||
export function useGraph(args: GraphArgs & Suspendable): SuspenseResult<Graph | null>; | ||
|
||
/** | ||
* Fetch a single Graph. | ||
* | ||
* ```tsx | ||
* const { data, loading } = useGraph({ graph: evmAddress('0x…') }); | ||
* ``` | ||
*/ | ||
export function useGraph(args: GraphArgs): ReadResult<Graph | null>; | ||
|
||
export function useGraph({ | ||
suspense = false, | ||
...request | ||
}: GraphArgs & { suspense?: boolean }): SuspendableResult<Graph | null> { | ||
return useSuspendableQuery({ | ||
document: GraphQuery, | ||
variables: { request }, | ||
suspense, | ||
}); | ||
} |
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,3 @@ | ||
export * from './useGroup'; | ||
export * from './useGroups'; | ||
export * from './useGroupMembers'; |
Oops, something went wrong.