Documents
Swapcard supports different formats of Documents (Documents (.doc and .docx), Presentations (.ppt and .pptx), Images (.png and .jpg), PDF files) for an Event.
Once you have imported a Document into the platform, a URL link is automatically associated with this file. This link allows you to download/display the Document when you click on it.
Object
Fetch the first hundred Documents
This query can be used to fetch the first 100 Documents from an Event.
Arguments
eventId
- The Id of the Event on which the Documents needs to be searched.
Query
query EventDocuments($eventId: ID!, $page: Int!) {
event(id: $eventId) {
documents(page: $page, pageSize: 100) {
pageInfo {
endCursor
totalItems
}
results {
description
id
name
type
url
}
}
}
}
Variables
{
"eventId": "RXZlbnRfMQ==",
"page": 1
}
Create Event Document
This mutation can be used to create a Document in an Event on Swapcard platform.
Arguments
eventId
- The Id of the Event on which the Document needs to be created.document
- The Document object contains basic details about the Document.
Query
mutation CreateEventDocument($eventId: ID!, $document: CreateDocumentInput! ){
createEventDocument(eventId: $eventId, document: $document) {
description
id
name
type
url
}
}
Variables
{
"eventId": "RXZlbnRfNTUxMDI0",
"document": {
"name": "test-document",
"url": "https://www.testdocument.com/links/TestPDFfile.pdf",
"description": "this is a test document"
}
}
Update Event Document
This mutation can be used to update a Document in an Event.
Arguments
document
- The Document object contains basic details about the Document.documentId
- The Id of the Document that needs to be updated.
Query
mutation UpdateEventDocument($document: UpdateDocumentInput!, $documentId: ID!) {
updateEventDocument(document: $document, id: $documentId) {
description
id
name
type
url
}
}
Variables
{
"documentId":"RG9jdW1lbnRfNTY1Mzky",
"document": {
"name": "test-document-update",
"url": "https://www.testdocument.com/links/UpdatedTestPDFfile.pdf",
"description": "this is an updated test document"
}
}
Delete Event Documents
This mutation can be used to delete Document in an Event.
Arguments
eventId
- The Id of the Event on which the Documents need to be deleted.documentIds
- The Ids of the Documents that need to be deleted. This is an array and can hold more than one value separated by commas.
Query
mutation DeleteEventDocument($eventId: ID!, $documentIds: [ID!]!) {
deleteEventDocument(eventId: $eventId, ids: $documentIds)
}
Variables
{
"eventId": "RXZlbnRfNTUxMDI0",
"documentIds":["RG9jfNTY1Mzky","RG9jdW1lbnRMzky"]
}
Create Document
This mutation can be used to create a Document in a community or an event on Swapcard platform.
The document argument contains a field "actionType". Two values are possible:
- "EMBED_URL": The url use to retrieve the document's media is the provided url. The corresponding field is "document.embeddedUrl". Default action if no "actionType" is provided.
- "UPLOAD_URL": From the provided url, a copy of the document will be done on Swapcard's CDN. In this case "document.embeddedUrl" will be null, and to get the url, the mutation "getMediaDocumentUrl" generate a presigned url.
Arguments
document
- The Document object contains basic details about the Document.communityId
- The Id of the Community on which the Document needs to be created, mandatory.eventId
- The Id of the Event on which the Document needs to be created, optionnal.
Query
mutation CreateDocument($communityId: ID!, $eventId: ID, $document: CreateDocumentInput! ){
createDocument(communityId: $communityId, document: $document, eventId: $eventId) {
document {
description
id
name
type
embeddedUrl
}
errors {
code
message
}
}
}
Variables
{
"communityId": "Q29tbXVuaXR5XzEyMw==",
"eventId": "RXZlbnRfNTUxMDI0",
"document": {
"name": "test-document",
"url": "https://www.testdocument.com/links/TestPDFfile.pdf",
"description": "this is a test document",
"actionType": "UPLOAD_URL"
}
}
Update Document
This mutation can be used to update a Document.
Arguments
document
- The Document object contains basic details about the Document.id
- The Id of the Document that needs to be updated.
Query
mutation UpdateDocument($document: UpdateDocumentInput!, $id: ID!) {
updateDocument(document: $document, id: $documentId) {
document {
description
id
name
type
embeddedUrl
}
errors {
code
message
}
}
}
Variables
{
"id":"RG9jdW1lbnRfNTY1Mzky",
"document": {
"name": "test-document-update",
"url": "https://www.testdocument.com/links/UpdatedTestPDFfile.pdf",
"description": "this is an updated test document",
"actionType": "EMBED_URL"
}
}