-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a112c18
commit aba46af
Showing
8 changed files
with
192 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
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
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
14 changes: 14 additions & 0 deletions
14
libs/shinkai-node-state/src/v2/queries/getShinkaiFileProtocol/index.ts
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,14 @@ | ||
import { getShinkaiFileProtocol as getShinkaiFileProtocolApi } from '@shinkai_network/shinkai-message-ts/api/tools/index'; | ||
|
||
import type { GetShinkaiFileProtocolInput } from './types'; | ||
|
||
export const getShinkaiFileProtocol = async ({ | ||
nodeAddress, | ||
token, | ||
file, | ||
}: GetShinkaiFileProtocolInput) => { | ||
const result = await getShinkaiFileProtocolApi(nodeAddress, token, { | ||
file, | ||
}); | ||
return result; | ||
}; |
9 changes: 9 additions & 0 deletions
9
libs/shinkai-node-state/src/v2/queries/getShinkaiFileProtocol/types.ts
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,9 @@ | ||
import { Token } from '@shinkai_network/shinkai-message-ts/api/general/types'; | ||
import { GetShinkaiFileProtocolResponse } from '@shinkai_network/shinkai-message-ts/api/tools/types'; | ||
|
||
export type GetShinkaiFileProtocolInput = Token & { | ||
nodeAddress: string; | ||
file: string; | ||
}; | ||
|
||
export type GetShinkaiFileProtocolOutput = GetShinkaiFileProtocolResponse; |
32 changes: 32 additions & 0 deletions
32
libs/shinkai-node-state/src/v2/queries/getShinkaiFileProtocol/useGetShinkaiFileProtocol.ts
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,32 @@ | ||
import { QueryObserverOptions, useQuery } from '@tanstack/react-query'; | ||
|
||
import { FunctionKeyV2 } from '../../constants'; | ||
import { getShinkaiFileProtocol } from './index'; | ||
import { | ||
GetShinkaiFileProtocolInput, | ||
GetShinkaiFileProtocolOutput, | ||
} from './types'; | ||
|
||
export type UseGetShinkaiFileProtocol = [ | ||
FunctionKeyV2.GET_SHINKAI_FILE_PROTOCOL, | ||
GetShinkaiFileProtocolInput, | ||
]; | ||
type Options = QueryObserverOptions< | ||
GetShinkaiFileProtocolOutput, | ||
Error, | ||
GetShinkaiFileProtocolOutput, | ||
GetShinkaiFileProtocolOutput, | ||
UseGetShinkaiFileProtocol | ||
>; | ||
|
||
export const useGetShinkaiFileProtocol = ( | ||
input: GetShinkaiFileProtocolInput, | ||
options?: Omit<Options, 'queryKey' | 'queryFn'>, | ||
) => { | ||
const response = useQuery({ | ||
queryKey: [FunctionKeyV2.GET_SHINKAI_FILE_PROTOCOL, input], | ||
queryFn: () => getShinkaiFileProtocol(input), | ||
...options, | ||
}); | ||
return response; | ||
}; |