Skip to content

Instantly share code, notes, and snippets.


penso/test.swift Secret

Created Feb 20, 2021
What would you like to do?
func saveDocument(_ document: DocumentAPIType) -> Promises.Promise<DocumentAPIType> {
guard let title = document.title else {
return Promises.Promise(DocumentRequestError.noTitle)
let parameters = UpdateDocumentParameters(id:,
title: title,
previousChecksum: document.previousChecksum,
createdAt: document.createdAt,
updatedAt: document.updatedAt)
let bodyParamsRequest = GraphqlParameters(fileName: "update_document", variables: parameters)
let promise: Promises.Promise<UpdateDocument> = self.performRequest(bodyParamsRequest: bodyParamsRequest,
authenticatedCall: true)
return promise.then(on: self.backgroundQueue) {
if let document = $0.document {
return Promises.Promise(document)
throw DocumentRequestError.parserError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment