117 lines
3.4 KiB
TypeScript
117 lines
3.4 KiB
TypeScript
import { gql } from "@apollo/client"
|
|
import * as Apollo from "@apollo/client"
|
|
export type Maybe<T> = T | null;
|
|
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
const defaultOptions = {}
|
|
/** All built-in and custom scalars, mapped to their actual values */
|
|
export type Scalars = {
|
|
ID: string;
|
|
String: string;
|
|
Boolean: boolean;
|
|
Int: number;
|
|
Float: number;
|
|
};
|
|
|
|
/** Represents a directory */
|
|
export type Directory = {
|
|
__typename?: "Directory";
|
|
directorys?: Maybe<Array<Maybe<Directory>>>;
|
|
files?: Maybe<Array<Maybe<File>>>;
|
|
id: Scalars["ID"];
|
|
name?: Maybe<Scalars["String"]>;
|
|
parent?: Maybe<Directory>;
|
|
};
|
|
|
|
/** Represents a file, not a directory */
|
|
export type File = {
|
|
__typename?: "File";
|
|
contentType?: Maybe<Scalars["String"]>;
|
|
etag?: Maybe<Scalars["String"]>;
|
|
/** The uniqe ID of the file. Represents the path and the s3 key. */
|
|
id: Scalars["ID"];
|
|
name?: Maybe<Scalars["String"]>;
|
|
parent?: Maybe<Directory>;
|
|
size?: Maybe<Scalars["Int"]>;
|
|
};
|
|
|
|
export type RootQuery = {
|
|
__typename?: "RootQuery";
|
|
directorys: Array<Maybe<Directory>>;
|
|
file?: Maybe<File>;
|
|
files: Array<Maybe<File>>;
|
|
};
|
|
|
|
|
|
export type RootQueryDirectorysArgs = {
|
|
path: Scalars["String"];
|
|
};
|
|
|
|
|
|
export type RootQueryFileArgs = {
|
|
id: Scalars["ID"];
|
|
};
|
|
|
|
|
|
export type RootQueryFilesArgs = {
|
|
path: Scalars["String"];
|
|
};
|
|
|
|
export type OpenDirQueryVariables = Exact<{
|
|
path: Scalars["String"];
|
|
}>;
|
|
|
|
|
|
export type OpenDirQuery = (
|
|
{ __typename?: "RootQuery" }
|
|
& { files: Array<Maybe<(
|
|
{ __typename?: "File" }
|
|
& Pick<File, "id" | "name">
|
|
)>>, directorys: Array<Maybe<(
|
|
{ __typename?: "Directory" }
|
|
& Pick<Directory, "id" | "name">
|
|
)>> }
|
|
);
|
|
|
|
|
|
export const OpenDirDocument = gql`
|
|
query openDir($path: String!) {
|
|
files(path: $path) {
|
|
id
|
|
name
|
|
}
|
|
directorys(path: $path) {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
`
|
|
|
|
/**
|
|
* __useOpenDirQuery__
|
|
*
|
|
* To run a query within a React component, call `useOpenDirQuery` and pass it any options that fit your needs.
|
|
* When your component renders, `useOpenDirQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
* you can use to render your UI.
|
|
*
|
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
*
|
|
* @example
|
|
* const { data, loading, error } = useOpenDirQuery({
|
|
* variables: {
|
|
* path: // value for 'path'
|
|
* },
|
|
* });
|
|
*/
|
|
export function useOpenDirQuery(baseOptions: Apollo.QueryHookOptions<OpenDirQuery, OpenDirQueryVariables>) {
|
|
const options = {...defaultOptions, ...baseOptions}
|
|
return Apollo.useQuery<OpenDirQuery, OpenDirQueryVariables>(OpenDirDocument, options)
|
|
}
|
|
export function useOpenDirLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<OpenDirQuery, OpenDirQueryVariables>) {
|
|
const options = {...defaultOptions, ...baseOptions}
|
|
return Apollo.useLazyQuery<OpenDirQuery, OpenDirQueryVariables>(OpenDirDocument, options)
|
|
}
|
|
export type OpenDirQueryHookResult = ReturnType<typeof useOpenDirQuery>;
|
|
export type OpenDirLazyQueryHookResult = ReturnType<typeof useOpenDirLazyQuery>;
|
|
export type OpenDirQueryResult = Apollo.QueryResult<OpenDirQuery, OpenDirQueryVariables>; |