@r26d/absinthe-apollo-upload-link
v1.1.0
Published
A terminating Apollo Link for Apollo Client that allows FileList, File, Blob or ReactNativeFile instances within query or mutation variables and sends GraphQL multipart requests. Modified to support the Absinthe way of posting files
Downloads
7
Maintainers
Readme
Table of Contents generated with DocToc
@r26d/absinthe-apollo-upload-link
A terminating Apollo Link for Apollo Client that allows FileList, File, Blob or ReactNativeFile instances within query or mutation variables and sends GraphQL multipart requests. Modified to support the Absinthe way of posting files
This fork modifies the request format to support Absinthe's way of handling file uploads.
API
FetchOptions
GraphQL request fetch
options.
Type: object
Properties
createUploadLink
Creates a terminating Apollo Link
capable of file uploads. Options match createHttpLink
.
Parameters
options
object Options.options.uri
string GraphQL endpoint URI. (optional, default/graphql
)options.fetch
Function?fetch
implementation to use, defaulting to thefetch
global.options.fetchOptions
FetchOptions?fetch
options; overridden by upload requirements.options.credentials
string? Overridesoptions.fetchOptions.credentials
.options.headers
object? Merges with and overridesoptions.fetchOptions.headers
.options.includeExtensions
boolean Toggles sendingextensions
fields to the GraphQL server. (optional, defaultfalse
)
Examples
A basic Apollo Client setup.
```js
const { ApolloClient } = require('apollo-client')
const { InMemoryCache } = require('apollo-cache-inmemory')
const { createUploadLink } = require('apollo-upload-client')
const client = new ApolloClient({
cache: new InMemoryCache(),
link: createUploadLink()
})
```
Returns ApolloLink A terminating Apollo Link capable of file uploads.
API
License
MIT :copyright: r26D LLC