Client library for the IPFS HTTP API
type Module @imports(
types: [
"Http_Module",
"Http_Request",
"Http_ResponseType",
"Http_FormDataEntry",
"Http_Response"
]
) {
cat(
cid: String!
ipfsProvider: String!
timeout: UInt32
catOptions: CatOptions
): Bytes!
resolve(
cid: String!
ipfsProvider: String!
timeout: UInt32
resolveOptions: ResolveOptions
): ResolveResult!
addFile(
data: FileEntry!
ipfsProvider: String!
timeout: UInt32
addOptions: AddOptions
): AddResult!
addDir(
data: DirectoryEntry!
ipfsProvider: String!
timeout: UInt32
addOptions: AddOptions
): [AddResult!]!
addBlob(
data: Blob!
ipfsProvider: String!
timeout: UInt32
addOptions: AddOptions
): [AddResult!]!
}
type CatOptions {
offset: Int32
length: Int32
}
type AddOptions {
pin: Boolean
onlyHash: Boolean
wrapWithDirectory: Boolean
}
type ResolveOptions {
recursive: Boolean
dhtRecordCount: Int32
dhtTimeout: String
}
type ResolveResult {
cid: String!
provider: String!
}
type AddResult {
name: String!
hash: String!
size: String!
}
type FileEntry {
name: String!
data: Bytes!
}
type DirectoryEntry {
name: String!
directories: [DirectoryEntry!]
files: [FileEntry!]
}
type Blob {
directories: [DirectoryEntry!]
files: [FileEntry!]
}
### Imported Modules START ###
type Http_Module @imported(
uri: "wrapscan.io/polywrap/http@1.0",
namespace: "Http",
nativeType: "Module"
) {
get(
url: String!
request: Http_Request
): Http_Response
post(
url: String!
request: Http_Request
): Http_Response
}
### Imported Modules END ###
### Imported Objects START ###
type Http_Request @imported(
uri: "wrapscan.io/polywrap/http@1.0",
namespace: "Http",
nativeType: "Request"
) {
headers: Map @annotate(type: "Map<String!, String!>")
urlParams: Map @annotate(type: "Map<String!, String!>")
responseType: Http_ResponseType!
"""
The body of the request. If present, the `formData` property will be ignored.
"""
body: String
"""
An alternative to the standard request body, 'formData' is expected to be in the 'multipart/form-data' format.
If present, the `body` property is not null, `formData` will be ignored.
Otherwise, if formData is not null, the following header will be added to the request: 'Content-Type: multipart/form-data'.
"""
formData: [Http_FormDataEntry!]
timeout: UInt32
}
type Http_FormDataEntry @imported(
uri: "wrapscan.io/polywrap/http@1.0",
namespace: "Http",
nativeType: "FormDataEntry"
) {
"""
FormData entry key
"""
name: String!
"""
If 'type' is defined, value is treated as a base64 byte string
"""
value: String
"""
File name to report to the server
"""
fileName: String
"""
MIME type (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types). Defaults to empty string.
"""
type: String
}
type Http_Response @imported(
uri: "wrapscan.io/polywrap/http@1.0",
namespace: "Http",
nativeType: "Response"
) {
status: Int!
statusText: String!
headers: Map @annotate(type: "Map<String!, String!>")
body: String
}
enum Http_ResponseType @imported(
uri: "wrapscan.io/polywrap/http@1.0",
namespace: "Http",
nativeType: "ResponseType"
) {
TEXT
BINARY
}
### Imported Objects END ###
### Imported Envs START ###
### Imported Envs END ###