Class FileUploadMutation
java.lang.Object
com.netflix.graphql.dgs.example.datafetcher.FileUploadMutation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanuploadFile(com.netflix.graphql.dgs.example.datafetcher.FileUploadMutation.FileUploadInput input, graphql.schema.DataFetchingEnvironment dfe) Implementation of the _Data Fetcher_ that will handle file upload.
-
Constructor Details
-
FileUploadMutation
public FileUploadMutation()
-
-
Method Details
-
uploadFile
public boolean uploadFile(com.netflix.graphql.dgs.example.datafetcher.FileUploadMutation.FileUploadInput input, graphql.schema.DataFetchingEnvironment dfe) Implementation of the _Data Fetcher_ that will handle file upload. To test file upload via the command line you will first have to create a file, let's say we name ita.txtand contains onlyHello World!. After that, you can use thecurlcommand to execute the filue upload of one file as follows:<pre> curl -a http://localhost:8080/graphql \ --header "graphql-require-preflight:true" \ -F operations='{ "query" : "mutation ($file: Upload!) { uploadFile(input: { files:[$file]} ) }", "variables": {"file": null } }' \ -F map='{ "0": ["variables.file"] }' \ -F 0=@a.txt </pre>- Parameters:
input- the GraphQL input argument of type FileUploadInput, serialized to the java pojo FileUploadInput.dfe- the Data Fetching Environment- Returns:
- boolean that will be true if all files are uploaded.
-