-
Notifications
You must be signed in to change notification settings - Fork 235
Add samples #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add samples #213
Conversation
samples/wiki.ts
Outdated
| const textStream: NodeJS.ReadableStream = await wikiApiObject.getPageText(project, wikiId) | ||
| console.log("Wiki text", textStream.read().toString()); | ||
|
|
||
| if (wikis.length == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Length is 0 then we try to delete? Should be !==?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think this is correct logic because we only want to delete a wiki if we created one (otherwise we're deleting their actual wiki), and we only want to create a wiki if they don't already have one (otherwise it will fail). With that said, the code clarity is not great, I've updated to hopefully be more clear
samples/wiki.ts
Outdated
|
|
||
| if (wikis.length == 0) { | ||
| common.heading("Delete the created wiki"); | ||
| await wikiApiObject.deleteWiki(wikiId, project); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check response if there is one and print it.
samples/wiki.ts
Outdated
| } | ||
|
|
||
| common.heading("Get the text from a wiki"); | ||
| const textStream: NodeJS.ReadableStream = await wikiApiObject.getPageText(project, wikiId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename variable to pageText
samples/wiki.ts
Outdated
|
|
||
| export async function run() { | ||
| let webApi: nodeApi.WebApi = await common.getWebApi(); | ||
| let wikiApiObject: WikiApi.IWikiApi = await webApi.getWikiApi(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Const?
Added samples for Git and Wiki. Probably could be developed more (in particular Git), but this is at least a good starting place.