Official Node.js SDK for PubPub.
- PubPub SDK
- Contents
- Installation
- Usage
- Limitations
- Guides
- API
pubpub.auth
pubpub.collection
pubpub.collectionAttribution
pubpub.collectionPub
pubpub.community
pubpub.customScript
pubpub.facets
pubpub.member
pubpub.page
pubpub.page.create
pubpub.page.get
pubpub.page.getMany
pubpub.page.remove
pubpub.page.update
pubpub.pub.doi
pubpub.pub.get
pubpub.pub.getMany
pubpub.pub.getResource
pubpub.pub.queryMany
pubpub.pub.remove
pubpub.pub.text
pubpub.pub.update
pubpub.pubAttribution
pubpub.pubEdge
pubpub.release
pubpub.upload
pubpub.workerTask
- Other types
- Contributing
- TODO
- FAQ
- License
If you use the SDK in Node, you must use Node 18 or higher in order to support native FormData.
pnpm add @pubpub/sdk
# yarn add @pubpub/sdk
# npm install @pubpub/sdk
import { PubPub } from '@pubpub/sdk'
const communityUrl = 'https://demo.pubpub.org'
async function main() {
const pubpub = await PubPub.createSDK({
communityUrl,
email: '...',
password: '...',
})
const pubs = await pubpub.pub.getMany()
console.log(pubs)
}
main()
Replace https://demo.pubpub.org
with your community URL, and replace …
with your PubPUb login email address and password, respectively.
The following actions are not permitted by the SDK, nor through the API in general:
Deleting a community is not permitted, due to the risk of accidental deletion of a community. Creating a community is not permitted, due to the potential for abuse (e.g., spam communities).
It is not possible to create, delete or modifying users, due to the risks involved.
import { PubPub } from '@pubpub/sdk'
const communityUrl = 'https://demo.pubpub.org'
const email = '...'
const password = '...'
const pubpub = await PubPub.createSDK({
communityUrl,
email,
password,
})
Replace https://demo.pubpub.org
with your community url, and replace …
with your login email address and password, respectively.
Once your session is complete, you should logout:
await pubpub.logout()
Some models allow you to query them through the GET /api/<models>
and GET /api/<models>/<id>
endpoints on the API, and the PubPub.<model>.getMany
and PubPub.<model>.get
methods on the client.
These follow a standard pattern, and are documented here.
The get
methods allow you to get a single model by its id
, OR by its slug
(if it has one).
To get a single model by its id
:
const pubById = await pubpub.pub.get({
slugOrId: '00000000-0000-0000-0000-000000000000',
})
Replace 00000000-0000-0000-0000-000000000000
with the model’s id
.
The slug
of a Pub is the part of the URL after /pub
. To get a single model by its slug
:
// for https://demo.pubpub.org/pub/my-pub
const { body: myPub } = await pubpub.pub.get({
slugOrId: 'my-pub',
})
Replace my-pub
with your Pub’s slug.
The getMany
methods allow you to search for models. It returns an array of models.
You can filter models in the following ways
By providing a limit
and offset
parameter, you can paginate the results.
limit
:10
offset
:0
const { body: firstTenCommunities } = await pubpub.community.getMany({
limit: 10,
offset: 0,
}) // this is the default
const { body: nextTenCommunities } = await pubpub.community.getMany({
limit: 10,
offset: 10,
})
By providing orderBy
and sortBy
parameters, you can sort the results.
The orderBy
parameter can always be updatedAt
or createdAt
, and the sortBy
parameter can always be ASC
or DESC
.
The orderBy
parameters can also be some fiels of the model, depending on the model. Check the documentation of the specific method in the API section for more information.
orderBy
:createdAt
sortBy
:DESC
const { body: communitiesSortedByCreatedAt } = await pubpub.community.getMany({
orderBy: 'createdAt',
sortBy: 'DESC',
}) // this is the default
const { body: communitiesSortedByTitle } = await pubpub.community.getMany({
query: {
orderBy: 'title',
sortBy: 'ASC',
},
})
You can choose which associated models to include in the response by providing an includes
parameter to your query.
By default, some models are always included. Currently this is not well documented here, check the documentation of the relevant API route to find this information.
Note
Specifying includes
will override the default includes.
Note
The return type will not change based on the includes
parameter. This means that even though you might have specified includes: ['pubAttributions']
, the return type will have pubAttribubtions?: PubAttribution[]
instead of pubAttributions: PubAttribution[]
.
Maybe you don't need all the attributes of a model, and you want to save some bandwidth. You can do this by providing an attributes
parameter to your query. This parameter is an array of attributes you want to include in the response.
Note
Specifying attributes
will not change the return type.
This means that even though you might have specified attributes: ['title']
, the return type will still have description?: string
instead of description: string
.
By default, all attributes are included.
const { body: communitiesWithOnlyTitleAndCreatedAt } =
await pubpub.community.getMany({
query: {
attributes: ['title', 'createdAt'],
},
})
console.log(communitiesWithOnlyTitleAndCreatedAt[0].title) // this works
console.log(communitiesWithOnlyTitleAndCreatedAt[0].description) // undefined
The most powerful way to query models is by providing a filter
parameter to your query. This parameter is an object that allows you to filter the results based on the attributes of the model.
You can also provide filters as query parameters. E.g. instead of doing
const { body: pubs } = await pubpub.pub.getMany({
query: {
filter: {
title: 'My pub',
},
},
})
Almost any attribute of a model can be used to filter the results. Check the documentation of the relevant API route to find this information.
The filters follow a standard patter.
By just defining the attribute you want to filter on, you can filter on equality.
{
filter: {
title: 'My community',
}
}
will return all communities with the exact title (case-sensitive) 'My community'
.
You can provide an array of filters to filter on multiple values.
{
filter: {
title: ['My community', 'My other community'],
}
}
will return all communities with the exact title (case-sensitive) 'My community'
or 'My other community'
.
You can provide an object of filters to filter on multiple attributes.
{
filter: {
title: 'My community',
description: 'This is my community',
}
}
You can also do AND
filters for the same property, by nesting arrays.
{
filter: {
title: [
[
{
contains: 'My',
},
{
contains: 'community',
},
],
]
}
}
This will return all communities with a title that contains both 'My'
and 'community'
. The contains
filter for string values is documented below.
At the moment, you cannot easily do OR filters for multiple properties, please make multiple requests instead. If you find yourself needing this, please open an issue!
You can filter on whether an attribute exists or not by providing true
or false
as the value.
const attributionsWithUser = await pubpub.pubAttribution.getMany({
query: {
userId: true,
},
})
If the property you are filtering on is a string, you can use the following filters.
string
If you provide a string, or { exact: string }
, it will filter on equality.
const pubsCalledMyPub = await pubpub.pub.getMany({
query: {
title: 'My pub',
},
})
boolean
If you provide a boolean, it will filter on existence.
const { body: pubsWithoutDownloads } = await pubpub.pub.getMany({
query: {
downloads: false,
},
})
{ contains: string }
If you provide an object with a contains
property, it will filter on whether the string contains the provided string.
This is case-insensitive.
const { body: pubsContainingPub } = await pubpub.pub.getMany({
query: {
title: {
contains: 'pub',
},
},
})
{ contains: string; not: true }
If you provide an object with a contains
property and a not
property set to true
, it will filter on whether the string does not contain the provided string.
const { body: pubsNotContainingPub } = await pubpub.pub.getMany({
query: {
title: {
contains: 'pub',
not: true,
},
},
})
There isn't a way to do { exact: string, not: true}
, as this is almost always equivalent to { contains: string, not: true }
.
If you find yourself needing this, please open an issue!
Full type
This is the full type of the filter
parameter for string properties.
type StringFilter =
| string
| boolean
| string[]
| { exact: string }
| { contains: string; not?: true | undefined }
| (
| string
| { exact: string }
| { contains: string; not?: true | undefined }
)[]
| (
| string
| boolean
| { exact: string }
| { contains: string; not?: true | undefined }
| (
| string
| { exact: string }
| { contains: string; not?: true | undefined }
)[]
)[]
| undefined
For attributes that are enums, you can filter on the enum values. You cannot do contains
queries.
const issues = await pubpub.collection.getMany({
query: {
kind: 'issue',
},
})
You can of course also do OR
filters.
const { body: issuesAndBooks } = await pubpub.collection.getMany({
query: {
kind: ['issue', 'book'],
},
})
While you can technically do AND
filters, this is not very useful, as the attribute can only have one value.
If the property is id
or ends with Id
(e.g. communityId
), you can only provide a full UUID
, an array of full UUID
s, or a boolean.
const { body: pub } = await pubpub.pub.get({
id: '00000000-0000-0000-0000-000000000000',
})
If the property is a number
or a Date
, you can use the following filters.
####### number
| Date
If you provide a number, it will filter on equality.
const pubsCreatedAtAnExactDate = await pubpub.pub.getMany({
query: {
createdAt: new Date('2021-01-01'),
},
})
{ gt: number | Date, lt: number | Date, eq: number | Date, gte: number | Date, lte: number | Date, ne: number | Date }
If you provide an object with any of the above properties, it will filter on the corresponding comparison.
const { body: pubsCreatedAfter2020 } = await pubpub.pub.getMany({
query: {
createdAt: {
gt: new Date('2020-01-01'),
},
},
})
You can combine these as with other filters.
const { body: pubsCreatedBetween2020And2021 } = await pubpub.pub.getMany({
query: {
createdAt: {
gt: new Date('2020-01-01'),
lt: new Date('2021-01-01'),
},
},
})
const { body: pubsCreatedBefore2020OrAfter2021 } = await pubpub.pub.getMany({
query: {
createdAt: [
{
lt: new Date('2020-01-01'),
},
{
gt: new Date('2021-01-01'),
},
],
},
})
Full types
type NumberFilter =
| boolean
| number
| {
eq?: number | undefined
gt?: number | undefined
gte?: number | undefined
lt?: number | undefined
lte?: number | undefined
ne?: number | undefined
}
| (
| number
| {
eq?: number | undefined
gt?: number | undefined
gte?: number | undefined
lt?: number | undefined
lte?: number | undefined
ne?: number | undefined
}
)[]
| (
| boolean
| number
| {
eq?: number | undefined
gt?: number | undefined
gte?: number | undefined
lt?: number | undefined
lte?: number | undefined
ne?: number | undefined
}
| (
| number
| {
eq?: number | undefined
gt?: number | undefined
gte?: number | undefined
lt?: number | undefined
lte?: number | undefined
ne?: number | undefined
}
)[]
)[]
| undefined
For Dates, you can either input a Date
object, or an ISO formatted string.
It does not really matter, as it implicitly Date.toISOString()
gets called on the value.
type Date =
| boolean
| string
| Date
| {
eq?: Date | string | undefined
gt?: Date | string | undefined
gte?: Date | string | undefined
lt?: Date | string | undefined
lte?: Date | string | undefined
ne?: Date | string | undefined
}
| (
| string
| Date
| {
eq?: Date | string | undefined
gt?: Date | string | undefined
gte?: Date | string | undefined
lt?: Date | string | undefined
lte?: Date | string | undefined
ne?: Date | string | undefined
}
)[]
| (
| boolean
| string
| Date
| {
eq?: Date | string | undefined
gt?: Date | string | undefined
gte?: Date | string | undefined
lt?: Date | string | undefined
lte?: Date | string | undefined
ne?: Date | string | undefined
}
| (
| string
| Date
| {
eq?: Date | string | undefined
gt?: Date | string | undefined
gte?: Date | string | undefined
lt?: Date | string | undefined
lte?: Date | string | undefined
ne?: Date | string | undefined
}
)[]
)[]
| undefined
Methods for dealing with authentication
POST /api/login
Login and returns authentication cookie
login: (input, rest?) =>
Promise<
| { status: 201; body: 'success'; headers: Headers }
| { status: 500; body: string; headers: Headers }
| { status: 401; body: 'Login attempt failed'; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-login/post
input
{
email: string
password: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<
| {
status: 201
body: 'success'
headers: Headers
}
| {
status: 500
body: string
headers: Headers
}
| {
status: 401
body: 'Login attempt failed'
headers: Headers
}
>
GET /api/logout
Logout and clear authentication cookie
logout: (input?) => Promise<{ status: 200; body: 'success'; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-logout/get
input?
{
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: 'success'
headers: Headers
}>
POST /api/collections
Create a collection
create: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections/post
input
{
doi: undefined | null | string
isPublic: undefined | null | boolean
isRestricted: undefined | null | boolean
kind: 'tag' | 'issue' | 'book' | 'conference'
pageId: undefined | null | string
slug: undefined | string
title: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
POST /api/collections/:collectionId/doi
Deposit metadata to create a DOI
deposit: (input) =>
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| { status: 400; body: { error: string }; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections-collectionId-doi/post
input
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
collectionId: string
}
}
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| {
status: 400
body: {
error: string
}
headers: Headers
}
>
POST /api/collections/:collectionId/doi/preview
Preview a DOI deposit
preview: (input) =>
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| { status: 400; body: { error: string }; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections-collectionId-doi-preview/post
input
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
collectionId: string
}
}
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| {
status: 400
body: {
error: string
}
headers: Headers
}
>
GET /api/collections/:slugOrId
Get a collection by it's id or slug
get: (input) =>
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
members?: Member[]
page?: Page
community?: Community
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections-slugOrId/get
input
{
params: { slugOrId: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
query?:
| {
include?:
| (
| 'community'
| 'attributions'
| 'collectionPubs'
| 'members'
| 'page'
)[]
| undefined
attributes?:
| (
| 'id'
| 'communityId'
| 'title'
| 'avatar'
| 'viewHash'
| 'editHash'
| 'scopeSummaryId'
| 'slug'
| 'isRestricted'
| 'isPublic'
| 'metadata'
| 'kind'
| 'doi'
| 'readNextPreviewSize'
| 'layout'
| 'layoutAllowsDuplicatePubs'
| 'pageId'
| 'crossrefDepositRecordId'
)[]
| undefined
}
| undefined
}
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
members?: Member[]
page?: Page
community?: Community
}
headers: Headers
}>
GET /api/collections
Get many collections
getMany: (input?) =>
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
members?: Member[]
page?: Page
community?: Community
}[]
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections/get
input?
{
query:
| ({
limit?: number | undefined
offset?: number | undefined
sortBy?:
| 'createdAt'
| 'updatedAt'
| 'title'
| 'slug'
| 'kind'
| undefined
orderBy?: 'ASC' | 'DESC' | undefined
filter?:
| {
id?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
title?: StringFilter
avatar?: StringFilter
viewHash?: StringFilter
editHash?: StringFilter
scopeSummaryId?: string | boolean | string[] | undefined
slug?: StringFilter
isRestricted?: boolean | undefined
isPublic?: boolean | undefined
metadata?: { [x: string]: any } | undefined
kind?:
| 'tag'
| 'issue'
| 'book'
| 'conference'
| ('tag' | 'issue' | 'book' | 'conference' | null)[]
| null
| undefined
doi?: StringFilter
readNextPreviewSize?:
| 'none'
| 'minimal'
| 'medium'
| 'choose-best'
| ('none' | 'minimal' | 'medium' | 'choose-best')[]
| undefined
layoutAllowsDuplicatePubs?: boolean | undefined
pageId?: string | boolean | string[] | undefined
crossrefDepositRecordId?: string | boolean | string[] | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
}
| undefined
include?:
| (
| 'community'
| 'attributions'
| 'collectionPubs'
| 'members'
| 'page'
)[]
| undefined
attributes?:
| (
| 'id'
| 'createdAt'
| 'updatedAt'
| 'communityId'
| 'title'
| 'avatar'
| 'viewHash'
| 'editHash'
| 'scopeSummaryId'
| 'slug'
| 'isRestricted'
| 'isPublic'
| 'metadata'
| 'kind'
| 'doi'
| 'readNextPreviewSize'
| 'layout'
| 'layoutAllowsDuplicatePubs'
| 'pageId'
| 'crossrefDepositRecordId'
)[]
| undefined
} & {
id?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
title?: StringFilter
avatar?: StringFilter
viewHash?: StringFilter
editHash?: StringFilter
scopeSummaryId?: string | boolean | string[] | undefined
slug?: StringFilter
isRestricted?: boolean | undefined
isPublic?: boolean | undefined
metadata?: { [x: string]: any } | undefined
kind?:
| 'tag'
| 'issue'
| 'book'
| 'conference'
| ('tag' | 'issue' | 'book' | 'conference' | null)[]
| null
| undefined
doi?: StringFilter
readNextPreviewSize?:
| 'none'
| 'minimal'
| 'medium'
| 'choose-best'
| ('none' | 'minimal' | 'medium' | 'choose-best')[]
| undefined
layoutAllowsDuplicatePubs?: boolean | undefined
pageId?: string | boolean | string[] | undefined
crossrefDepositRecordId?: string | boolean | string[] | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
})
| undefined
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
members?: Member[]
page?: Page
community?: Community
}[]
headers: Headers
}>
GET /api/collections/:collectionId/resource
Get collection as a resource
getResource: (input) => Promise<{ status: 200; body: any; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections-collectionId-resource/get
input
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
collectionId: string
}
}
Promise<{
status: 200
body: any
headers: Headers
}>
DELETE /api/collections
Remove a collection
remove: (input, rest?) =>
Promise<{ status: 200; body: string; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections/delete
input
{
id: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: string
headers: Headers
}>
PUT /api/collections
Update a collection
update: (input, rest?) =>
Promise<{
status: 200
body: {
communityId?: string | undefined
title?: string | undefined
slug?: string | undefined
isRestricted?: boolean | null | undefined
isPublic?: boolean | null | undefined
doi?: string | null | undefined
pageId?: string | null | undefined
kind?: 'tag' | 'issue' | 'book' | 'conference' | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collections/put
input
{
avatar: null | string
doi: null | string
id: string
isPublic: null | boolean
isRestricted: null | boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
metadata: null | Record<string, any>
pageId: null | string
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
slug: string
title: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
communityId?: string | undefined
title?: string | undefined
slug?: string | undefined
isRestricted?: boolean | null | undefined
isPublic?: boolean | null | undefined
doi?: string | null | undefined
pageId?: string | null | undefined
kind?: 'tag' | 'issue' | 'book' | 'conference' | undefined
}
headers: Headers
}>
POST /api/collectionAttributions/batch
Batch create collection attributions
batchCreate: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionAttributions-batch/post
input
{
attributions?: Attribution[]
collectionId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
POST /api/collectionAttributions
Create a collection attribution
create: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionAttributions/post
input
{
affiliation: null | string
avatar: null | string
collectionId: string
createdAt: string
isAuthor: null | boolean
name: string
orcid: null | string
order: number
roles: null | string[]
title: null | string
updatedAt: string
userId: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
GET /api/collectionAttributions/:id
Get a collection attribution
get: (input) =>
Promise<{
status: 200
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
collection?: Collection
user?: User
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-collectionAttributions-id/get
input
{
params: { id: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
query?:
| {
include?: ('collection' | 'user')[] | undefined
attributes?:
| (
| 'id'
| 'collectionId'
| 'title'
| 'avatar'
| 'name'
| 'order'
| 'userId'
| 'orcid'
| 'isAuthor'
| 'roles'
| 'affiliation'
)[]
| undefined
}
| undefined
}
Promise<{
status: 200
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
collection?: Collection
user?: User
}
headers: Headers
}>
GET /api/collectionAttributions
Get multiple collection attributions. You are limited to attributions in your community.
getMany: (input?) =>
Promise<{
status: 200
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
collection?: Collection
user?: User
}[]
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-collectionAttributions/get
input?
{
query:
| ({
limit?: number | undefined
offset?: number | undefined
sortBy?:
| 'createdAt'
| 'updatedAt'
| 'name'
| 'order'
| 'affiliation'
| undefined
orderBy?: 'ASC' | 'DESC' | undefined
filter?:
| {
id?: string | boolean | string[] | undefined
collectionId?: string | boolean | string[] | undefined
title?: StringFilter
avatar?: StringFilter
name?: StringFilter
order?: NumberFilter
userId?: string | boolean | string[] | undefined
orcid?: StringFilter
isAuthor?: boolean | undefined
roles?:
| ( StringFilter
)[]
| undefined
affiliation?: StringFilter
createdAt?: DateFilter
updatedAt?: DateFilter
}
| undefined
include?: ('collection' | 'user')[] | undefined
attributes?:
| (
| 'id'
| 'createdAt'
| 'updatedAt'
| 'collectionId'
| 'title'
| 'avatar'
| 'name'
| 'order'
| 'userId'
| 'orcid'
| 'isAuthor'
| 'roles'
| 'affiliation'
)[]
| undefined
} & {
id?: string | boolean | string[] | undefined
collectionId?: string | boolean | string[] | undefined
title?: StringFilter
avatar?: StringFilter
name?: StringFilter
order?: NumberFilter
userId?: string | boolean | string[] | undefined
orcid?: StringFilter
isAuthor?: boolean | undefined
roles?:
| ( StringFilter
)[]
| undefined
affiliation?: StringFilter
createdAt?: DateFilter
updatedAt?: DateFilter
})
| undefined
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
collection?: Collection
user?: User
}[]
headers: Headers
}>
DELETE /api/collectionAttributions
Remove a collection attribution
remove: (input, rest?) =>
Promise<{ status: 200; body: string; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionAttributions/delete
input
{
collectionId: string
id: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: string
headers: Headers
}>
PUT /api/collectionAttributions
Update a collection attribution
update: (input, rest?) =>
Promise<{
status: 200
body: {
createdAt?: string | undefined
updatedAt?: string | undefined
title?: string | null | undefined
avatar?: string | null | undefined
name?: string | null | undefined
order?: number | undefined
userId?: string | null | undefined
orcid?: string | null | undefined
isAuthor?: boolean | null | undefined
roles?: string[] | null | undefined
affiliation?: string | null | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionAttributions/put
input
{
affiliation: null | string
avatar: null | string
collectionId: string
createdAt: string
id: string
isAuthor: null | boolean
name: null | string
orcid: null | string
order: number
roles: null | string[]
title: null | string
updatedAt: string
userId: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
createdAt?: string | undefined
updatedAt?: string | undefined
title?: string | null | undefined
avatar?: string | null | undefined
name?: string | null | undefined
order?: number | undefined
userId?: string | null | undefined
orcid?: string | null | undefined
isAuthor?: boolean | null | undefined
roles?: string[] | null | undefined
affiliation?: string | null | undefined
}
headers: Headers
}>
POST /api/collectionPubs
Add a pub to a collection
create: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
pubId: string
collectionId: string
rank: string
contextHint: string | null
pubRank: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionPubs/post
input
{
collectionId: string
moveToTop: boolean
pubId: string
rank: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
pubId: string
collectionId: string
rank: string
contextHint: string | null
pubRank: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
GET /api/collectionPubs
Get the pubs associated with a collection
get: (input?) =>
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| { id: string; title: string; color: string; publicApply: boolean }[]
| null
downloads: { createdAt: string; type: 'formatted'; url: string }[] | null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionPubs/get
input?
{
query: {
collectionId: string
communityId: string
pubId?: string | undefined
limit?: number | undefined
offset?: number | undefined
}
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
DELETE /api/collectionPubs
Remove a pub from a collection
remove: (input, rest?) =>
Promise<{ status: 200; body: string; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionPubs/delete
input
{
id: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: string
headers: Headers
}>
PUT /api/collectionPubs
Change the pubs that are associated with a collection
update: (input, rest?) =>
Promise<{
status: 200
body: {
pubId?: string | undefined
collectionId?: string | undefined
rank?: string | undefined
contextHint?: string | null | undefined
pubRank?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-collectionPubs/put
input
{
collectionId: string
contextHint: null | string
id: string
pubId: string
pubRank: string
rank: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
pubId?: string | undefined
collectionId?: string | undefined
rank?: string | undefined
contextHint?: string | null | undefined
pubRank?: string | undefined
}
headers: Headers
}>
POST /api/communities
Create a community
create: (input, rest?) =>
Promise<
| { status: 201; body: string; headers: Headers }
| { status: 409; body: string; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-communities/post
input
{
accentColorDark: undefined | string
accentColorLight: undefined | string
description: undefined | null | string
headerLogo: undefined | null | string
heroLogo: undefined | null | string
heroTitle: undefined | null | string
subdomain: string
title: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<
| {
status: 201
body: string
headers: Headers
}
| {
status: 409
body: string
headers: Headers
}
>
GET /api/communities/:id
Get a community
get: (input) =>
Promise<{
status: 200
body: {
id: string
subdomain: string
domain: string | null
title: string
citeAs: string | null
publishAs: string | null
description: string | null
avatar: string | null
favicon: string | null
accentColorLight: string
accentColorDark: string
hideCreatePubButton: boolean | null
headerLogo: string | null
headerLinks:
| { title: string; url: string; external?: boolean | undefined }[]
| null
headerColorType: 'light' | 'dark' | 'custom' | null
useHeaderTextAccent: boolean | null
hideHero: boolean | null
hideHeaderLogo: boolean | null
heroLogo: string | null
heroBackgroundImage: string | null
heroBackgroundColor: string | null
heroTextColor: string | null
useHeaderGradient: boolean | null
heroImage: string | null
heroTitle: string | null
heroText: string | null
heroPrimaryButton: { title: string; url: string } | null
heroSecondaryButton: { title: string; url: string } | null
heroAlign: string | null
navigation:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
hideNav: boolean | null
navLinks:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
footerLinks:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
footerLogoLink: string | null
footerTitle: string | null
footerImage: string | null
website: string | null
facebook: string | null
twitter: string | null
instagram: string | null
mastodon: string | null
linkedin: string | null
bluesky: string | null
github: string | null
email: string | null
socialLinksLocation: 'header' | 'footer' | null
issn: string | null
isFeatured: boolean | null
viewHash: string | null
editHash: string | null
premiumLicenseFlag: boolean | null
defaultPubCollections: string[] | null
analyticsSettings:
| { type: 'google-analytics'; credentials: string }
| { type: 'simple-analytics'; credentials: null }
| null
spamTagId: string | null
organizationId: string | null
scopeSummaryId: string | null
accentTextColor: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-communities-id/get
input
{
params: { id: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
subdomain: string
domain: string | null
title: string
citeAs: string | null
publishAs: string | null
description: string | null
avatar: string | null
favicon: string | null
accentColorLight: string
accentColorDark: string
hideCreatePubButton: boolean | null
headerLogo: string | null
headerLinks:
| {
title: string
url: string
external?: boolean | undefined
}[]
| null
headerColorType: 'light' | 'dark' | 'custom' | null
useHeaderTextAccent: boolean | null
hideHero: boolean | null
hideHeaderLogo: boolean | null
heroLogo: string | null
heroBackgroundImage: string | null
heroBackgroundColor: string | null
heroTextColor: string | null
useHeaderGradient: boolean | null
heroImage: string | null
heroTitle: string | null
heroText: string | null
heroPrimaryButton: {
title: string
url: string
} | null
heroSecondaryButton: {
title: string
url: string
} | null
heroAlign: string | null
navigation:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
hideNav: boolean | null
navLinks:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
footerLinks:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
footerLogoLink: string | null
footerTitle: string | null
footerImage: string | null
website: string | null
facebook: string | null
twitter: string | null
instagram: string | null
mastodon: string | null
linkedin: string | null
bluesky: string | null
github: string | null
email: string | null
socialLinksLocation: 'header' | 'footer' | null
issn: string | null
isFeatured: boolean | null
viewHash: string | null
editHash: string | null
premiumLicenseFlag: boolean | null
defaultPubCollections: string[] | null
analyticsSettings:
| {
type: 'google-analytics'
credentials: string
}
| {
type: 'simple-analytics'
credentials: null
}
| null
spamTagId: string | null
organizationId: string | null
scopeSummaryId: string | null
accentTextColor: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
GET /api/communities
Get a list of communities. Currently only returns the current community.
getCommunities: (input?) =>
Promise<{
status: 200
body: {
id: string
subdomain: string
domain: string | null
title: string
citeAs: string | null
publishAs: string | null
description: string | null
avatar: string | null
favicon: string | null
accentColorLight: string
accentColorDark: string
hideCreatePubButton: boolean | null
headerLogo: string | null
headerLinks:
| { title: string; url: string; external?: boolean | undefined }[]
| null
headerColorType: 'light' | 'dark' | 'custom' | null
useHeaderTextAccent: boolean | null
hideHero: boolean | null
hideHeaderLogo: boolean | null
heroLogo: string | null
heroBackgroundImage: string | null
heroBackgroundColor: string | null
heroTextColor: string | null
useHeaderGradient: boolean | null
heroImage: string | null
heroTitle: string | null
heroText: string | null
heroPrimaryButton: { title: string; url: string } | null
heroSecondaryButton: { title: string; url: string } | null
heroAlign: string | null
navigation:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
hideNav: boolean | null
navLinks:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
footerLinks:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
footerLogoLink: string | null
footerTitle: string | null
footerImage: string | null
website: string | null
facebook: string | null
twitter: string | null
instagram: string | null
mastodon: string | null
linkedin: string | null
bluesky: string | null
github: string | null
email: string | null
socialLinksLocation: 'header' | 'footer' | null
issn: string | null
isFeatured: boolean | null
viewHash: string | null
editHash: string | null
premiumLicenseFlag: boolean | null
defaultPubCollections: string[] | null
analyticsSettings:
| { type: 'google-analytics'; credentials: string }
| { type: 'simple-analytics'; credentials: null }
| null
spamTagId: string | null
organizationId: string | null
scopeSummaryId: string | null
accentTextColor: string
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-communities/get
input?
{
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
subdomain: string
domain: string | null
title: string
citeAs: string | null
publishAs: string | null
description: string | null
avatar: string | null
favicon: string | null
accentColorLight: string
accentColorDark: string
hideCreatePubButton: boolean | null
headerLogo: string | null
headerLinks:
| {
title: string
url: string
external?: boolean | undefined
}[]
| null
headerColorType: 'light' | 'dark' | 'custom' | null
useHeaderTextAccent: boolean | null
hideHero: boolean | null
hideHeaderLogo: boolean | null
heroLogo: string | null
heroBackgroundImage: string | null
heroBackgroundColor: string | null
heroTextColor: string | null
useHeaderGradient: boolean | null
heroImage: string | null
heroTitle: string | null
heroText: string | null
heroPrimaryButton: {
title: string
url: string
} | null
heroSecondaryButton: {
title: string
url: string
} | null
heroAlign: string | null
navigation:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
hideNav: boolean | null
navLinks:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
footerLinks:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
footerLogoLink: string | null
footerTitle: string | null
footerImage: string | null
website: string | null
facebook: string | null
twitter: string | null
instagram: string | null
mastodon: string | null
linkedin: string | null
bluesky: string | null
github: string | null
email: string | null
socialLinksLocation: 'header' | 'footer' | null
issn: string | null
isFeatured: boolean | null
viewHash: string | null
editHash: string | null
premiumLicenseFlag: boolean | null
defaultPubCollections: string[] | null
analyticsSettings:
| {
type: 'google-analytics'
credentials: string
}
| {
type: 'simple-analytics'
credentials: null
}
| null
spamTagId: string | null
organizationId: string | null
scopeSummaryId: string | null
accentTextColor: string
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
PUT /api/communities
Update a community
update: (input?, rest?) =>
Promise<{
status: 200
body: {
subdomain?: string | undefined
domain?: string | null | undefined
title?: string | undefined
citeAs?: string | null | undefined
publishAs?: string | null | undefined
description?: string | null | undefined
avatar?: string | null | undefined
favicon?: string | null | undefined
accentColorLight?: string | undefined
accentColorDark?: string | undefined
hideCreatePubButton?: boolean | null | undefined
headerLogo?: string | null | undefined
headerLinks?:
| { title: string; url: string; external?: boolean | undefined }[]
| null
| undefined
headerColorType?: 'light' | 'dark' | 'custom' | null | undefined
useHeaderTextAccent?: boolean | null | undefined
hideHero?: boolean | null | undefined
hideHeaderLogo?: boolean | null | undefined
heroLogo?: string | null | undefined
heroBackgroundImage?: string | null | undefined
heroBackgroundColor?: string | null | undefined
heroTextColor?: string | null | undefined
useHeaderGradient?: boolean | null | undefined
heroImage?: string | null | undefined
heroTitle?: string | null | undefined
heroText?: string | null | undefined
heroPrimaryButton?: { title: string; url: string } | null | undefined
heroSecondaryButton?: { title: string; url: string } | null | undefined
heroAlign?: string | null | undefined
navigation?:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
| undefined
hideNav?: boolean | null | undefined
navLinks?:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
| undefined
footerLinks?:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
| undefined
footerLogoLink?: string | null | undefined
footerTitle?: string | null | undefined
footerImage?: string | null | undefined
website?: string | null | undefined
facebook?: string | null | undefined
twitter?: string | null | undefined
instagram?: string | null | undefined
mastodon?: string | null | undefined
linkedin?: string | null | undefined
bluesky?: string | null | undefined
github?: string | null | undefined
email?: string | null | undefined
socialLinksLocation?: 'header' | 'footer' | null | undefined
issn?: string | null | undefined
isFeatured?: boolean | null | undefined
viewHash?: string | null | undefined
editHash?: string | null | undefined
premiumLicenseFlag?: boolean | null | undefined
defaultPubCollections?: string[] | null | undefined
analyticsSettings?:
| { type: 'google-analytics'; credentials: string }
| { type: 'simple-analytics'; credentials: null }
| null
| undefined
spamTagId?: string | null | undefined
organizationId?: string | null | undefined
scopeSummaryId?: string | null | undefined
accentTextColor?: string | undefined
communityId?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-communities/put
input?
{
accentColorDark: string
accentColorLight: string
accentTextColor: string
analyticsSettings:
| null
| {
credentials: string
type: 'google-analytics'
}
| {
credentials: null
type: 'simple-analytics'
}
avatar: null | string
bluesky: null | string
citeAs: null | string
defaultPubCollections: null | string[]
description: null | string
domain: null | string
editHash: null | string
email: null | string
facebook: null | string
favicon: null | string
footerImage: null | string
footerLinks:
| null
| (
| {
id: string
type: 'collection' | 'page'
}
| {
href: string
id: string
title: string
}
| {
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
id: string
title: string
}
)[]
footerLogoLink: null | string
footerTitle: null | string
github: null | string
headerColorType: null | 'light' | 'dark' | 'custom'
headerLinks:
| null
| {
external: boolean
title: string
url: string
}[]
headerLogo: null | string
heroAlign: null | string
heroBackgroundColor: null | string
heroBackgroundImage: null | string
heroImage: null | string
heroLogo: null | string
heroPrimaryButton: null | {
title: string
url: string
}
heroSecondaryButton: null | {
title: string
url: string
}
heroText: null | string
heroTextColor: null | string
heroTitle: null | string
hideCreatePubButton: null | boolean
hideHeaderLogo: null | boolean
hideHero: null | boolean
hideNav: null | boolean
instagram: null | string
isFeatured: null | boolean
issn: null | string
linkedin: null | string
mastodon: null | string
navLinks:
| null
| (
| {
id: string
type: 'collection' | 'page'
}
| {
href: string
id: string
title: string
}
| {
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
id: string
title: string
}
)[]
navigation:
| null
| (
| {
id: string
type: 'collection' | 'page'
}
| {
href: string
id: string
title: string
}
| {
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
id: string
title: string
}
)[]
organizationId: null | string
premiumLicenseFlag: null | boolean
publishAs: null | string
scopeSummaryId: null | string
socialLinksLocation: null | 'header' | 'footer'
spamTagId: null | string
subdomain: string
title: string
twitter: null | string
useHeaderGradient: null | boolean
useHeaderTextAccent: null | boolean
viewHash: null | string
website: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
subdomain?: string | undefined
domain?: string | null | undefined
title?: string | undefined
citeAs?: string | null | undefined
publishAs?: string | null | undefined
description?: string | null | undefined
avatar?: string | null | undefined
favicon?: string | null | undefined
accentColorLight?: string | undefined
accentColorDark?: string | undefined
hideCreatePubButton?: boolean | null | undefined
headerLogo?: string | null | undefined
headerLinks?:
| {
title: string
url: string
external?: boolean | undefined
}[]
| null
| undefined
headerColorType?: 'light' | 'dark' | 'custom' | null | undefined
useHeaderTextAccent?: boolean | null | undefined
hideHero?: boolean | null | undefined
hideHeaderLogo?: boolean | null | undefined
heroLogo?: string | null | undefined
heroBackgroundImage?: string | null | undefined
heroBackgroundColor?: string | null | undefined
heroTextColor?: string | null | undefined
useHeaderGradient?: boolean | null | undefined
heroImage?: string | null | undefined
heroTitle?: string | null | undefined
heroText?: string | null | undefined
heroPrimaryButton?:
| {
title: string
url: string
}
| null
| undefined
heroSecondaryButton?:
| {
title: string
url: string
}
| null
| undefined
heroAlign?: string | null | undefined
navigation?:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
| undefined
hideNav?: boolean | null | undefined
navLinks?:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
| undefined
footerLinks?:
| (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
| {
id: string
title: string
children: (
| {
id: string
type: 'collection' | 'page'
}
| {
id: string
title: string
href: string
}
)[]
}
)[]
| null
| undefined
footerLogoLink?: string | null | undefined
footerTitle?: string | null | undefined
footerImage?: string | null | undefined
website?: string | null | undefined
facebook?: string | null | undefined
twitter?: string | null | undefined
instagram?: string | null | undefined
mastodon?: string | null | undefined
linkedin?: string | null | undefined
bluesky?: string | null | undefined
github?: string | null | undefined
email?: string | null | undefined
socialLinksLocation?: 'header' | 'footer' | null | undefined
issn?: string | null | undefined
isFeatured?: boolean | null | undefined
viewHash?: string | null | undefined
editHash?: string | null | undefined
premiumLicenseFlag?: boolean | null | undefined
defaultPubCollections?: string[] | null | undefined
analyticsSettings?:
| {
type: 'google-analytics'
credentials: string
}
| {
type: 'simple-analytics'
credentials: null
}
| null
| undefined
spamTagId?: string | null | undefined
organizationId?: string | null | undefined
scopeSummaryId?: string | null | undefined
accentTextColor?: string | undefined
communityId?: string | undefined
}
headers: Headers
}>
POST /api/customScripts
Set a custom scripts, i.e. the CSS or JS (if you have access) for this community
set: (input, rest?) =>
Promise<{
status: 200
body: {
id: string
type: 'css' | 'js' | null
communityId: string | null
content: string | null
}
headers: Headers
}>
const pubpub = await PubPub.createSDK({
// ...
})
const { body } = await pubpub.customScript.set({
type: 'css', // js only if your community has access to it
content: '...', // raw css
})
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-customScripts/post
input
{
content: null | string
type: null | 'css' | 'js'
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
id: string
type: 'css' | 'js' | null
communityId: string | null
content: string | null
}
headers: Headers
}>
POST /api/facets
Facets are properties that cascade down from a community, collection, or publication to all of its children, like the style of citation used or the license for content.
You cannot "unset" facets, so passing an empty object will just be treated as no change.
update: (input, rest?) => Promise<{ status: 200; body: {}; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-facets/post
input
{
facets: {
CitationStyle:
| undefined
| {
citationStyle?:
| 'acm-siggraph'
| 'american-anthro'
| 'apa'
| 'apa-7'
| 'arcadia-science'
| 'cell'
| 'chicago'
| 'harvard'
| 'elife'
| 'frontiers'
| 'mla'
| 'vancouver'
| 'ama'
| undefined
inlineCitationStyle?:
| 'label'
| 'count'
| 'authorYear'
| 'author'
| undefined
}
License:
| undefined
| {
kind?:
| 'cc-by'
| 'cc-0'
| 'cc-by-nc'
| 'cc-by-nd'
| 'cc-by-nc-nd'
| 'cc-by-nc-sa'
| 'cc-by-sa'
| 'copyright'
| undefined
copyrightSelection?:
| {
choice?: 'infer-from-scope' | 'choose-here' | undefined
year?: number | null | undefined
}
| undefined
}
NodeLabels:
| undefined
| {
image?:
| { enabled?: boolean | undefined; text?: string | undefined }
| undefined
video?:
| { enabled?: boolean | undefined; text?: string | undefined }
| undefined
audio?:
| { enabled?: boolean | undefined; text?: string | undefined }
| undefined
table?:
| { enabled?: boolean | undefined; text?: string | undefined }
| undefined
math?:
| { enabled?: boolean | undefined; text?: string | undefined }
| undefined
iframe?:
| { enabled?: boolean | undefined; text?: string | undefined }
| undefined
}
PubEdgeDisplay:
| undefined
| {
defaultsToCarousel?: boolean | undefined
descriptionIsVisible?: boolean | undefined
}
PubHeaderTheme:
| undefined
| {
backgroundImage?: string | undefined
backgroundColor?: string | undefined
textStyle?:
| 'light'
| 'dark'
| 'black-blocks'
| 'white-blocks'
| undefined
}
}
scope: {
id: string
kind: 'community' | 'collection' | 'pub'
}
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {}
headers: Headers
}>
POST /api/members
Create a member
create: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
pubId: string | null
collectionId: string | null
communityId: string | null
organizationId: string | null
userId: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-members/post
input
{
collectionId: null | string
pubId: null | string
targetUserId: string
value: {
permissions: 'view' | 'edit' | 'manage' | 'admin'
}
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
pubId: string | null
collectionId: string | null
communityId: string | null
organizationId: string | null
userId: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
GET /api/members/:id
Get a member
get: (input) =>
Promise<{
status: 200
body: {
id: string
pubId: string | null
collectionId: string | null
communityId: string | null
organizationId: string | null
userId: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
createdAt?: string | undefined
updatedAt?: string | undefined
user?: User
community?: Community
pub?: Pub
collection?: Collection
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-members-id/get
input
{
params: { id: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
query?:
| {
include?: ('community' | 'collection' | 'pub' | 'user')[] | undefined
attributes?:
| (
| 'id'
| 'pubId'
| 'collectionId'
| 'communityId'
| 'organizationId'
| 'userId'
| 'permissions'
| 'isOwner'
| 'subscribedToActivityDigest'
)[]
| undefined
}
| undefined
}
Promise<{
status: 200
body: {
id: string
pubId: string | null
collectionId: string | null
communityId: string | null
organizationId: string | null
userId: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
createdAt?: string | undefined
updatedAt?: string | undefined
user?: User
community?: Community
pub?: Pub
collection?: Collection
}
headers: Headers
}>
GET /api/members
Get many members
getMany: (input?) =>
Promise<{
status: 200
body: {
id: string
pubId: string | null
collectionId: string | null
communityId: string | null
organizationId: string | null
userId: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
createdAt?: string | undefined
updatedAt?: string | undefined
user?: User
community?: Community
pub?: Pub
collection?: Collection
}[]
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-members/get
input?
{
query:
| ({
limit?: number | undefined
offset?: number | undefined
sortBy?: 'createdAt' | 'updatedAt' | undefined
orderBy?: 'ASC' | 'DESC' | undefined
filter?:
| {
id?: string | boolean | string[] | undefined
pubId?: string | boolean | string[] | undefined
collectionId?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
organizationId?: string | boolean | string[] | undefined
userId?: string | boolean | string[] | undefined
permissions?:
| 'view'
| 'edit'
| 'manage'
| 'admin'
| ('view' | 'edit' | 'manage' | 'admin')[]
| undefined
isOwner?: boolean | undefined
subscribedToActivityDigest?: boolean | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
}
| undefined
include?: ('community' | 'collection' | 'pub' | 'user')[] | undefined
attributes?:
| (
| 'id'
| 'createdAt'
| 'updatedAt'
| 'pubId'
| 'collectionId'
| 'communityId'
| 'organizationId'
| 'userId'
| 'permissions'
| 'isOwner'
| 'subscribedToActivityDigest'
)[]
| undefined
} & {
id?: string | boolean | string[] | undefined
pubId?: string | boolean | string[] | undefined
collectionId?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
organizationId?: string | boolean | string[] | undefined
userId?: string | boolean | string[] | undefined
permissions?:
| 'view'
| 'edit'
| 'manage'
| 'admin'
| ('view' | 'edit' | 'manage' | 'admin')[]
| undefined
isOwner?: boolean | undefined
subscribedToActivityDigest?: boolean | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
})
| undefined
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
pubId: string | null
collectionId: string | null
communityId: string | null
organizationId: string | null
userId: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
createdAt?: string | undefined
updatedAt?: string | undefined
user?: User
community?: Community
pub?: Pub
collection?: Collection
}[]
headers: Headers
}>
DELETE /api/members
Remove a member
remove: (input, rest?) =>
Promise<{ status: 200; body: string; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-members/delete
input
{
collectionId: null | string
id: string
pubId: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: string
headers: Headers
}>
PUT /api/members
Update a member
update: (input, rest?) =>
Promise<{
status: 200
body: {
id: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-members/put
input
{
collectionId: null | string
id: string
pubId: null | string
value: {
permissions: 'view' | 'edit' | 'manage' | 'admin'
subscribedToActivityDigest: boolean
}
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
id: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
}
headers: Headers
}>
POST /api/pages
Create a page
create: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
slug: string
isPublic: boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
isNarrowWidth: boolean | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pages/post
input
{
avatar: undefined | null | string
description: undefined | null | string
isNarrowWidth: undefined | null | boolean
isPublic: undefined | boolean
layout: Layout
layoutAllowsDuplicatePubs: undefined | boolean
slug: string
title: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
slug: string
isPublic: boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
isNarrowWidth: boolean | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
GET /api/pages/:slugOrId
Get a page by it's slug or id.
get: (input) =>
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
slug: string
isPublic: boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
isNarrowWidth: boolean | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pages-slugOrId/get
input
{
params: { slugOrId: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
query?:
| {
include?: 'community'[] | undefined
attributes?:
| (
| 'id'
| 'communityId'
| 'title'
| 'description'
| 'avatar'
| 'viewHash'
| 'slug'
| 'isPublic'
| 'layout'
| 'layoutAllowsDuplicatePubs'
| 'isNarrowWidth'
)[]
| undefined
}
| undefined
}
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
slug: string
isPublic: boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
isNarrowWidth: boolean | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
GET /api/pages
Get many pages
getMany: (input?) =>
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
slug: string
isPublic: boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
isNarrowWidth: boolean | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pages/get
input?
{
query:
| ({
limit?: number | undefined
offset?: number | undefined
sortBy?: 'createdAt' | 'updatedAt' | 'title' | 'slug' | undefined
orderBy?: 'ASC' | 'DESC' | undefined
filter?:
| {
id?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
title?: StringFilter
description?: StringFilter
avatar?: StringFilter
viewHash?: StringFilter
slug?: StringFilter
isPublic?: boolean | undefined
layoutAllowsDuplicatePubs?: boolean | undefined
isNarrowWidth?: boolean | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
}
| undefined
include?: 'community'[] | undefined
attributes?:
| (
| 'id'
| 'createdAt'
| 'updatedAt'
| 'communityId'
| 'title'
| 'description'
| 'avatar'
| 'viewHash'
| 'slug'
| 'isPublic'
| 'layout'
| 'layoutAllowsDuplicatePubs'
| 'isNarrowWidth'
)[]
| undefined
} & {
id?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
title?: StringFilter
description?: StringFilter
avatar?: StringFilter
viewHash?: StringFilter
slug?: StringFilter
isPublic?: boolean | undefined
layoutAllowsDuplicatePubs?: boolean | undefined
isNarrowWidth?: boolean | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
})
| undefined
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
slug: string
isPublic: boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
isNarrowWidth: boolean | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
DELETE /api/pages
Remove a page
remove: (input, rest?) =>
Promise<{ status: 201; body: string; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pages/delete
input
{
pageId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: string
headers: Headers
}>
PUT /api/pages
Update a page
update: (input, rest?) =>
Promise<{
status: 201
body: {
title?: string | undefined
description?: string | null | undefined
avatar?: string | null | undefined
viewHash?: string | null | undefined
slug?: string | undefined
isPublic?: boolean | undefined
layout?: Layout
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| { id: string; title: string; color: string; publicApply: boolean }[]
| null
downloads: { createdAt: string; type: 'formatted'; url: string }[] | null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubs/post
input?
{
avatar: null | string
collectionId: null | string
createPubToken: null | string
customPublishedAt: null | string
description: null | string
doi: null | string
downloads:
| null
| {
createdAt: string
type: 'formatted'
url: string
}[]
htmlDescription: null | string
htmlTitle: null | string
slug: string
title: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}>
POST /api/pubs/:pubId/doi
Deposit metadata to create a DOI
deposit: (input, rest) =>
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| { status: 400; body: { error: string }; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-pubId-doi/post
input
;undefined | null | {}
rest
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
pubId: string
}
}
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| {
status: 400
body: {
error: string
}
headers: Headers
}
>
POST /api/pubs/:pubId/doi/preview
Preview a DOI deposit
preview: (input, rest) =>
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| { status: 400; body: { error: string }; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-pubId-doi-preview/post
input
;undefined | null | {}
rest
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
pubId: string
}
}
Promise<
| {
status: 200
body: {
type: 'element'
name: string
attributes?: Record<string, string> | undefined
children?: any[] | undefined
}
headers: Headers
}
| {
status: 400
body: {
error: string
}
headers: Headers
}
>
GET /api/pubs/:slugOrId
Get a pub by it's slug or id.
The slug is the thing after /pub/
in the URL, but before /release
or /draft
.
get: (input) =>
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| { id: string; title: string; color: string; publicApply: boolean }[]
| null
downloads: { createdAt: string; type: 'formatted'; url: string }[] | null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
community?: Community
draft?:
| { id: string; latestKeyAt: string | null; firebasePath: string }
| undefined
discussions?: Discussion[]
members?: Member[]
releases?: Release[]
inboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
outboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
reviews?: Review[]
submission?: Submission
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-slugOrId/get
input
{
params: { slugOrId: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
query?:
| {
include?:
| (
| 'community'
| 'attributions'
| 'collectionPubs'
| 'members'
| 'draft'
| 'reviews'
| 'releases'
| 'outboundEdges'
| 'inboundEdges'
| 'submission'
)[]
| undefined
attributes?:
| (
| 'id'
| 'communityId'
| 'title'
| 'description'
| 'avatar'
| 'viewHash'
| 'editHash'
| 'scopeSummaryId'
| 'slug'
| 'metadata'
| 'doi'
| 'crossrefDepositRecordId'
| 'htmlTitle'
| 'htmlDescription'
| 'customPublishedAt'
| 'labels'
| 'downloads'
| 'reviewHash'
| 'commentHash'
| 'draftId'
)[]
| undefined
}
| undefined
}
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
community?: Community
draft?: Draft
discussions?: Discussion[]
members?: Member[]
releases?: Release[]
inboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
outboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
reviews?: Review[]
submission?: Submission
}
headers: Headers
}>
GET /api/pubs
Get many pubs
getMany: (input?) =>
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| { id: string; title: string; color: string; publicApply: boolean }[]
| null
downloads: { createdAt: string; type: 'formatted'; url: string }[] | null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
community?: Community
draft?:
| { id: string; latestKeyAt: string | null; firebasePath: string }
| undefined
discussions?: Discussion[]
members?: Member[]
releases?: Release[]
inboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
outboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
reviews?: Review[]
submission?: Submission
}[]
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs/get
input?
{
query:
| ({
limit?: number | undefined
offset?: number | undefined
sortBy?: 'createdAt' | 'updatedAt' | 'title' | 'slug' | undefined
orderBy?: 'ASC' | 'DESC' | undefined
filter?:
| {
id?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
title?: StringFilter
description?: StringFilter
avatar?: StringFilter
viewHash?: StringFilter
editHash?: StringFilter
scopeSummaryId?: string | boolean | string[] | undefined
slug?: StringFilter
metadata?:
| {
mtg_id?: StringFilter
bibcode?: StringFilter
mtg_presentation_id?: StringFilter
}
| undefined
doi?: StringFilter
crossrefDepositRecordId?: string | boolean | string[] | undefined
htmlTitle?: StringFilter
htmlDescription?: StringFilter
customPublishedAt?: DateFilter
labels?:
| {
id?: string | boolean | string[] | undefined
title?: StringFilter
color?: StringFilter
publicApply?: boolean | undefined
}[]
| undefined
downloads?:
| {
createdAt?: DateFilter
type?: 'formatted' | 'formatted'[] | undefined
url?: StringFilter
}[]
| undefined
reviewHash?: StringFilter
commentHash?: StringFilter
draftId?: string | boolean | string[] | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
}
| undefined
include?:
| (
| 'community'
| 'attributions'
| 'collectionPubs'
| 'members'
| 'draft'
| 'reviews'
| 'releases'
| 'outboundEdges'
| 'inboundEdges'
| 'submission'
)[]
| undefined
attributes?:
| (
| 'id'
| 'createdAt'
| 'updatedAt'
| 'communityId'
| 'title'
| 'description'
| 'avatar'
| 'viewHash'
| 'editHash'
| 'scopeSummaryId'
| 'slug'
| 'metadata'
| 'doi'
| 'crossrefDepositRecordId'
| 'htmlTitle'
| 'htmlDescription'
| 'customPublishedAt'
| 'labels'
| 'downloads'
| 'reviewHash'
| 'commentHash'
| 'draftId'
)[]
| undefined
} & {
id?: string | boolean | string[] | undefined
communityId?: string | boolean | string[] | undefined
title?: StringFilter
description?: StringFilter
avatar?: StringFilter
viewHash?: StringFilter
editHash?: StringFilter
scopeSummaryId?: string | boolean | string[] | undefined
slug?: StringFilter
metadata?:
| {
mtg_id?: StringFilter
bibcode?: StringFilter
mtg_presentation_id?: StringFilter
}
| undefined
doi?: StringFilter
crossrefDepositRecordId?: string | boolean | string[] | undefined
htmlTitle?: StringFilter
htmlDescription?: StringFilter
customPublishedAt?: DateFilter
labels?:
| {
id?: string | boolean | string[] | undefined
title?: StringFilter
color?: StringFilter
publicApply?: boolean | undefined
}[]
| undefined
downloads?:
| {
createdAt?: DateFilter
type?: 'formatted' | 'formatted'[] | undefined
url?: StringFilter
}[]
| undefined
reviewHash?: StringFilter
commentHash?: StringFilter
draftId?: string | boolean | string[] | undefined
createdAt?: DateFilter
updatedAt?: DateFilter
})
| undefined
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
community?: Community
draft?: Draft
discussions?: Discussion[]
members?: Member[]
releases?: Release[]
inboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
outboundEdges?:
| {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}[]
| undefined
reviews?: Review[]
submission?: Submission
}[]
headers: Headers
}>
GET /api/pubs/:pubId/resource
Get pub as a resource
getResource: (input) => Promise<{ status: 200; body: any; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-pubId-resource/get
input
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
pubId: string
}
}
Promise<{
status: 200
body: any
headers: Headers
}>
POST /api/pubs/many
Search for many pubs. This is an older alternative to the more standardised GET /api/pubs
,
offering different options.
queryMany: (input, rest?) =>
Promise<{
status: 200
body: {
pubsById: Record<
string,
{
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| { createdAt: string; type: 'formatted'; url: string }[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
discussions?: Discussion[]
releases?: Release[]
isRelease: boolean
releaseNumber: number | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
>
pubIds: string[]
loadedAllPubs?: number | boolean | null | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-many/post
input
{
alreadyFetchedPubIds: string[]
pubOptions: {
getCollections: boolean
getCommunity: boolean
getDiscussions: boolean
getDraft: boolean
getEdges: 'all' | 'approved-only'
getEdgesOptions: {
includeCommunityForPubs?: boolean | undefined
includeTargetPub?: boolean | undefined
includePub?: boolean | undefined
}
getExports: boolean
getFacets: boolean
getMembers: boolean
getReviews: boolean
getSubmissions: boolean
isAuth: boolean
isPreview: boolean
}
query:
| ({
collectionIds: string[]
excludeCollectionIds: string[]
limit: number
offset: number
ordering: {
direction: 'ASC' | 'DESC'
field: 'title' | 'collectionRank' | 'updatedDate' | 'creationDate'
}
pubIds: string[]
} & undefined)
| {
collectionIds: string[]
excludeCollectionIds: string[]
limit: number
offset: number
ordering: {
direction: 'ASC' | 'DESC'
field: 'title' | 'collectionRank' | 'updatedDate' | 'creationDate'
}
pubIds: string[]
}
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
pubsById: Record<
string,
{
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
discussions?: Discussion[]
releases?: Release[]
isRelease: boolean
releaseNumber: number | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
>
pubIds: string[]
loadedAllPubs?: number | boolean | null | undefined
}
headers: Headers
}>
DELETE /api/pubs
Remove a Pub
remove: (input, rest?) => Promise<{ status: 200; body: {}; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubs/delete
input
{
pubId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {}
headers: Headers
}>
Methods for working with the text of a pub
POST /api/pubs/text/convert
Convert files to a ProseMirror document.
Mostly for use in conjunction with PUT /api/pubs/:pubId/text
.
convert: (input, rest?) =>
Promise<{
status: 200
body: {
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
warnings: any[]
pandocErrorOutput: string
proposedMetadata: Record<string, any>
rawMetadata?: Record<string, any> | undefined
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-text-convert/post
input
{
files: {
}
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
warnings: any[]
pandocErrorOutput: string
proposedMetadata: Record<string, any>
rawMetadata?: Record<string, any> | undefined
}
headers: Headers
}>
GET /api/pubs/:pubId/text
Get the text of a Pub as a ProseMirror document
get: (input) =>
Promise<{
status: 200
body: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-pubId-text/get
input
{
params: { pubId: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
headers: Headers
}>
POST /api/pubs/text/import
Create a pub and upload a file and import it to a pub.
import: (input, rest?) => Promise<{ status: 201; body: { pub: { id: string; communityId: string; title: string; description: string | null; avatar: string | null; viewHash: string | null; editHash: string | null; scopeSummaryId: string | null; slug: string; metadata: { mtg_id: string; bibcode: string; mtg_presentation_id: string; } | null; doi: string | null; crossrefDepositRecordId: string | null; attributions: { id: string; pubId: string; title: string | null; avatar: string | null; name: string | null; order: number; userId: string | null; orcid: string | null; isAuthor: boolean | null; roles: string[] | null; affiliation: string | null; createdAt?: string | undefined; updatedAt?: string | undefined; }[]; htmlTitle: string | null; htmlDescription: string | null; customPublishedAt: string | null; labels: { id: string; title: string; color: string; publicApply: boolean; }[] | null; downloads: { createdAt: string; type: "formatted"; url: string; }[] | null; reviewHash: string | null; commentHash: string | null; draftId: string; createdAt?: string | undefined; updatedAt?: string | undefined; }; doc: { type: "doc"; content: any[]; attrs?: Record<string, any> | undefined; }; }; headers: Headers; }>;
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-text-import/post
input
{
attributions: boolean | 'match'
avatar: null | string
collectionId: string
customPublishedAt: null | string
description: null | string
doi: null | string
downloads:
| null
| {
createdAt: string
type: 'formatted'
url: string
}[]
files: {}
htmlDescription: null | string
htmlTitle: null | string
overrideAll: boolean
overrides:
| 'title'
| 'description'
| 'slug'
| 'customPublishedAt'
| ('title' | 'description' | 'slug' | 'customPublishedAt')[]
pubId: undefined
slug: string
title: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
pub?: Pub
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
}
headers: Headers
}>
POST /api/pubs/text/importOld
Create a pub and upload a file and import it to a pub.
importOld: (input, rest?) =>
Promise<{
status: 201
body: {
pub?: Pub
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-text-importOld/post
input
{
pub?: Pub
sourceFiles: {
assetKey: string
clientPath: string
id: number
label:
| 'metadata'
| 'none'
| 'supplement'
| 'document'
| 'preamble'
| 'bibliography'
loaded: number
state: string
total: number
}[]
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
pub?: Pub
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
}
headers: Headers
}>
POST /api/pubs/:pubId/text/import
Upload files and import it to a pub.
importToPub: (input, rest) =>
Promise<{
status: 200
body: {
pub?: Pub
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-pubId-text-import/post
input
{
attributions: boolean | 'match'
files: {}
method: 'replace' | 'overwrite' | 'append' | 'prepend'
overrideAll: boolean
overrides:
| 'title'
| 'description'
| 'slug'
| 'customPublishedAt'
| ('title' | 'description' | 'slug' | 'customPublishedAt')[]
}
rest
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
pubId: string
}
}
Promise<{
status: 200
body: {
pub?: Pub
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
}
headers: Headers
}>
PUT /api/pubs/:pubId/text
Replace the text of a pub with a different ProseMirror document
update: (input, rest) =>
Promise<
| {
status: 200
body: {
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
url?: string | undefined
}
headers: Headers
}
| { status: 400; body: { error: string }; headers: Headers }
>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubs-pubId-text/put
input
{
clientID: string
doc: {
attrs: Record<string, any>
content: any[]
type: 'doc'
}
method: 'replace' | 'overwrite' | 'append' | 'prepend'
publishRelease: boolean
}
rest
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
params: {
pubId: string
}
}
Promise<
| {
status: 200
body: {
doc: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
}
url?: string | undefined
}
headers: Headers
}
| {
status: 400
body: {
error: string
}
headers: Headers
}
>
PUT /api/pubs
Update a Pub
update: (input, rest?) =>
Promise<{
status: 200
body: {
title?: string | undefined
description?: string | null | undefined
avatar?: string | null | undefined
viewHash?: string | null | undefined
editHash?: string | null | undefined
slug?: string | undefined
metadata?:
| { mtg_id: string; bibcode: string; mtg_presentation_id: string }
| null
| undefined
doi?: string | null | undefined
htmlTitle?: string | null | undefined
htmlDescription?: string | null | undefined
customPublishedAt?: string | null | undefined
labels?:
| { id: string; title: string; color: string; publicApply: boolean }[]
| null
| undefined
downloads?:
| { createdAt: string; type: 'formatted'; url: string }[]
| null
| undefined
reviewHash?: string | null | undefined
commentHash?: string | null | undefined
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubs/put
input
{
avatar: null | string
commentHash: null | string
customPublishedAt: null | string
description: null | string
doi: null | string
downloads:
| null
| {
createdAt: string
type: 'formatted'
url: string
}[]
editHash: null | string
htmlDescription: null | string
htmlTitle: null | string
labels:
| null
| {
color: string
id: string
publicApply: boolean
title: string
}[]
metadata: null | {
bibcode: string
mtg_id: string
mtg_presentation_id: string
}
pubId: string
reviewHash: null | string
slug: string
title: string
viewHash: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
title?: string | undefined
description?: string | null | undefined
avatar?: string | null | undefined
viewHash?: string | null | undefined
editHash?: string | null | undefined
slug?: string | undefined
metadata?:
| {
mtg_id: string
bibcode: string
mtg_presentation_id: string
}
| null
| undefined
doi?: string | null | undefined
htmlTitle?: string | null | undefined
htmlDescription?: string | null | undefined
customPublishedAt?: string | null | undefined
labels?:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
| undefined
downloads?:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
| undefined
reviewHash?: string | null | undefined
commentHash?: string | null | undefined
}
headers: Headers
}>
POST /api/pubAttributions/batch
Batch create pub attributions
batchCreate: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubAttributions-batch/post
input
{
attributions?: Attribution[]
pubId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
headers: Headers
}>
POST /api/pubAttributions
Add an attribution to a pub
create: (input, rest?) =>
Promise<
| {
status: 201
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}
| { status: 500; body: string; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubAttributions/post
input
{
affiliation: null | string
avatar: null | string
createdAt: string
isAuthor: null | boolean
name: string
orcid: null | string
order: number
pubId: string
roles: null | string[]
title: null | string
updatedAt: string
userId: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<
| {
status: 201
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
headers: Headers
}
| {
status: 500
body: string
headers: Headers
}
>
GET /api/pubAttributions/:id
Get a pub attribution
get: (input) =>
Promise<{
status: 200
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
pub?: Pub
user?: User
}
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubAttributions-id/get
input
{
params: { id: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
query?:
| {
include?: ('pub' | 'user')[] | undefined
attributes?:
| (
| 'id'
| 'pubId'
| 'title'
| 'avatar'
| 'name'
| 'order'
| 'userId'
| 'orcid'
| 'isAuthor'
| 'roles'
| 'affiliation'
)[]
| undefined
}
| undefined
}
Promise<{
status: 200
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
pub?: Pub
user?: User
}
headers: Headers
}>
GET /api/pubAttributions
Get multiple pub attributions. You are limited to attributions in your community.
getMany: (input?) =>
Promise<{
status: 200
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
pub?: Pub
user?: User
}[]
headers: Headers
}>
You need to be an admin of this community in order to access this resource.
https://pubpub.org/apiDocs#/paths/api-pubAttributions/get
input?
{
query:
| ({
limit?: number | undefined
offset?: number | undefined
sortBy?:
| 'createdAt'
| 'updatedAt'
| 'name'
| 'order'
| 'affiliation'
| undefined
orderBy?: 'ASC' | 'DESC' | undefined
filter?:
| {
id?: string | boolean | string[] | undefined
pubId?: string | boolean | string[] | undefined
title?: StringFilter
avatar?: StringFilter
name?: StringFilter
order?: NumberFilter
userId?: string | boolean | string[] | undefined
orcid?: StringFilter
isAuthor?: boolean | undefined
roles?:
| ( StringFilter
)[]
| undefined
affiliation?: StringFilter
createdAt?: DateFilter
updatedAt?: DateFilter
}
| undefined
include?: ('pub' | 'user')[] | undefined
attributes?:
| (
| 'id'
| 'createdAt'
| 'updatedAt'
| 'pubId'
| 'title'
| 'avatar'
| 'name'
| 'order'
| 'userId'
| 'orcid'
| 'isAuthor'
| 'roles'
| 'affiliation'
)[]
| undefined
} & {
id?: string | boolean | string[] | undefined
pubId?: string | boolean | string[] | undefined
title?: StringFilter
avatar?: StringFilter
name?: StringFilter
order?: NumberFilter
userId?: string | boolean | string[] | undefined
orcid?: StringFilter
isAuthor?: boolean | undefined
roles?:
| ( StringFilter
)[]
| undefined
affiliation?: StringFilter
createdAt?: DateFilter
updatedAt?: DateFilter
})
| undefined
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
pub?: Pub
user?: User
}[]
headers: Headers
}>
DELETE /api/pubAttributions
Remove a pub attribution
remove: (input, rest?) =>
Promise<
| { status: 200; body: string; headers: Headers }
| { status: 500; body: string; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubAttributions/delete
input
{
id: string
pubId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<
| {
status: 200
body: string
headers: Headers
}
| {
status: 500
body: string
headers: Headers
}
>
PUT /api/pubAttributions
Update a pub attribution
update: (input, rest?) =>
Promise<
| {
status: 200
body: {
createdAt?: string | undefined
updatedAt?: string | undefined
title?: string | null | undefined
avatar?: string | null | undefined
name?: string | null | undefined
order?: number | undefined
userId?: string | null | undefined
orcid?: string | null | undefined
isAuthor?: boolean | null | undefined
roles?: string[] | null | undefined
affiliation?: string | null | undefined
}
headers: Headers
}
| { status: 500; body: string; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubAttributions/put
input
{
affiliation: null | string
avatar: null | string
createdAt: string
id: string
isAuthor: null | boolean
name: null | string
orcid: null | string
order: number
pubId: string
roles: null | string[]
title: null | string
updatedAt: string
userId: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<
| {
status: 200
body: {
createdAt?: string | undefined
updatedAt?: string | undefined
title?: string | null | undefined
avatar?: string | null | undefined
name?: string | null | undefined
order?: number | undefined
userId?: string | null | undefined
orcid?: string | null | undefined
isAuthor?: boolean | null | undefined
roles?: string[] | null | undefined
affiliation?: string | null | undefined
}
headers: Headers
}
| {
status: 500
body: string
headers: Headers
}
>
POST /api/pubEdges
Create a connection from one pub to another, or to an external publication
create: (input, rest?) =>
Promise<{
status: 201
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
targetPub: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| { id: string; title: string; color: string; publicApply: boolean }[]
| null
downloads:
| { createdAt: string; type: 'formatted'; url: string }[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
releases?: Release[]
createdAt?: string | undefined
updatedAt?: string | undefined
}
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubEdges/post
input
{
approvedByTarget: undefined | boolean
externalPublication: null | {
avatar: undefined | null | string
contributors: undefined | null | string[]
description: undefined | null | string
doi: undefined | null | string
publicationDate: undefined | null | string
title: string
url: string
}
pubId: string
pubIsParent: boolean
rank: undefined | string
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
targetPubId: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
targetPub: {
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
attributions?: Attribution[]
collectionPubs?: CollectionPub[]
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
releases?: Release[]
createdAt?: string | undefined
updatedAt?: string | undefined
}
}
headers: Headers
}>
GET /api/pubEdges/:id
Get a pubEdge by id
get: (input) =>
Promise<{
status: 200
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubEdges-id/get
input
{
params: { id: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<{
status: 200
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}
headers: Headers
}>
DELETE /api/pubEdges
Remove a connection for a pub
remove: (input, rest?) => Promise<{ status: 200; body: {}; headers: Headers }>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubEdges/delete
input
{
pubEdgeId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {}
headers: Headers
}>
PUT /api/pubEdges
Update a pubEdge
update: (input, rest?) =>
Promise<{
status: 200
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubEdges/put
input
{
approvedByTarget: undefined | boolean
externalPublication: null | {
avatar: null | string
contributors: null | string[]
description: null | string
doi: null | string
id: string
publicationDate: null | string
title: string
url: string
}
pubEdgeId: string
pubId: undefined | string
pubIsParent: undefined | boolean
rank: undefined | string
relationType:
| undefined
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
targetPubId: null | string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}
headers: Headers
}>
PUT /api/pubEdges/approvedByTarget
Update the approvedByTarget field of a pubEdge
updateApprovedByTarget: (input, rest?) =>
Promise<{
status: 200
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-pubEdges-approvedByTarget/put
input
{
approvedByTarget: boolean
pubEdgeId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 200
body: {
id: string
pubId: string
externalPublicationId: string | null
targetPubId: string | null
relationType:
| 'version'
| 'comment'
| 'commentary'
| 'preprint'
| 'rejoinder'
| 'reply'
| 'review'
| 'supplement'
| 'translation'
rank: string
pubIsParent: boolean
approvedByTarget: boolean
}
headers: Headers
}>
POST /api/releases
Create a release
create: (input, rest?) =>
Promise<
| { status: 400; body: string; headers: Headers }
| {
status: 201
body: {
id: string
pubId: string
userId: string
historyKey: number
noteContent: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
} | null
noteText: string | null
docId: string
historyKeyMissing: boolean
}
headers: Headers
}
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-releases/post
input
{
historyKey: number
noteContent: null | {
attrs: Record<string, any>
content: any[]
type: 'doc'
}
noteText: null | string
pubId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<
| {
status: 400
body: string
headers: Headers
}
| {
status: 201
body: {
id: string
pubId: string
userId: string
historyKey: number
noteContent: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
} | null
noteText: string | null
docId: string
historyKeyMissing: boolean
}
headers: Headers
}
>
POST /api/upload
Upload a file to PubPub. For if you want to upload PDFs/images to use as formatted downloads or within a Pub.
Abuse of this endpoint will result in a ban.
file: (input, rest?) =>
Promise<{
status: 201
body: { url: string; key: string; size: number }
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-upload/post
input
{
file: {
}
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body: {
url: string
key: string
size: number
}
headers: Headers
}>
GET /api/uploadPolicy
Get upload policy. Used for doing manual uploads.
policy: (input) =>
Promise<{
status: 200
body: {
acl: string
policy: string
signature: string
awsAccessKeyId: string
bucket: string
}
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-uploadPolicy/get
input
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
query: {
contentType: string
}
}
Promise<{
status: 200
body: {
acl: string
policy: string
signature: string
awsAccessKeyId: string
bucket: string
}
headers: Headers
}>
Methods for dealing with worker tasks, i.e. imports and exports
POST /api/export
Export a pub to a file. Returns the export task's status.
Requires authentication for unreleased pubs.
This returns an id of an export task. You will have to poll the status of the task to see if it is complete.
Alternatively, the SDK has a helper function that will poll the status for you, see the
exportPub
in @pubpub/sdk
.
createExport: (input, rest?) =>
Promise<{
status: 201
body: { taskId: string } | { url: string }
headers: Headers
}>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-export/post
input
{
accessHash: null | string
format:
| 'html'
| 'plain'
| 'json'
| 'epub'
| 'odt'
| 'jats'
| 'docx'
| 'tex'
| 'pdf'
| 'markdown'
historyKey: number
pubId: string
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<{
status: 201
body:
| {
taskId: string
}
| {
url: string
}
headers: Headers
}>
POST /api/import
Import files to a pub.
This requires you to first upload the files using /api/upload
, create a Pub using POST /api/pubs
, then create an import task using this endpoint, and then ping
/api/workerTasks?workerTaskId={UUID}
to check the status of the import.
It's much easier to use /api/pubs/text/import
or /api/pubs/{pubId}/text/import
instead to
import and create a Pub or just import to a Pub respectively. You can directly upload files
to these endpoints, do not need to poll the status of the import, and, if you are importing
to a Pub, you can determine whether the imported files should be added to the existing Pub or
replace the existing Pub's content.
createImport: (input, rest?) =>
Promise<
| { status: 201; body: string; headers: Headers }
| { status: 500; body: string; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-import/post
input
{
importerFlags: {
extractEndnotes: boolean
keepStraightQuotes: boolean
pandocFormat:
| 'html'
| 'docx+citations'
| 'epub'
| 'markdown+tex_math_dollars'
| 'odt'
| 'markdown_strict'
| 'jats'
| 'latex'
skipJatsBibExtraction: boolean
}
sourceFiles: {
assetKey: string
clientPath: string
id: number
label:
| 'metadata'
| 'none'
| 'supplement'
| 'document'
| 'preamble'
| 'bibliography'
loaded: number
state: string
total: number
}[]
}
rest?
{
cache: RequestCache
extraHeaders: Record<string, undefined | string>
}
Promise<
| {
status: 201
body: string
headers: Headers
}
| {
status: 500
body: string
headers: Headers
}
>
GET /api/workerTasks
Get the status of a worker task. This is used to poll for the status of a worker task, such as an import or export.
get: (input?) =>
Promise<
| {
status: 201
body: {
id: string
isProcessing: boolean | null
error?: any
output?: any
}
headers: Headers
}
| { status: 404; body: { error: 'WorkerTask not found' }; headers: Headers }
>
You need to be logged in and have access to this resource.
https://pubpub.org/apiDocs#/paths/api-workerTasks/get
input?
{
query: { workerTaskId: string }
cache?: RequestCache | undefined
extraHeaders?:
| ({
[x: string]: undefined
[x: number]: undefined
[x: symbol]: undefined
} & Record<string, string | undefined>)
| undefined
}
Promise<
| {
status: 201
body: {
id: string
isProcessing: boolean | null
error?: any
output?: any
}
headers: Headers
}
| {
status: 404
body: {
error: 'WorkerTask not found'
}
headers: Headers
}
>
{
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
id: string
pubId: string
collectionId: string
collection: {
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
attributions: {
id: string
collectionId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
createdAt?: string | undefined
updatedAt?: string | undefined
}
rank: string
contextHint: string | null
pubRank: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
number: number
id: string
pubId: string | null
title: string | null
labels: string[] | null
userId: string | null
isClosed: boolean | null
threadId: string
visibilityId: string
anchorId: string | null
commenterId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
id: string
pubId: string
userId: string
historyKey: number
noteContent: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
} | null
noteText: string | null
docId: string
historyKeyMissing: boolean
}
{
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
metadata: {
mtg_id: string
bibcode: string
mtg_presentation_id: string
} | null
doi: string | null
crossrefDepositRecordId: string | null
attributions: {
id: string
pubId: string
title: string | null
avatar: string | null
name: string | null
order: number
userId: string | null
orcid: string | null
isAuthor: boolean | null
roles: string[] | null
affiliation: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}[]
htmlTitle: string | null
htmlDescription: string | null
customPublishedAt: string | null
labels:
| {
id: string
title: string
color: string
publicApply: boolean
}[]
| null
downloads:
| {
createdAt: string
type: 'formatted'
url: string
}[]
| null
reviewHash: string | null
commentHash: string | null
draftId: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
id: string
pubId: string | null
collectionId: string | null
communityId: string | null
organizationId: string | null
userId: string
permissions: 'view' | 'edit' | 'manage' | 'admin'
isOwner: boolean | null
subscribedToActivityDigest: boolean
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
id: string
communityId: string
title: string
description: string | null
avatar: string | null
viewHash: string | null
slug: string
isPublic: boolean
layout: Layout
layoutAllowsDuplicatePubs: boolean
isNarrowWidth: boolean | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
id: string
subdomain: string
domain: string | null
title: string
citeAs: string | null
publishAs: string | null
description: string | null
avatar: string | null
favicon: string | null
accentColorLight: string
accentColorDark: string
hideCreatePubButton: boolean | null
headerLogo: string | null
headerLinks:
| { title: string; url: string; external?: boolean | undefined }[]
| null
headerColorType: 'light' | 'dark' | 'custom' | null
useHeaderTextAccent: boolean | null
hideHero: boolean | null
hideHeaderLogo: boolean | null
heroLogo: string | null
heroBackgroundImage: string | null
heroBackgroundColor: string | null
heroTextColor: string | null
useHeaderGradient: boolean | null
heroImage: string | null
heroTitle: string | null
heroText: string | null
heroPrimaryButton: { title: string; url: string } | null
heroSecondaryButton: { title: string; url: string } | null
heroAlign: string | null
navigation:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
hideNav: boolean | null
navLinks:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
footerLinks:
| (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
| {
id: string
title: string
children: (
| { id: string; type: 'collection' | 'page' }
| { id: string; title: string; href: string }
)[]
}
)[]
| null
footerLogoLink: string | null
footerTitle: string | null
footerImage: string | null
website: string | null
facebook: string | null
twitter: string | null
instagram: string | null
mastodon: string | null
linkedin: string | null
bluesky: string | null
github: string | null
email: string | null
socialLinksLocation: 'header' | 'footer' | null
issn: string | null
isFeatured: boolean | null
viewHash: string | null
editHash: string | null
premiumLicenseFlag: boolean | null
defaultPubCollections: string[] | null
analyticsSettings:
| { type: 'google-analytics'; credentials: string }
| { type: 'simple-analytics'; credentials: null }
| null
spamTagId: string | null
organizationId: string | null
scopeSummaryId: string | null
accentTextColor: string
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
id: string
communityId: string
title: string
avatar: string | null
viewHash: string | null
editHash: string | null
scopeSummaryId: string | null
slug: string
isRestricted: boolean | null
isPublic: boolean | null
metadata: Record<string, any> | null
kind: 'tag' | 'issue' | 'book' | 'conference' | null
doi: string | null
readNextPreviewSize: 'none' | 'minimal' | 'medium' | 'choose-best'
layout: Layout
layoutAllowsDuplicatePubs: boolean
pageId: string | null
crossrefDepositRecordId: string | null
createdAt?: string | undefined
updatedAt?: string | undefined
}
{
id: string
title: string | null
avatar: string | null
website: string | null
facebook: string | null
twitter: string | null
github: string | null
slug: string
firstName: string
lastName: string
fullName: string
initials: string
bio: string | null
publicEmail: string | null
authRedirectHost: string | null
location: string | null
orcid: string | null
googleScholar: string | null
}
{
number: number
id: string
pubId: string | null
title: string | null
status: 'open' | 'closed' | 'completed'
userId: string | null
threadId: string
visibilityId: string
releaseRequested: boolean | null
reviewContent: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
} | null
labels?: unknown
}
{
id: string
pubId: string
status: 'received' | 'incomplete' | 'accepted' | 'declined'
submittedAt: string | null
submissionWorkflowId: string
abstract: {
type: 'doc'
content: any[]
attrs?: Record<string, any> | undefined
} | null
}
{
id: string
latestKeyAt: string | null
firebasePath: string
}
If you find a bug or have a feature request, please open an issue.
git clone
pnpm install
pnpm run build
pnpm run test
pnpm run build
pnpm run publish
pnpm generate-docs
- Add CORS
- Add CRUD methods for discussions
- Reorder some methods (make attributions a submethod of pub, for example)
You can use the PubPub ID Finder to find the ID of a community, page, or collection.
While the SDK was designed to also be run in the browser, we are not yet sending CORS headers correctly, so this may not work.
GPL-3.0+, PubPub