From 5ecec02ac7a7d66f3e00d9a2275d0f308252cac4 Mon Sep 17 00:00:00 2001 From: SDKgen-Bot Date: Fri, 15 Nov 2024 18:58:26 +0000 Subject: [PATCH] Type "Common_Message" (struct) description has changed from "NULL" to "Common error message" --- sdkgen.lock | 2 +- src/AuthorizationTag.ts | 36 +-- src/BackendApp.ts | 2 + src/BackendToken.ts | 1 + src/BackendUser.ts | 2 + src/Client.ts | 58 +++-- src/Collection.ts | 1 + src/Comment.ts | 2 + src/CommentCollection.ts | 5 +- src/CommentCreate.ts | 2 + src/CommentReactions.ts | 1 + src/Commit.ts | 2 + src/CommitCollection.ts | 5 +- src/CommitPrevious.ts | 1 + src/CommitTag.ts | 54 ++-- src/CommonMessage.ts | 4 + src/CommonMetadata.ts | 4 +- src/Document.ts | 2 + src/DocumentCollection.ts | 5 +- src/DocumentCreate.ts | 3 +- src/DocumentExportRequest.ts | 1 + src/DocumentExportResponse.ts | 1 + src/DocumentMeta.ts | 1 + src/DocumentPreview.ts | 2 + src/DocumentTag.ts | 461 ++++++++++++++++++++-------------- src/DocumentUpdate.ts | 3 +- src/ExploreTag.ts | 27 +- src/Issue.ts | 2 + src/IssueCollection.ts | 5 +- src/IssueCreate.ts | 1 + src/IssueTag.ts | 274 ++++++++++++-------- src/Message.ts | 1 + src/MetaTag.ts | 9 +- src/Passthru.ts | 4 +- src/PullRequest.ts | 2 + src/PullRequestCollection.ts | 5 +- src/PullRequestCreate.ts | 1 + src/PullRequestTag.ts | 322 ++++++++++++++---------- src/StarTag.ts | 27 +- src/SystemAbout.ts | 2 + src/SystemAboutApps.ts | 4 +- src/SystemAboutLink.ts | 1 + src/Tag.ts | 2 + src/TagChangelog.ts | 1 + src/TagCollection.ts | 5 +- src/TagTag.ts | 110 +++++--- src/Trigger.ts | 2 + src/TriggerCollection.ts | 5 +- src/TriggerConfig.ts | 4 +- src/TriggerCreate.ts | 2 + src/TriggerTag.ts | 151 ++++++----- src/User.ts | 1 + 52 files changed, 1009 insertions(+), 622 deletions(-) diff --git a/sdkgen.lock b/sdkgen.lock index 3e4518e..989a1df 100644 --- a/sdkgen.lock +++ b/sdkgen.lock @@ -1 +1 @@ -{"typehub/sdk":{"baseUrl":"https://api.typehub.cloud/","security":{"type":"oauth2","tokenUrl":"https://api.typehub.cloud/authorization/token","scopes":["commit","default","document","explore","issue","pull_request","star","tag","trigger"]},"operations":{"tag.changelog":{"path":"/document/:user/:document/changelog","method":"POST","return":{"code":200,"schema":{"$ref":"TagChangelog"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Generates the changelog for the current release","stability":1,"security":["tag"],"authorization":true,"tags":["tag"]},"tag.create":{"path":"/document/:user/:document/tag","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Creates a new tag","stability":1,"security":["tag"],"authorization":true,"tags":["tag"]},"tag.get":{"path":"/document/:user/:document/tag/:id","method":"GET","return":{"code":200,"schema":{"$ref":"Tag"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns a tag","stability":1,"security":[],"authorization":false,"tags":["tag"]},"tag.getAll":{"path":"/document/:user/:document/tag","method":"GET","return":{"code":200,"schema":{"$ref":"TagCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns all tags for a document","stability":1,"security":[],"authorization":false,"tags":["tag"]},"star.getAll":{"path":"/star","method":"GET","return":{"code":200,"schema":{"$ref":"DocumentCollection"}},"arguments":{"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns all stared documents for the current user","stability":1,"security":["star"],"authorization":true,"tags":["star"]},"trigger.execute":{"path":"/document/:user/:document/trigger/:id/execute","method":"POST","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Executes a trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.delete":{"path":"/document/:user/:document/trigger/:id","method":"DELETE","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Removes a trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.create":{"path":"/document/:user/:document/trigger","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"TriggerCreate"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Creates a new trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.get":{"path":"/document/:user/:document/trigger/:id","method":"GET","return":{"code":200,"schema":{"$ref":"Trigger"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns a trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.getAll":{"path":"/document/:user/:document/trigger","method":"GET","return":{"code":200,"schema":{"$ref":"TriggerCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns all configured triggers","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"pull_request.reactComment":{"path":"/document/:user/:document/pull_request/:id/comment/:comment/:reaction","method":"POST","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"comment":{"in":"path","schema":{"type":"string"}},"reaction":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Reacts to a comment","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.createComment":{"path":"/document/:user/:document/pull_request/:id/comment","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"CommentCreate"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Creates a new pull request comment","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.getAllComments":{"path":"/document/:user/:document/pull_request/:id/comment","method":"GET","return":{"code":200,"schema":{"$ref":"CommentCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Shows all pull request comments","stability":1,"security":[],"authorization":false,"tags":["pull_request"]},"pull_request.delete":{"path":"/document/:user/:document/pull_request/:id","method":"DELETE","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Removes a pull request","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.update":{"path":"/document/:user/:document/pull_request/:id","method":"PUT","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Merges a pull request","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.create":{"path":"/document/:user/:document/pull_request","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"PullRequestCreate"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Creates a new pull request","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.get":{"path":"/document/:user/:document/pull_request/:id","method":"GET","return":{"code":200,"schema":{"$ref":"PullRequest"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns a pull request","stability":1,"security":[],"authorization":false,"tags":["pull_request"]},"pull_request.getAll":{"path":"/document/:user/:document/pull_request","method":"GET","return":{"code":200,"schema":{"$ref":"PullRequestCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"status":{"in":"query","schema":{"type":"integer"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns all pull requests","stability":1,"security":[],"authorization":false,"tags":["pull_request"]},"issue.reactComment":{"path":"/document/:user/:document/issue/:id/comment/:comment/:reaction","method":"POST","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"comment":{"in":"path","schema":{"type":"string"}},"reaction":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Reacts to a comment","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"issue.createComment":{"path":"/document/:user/:document/issue/:id/comment","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"CommentCreate"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Creates a new issue comment","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"issue.getAllComments":{"path":"/document/:user/:document/issue/:id/comment","method":"GET","return":{"code":200,"schema":{"$ref":"CommentCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Shows all issue comments","stability":1,"security":[],"authorization":false,"tags":["issue"]},"issue.delete":{"path":"/document/:user/:document/issue/:id","method":"DELETE","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Removes an issue","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"issue.create":{"path":"/document/:user/:document/issue","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"IssueCreate"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Creates a new issue","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"issue.get":{"path":"/document/:user/:document/issue/:id","method":"GET","return":{"code":200,"schema":{"$ref":"Issue"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns an issue","stability":1,"security":[],"authorization":false,"tags":["issue"]},"issue.getAll":{"path":"/document/:user/:document/issue","method":"GET","return":{"code":200,"schema":{"$ref":"IssueCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"status":{"in":"query","schema":{"type":"integer"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns all issues","stability":1,"security":[],"authorization":false,"tags":["issue"]},"explore.getAll":{"path":"/explore","method":"GET","return":{"code":200,"schema":{"$ref":"DocumentCollection"}},"arguments":{"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns trending documents","stability":1,"security":[],"authorization":false,"tags":["explore"]},"document.revert":{"path":"/document/:user/:document/revert/:id","method":"POST","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Reverts your document to this commit","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.reset":{"path":"/document/:user/:document/reset","method":"POST","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Resets your document to the latest source","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.fork":{"path":"/document/:user/:document/fork","method":"GET","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Fork this document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.import":{"path":"/document/:user/:document/import","method":"POST","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Import a TypeAPI specification to this document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.export":{"path":"/document/:user/:document/export","method":"POST","return":{"code":200,"schema":{"$ref":"DocumentExportResponse"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"DocumentExportRequest"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Export this document","stability":1,"security":[],"authorization":false,"tags":["document"]},"document.star":{"path":"/document/:user/:document/star","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"Passthru"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Stars this document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.delete":{"path":"/document/:user/:document","method":"DELETE","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Removes a document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.meta":{"path":"/document/:user/:document/meta","method":"PUT","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"DocumentMeta"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Updates the meta data of an document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.update":{"path":"/document/:user/:document","method":"PUT","return":{"code":200,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"DocumentUpdate"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Updates a document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.create":{"path":"/document/:user","method":"POST","return":{"code":201,"schema":{"$ref":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"$ref":"DocumentCreate"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Creates a new document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.showPreview":{"path":"/document/:user/:document/preview","method":"GET","return":{"code":200,"schema":{"$ref":"DocumentPreview"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"version":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns a document preview","stability":1,"security":[],"authorization":false,"tags":["document"]},"document.get":{"path":"/document/:user/:document","method":"GET","return":{"code":200,"schema":{"$ref":"Document"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"version":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns a document","stability":1,"security":[],"authorization":false,"tags":["document"]},"document.getAll":{"path":"/document/:user","method":"GET","return":{"code":200,"schema":{"$ref":"DocumentCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns all documents","stability":1,"security":[],"authorization":false,"tags":["document"]},"commit.get":{"path":"/document/:user/:document/commit/:id","method":"GET","return":{"code":200,"schema":{"$ref":"Commit"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns a commit","stability":1,"security":[],"authorization":false,"tags":["commit"]},"commit.getAll":{"path":"/document/:user/:document/commit","method":"GET","return":{"code":200,"schema":{"$ref":"CommitCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"$ref":"Message"}},{"code":404,"schema":{"$ref":"Message"}},{"code":500,"schema":{"$ref":"Message"}}],"description":"Returns all commits for a document","stability":1,"security":[],"authorization":false,"tags":["commit"]},"authorization.getWhoami":{"path":"/authorization/whoami","method":"GET","return":{"code":200,"schema":{"$ref":"Backend_User"}},"arguments":[],"throws":[{"code":500,"schema":{"$ref":"Common_Message"}}],"description":"","stability":2,"security":["authorization"],"authorization":true,"tags":["authorization"]},"authorization.revoke":{"path":"/authorization/revoke","method":"POST","return":{"code":200,"schema":{"$ref":"Common_Message"}},"arguments":[],"throws":[{"code":400,"schema":{"$ref":"Common_Message"}},{"code":500,"schema":{"$ref":"Common_Message"}}],"description":"","stability":2,"security":["authorization"],"authorization":true,"tags":["authorization"]},"meta.getAbout":{"path":"/","method":"GET","return":{"code":200,"schema":{"$ref":"System_About"}},"arguments":[],"throws":[],"description":"","stability":2,"security":[],"authorization":false,"tags":[]}},"definitions":{"Backend_App":{"type":"object","properties":{"id":{"type":"integer"},"userId":{"type":"integer"},"status":{"type":"integer"},"name":{"type":"string","pattern":"^[a-zA-Z0-9\\-\\_]{3,64}$"},"url":{"type":"string"},"parameters":{"type":"string"},"appKey":{"type":"string"},"appSecret":{"type":"string"},"metadata":{"$ref":"Common_Metadata"},"date":{"format":"date-time","type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"tokens":{"type":"array","items":{"$ref":"Backend_Token"}}}},"Backend_Token":{"type":"object","properties":{"id":{"type":"integer"},"status":{"type":"integer"},"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"ip":{"type":"string"},"expire":{"format":"date-time","type":"string"},"date":{"format":"date-time","type":"string"}}},"Backend_User":{"type":"object","properties":{"id":{"type":"integer"},"roleId":{"type":"integer"},"planId":{"type":"integer"},"status":{"type":"integer"},"name":{"type":"string","pattern":"^[a-zA-Z0-9\\-\\_\\.]{3,32}$"},"email":{"type":"string"},"points":{"type":"integer"},"scopes":{"type":"array","items":{"type":"string"}},"apps":{"type":"array","items":{"$ref":"Backend_App"}},"metadata":{"$ref":"Common_Metadata"},"date":{"format":"date-time","type":"string"}}},"Collection":{"type":"object","properties":{"totalResults":{"type":"integer"},"startIndex":{"type":"integer"},"itemsPerPage":{"type":"integer"},"entry":{"type":"array","items":{"$generic":"T"}}}},"Comment":{"type":"object","properties":{"id":{"type":"integer"},"user":{"$ref":"User"},"status":{"type":"integer"},"reaction":{"$ref":"CommentReactions"},"comment":{"type":"string"},"updateDate":{"format":"date-time","type":"string"},"insertDate":{"format":"date-time","type":"string"}}},"CommentCollection":{"$ref":"Collection","$template":{"T":"Comment"}},"CommentCreate":{"$extends":"Comment","type":"object","required":["comment"]},"CommentReactions":{"type":"object","properties":{"like":{"type":"integer"},"dislike":{"type":"integer"},"laugh":{"type":"integer"},"hooray":{"type":"integer"},"confused":{"type":"integer"},"heart":{"type":"integer"},"rocket":{"type":"integer"},"eyes":{"type":"integer"}}},"Commit":{"type":"object","properties":{"id":{"type":"integer"},"document":{"$ref":"Document"},"user":{"$ref":"User"},"previous":{"$ref":"CommitPrevious"},"message":{"type":"string"},"commitHash":{"type":"string"},"spec":{"type":"any"},"insertDate":{"format":"date-time","type":"string"}}},"CommitCollection":{"$ref":"Collection","$template":{"T":"Commit"}},"CommitPrevious":{"type":"object","properties":{"id":{"type":"integer"},"message":{"type":"string"},"commitHash":{"type":"string"},"spec":{"type":"any"},"insertDate":{"format":"date-time","type":"string"}}},"Common_Message":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"id":{"type":"string"}}},"Common_Metadata":{"type":"object","additionalProperties":{"type":"string"}},"Document":{"type":"object","properties":{"id":{"type":"integer"},"user":{"$ref":"User"},"source":{"$ref":"Document"},"status":{"type":"integer"},"stars":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"private":{"type":"boolean"},"baseVersion":{"type":"string"},"developmentMode":{"type":"boolean"},"homepage":{"type":"string"},"spec":{"type":"any"},"updateDate":{"format":"date-time","type":"string"},"insertDate":{"format":"date-time","type":"string"}}},"DocumentCollection":{"$ref":"Collection","$template":{"T":"Document"}},"DocumentCreate":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"private":{"type":"boolean"},"baseVersion":{"type":"string"},"homepage":{"type":"string"}},"required":["name"]},"DocumentExportRequest":{"type":"object","properties":{"version":{"type":"string"},"format":{"type":"string"},"namespace":{"type":"string"}}},"DocumentExportResponse":{"type":"object","properties":{"href":{"type":"string"}}},"DocumentMeta":{"type":"object","properties":{"description":{"type":"string"},"private":{"type":"boolean"},"baseVersion":{"type":"string"},"developmentMode":{"type":"boolean"},"homepage":{"type":"string"}}},"DocumentPreview":{"type":"object","properties":{"tags":{"type":"array","items":{"$ref":"Tag"}},"types":{"type":"array","items":{"type":"string"}}}},"DocumentUpdate":{"type":"object","properties":{"spec":{"type":"any"}},"required":["spec"]},"Issue":{"type":"object","properties":{"id":{"type":"integer"},"user":{"$ref":"User"},"document":{"$ref":"Document"},"status":{"type":"integer"},"title":{"type":"string"},"updateDate":{"format":"date-time","type":"string"},"insertDate":{"format":"date-time","type":"string"}}},"IssueCollection":{"$ref":"Collection","$template":{"T":"Issue"}},"IssueCreate":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"}}},"Message":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"Passthru":{"description":"No schema information available","type":"object","additionalProperties":{"type":"any"}},"PullRequest":{"type":"object","properties":{"id":{"type":"integer"},"status":{"type":"integer"},"source":{"$ref":"Document"},"target":{"$ref":"Document"},"user":{"$ref":"User"},"title":{"type":"string"},"updateDate":{"format":"date-time","type":"string"},"insertDate":{"format":"date-time","type":"string"}}},"PullRequestCollection":{"$ref":"Collection","$template":{"T":"PullRequest"}},"PullRequestCreate":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"}}},"System_About":{"type":"object","properties":{"apiVersion":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"termsOfService":{"type":"string"},"contactName":{"type":"string"},"contactUrl":{"type":"string"},"contactEmail":{"type":"string"},"licenseName":{"type":"string"},"licenseUrl":{"type":"string"},"paymentCurrency":{"type":"string"},"categories":{"type":"array","items":{"type":"string"}},"scopes":{"type":"array","items":{"type":"string"}},"apps":{"$ref":"System_AboutApps"},"links":{"type":"array","items":{"$ref":"System_AboutLink"}}}},"System_AboutApps":{"type":"object","additionalProperties":{"type":"string"}},"System_AboutLink":{"type":"object","properties":{"rel":{"type":"string"},"href":{"type":"string"}}},"Tag":{"type":"object","properties":{"id":{"type":"string"},"document":{"$ref":"Document"},"user":{"$ref":"User"},"version":{"type":"string"},"changelog":{"type":"string"},"spec":{"type":"any"},"insertDate":{"format":"date-time","type":"string"}}},"TagChangelog":{"type":"object","properties":{"master":{"type":"any"},"tag":{"type":"any"},"version":{"type":"string"},"changelog":{"type":"array","items":{"type":"string"}}}},"TagCollection":{"$ref":"Collection","$template":{"T":"Tag"}},"Trigger":{"type":"object","properties":{"id":{"type":"integer"},"user":{"$ref":"User"},"document":{"$ref":"Document"},"type":{"type":"string"},"config":{"$ref":"TriggerConfig"},"updateDate":{"format":"date-time","type":"string"},"insertDate":{"format":"date-time","type":"string"}}},"TriggerCollection":{"$ref":"Collection","$template":{"T":"Trigger"}},"TriggerConfig":{"type":"object","additionalProperties":{"type":"string"}},"TriggerCreate":{"$extends":"Trigger","type":"object"},"User":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}} \ No newline at end of file +{"typehub/sdk":{"baseUrl":"https://api.typehub.cloud/","security":{"type":"oauth2","tokenUrl":"https://api.typehub.cloud/authorization/token","scopes":["commit","default","document","explore","issue","pull_request","star","tag","trigger"]},"operations":{"authorization.getWhoami":{"path":"/authorization/whoami","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"Backend_User"}},"arguments":[],"throws":[{"code":500,"schema":{"type":"reference","target":"Common_Message"}}],"description":"","stability":2,"security":["authorization"],"authorization":true,"tags":["authorization"]},"authorization.revoke":{"path":"/authorization/revoke","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"Common_Message"}},"arguments":[],"throws":[{"code":400,"schema":{"type":"reference","target":"Common_Message"}},{"code":500,"schema":{"type":"reference","target":"Common_Message"}}],"description":"","stability":2,"security":["authorization"],"authorization":true,"tags":["authorization"]},"commit.get":{"path":"/document/:user/:document/commit/:id","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"Commit"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns a commit","stability":1,"security":[],"authorization":false,"tags":["commit"]},"commit.getAll":{"path":"/document/:user/:document/commit","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"CommitCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns all commits for a document","stability":1,"security":[],"authorization":false,"tags":["commit"]},"document.create":{"path":"/document/:user","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"DocumentCreate"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Creates a new document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.delete":{"path":"/document/:user/:document","method":"DELETE","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Removes a document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.export":{"path":"/document/:user/:document/export","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"DocumentExportResponse"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"DocumentExportRequest"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Export this document","stability":1,"security":[],"authorization":false,"tags":["document"]},"document.fork":{"path":"/document/:user/:document/fork","method":"GET","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Fork this document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.get":{"path":"/document/:user/:document","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"Document"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"version":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns a document","stability":1,"security":[],"authorization":false,"tags":["document"]},"document.getAll":{"path":"/document/:user","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"DocumentCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns all documents","stability":1,"security":[],"authorization":false,"tags":["document"]},"document.import":{"path":"/document/:user/:document/import","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Import a TypeAPI specification to this document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.meta":{"path":"/document/:user/:document/meta","method":"PUT","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"DocumentMeta"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Updates the meta data of an document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.reset":{"path":"/document/:user/:document/reset","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Resets your document to the latest source","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.revert":{"path":"/document/:user/:document/revert/:id","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Reverts your document to this commit","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.showPreview":{"path":"/document/:user/:document/preview","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"DocumentPreview"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"version":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns a document preview","stability":1,"security":[],"authorization":false,"tags":["document"]},"document.star":{"path":"/document/:user/:document/star","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Stars this document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"document.update":{"path":"/document/:user/:document","method":"PUT","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"DocumentUpdate"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Updates a document","stability":1,"security":["document"],"authorization":true,"tags":["document"]},"explore.getAll":{"path":"/explore","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"DocumentCollection"}},"arguments":{"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns trending documents","stability":1,"security":[],"authorization":false,"tags":["explore"]},"issue.create":{"path":"/document/:user/:document/issue","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"IssueCreate"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Creates a new issue","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"issue.createComment":{"path":"/document/:user/:document/issue/:id/comment","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"CommentCreate"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Creates a new issue comment","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"issue.delete":{"path":"/document/:user/:document/issue/:id","method":"DELETE","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Removes an issue","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"issue.get":{"path":"/document/:user/:document/issue/:id","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"Issue"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns an issue","stability":1,"security":[],"authorization":false,"tags":["issue"]},"issue.getAll":{"path":"/document/:user/:document/issue","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"IssueCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"status":{"in":"query","schema":{"type":"integer"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns all issues","stability":1,"security":[],"authorization":false,"tags":["issue"]},"issue.getAllComments":{"path":"/document/:user/:document/issue/:id/comment","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"CommentCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Shows all issue comments","stability":1,"security":[],"authorization":false,"tags":["issue"]},"issue.reactComment":{"path":"/document/:user/:document/issue/:id/comment/:comment/:reaction","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"comment":{"in":"path","schema":{"type":"string"}},"reaction":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Reacts to a comment","stability":1,"security":["issue"],"authorization":true,"tags":["issue"]},"meta.getAbout":{"path":"/","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"System_About"}},"arguments":[],"throws":[],"description":"","stability":2,"security":[],"authorization":false,"tags":[]},"pull_request.create":{"path":"/document/:user/:document/pull_request","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"PullRequestCreate"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Creates a new pull request","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.createComment":{"path":"/document/:user/:document/pull_request/:id/comment","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"CommentCreate"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Creates a new pull request comment","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.delete":{"path":"/document/:user/:document/pull_request/:id","method":"DELETE","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Removes a pull request","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.get":{"path":"/document/:user/:document/pull_request/:id","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"PullRequest"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns a pull request","stability":1,"security":[],"authorization":false,"tags":["pull_request"]},"pull_request.getAll":{"path":"/document/:user/:document/pull_request","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"PullRequestCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"status":{"in":"query","schema":{"type":"integer"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns all pull requests","stability":1,"security":[],"authorization":false,"tags":["pull_request"]},"pull_request.getAllComments":{"path":"/document/:user/:document/pull_request/:id/comment","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"CommentCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Shows all pull request comments","stability":1,"security":[],"authorization":false,"tags":["pull_request"]},"pull_request.reactComment":{"path":"/document/:user/:document/pull_request/:id/comment/:comment/:reaction","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"comment":{"in":"path","schema":{"type":"string"}},"reaction":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Reacts to a comment","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"pull_request.update":{"path":"/document/:user/:document/pull_request/:id","method":"PUT","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Merges a pull request","stability":1,"security":["pull_request"],"authorization":true,"tags":["pull_request"]},"star.getAll":{"path":"/star","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"DocumentCollection"}},"arguments":{"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns all stared documents for the current user","stability":1,"security":["star"],"authorization":true,"tags":["star"]},"tag.changelog":{"path":"/document/:user/:document/changelog","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"TagChangelog"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Generates the changelog for the current release","stability":1,"security":["tag"],"authorization":true,"tags":["tag"]},"tag.create":{"path":"/document/:user/:document/tag","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Creates a new tag","stability":1,"security":["tag"],"authorization":true,"tags":["tag"]},"tag.get":{"path":"/document/:user/:document/tag/:id","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"Tag"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns a tag","stability":1,"security":[],"authorization":false,"tags":["tag"]},"tag.getAll":{"path":"/document/:user/:document/tag","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"TagCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns all tags for a document","stability":1,"security":[],"authorization":false,"tags":["tag"]},"trigger.create":{"path":"/document/:user/:document/trigger","method":"POST","return":{"code":201,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"TriggerCreate"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Creates a new trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.delete":{"path":"/document/:user/:document/trigger/:id","method":"DELETE","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Removes a trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.execute":{"path":"/document/:user/:document/trigger/:id/execute","method":"POST","return":{"code":200,"schema":{"type":"reference","target":"Message"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}},"payload":{"in":"body","schema":{"type":"reference","target":"Passthru"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Executes a trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.get":{"path":"/document/:user/:document/trigger/:id","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"Trigger"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"id":{"in":"path","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns a trigger","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]},"trigger.getAll":{"path":"/document/:user/:document/trigger","method":"GET","return":{"code":200,"schema":{"type":"reference","target":"TriggerCollection"}},"arguments":{"user":{"in":"path","schema":{"type":"string"}},"document":{"in":"path","schema":{"type":"string"}},"startIndex":{"in":"query","schema":{"type":"integer"}},"count":{"in":"query","schema":{"type":"integer"}},"search":{"in":"query","schema":{"type":"string"}}},"throws":[{"code":400,"schema":{"type":"reference","target":"Message"}},{"code":404,"schema":{"type":"reference","target":"Message"}},{"code":500,"schema":{"type":"reference","target":"Message"}}],"description":"Returns all configured triggers","stability":1,"security":["trigger"],"authorization":true,"tags":["trigger"]}},"definitions":{"Backend_App":{"type":"struct","properties":{"id":{"type":"integer"},"userId":{"type":"integer"},"status":{"type":"integer"},"name":{"type":"string"},"url":{"type":"string"},"parameters":{"type":"string"},"appKey":{"type":"string"},"appSecret":{"type":"string"},"metadata":{"type":"reference","target":"Common_Metadata"},"date":{"type":"string","format":"date-time"},"scopes":{"type":"array","schema":{"type":"string"}},"tokens":{"type":"array","schema":{"type":"reference","target":"Backend_Token"}}}},"Backend_Token":{"type":"struct","properties":{"id":{"type":"integer"},"status":{"type":"integer"},"name":{"type":"string"},"scopes":{"type":"array","schema":{"type":"string"}},"ip":{"type":"string"},"expire":{"type":"string","format":"date-time"},"date":{"type":"string","format":"date-time"}}},"Backend_User":{"type":"struct","properties":{"id":{"type":"integer"},"roleId":{"type":"integer"},"planId":{"type":"integer"},"status":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"points":{"type":"integer"},"scopes":{"type":"array","schema":{"type":"string"}},"apps":{"type":"array","schema":{"type":"reference","target":"Backend_App"}},"metadata":{"type":"reference","target":"Common_Metadata"},"date":{"type":"string","format":"date-time"}}},"Collection":{"type":"struct","properties":{"totalResults":{"type":"integer"},"startIndex":{"type":"integer"},"itemsPerPage":{"type":"integer"},"entry":{"type":"array","schema":{"type":"generic","name":"T"}}}},"Comment":{"type":"struct","properties":{"id":{"type":"integer"},"user":{"type":"reference","target":"User"},"status":{"type":"integer"},"reaction":{"type":"reference","target":"CommentReactions"},"comment":{"type":"string"},"updateDate":{"type":"string","format":"date-time"},"insertDate":{"type":"string","format":"date-time"}}},"CommentCollection":{"type":"struct","parent":{"type":"reference","target":"Collection","template":{"T":"Comment"}}},"CommentCreate":{"type":"struct","parent":{"type":"reference","target":"Comment"}},"CommentReactions":{"type":"struct","properties":{"like":{"type":"integer"},"dislike":{"type":"integer"},"laugh":{"type":"integer"},"hooray":{"type":"integer"},"confused":{"type":"integer"},"heart":{"type":"integer"},"rocket":{"type":"integer"},"eyes":{"type":"integer"}}},"Commit":{"type":"struct","properties":{"id":{"type":"integer"},"document":{"type":"reference","target":"Document"},"user":{"type":"reference","target":"User"},"previous":{"type":"reference","target":"CommitPrevious"},"message":{"type":"string"},"commitHash":{"type":"string"},"spec":{"type":"any"},"insertDate":{"type":"string","format":"date-time"}}},"CommitCollection":{"type":"struct","parent":{"type":"reference","target":"Collection","template":{"T":"Commit"}}},"CommitPrevious":{"type":"struct","properties":{"id":{"type":"integer"},"message":{"type":"string"},"commitHash":{"type":"string"},"spec":{"type":"any"},"insertDate":{"type":"string","format":"date-time"}}},"Common_Message":{"description":"Common error message","type":"struct","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"id":{"type":"string"}}},"Common_Metadata":{"type":"map","schema":{"type":"string"}},"Document":{"type":"struct","properties":{"id":{"type":"integer"},"user":{"type":"reference","target":"User"},"source":{"type":"reference","target":"Document"},"status":{"type":"integer"},"stars":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"private":{"type":"boolean"},"baseVersion":{"type":"string"},"developmentMode":{"type":"boolean"},"homepage":{"type":"string"},"spec":{"type":"any"},"updateDate":{"type":"string","format":"date-time"},"insertDate":{"type":"string","format":"date-time"}}},"DocumentCollection":{"type":"struct","parent":{"type":"reference","target":"Collection","template":{"T":"Document"}}},"DocumentCreate":{"type":"struct","properties":{"name":{"type":"string"},"description":{"type":"string"},"private":{"type":"boolean"},"baseVersion":{"type":"string"},"homepage":{"type":"string"}}},"DocumentExportRequest":{"type":"struct","properties":{"version":{"type":"string"},"format":{"type":"string"},"namespace":{"type":"string"}}},"DocumentExportResponse":{"type":"struct","properties":{"href":{"type":"string"}}},"DocumentMeta":{"type":"struct","properties":{"description":{"type":"string"},"private":{"type":"boolean"},"baseVersion":{"type":"string"},"developmentMode":{"type":"boolean"},"homepage":{"type":"string"}}},"DocumentPreview":{"type":"struct","properties":{"tags":{"type":"array","schema":{"type":"reference","target":"Tag"}},"types":{"type":"array","schema":{"type":"string"}}}},"DocumentUpdate":{"type":"struct","properties":{"spec":{"type":"any"}}},"Issue":{"type":"struct","properties":{"id":{"type":"integer"},"user":{"type":"reference","target":"User"},"document":{"type":"reference","target":"Document"},"status":{"type":"integer"},"title":{"type":"string"},"updateDate":{"type":"string","format":"date-time"},"insertDate":{"type":"string","format":"date-time"}}},"IssueCollection":{"type":"struct","parent":{"type":"reference","target":"Collection","template":{"T":"Issue"}}},"IssueCreate":{"type":"struct","properties":{"title":{"type":"string"},"description":{"type":"string"}}},"Message":{"type":"struct","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"Passthru":{"description":"No schema information available","type":"map","schema":{"type":"any"}},"PullRequest":{"type":"struct","properties":{"id":{"type":"integer"},"status":{"type":"integer"},"source":{"type":"reference","target":"Document"},"target":{"type":"reference","target":"Document"},"user":{"type":"reference","target":"User"},"title":{"type":"string"},"updateDate":{"type":"string","format":"date-time"},"insertDate":{"type":"string","format":"date-time"}}},"PullRequestCollection":{"type":"struct","parent":{"type":"reference","target":"Collection","template":{"T":"PullRequest"}}},"PullRequestCreate":{"type":"struct","properties":{"title":{"type":"string"},"description":{"type":"string"}}},"System_About":{"type":"struct","properties":{"apiVersion":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"termsOfService":{"type":"string"},"contactName":{"type":"string"},"contactUrl":{"type":"string"},"contactEmail":{"type":"string"},"licenseName":{"type":"string"},"licenseUrl":{"type":"string"},"paymentCurrency":{"type":"string"},"categories":{"type":"array","schema":{"type":"string"}},"scopes":{"type":"array","schema":{"type":"string"}},"apps":{"type":"reference","target":"System_AboutApps"},"links":{"type":"array","schema":{"type":"reference","target":"System_AboutLink"}}}},"System_AboutApps":{"type":"map","schema":{"type":"string"}},"System_AboutLink":{"type":"struct","properties":{"rel":{"type":"string"},"href":{"type":"string"}}},"Tag":{"type":"struct","properties":{"id":{"type":"string"},"document":{"type":"reference","target":"Document"},"user":{"type":"reference","target":"User"},"version":{"type":"string"},"changelog":{"type":"string"},"spec":{"type":"any"},"insertDate":{"type":"string","format":"date-time"}}},"TagChangelog":{"type":"struct","properties":{"master":{"type":"any"},"tag":{"type":"any"},"version":{"type":"string"},"changelog":{"type":"array","schema":{"type":"string"}}}},"TagCollection":{"type":"struct","parent":{"type":"reference","target":"Collection","template":{"T":"Tag"}}},"Trigger":{"type":"struct","properties":{"id":{"type":"integer"},"user":{"type":"reference","target":"User"},"document":{"type":"reference","target":"Document"},"type":{"type":"string"},"config":{"type":"reference","target":"TriggerConfig"},"updateDate":{"type":"string","format":"date-time"},"insertDate":{"type":"string","format":"date-time"}}},"TriggerCollection":{"type":"struct","parent":{"type":"reference","target":"Collection","template":{"T":"Trigger"}}},"TriggerConfig":{"type":"map","schema":{"type":"string"}},"TriggerCreate":{"type":"struct","parent":{"type":"reference","target":"Trigger"}},"User":{"type":"struct","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}} \ No newline at end of file diff --git a/src/AuthorizationTag.ts b/src/AuthorizationTag.ts index 22b2b45..0aa6334 100644 --- a/src/AuthorizationTag.ts +++ b/src/AuthorizationTag.ts @@ -14,7 +14,7 @@ import {CommonMessageException} from "./CommonMessageException"; export class AuthorizationTag extends TagAbstract { /** * @returns {Promise} - * @throws {CommonMessageExceptionException} + * @throws {CommonMessageException} * @throws {ClientException} */ public async getWhoami(): Promise { @@ -24,6 +24,8 @@ export class AuthorizationTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), @@ -36,12 +38,13 @@ export class AuthorizationTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 500: - throw new CommonMessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 500) { + throw new CommonMessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -50,7 +53,7 @@ export class AuthorizationTag extends TagAbstract { /** * @returns {Promise} - * @throws {CommonMessageExceptionException} + * @throws {CommonMessageException} * @throws {ClientException} */ public async revoke(): Promise { @@ -60,6 +63,8 @@ export class AuthorizationTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + }, params: this.parser.query({ }, [ ]), @@ -72,14 +77,17 @@ export class AuthorizationTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new CommonMessageException(error.response.data); - case 500: - throw new CommonMessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new CommonMessageException(error.response.data); } + + if (statusCode === 500) { + throw new CommonMessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/BackendApp.ts b/src/BackendApp.ts index 8d220bf..7846984 100644 --- a/src/BackendApp.ts +++ b/src/BackendApp.ts @@ -5,6 +5,7 @@ import {CommonMetadata} from "./CommonMetadata"; import {BackendToken} from "./BackendToken"; + export interface BackendApp { id?: number userId?: number @@ -19,3 +20,4 @@ export interface BackendApp { scopes?: Array tokens?: Array } + diff --git a/src/BackendToken.ts b/src/BackendToken.ts index ee5368e..f1de257 100644 --- a/src/BackendToken.ts +++ b/src/BackendToken.ts @@ -12,3 +12,4 @@ export interface BackendToken { expire?: string date?: string } + diff --git a/src/BackendUser.ts b/src/BackendUser.ts index b4febbd..697e00a 100644 --- a/src/BackendUser.ts +++ b/src/BackendUser.ts @@ -5,6 +5,7 @@ import {BackendApp} from "./BackendApp"; import {CommonMetadata} from "./CommonMetadata"; + export interface BackendUser { id?: number roleId?: number @@ -18,3 +19,4 @@ export interface BackendUser { metadata?: CommonMetadata date?: string } + diff --git a/src/Client.ts b/src/Client.ts index 52d54b3..093840f 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -6,47 +6,48 @@ import axios, {AxiosRequestConfig} from "axios"; import {ClientAbstract, CredentialsInterface, TokenStoreInterface} from "sdkgen-client" import {OAuth2} from "sdkgen-client" +import {Anonymous} from "sdkgen-client" import {ClientException, UnknownStatusCodeException} from "sdkgen-client"; -import {TagTag} from "./TagTag"; -import {StarTag} from "./StarTag"; -import {TriggerTag} from "./TriggerTag"; -import {PullRequestTag} from "./PullRequestTag"; -import {IssueTag} from "./IssueTag"; -import {ExploreTag} from "./ExploreTag"; -import {DocumentTag} from "./DocumentTag"; -import {CommitTag} from "./CommitTag"; import {AuthorizationTag} from "./AuthorizationTag"; +import {CommitTag} from "./CommitTag"; +import {DocumentTag} from "./DocumentTag"; +import {ExploreTag} from "./ExploreTag"; +import {IssueTag} from "./IssueTag"; import {MetaTag} from "./MetaTag"; +import {PullRequestTag} from "./PullRequestTag"; +import {StarTag} from "./StarTag"; +import {TagTag} from "./TagTag"; +import {TriggerTag} from "./TriggerTag"; export class Client extends ClientAbstract { - public tag(): TagTag + public authorization(): AuthorizationTag { - return new TagTag( + return new AuthorizationTag( this.httpClient, this.parser ); } - public star(): StarTag + public commit(): CommitTag { - return new StarTag( + return new CommitTag( this.httpClient, this.parser ); } - public trigger(): TriggerTag + public document(): DocumentTag { - return new TriggerTag( + return new DocumentTag( this.httpClient, this.parser ); } - public pullRequest(): PullRequestTag + public explore(): ExploreTag { - return new PullRequestTag( + return new ExploreTag( this.httpClient, this.parser ); @@ -60,41 +61,41 @@ export class Client extends ClientAbstract { ); } - public explore(): ExploreTag + public meta(): MetaTag { - return new ExploreTag( + return new MetaTag( this.httpClient, this.parser ); } - public document(): DocumentTag + public pullRequest(): PullRequestTag { - return new DocumentTag( + return new PullRequestTag( this.httpClient, this.parser ); } - public commit(): CommitTag + public star(): StarTag { - return new CommitTag( + return new StarTag( this.httpClient, this.parser ); } - public authorization(): AuthorizationTag + public tag(): TagTag { - return new AuthorizationTag( + return new TagTag( this.httpClient, this.parser ); } - public meta(): MetaTag + public trigger(): TriggerTag { - return new MetaTag( + return new TriggerTag( this.httpClient, this.parser ); @@ -106,4 +107,9 @@ export class Client extends ClientAbstract { { return new Client('https://api.typehub.cloud/', new OAuth2(clientId, clientSecret, 'https://api.typehub.cloud/authorization/token', '', tokenStore, scopes)); } + + public static buildAnonymous(): Client + { + return new Client('https://api.typehub.cloud/', new Anonymous()); + } } diff --git a/src/Collection.ts b/src/Collection.ts index 17671dc..c3e0f99 100644 --- a/src/Collection.ts +++ b/src/Collection.ts @@ -9,3 +9,4 @@ export interface Collection { itemsPerPage?: number entry?: Array } + diff --git a/src/Comment.ts b/src/Comment.ts index 1c25a65..e6711a6 100644 --- a/src/Comment.ts +++ b/src/Comment.ts @@ -5,6 +5,7 @@ import {User} from "./User"; import {CommentReactions} from "./CommentReactions"; + export interface Comment { id?: number user?: User @@ -14,3 +15,4 @@ export interface Comment { updateDate?: string insertDate?: string } + diff --git a/src/CommentCollection.ts b/src/CommentCollection.ts index cfbdb98..6570ed2 100644 --- a/src/CommentCollection.ts +++ b/src/CommentCollection.ts @@ -5,4 +5,7 @@ import {Collection} from "./Collection"; import {Comment} from "./Comment"; -export type CommentCollection = Collection; + +export interface CommentCollection extends Collection { +} + diff --git a/src/CommentCreate.ts b/src/CommentCreate.ts index 9e67eb2..82afaac 100644 --- a/src/CommentCreate.ts +++ b/src/CommentCreate.ts @@ -4,5 +4,7 @@ */ import {Comment} from "./Comment"; + export interface CommentCreate extends Comment { } + diff --git a/src/CommentReactions.ts b/src/CommentReactions.ts index 55092c5..c7da4dc 100644 --- a/src/CommentReactions.ts +++ b/src/CommentReactions.ts @@ -13,3 +13,4 @@ export interface CommentReactions { rocket?: number eyes?: number } + diff --git a/src/Commit.ts b/src/Commit.ts index 95fa0a7..ca94cdb 100644 --- a/src/Commit.ts +++ b/src/Commit.ts @@ -6,6 +6,7 @@ import {Document} from "./Document"; import {User} from "./User"; import {CommitPrevious} from "./CommitPrevious"; + export interface Commit { id?: number document?: Document @@ -16,3 +17,4 @@ export interface Commit { spec?: any insertDate?: string } + diff --git a/src/CommitCollection.ts b/src/CommitCollection.ts index 8be909e..129af20 100644 --- a/src/CommitCollection.ts +++ b/src/CommitCollection.ts @@ -5,4 +5,7 @@ import {Collection} from "./Collection"; import {Commit} from "./Commit"; -export type CommitCollection = Collection; + +export interface CommitCollection extends Collection { +} + diff --git a/src/CommitPrevious.ts b/src/CommitPrevious.ts index 9af28bf..da518c0 100644 --- a/src/CommitPrevious.ts +++ b/src/CommitPrevious.ts @@ -10,3 +10,4 @@ export interface CommitPrevious { spec?: any insertDate?: string } + diff --git a/src/CommitTag.ts b/src/CommitTag.ts index eacd6d8..6c3f462 100644 --- a/src/CommitTag.ts +++ b/src/CommitTag.ts @@ -16,7 +16,7 @@ export class CommitTag extends TagAbstract { * Returns a commit * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async get(user: string, document: string, id: string): Promise { @@ -29,6 +29,8 @@ export class CommitTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), @@ -41,16 +43,21 @@ export class CommitTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -61,7 +68,7 @@ export class CommitTag extends TagAbstract { * Returns all commits for a document * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async getAll(user: string, document: string, startIndex?: number, count?: number, search?: string): Promise { @@ -73,6 +80,8 @@ export class CommitTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ 'startIndex': startIndex, 'count': count, @@ -88,16 +97,21 @@ export class CommitTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/CommonMessage.ts b/src/CommonMessage.ts index 890f1a8..8f391b0 100644 --- a/src/CommonMessage.ts +++ b/src/CommonMessage.ts @@ -3,8 +3,12 @@ * {@link https://sdkgen.app} */ +/** + * Common error message + */ export interface CommonMessage { success?: boolean message?: string id?: string } + diff --git a/src/CommonMetadata.ts b/src/CommonMetadata.ts index c7392f0..65a5689 100644 --- a/src/CommonMetadata.ts +++ b/src/CommonMetadata.ts @@ -3,4 +3,6 @@ * {@link https://sdkgen.app} */ -export type CommonMetadata = Record; +export interface CommonMetadata extends Record { +} + diff --git a/src/Document.ts b/src/Document.ts index a5d5ad2..c8189e0 100644 --- a/src/Document.ts +++ b/src/Document.ts @@ -4,6 +4,7 @@ */ import {User} from "./User"; + export interface Document { id?: number user?: User @@ -20,3 +21,4 @@ export interface Document { updateDate?: string insertDate?: string } + diff --git a/src/DocumentCollection.ts b/src/DocumentCollection.ts index a20599b..982db65 100644 --- a/src/DocumentCollection.ts +++ b/src/DocumentCollection.ts @@ -5,4 +5,7 @@ import {Collection} from "./Collection"; import {Document} from "./Document"; -export type DocumentCollection = Collection; + +export interface DocumentCollection extends Collection { +} + diff --git a/src/DocumentCreate.ts b/src/DocumentCreate.ts index 4e6f02e..db2412a 100644 --- a/src/DocumentCreate.ts +++ b/src/DocumentCreate.ts @@ -4,9 +4,10 @@ */ export interface DocumentCreate { - name: string + name?: string description?: string private?: boolean baseVersion?: string homepage?: string } + diff --git a/src/DocumentExportRequest.ts b/src/DocumentExportRequest.ts index 7bc2c6b..cdcd28a 100644 --- a/src/DocumentExportRequest.ts +++ b/src/DocumentExportRequest.ts @@ -8,3 +8,4 @@ export interface DocumentExportRequest { format?: string namespace?: string } + diff --git a/src/DocumentExportResponse.ts b/src/DocumentExportResponse.ts index 65e6c02..ca0ccb4 100644 --- a/src/DocumentExportResponse.ts +++ b/src/DocumentExportResponse.ts @@ -6,3 +6,4 @@ export interface DocumentExportResponse { href?: string } + diff --git a/src/DocumentMeta.ts b/src/DocumentMeta.ts index 13ed8ae..80f74c4 100644 --- a/src/DocumentMeta.ts +++ b/src/DocumentMeta.ts @@ -10,3 +10,4 @@ export interface DocumentMeta { developmentMode?: boolean homepage?: string } + diff --git a/src/DocumentPreview.ts b/src/DocumentPreview.ts index 154449d..8cf6b40 100644 --- a/src/DocumentPreview.ts +++ b/src/DocumentPreview.ts @@ -4,7 +4,9 @@ */ import {Tag} from "./Tag"; + export interface DocumentPreview { tags?: Array types?: Array } + diff --git a/src/DocumentTag.ts b/src/DocumentTag.ts index 74b5ecc..ee237ae 100644 --- a/src/DocumentTag.ts +++ b/src/DocumentTag.ts @@ -21,22 +21,23 @@ import {Passthru} from "./Passthru"; export class DocumentTag extends TagAbstract { /** - * Reverts your document to this commit + * Creates a new document * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async revert(user: string, document: string, id: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/revert/:id', { + public async create(user: string, payload: DocumentCreate): Promise { + const url = this.parser.url('/document/:user', { 'user': user, - 'document': document, - 'id': id, }); let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -50,16 +51,21 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -67,25 +73,26 @@ export class DocumentTag extends TagAbstract { } /** - * Resets your document to the latest source + * Removes a document * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async reset(user: string, document: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/reset', { + public async delete(user: string, document: string): Promise { + const url = this.parser.url('/document/:user/:document', { 'user': user, 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'POST', + method: 'DELETE', + headers: { + }, params: this.parser.query({ }, [ ]), - data: payload }; try { @@ -95,16 +102,21 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -112,43 +124,52 @@ export class DocumentTag extends TagAbstract { } /** - * Fork this document + * Export this document * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async fork(user: string, document: string): Promise { - const url = this.parser.url('/document/:user/:document/fork', { + public async export(user: string, document: string, payload: DocumentExportRequest): Promise { + const url = this.parser.url('/document/:user/:document/export', { 'user': user, 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), + data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -156,25 +177,26 @@ export class DocumentTag extends TagAbstract { } /** - * Import a TypeAPI specification to this document + * Fork this document * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async import(user: string, document: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/import', { + public async fork(user: string, document: string): Promise { + const url = this.parser.url('/document/:user/:document/fork', { 'user': user, 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'POST', + method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), - data: payload }; try { @@ -184,16 +206,21 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -201,44 +228,43 @@ export class DocumentTag extends TagAbstract { } /** - * Export this document + * Returns a document * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async export(user: string, document: string, payload: DocumentExportRequest): Promise { - const url = this.parser.url('/document/:user/:document/export', { + public async get(user: string, document: string, version?: string): Promise { + const url = this.parser.url('/document/:user/:document', { 'user': user, 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'POST', + method: 'GET', + headers: { + }, params: this.parser.query({ + 'version': version, }, [ ]), - data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -246,44 +272,52 @@ export class DocumentTag extends TagAbstract { } /** - * Stars this document + * Returns all documents * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async star(user: string, document: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/star', { + public async getAll(user: string, startIndex?: number, count?: number, search?: string): Promise { + const url = this.parser.url('/document/:user', { 'user': user, - 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'POST', + method: 'GET', + headers: { + }, params: this.parser.query({ + 'startIndex': startIndex, + 'count': count, + 'search': search, }, [ ]), - data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -291,24 +325,28 @@ export class DocumentTag extends TagAbstract { } /** - * Removes a document + * Import a TypeAPI specification to this document * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async delete(user: string, document: string): Promise { - const url = this.parser.url('/document/:user/:document', { + public async import(user: string, document: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/import', { 'user': user, 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'DELETE', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), + data: payload }; try { @@ -318,16 +356,21 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -338,7 +381,7 @@ export class DocumentTag extends TagAbstract { * Updates the meta data of an document * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async meta(user: string, document: string, payload: DocumentMeta): Promise { @@ -350,6 +393,9 @@ export class DocumentTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -363,16 +409,21 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -380,21 +431,24 @@ export class DocumentTag extends TagAbstract { } /** - * Updates a document + * Resets your document to the latest source * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async update(user: string, document: string, payload: DocumentUpdate): Promise { - const url = this.parser.url('/document/:user/:document', { + public async reset(user: string, document: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/reset', { 'user': user, 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'PUT', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -408,16 +462,21 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -425,20 +484,25 @@ export class DocumentTag extends TagAbstract { } /** - * Creates a new document + * Reverts your document to this commit * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async create(user: string, payload: DocumentCreate): Promise { - const url = this.parser.url('/document/:user', { + public async revert(user: string, document: string, id: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/revert/:id', { 'user': user, + 'document': document, + 'id': id, }); let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -452,16 +516,21 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -472,7 +541,7 @@ export class DocumentTag extends TagAbstract { * Returns a document preview * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async showPreview(user: string, document: string, version?: string): Promise { @@ -484,6 +553,8 @@ export class DocumentTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ 'version': version, }, [ @@ -497,12 +568,13 @@ export class DocumentTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -510,40 +582,52 @@ export class DocumentTag extends TagAbstract { } /** - * Returns a document + * Stars this document * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async get(user: string, document: string, version?: string): Promise { - const url = this.parser.url('/document/:user/:document', { + public async star(user: string, document: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/star', { 'user': user, 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ - 'version': version, }, [ ]), + data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -551,45 +635,52 @@ export class DocumentTag extends TagAbstract { } /** - * Returns all documents + * Updates a document * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async getAll(user: string, startIndex?: number, count?: number, search?: string): Promise { - const url = this.parser.url('/document/:user', { + public async update(user: string, document: string, payload: DocumentUpdate): Promise { + const url = this.parser.url('/document/:user/:document', { 'user': user, + 'document': document, }); let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ - 'startIndex': startIndex, - 'count': count, - 'search': search, }, [ ]), + data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/DocumentUpdate.ts b/src/DocumentUpdate.ts index b7083a9..4e2ca4d 100644 --- a/src/DocumentUpdate.ts +++ b/src/DocumentUpdate.ts @@ -4,5 +4,6 @@ */ export interface DocumentUpdate { - spec: any + spec?: any } + diff --git a/src/ExploreTag.ts b/src/ExploreTag.ts index 540d6d7..9f7fb56 100644 --- a/src/ExploreTag.ts +++ b/src/ExploreTag.ts @@ -15,7 +15,7 @@ export class ExploreTag extends TagAbstract { * Returns trending documents * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async getAll(startIndex?: number, count?: number, search?: string): Promise { @@ -25,6 +25,8 @@ export class ExploreTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ 'startIndex': startIndex, 'count': count, @@ -40,16 +42,21 @@ export class ExploreTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/Issue.ts b/src/Issue.ts index 097a88e..188fc20 100644 --- a/src/Issue.ts +++ b/src/Issue.ts @@ -5,6 +5,7 @@ import {User} from "./User"; import {Document} from "./Document"; + export interface Issue { id?: number user?: User @@ -14,3 +15,4 @@ export interface Issue { updateDate?: string insertDate?: string } + diff --git a/src/IssueCollection.ts b/src/IssueCollection.ts index e3046af..e5ea130 100644 --- a/src/IssueCollection.ts +++ b/src/IssueCollection.ts @@ -5,4 +5,7 @@ import {Collection} from "./Collection"; import {Issue} from "./Issue"; -export type IssueCollection = Collection; + +export interface IssueCollection extends Collection { +} + diff --git a/src/IssueCreate.ts b/src/IssueCreate.ts index ff2064b..e9f8142 100644 --- a/src/IssueCreate.ts +++ b/src/IssueCreate.ts @@ -7,3 +7,4 @@ export interface IssueCreate { title?: string description?: string } + diff --git a/src/IssueTag.ts b/src/IssueTag.ts index 2f2b134..e59f80a 100644 --- a/src/IssueTag.ts +++ b/src/IssueTag.ts @@ -18,24 +18,24 @@ import {Passthru} from "./Passthru"; export class IssueTag extends TagAbstract { /** - * Reacts to a comment + * Creates a new issue * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async reactComment(user: string, document: string, id: string, comment: string, reaction: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/issue/:id/comment/:comment/:reaction', { + public async create(user: string, document: string, payload: IssueCreate): Promise { + const url = this.parser.url('/document/:user/:document/issue', { 'user': user, 'document': document, - 'id': id, - 'comment': comment, - 'reaction': reaction, }); let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -49,16 +49,21 @@ export class IssueTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -69,7 +74,7 @@ export class IssueTag extends TagAbstract { * Creates a new issue comment * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async createComment(user: string, document: string, id: string, payload: CommentCreate): Promise { @@ -82,6 +87,9 @@ export class IssueTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -95,16 +103,21 @@ export class IssueTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -112,14 +125,14 @@ export class IssueTag extends TagAbstract { } /** - * Shows all issue comments + * Removes an issue * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async getAllComments(user: string, document: string, id: string, startIndex?: number, count?: number, search?: string): Promise { - const url = this.parser.url('/document/:user/:document/issue/:id/comment', { + public async delete(user: string, document: string, id: string): Promise { + const url = this.parser.url('/document/:user/:document/issue/:id', { 'user': user, 'document': document, 'id': id, @@ -127,32 +140,36 @@ export class IssueTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'DELETE', + headers: { + }, params: this.parser.query({ - 'startIndex': startIndex, - 'count': count, - 'search': search, }, [ ]), }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -160,13 +177,13 @@ export class IssueTag extends TagAbstract { } /** - * Removes an issue + * Returns an issue * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async delete(user: string, document: string, id: string): Promise { + public async get(user: string, document: string, id: string): Promise { const url = this.parser.url('/document/:user/:document/issue/:id', { 'user': user, 'document': document, @@ -175,29 +192,36 @@ export class IssueTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, - method: 'DELETE', + method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -205,13 +229,13 @@ export class IssueTag extends TagAbstract { } /** - * Creates a new issue + * Returns all issues * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async create(user: string, document: string, payload: IssueCreate): Promise { + public async getAll(user: string, document: string, status?: number, startIndex?: number, count?: number, search?: string): Promise { const url = this.parser.url('/document/:user/:document/issue', { 'user': user, 'document': document, @@ -219,30 +243,40 @@ export class IssueTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, - method: 'POST', + method: 'GET', + headers: { + }, params: this.parser.query({ + 'status': status, + 'startIndex': startIndex, + 'count': count, + 'search': search, }, [ ]), - data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -250,14 +284,14 @@ export class IssueTag extends TagAbstract { } /** - * Returns an issue + * Shows all issue comments * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async get(user: string, document: string, id: string): Promise { - const url = this.parser.url('/document/:user/:document/issue/:id', { + public async getAllComments(user: string, document: string, id: string, startIndex?: number, count?: number, search?: string): Promise { + const url = this.parser.url('/document/:user/:document/issue/:id/comment', { 'user': user, 'document': document, 'id': id, @@ -266,28 +300,38 @@ export class IssueTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ + 'startIndex': startIndex, + 'count': count, + 'search': search, }, [ ]), }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -295,47 +339,55 @@ export class IssueTag extends TagAbstract { } /** - * Returns all issues + * Reacts to a comment * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async getAll(user: string, document: string, status?: number, startIndex?: number, count?: number, search?: string): Promise { - const url = this.parser.url('/document/:user/:document/issue', { + public async reactComment(user: string, document: string, id: string, comment: string, reaction: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/issue/:id/comment/:comment/:reaction', { 'user': user, 'document': document, + 'id': id, + 'comment': comment, + 'reaction': reaction, }); let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ - 'status': status, - 'startIndex': startIndex, - 'count': count, - 'search': search, }, [ ]), + data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/Message.ts b/src/Message.ts index 10c39de..e4f1b29 100644 --- a/src/Message.ts +++ b/src/Message.ts @@ -7,3 +7,4 @@ export interface Message { success?: boolean message?: string } + diff --git a/src/MetaTag.ts b/src/MetaTag.ts index 5a72d43..7d3333f 100644 --- a/src/MetaTag.ts +++ b/src/MetaTag.ts @@ -21,6 +21,8 @@ export class MetaTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), @@ -33,10 +35,9 @@ export class MetaTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); - } + const statusCode = error.response.status; + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/Passthru.ts b/src/Passthru.ts index d47d7e6..b3099a1 100644 --- a/src/Passthru.ts +++ b/src/Passthru.ts @@ -6,4 +6,6 @@ /** * No schema information available */ -export type Passthru = Record; +export interface Passthru extends Record { +} + diff --git a/src/PullRequest.ts b/src/PullRequest.ts index db99642..6e9cfd1 100644 --- a/src/PullRequest.ts +++ b/src/PullRequest.ts @@ -5,6 +5,7 @@ import {Document} from "./Document"; import {User} from "./User"; + export interface PullRequest { id?: number status?: number @@ -15,3 +16,4 @@ export interface PullRequest { updateDate?: string insertDate?: string } + diff --git a/src/PullRequestCollection.ts b/src/PullRequestCollection.ts index 9acfdd6..1f54b8f 100644 --- a/src/PullRequestCollection.ts +++ b/src/PullRequestCollection.ts @@ -5,4 +5,7 @@ import {Collection} from "./Collection"; import {PullRequest} from "./PullRequest"; -export type PullRequestCollection = Collection; + +export interface PullRequestCollection extends Collection { +} + diff --git a/src/PullRequestCreate.ts b/src/PullRequestCreate.ts index f2a808d..4bac6e6 100644 --- a/src/PullRequestCreate.ts +++ b/src/PullRequestCreate.ts @@ -7,3 +7,4 @@ export interface PullRequestCreate { title?: string description?: string } + diff --git a/src/PullRequestTag.ts b/src/PullRequestTag.ts index 42a91d5..c6b4ef4 100644 --- a/src/PullRequestTag.ts +++ b/src/PullRequestTag.ts @@ -18,24 +18,24 @@ import {PullRequestCreate} from "./PullRequestCreate"; export class PullRequestTag extends TagAbstract { /** - * Reacts to a comment + * Creates a new pull request * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async reactComment(user: string, document: string, id: string, comment: string, reaction: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/pull_request/:id/comment/:comment/:reaction', { + public async create(user: string, document: string, payload: PullRequestCreate): Promise { + const url = this.parser.url('/document/:user/:document/pull_request', { 'user': user, 'document': document, - 'id': id, - 'comment': comment, - 'reaction': reaction, }); let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -49,16 +49,21 @@ export class PullRequestTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -69,7 +74,7 @@ export class PullRequestTag extends TagAbstract { * Creates a new pull request comment * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async createComment(user: string, document: string, id: string, payload: CommentCreate): Promise { @@ -82,6 +87,9 @@ export class PullRequestTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -95,16 +103,21 @@ export class PullRequestTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -112,14 +125,14 @@ export class PullRequestTag extends TagAbstract { } /** - * Shows all pull request comments + * Removes a pull request * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async getAllComments(user: string, document: string, id: string, startIndex?: number, count?: number, search?: string): Promise { - const url = this.parser.url('/document/:user/:document/pull_request/:id/comment', { + public async delete(user: string, document: string, id: string): Promise { + const url = this.parser.url('/document/:user/:document/pull_request/:id', { 'user': user, 'document': document, 'id': id, @@ -127,32 +140,36 @@ export class PullRequestTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'DELETE', + headers: { + }, params: this.parser.query({ - 'startIndex': startIndex, - 'count': count, - 'search': search, }, [ ]), }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -160,13 +177,13 @@ export class PullRequestTag extends TagAbstract { } /** - * Removes a pull request + * Returns a pull request * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async delete(user: string, document: string, id: string): Promise { + public async get(user: string, document: string, id: string): Promise { const url = this.parser.url('/document/:user/:document/pull_request/:id', { 'user': user, 'document': document, @@ -175,29 +192,36 @@ export class PullRequestTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, - method: 'DELETE', + method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -205,45 +229,54 @@ export class PullRequestTag extends TagAbstract { } /** - * Merges a pull request + * Returns all pull requests * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async update(user: string, document: string, id: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/pull_request/:id', { + public async getAll(user: string, document: string, status?: number, startIndex?: number, count?: number, search?: string): Promise { + const url = this.parser.url('/document/:user/:document/pull_request', { 'user': user, 'document': document, - 'id': id, }); let params: AxiosRequestConfig = { url: url, - method: 'PUT', + method: 'GET', + headers: { + }, params: this.parser.query({ + 'status': status, + 'startIndex': startIndex, + 'count': count, + 'search': search, }, [ ]), - data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -251,44 +284,54 @@ export class PullRequestTag extends TagAbstract { } /** - * Creates a new pull request + * Shows all pull request comments * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async create(user: string, document: string, payload: PullRequestCreate): Promise { - const url = this.parser.url('/document/:user/:document/pull_request', { + public async getAllComments(user: string, document: string, id: string, startIndex?: number, count?: number, search?: string): Promise { + const url = this.parser.url('/document/:user/:document/pull_request/:id/comment', { 'user': user, 'document': document, + 'id': id, }); let params: AxiosRequestConfig = { url: url, - method: 'POST', + method: 'GET', + headers: { + }, params: this.parser.query({ + 'startIndex': startIndex, + 'count': count, + 'search': search, }, [ ]), - data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -296,44 +339,55 @@ export class PullRequestTag extends TagAbstract { } /** - * Returns a pull request + * Reacts to a comment * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async get(user: string, document: string, id: string): Promise { - const url = this.parser.url('/document/:user/:document/pull_request/:id', { + public async reactComment(user: string, document: string, id: string, comment: string, reaction: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/pull_request/:id/comment/:comment/:reaction', { 'user': user, 'document': document, 'id': id, + 'comment': comment, + 'reaction': reaction, }); let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), + data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -341,47 +395,53 @@ export class PullRequestTag extends TagAbstract { } /** - * Returns all pull requests + * Merges a pull request * - * @returns {Promise} - * @throws {MessageExceptionException} + * @returns {Promise} + * @throws {MessageException} * @throws {ClientException} */ - public async getAll(user: string, document: string, status?: number, startIndex?: number, count?: number, search?: string): Promise { - const url = this.parser.url('/document/:user/:document/pull_request', { + public async update(user: string, document: string, id: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/pull_request/:id', { 'user': user, 'document': document, + 'id': id, }); let params: AxiosRequestConfig = { url: url, - method: 'GET', + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ - 'status': status, - 'startIndex': startIndex, - 'count': count, - 'search': search, }, [ ]), + data: payload }; try { - const response = await this.httpClient.request(params); + const response = await this.httpClient.request(params); return response.data; } catch (error) { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/StarTag.ts b/src/StarTag.ts index 4639f3c..a9cd564 100644 --- a/src/StarTag.ts +++ b/src/StarTag.ts @@ -15,7 +15,7 @@ export class StarTag extends TagAbstract { * Returns all stared documents for the current user * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async getAll(startIndex?: number, count?: number, search?: string): Promise { @@ -25,6 +25,8 @@ export class StarTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ 'startIndex': startIndex, 'count': count, @@ -40,16 +42,21 @@ export class StarTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/SystemAbout.ts b/src/SystemAbout.ts index 5ad4355..ea8da80 100644 --- a/src/SystemAbout.ts +++ b/src/SystemAbout.ts @@ -5,6 +5,7 @@ import {SystemAboutApps} from "./SystemAboutApps"; import {SystemAboutLink} from "./SystemAboutLink"; + export interface SystemAbout { apiVersion?: string title?: string @@ -21,3 +22,4 @@ export interface SystemAbout { apps?: SystemAboutApps links?: Array } + diff --git a/src/SystemAboutApps.ts b/src/SystemAboutApps.ts index a0bab09..0fa53f6 100644 --- a/src/SystemAboutApps.ts +++ b/src/SystemAboutApps.ts @@ -3,4 +3,6 @@ * {@link https://sdkgen.app} */ -export type SystemAboutApps = Record; +export interface SystemAboutApps extends Record { +} + diff --git a/src/SystemAboutLink.ts b/src/SystemAboutLink.ts index 641f3c0..7478e34 100644 --- a/src/SystemAboutLink.ts +++ b/src/SystemAboutLink.ts @@ -7,3 +7,4 @@ export interface SystemAboutLink { rel?: string href?: string } + diff --git a/src/Tag.ts b/src/Tag.ts index 8053de7..5595aca 100644 --- a/src/Tag.ts +++ b/src/Tag.ts @@ -5,6 +5,7 @@ import {Document} from "./Document"; import {User} from "./User"; + export interface Tag { id?: string document?: Document @@ -14,3 +15,4 @@ export interface Tag { spec?: any insertDate?: string } + diff --git a/src/TagChangelog.ts b/src/TagChangelog.ts index 87b0071..7a78f71 100644 --- a/src/TagChangelog.ts +++ b/src/TagChangelog.ts @@ -9,3 +9,4 @@ export interface TagChangelog { version?: string changelog?: Array } + diff --git a/src/TagCollection.ts b/src/TagCollection.ts index 6615e8f..0acfe82 100644 --- a/src/TagCollection.ts +++ b/src/TagCollection.ts @@ -5,4 +5,7 @@ import {Collection} from "./Collection"; import {Tag} from "./Tag"; -export type TagCollection = Collection; + +export interface TagCollection extends Collection { +} + diff --git a/src/TagTag.ts b/src/TagTag.ts index 3f4f4dd..e46ed3e 100644 --- a/src/TagTag.ts +++ b/src/TagTag.ts @@ -19,7 +19,7 @@ export class TagTag extends TagAbstract { * Generates the changelog for the current release * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async changelog(user: string, document: string, payload: Passthru): Promise { @@ -31,6 +31,9 @@ export class TagTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -44,16 +47,21 @@ export class TagTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -64,7 +72,7 @@ export class TagTag extends TagAbstract { * Creates a new tag * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async create(user: string, document: string, payload: Passthru): Promise { @@ -76,6 +84,9 @@ export class TagTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -89,16 +100,21 @@ export class TagTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -109,7 +125,7 @@ export class TagTag extends TagAbstract { * Returns a tag * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async get(user: string, document: string, id: string): Promise { @@ -122,6 +138,8 @@ export class TagTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), @@ -134,16 +152,21 @@ export class TagTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -154,7 +177,7 @@ export class TagTag extends TagAbstract { * Returns all tags for a document * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async getAll(user: string, document: string, startIndex?: number, count?: number, search?: string): Promise { @@ -166,6 +189,8 @@ export class TagTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ 'startIndex': startIndex, 'count': count, @@ -181,16 +206,21 @@ export class TagTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/Trigger.ts b/src/Trigger.ts index 22f74e1..0d1ae58 100644 --- a/src/Trigger.ts +++ b/src/Trigger.ts @@ -6,6 +6,7 @@ import {User} from "./User"; import {Document} from "./Document"; import {TriggerConfig} from "./TriggerConfig"; + export interface Trigger { id?: number user?: User @@ -15,3 +16,4 @@ export interface Trigger { updateDate?: string insertDate?: string } + diff --git a/src/TriggerCollection.ts b/src/TriggerCollection.ts index 9c478aa..ebf7522 100644 --- a/src/TriggerCollection.ts +++ b/src/TriggerCollection.ts @@ -5,4 +5,7 @@ import {Collection} from "./Collection"; import {Trigger} from "./Trigger"; -export type TriggerCollection = Collection; + +export interface TriggerCollection extends Collection { +} + diff --git a/src/TriggerConfig.ts b/src/TriggerConfig.ts index bfd582a..84685c8 100644 --- a/src/TriggerConfig.ts +++ b/src/TriggerConfig.ts @@ -3,4 +3,6 @@ * {@link https://sdkgen.app} */ -export type TriggerConfig = Record; +export interface TriggerConfig extends Record { +} + diff --git a/src/TriggerCreate.ts b/src/TriggerCreate.ts index b2feb51..bb2a89c 100644 --- a/src/TriggerCreate.ts +++ b/src/TriggerCreate.ts @@ -4,5 +4,7 @@ */ import {Trigger} from "./Trigger"; + export interface TriggerCreate extends Trigger { } + diff --git a/src/TriggerTag.ts b/src/TriggerTag.ts index fa7382e..9c1e186 100644 --- a/src/TriggerTag.ts +++ b/src/TriggerTag.ts @@ -16,22 +16,24 @@ import {TriggerCreate} from "./TriggerCreate"; export class TriggerTag extends TagAbstract { /** - * Executes a trigger + * Creates a new trigger * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async execute(user: string, document: string, id: string, payload: Passthru): Promise { - const url = this.parser.url('/document/:user/:document/trigger/:id/execute', { + public async create(user: string, document: string, payload: TriggerCreate): Promise { + const url = this.parser.url('/document/:user/:document/trigger', { 'user': user, 'document': document, - 'id': id, }); let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -45,16 +47,21 @@ export class TriggerTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); + } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -65,7 +72,7 @@ export class TriggerTag extends TagAbstract { * Removes a trigger * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async delete(user: string, document: string, id: string): Promise { @@ -78,6 +85,8 @@ export class TriggerTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'DELETE', + headers: { + }, params: this.parser.query({ }, [ ]), @@ -90,16 +99,21 @@ export class TriggerTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -107,21 +121,25 @@ export class TriggerTag extends TagAbstract { } /** - * Creates a new trigger + * Executes a trigger * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ - public async create(user: string, document: string, payload: TriggerCreate): Promise { - const url = this.parser.url('/document/:user/:document/trigger', { + public async execute(user: string, document: string, id: string, payload: Passthru): Promise { + const url = this.parser.url('/document/:user/:document/trigger/:id/execute', { 'user': user, 'document': document, + 'id': id, }); let params: AxiosRequestConfig = { url: url, method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, params: this.parser.query({ }, [ ]), @@ -135,16 +153,21 @@ export class TriggerTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -155,7 +178,7 @@ export class TriggerTag extends TagAbstract { * Returns a trigger * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async get(user: string, document: string, id: string): Promise { @@ -168,6 +191,8 @@ export class TriggerTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ }, [ ]), @@ -180,16 +205,21 @@ export class TriggerTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } @@ -200,7 +230,7 @@ export class TriggerTag extends TagAbstract { * Returns all configured triggers * * @returns {Promise} - * @throws {MessageExceptionException} + * @throws {MessageException} * @throws {ClientException} */ public async getAll(user: string, document: string, startIndex?: number, count?: number, search?: string): Promise { @@ -212,6 +242,8 @@ export class TriggerTag extends TagAbstract { let params: AxiosRequestConfig = { url: url, method: 'GET', + headers: { + }, params: this.parser.query({ 'startIndex': startIndex, 'count': count, @@ -227,16 +259,21 @@ export class TriggerTag extends TagAbstract { if (error instanceof ClientException) { throw error; } else if (axios.isAxiosError(error) && error.response) { - switch (error.response.status) { - case 400: - throw new MessageException(error.response.data); - case 404: - throw new MessageException(error.response.data); - case 500: - throw new MessageException(error.response.data); - default: - throw new UnknownStatusCodeException('The server returned an unknown status code'); + const statusCode = error.response.status; + + if (statusCode === 400) { + throw new MessageException(error.response.data); } + + if (statusCode === 404) { + throw new MessageException(error.response.data); + } + + if (statusCode === 500) { + throw new MessageException(error.response.data); + } + + throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode); } else { throw new ClientException('An unknown error occurred: ' + String(error)); } diff --git a/src/User.ts b/src/User.ts index 08bb519..a6ff6d9 100644 --- a/src/User.ts +++ b/src/User.ts @@ -7,3 +7,4 @@ export interface User { id?: number name?: string } +