Skip to main content Link Menu Expand (external link) Document Search Copy Copied

A DataCite API client for use with fp-ts.

Example

import fetch from 'cross-fetch'
import { getWork } from 'datacite-ts'
import { Doi } from 'doi-ts'
import { FetchEnv } from 'fetch-fp-ts'
import * as C from 'fp-ts/Console'
import * as RTE from 'fp-ts/ReaderTaskEither'
import { pipe } from 'fp-ts/function'

const env: FetchEnv = {
  fetch,
}

void pipe(
  getWork('10.5438/0012' as Doi),
  RTE.chainFirstIOK(work => C.log(`Title is "${work.titles[0].title}"`)),
)(env)()
/*
Title is "DataCite Metadata Schema Documentation for the Publication and Citation of Research Data v4.0"
*/