Merge branch 'master' into ripgrep
35
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/.vsixmanifest
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||||
|
<Metadata>
|
||||||
|
<Identity Language="en-US" Id="vscode-docker" Version="0.0.6" Publisher="PeterJausovec"/>
|
||||||
|
<DisplayName>Dockerfile and Docker Compose File (yml) Support</DisplayName>
|
||||||
|
<Description xml:space="preserve">Adds syntax highlighting, snippets and description on hover for Dockerfiles and Docker compose files.</Description>
|
||||||
|
<Tags>snippet,dockerfile,Dockerfile,yaml</Tags>
|
||||||
|
<Categories>Languages</Categories>
|
||||||
|
<GalleryFlags>Public</GalleryFlags>
|
||||||
|
<Badges></Badges>
|
||||||
|
<Properties>
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/Microsoft/vscode-docker.git" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/Microsoft/vscode-docker.git" />
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/Microsoft/vscode-docker.git" />
|
||||||
|
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/Microsoft/vscode-docker/issues" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="https://github.com/Microsoft/vscode-docker/blob/master/README.md" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="#5c2d91" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="dark" />
|
||||||
|
</Properties>
|
||||||
|
<License>extension/LICENSE.md</License>
|
||||||
|
<Icon>extension/images/docker_icon.svg</Icon>
|
||||||
|
</Metadata>
|
||||||
|
<Installation>
|
||||||
|
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
|
||||||
|
</Installation>
|
||||||
|
<Dependencies/>
|
||||||
|
<Assets>
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/images/docker_icon.svg" Addressable="true" />
|
||||||
|
</Assets>
|
||||||
|
</PackageManifest>
|
13
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/LICENSE.md
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Visual Studio Code Extension for Docker
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
30
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/README.md
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
## Docker Extension for Visual Studio Code
|
||||||
|
-------------------
|
||||||
|
## Functionality
|
||||||
|
This extension adds syntax highlighting, snippets and additional intellisense for Dockerfiles and docker-compose files in Visual Studio Code. Hovering over
|
||||||
|
commands in your Dockerfile will show you additional information about commands and images.
|
||||||
|
|
||||||
|
![dockerfile](https://github.com/Microsoft/vscode-docker/raw/master/images/dockerfile.gif)
|
||||||
|
|
||||||
|
Similar functionality is available for docker compose files:
|
||||||
|
|
||||||
|
![composefile](https://github.com/Microsoft/vscode-docker/raw/master/images/dockercompose.gif)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
Open up Visual Studio Code, press F1 and type `ext install` and select **Dockerfile and Docker Compose File (yml) Support**. Once extension is installed you will
|
||||||
|
be prompted to restart Visual Studio Code.
|
||||||
|
|
||||||
|
![installation](https://github.com/Microsoft/vscode-docker/raw/master/images/installing.gif)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
There are a couple of ways you can contribute to this repo:
|
||||||
|
|
||||||
|
- Ideas, feature requests and bugs: We are open to all ideas and we want to get rid of bugs! Use the Issues section to either report a new issue, provide your ideas or contribute to existing threads
|
||||||
|
- Documentation: Found a typo or strangely worded sentences? Submit a PR!
|
||||||
|
- Code: Contribute bug fixes, features or design changes.
|
||||||
|
|
||||||
|
## Legal
|
||||||
|
Before we can accept your pull request you will need to sign a **Contribution License Agreement**. All you need to do is to submit a pull request, then the PR will get appropriately labelled (e.g. `cla-required`, `cla-norequired`, `cla-signed`, `cla-already-signed`). If you already signed the agreement we will continue with reviewing the PR, otherwise system will tell you how you can sign the CLA. Once you sign the CLA all future PR's will be labeled as `cla-signed`.
|
||||||
|
|
||||||
|
## License
|
||||||
|
[MIT](https://github.com/Microsoft/vscode-docker/blob/master/LICENSE)
|
114
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/images/docker_icon.svg
vendored
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 120 120" style="enable-background:new 0 0 120 120;" xml:space="preserve">
|
||||||
|
<style type="text/css">
|
||||||
|
.st0{fill:#263237;}
|
||||||
|
.st1{clip-path:url(#SVGID_2_);fill-rule:evenodd;clip-rule:evenodd;fill:#263237;}
|
||||||
|
.st2{fill-rule:evenodd;clip-rule:evenodd;fill:#E7E7E7;}
|
||||||
|
.st3{fill-rule:evenodd;clip-rule:evenodd;fill:#3A4E55;}
|
||||||
|
.st4{fill:#08AADA;}
|
||||||
|
.st5{fill:#2BB8EB;}
|
||||||
|
.st6{fill:#088CB9;}
|
||||||
|
.st7{fill:#069BC6;}
|
||||||
|
.st8{display:none;}
|
||||||
|
.st9{display:inline;fill:#3A4E55;}
|
||||||
|
.st10{fill-rule:evenodd;clip-rule:evenodd;fill:#00ACD2;}
|
||||||
|
.st11{fill-rule:evenodd;clip-rule:evenodd;fill:#26C2EE;}
|
||||||
|
.st12{fill-rule:evenodd;clip-rule:evenodd;fill:#D4EDF1;}
|
||||||
|
.st13{fill:#C0DBE0;}
|
||||||
|
.st14{fill:#D4EDF1;}
|
||||||
|
</style>
|
||||||
|
<circle class="st0" cx="60" cy="60" r="60"/>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<defs>
|
||||||
|
<circle id="SVGID_1_" cx="60" cy="60" r="60"/>
|
||||||
|
</defs>
|
||||||
|
<clipPath id="SVGID_2_">
|
||||||
|
<use xlink:href="#SVGID_1_" style="overflow:visible;"/>
|
||||||
|
</clipPath>
|
||||||
|
<rect x="10.8" y="18.2" class="st1" width="98.4" height="87.8"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path id="docker_1_" class="st2" d="M77.6,88.3c1.6-1.4,3.3-2.8,4.9-4.2c0.6-0.5,1.2-1,1.7-1.5c-0.4-0.6-1.2-1-1.8-1.2
|
||||||
|
c-1.3-0.5-2.5-0.3-3.7,0.3c-1.5,0.9-2.2,2.3-2.1,4c0,0.7,0.2,1.3,0.6,1.9C77.3,88,77.5,88.1,77.6,88.3 M79.5,89.7
|
||||||
|
c0.8,0.3,1.7,0.2,2.5,0.1c0.4-0.2,1.5-0.6,1.9-0.6l0.1,0l0.1,0c0.2,0.1,0.5,0.3,0.6,0.5c0.3,0.6,0.1,1.1-0.4,1.5L84,91.3
|
||||||
|
c-2.1,1.2-4.3,1-6.4-0.1c-1-0.5-1.7-1.3-2.3-2.3l-0.1-0.2c-1.3-2.3-1.2-4.7,0.4-6.9c0.5-0.8,1.2-1.3,2-1.8l0.3-0.2
|
||||||
|
c2-1.1,4.1-1.1,6.1-0.1c1.1,0.5,2,1.3,2.6,2.4l0.1,0.2c0.4,0.8-0.1,1.4-0.7,1.9c-0.7,0.5-1.4,1.2-2,1.7
|
||||||
|
C82.4,87.1,81,88.4,79.5,89.7z M95.1,79.1h0.2c0.7,0,1.1,0.4,1.1,1.1c0,0.9-0.9,1.1-1.6,1.1c-1,0-1.9,0.6-2.6,1.3
|
||||||
|
c-0.8,0.8-1.2,1.9-1.2,3.1V91c0,0.6-0.4,1.1-1,1.1h-0.2c-0.6,0-1-0.5-1-1.1v-5.6c0-2.2,1-3.9,2.8-5.1
|
||||||
|
C92.6,79.5,93.8,79.1,95.1,79.1z M67.8,82.9c0.9-0.9,1.7-1.7,2.6-2.5c0.2-0.2,1.2-1.2,1.5-1.2h0.4l0,0c0.5,0.1,0.9,0.4,0.9,1v0.2
|
||||||
|
c0,0.4-0.4,0.8-0.7,1c-0.5,0.5-1,1-1.5,1.6l-2.6,2.7c1.1,1.1,2.3,2.3,3.4,3.4c0.3,0.3,0.6,0.6,0.9,1c0.1,0.1,0.3,0.3,0.4,0.4
|
||||||
|
c0.1,0.1,0.2,0.3,0.2,0.5v0.2l0,0.1c-0.1,0.5-0.4,0.9-1,0.9H72c-0.4,0-0.8-0.4-1-0.6c-0.5-0.5-1-1-1.5-1.5l-1.7-1.7V91
|
||||||
|
c0,0.6-0.4,1.1-1,1.1h-0.2c-0.6,0-1-0.5-1-1.1V76.1c0-0.6,0.4-1.1,1-1.1h0.2c0.6,0,1,0.5,1,1.1V82.9z M60.7,81.4
|
||||||
|
c-0.3-0.2-0.9-0.2-1.3-0.2c-1.8-0.1-3.2,1-3.9,2.6c-0.3,0.6-0.4,1.1-0.4,1.8c0,1.9,1,3.2,2.7,4c0.6,0.3,1.4,0.3,2.1,0.3
|
||||||
|
c0.6,0,1.4-0.4,1.9-0.6l0.1,0h0.4l0,0c0.5,0.1,0.9,0.4,0.9,1v0.2c0,1.3-2.4,1.6-3.4,1.7c-3.3,0.2-5.7-1.6-6.7-4.7
|
||||||
|
c-0.2-0.5-0.2-1.1-0.2-1.6v-0.4c0-2.4,1.2-4.3,3.2-5.5c0.9-0.6,2-0.8,3.1-0.8h0.4c1.2,0,2.2,0.3,3.2,1l0.1,0.1l0,0.1
|
||||||
|
c0.1,0.2,0.2,0.4,0.2,0.6v0.2c0,0.6-0.4,0.9-0.9,1l0,0H62C61.7,81.9,61,81.6,60.7,81.4z M40.7,85.6c0,1.7,0.8,2.9,2.2,3.7
|
||||||
|
c0.7,0.4,1.4,0.6,2.2,0.6c1.6,0,2.9-0.8,3.7-2.2c0.4-0.7,0.6-1.4,0.6-2.2c0-1.5-0.7-2.7-2-3.6c-0.7-0.5-1.5-0.7-2.3-0.7
|
||||||
|
c-1.8,0-3.2,0.9-3.9,2.6C40.8,84.4,40.7,85,40.7,85.6z M44.8,79.1h0.3c2.5,0,4.5,1.2,5.7,3.4c0.5,0.9,0.8,1.9,0.8,2.9v0.4
|
||||||
|
c0,2.4-1.2,4.3-3.2,5.5c-0.9,0.6-2,0.8-3.1,0.8h-0.4c-2.4,0-4.3-1.2-5.5-3.2c-0.6-0.9-0.8-2-0.8-3.1v-0.4c0-2.4,1.2-4.3,3.2-5.5
|
||||||
|
C42.7,79.3,43.7,79.1,44.8,79.1z M26.4,85.6c0,1.7,0.8,3,2.3,3.8c0.6,0.3,1.3,0.5,2,0.5c1.7,0,2.9-0.8,3.8-2.2
|
||||||
|
c0.4-0.7,0.6-1.4,0.6-2.2c0-1.5-0.7-2.6-1.9-3.5c-0.7-0.5-1.5-0.8-2.4-0.8c-1.8,0-3.2,0.9-3.9,2.6C26.5,84.4,26.4,85,26.4,85.6z
|
||||||
|
M35,80.7v-4.6c0-0.6,0.4-1.1,1-1.1h0.2c0.6,0,1,0.5,1,1.1v9.7c0,2.4-1.2,4.3-3.2,5.5c-0.9,0.6-2,0.8-3.1,0.8h-0.4
|
||||||
|
c-2.4,0-4.3-1.2-5.5-3.2c-0.6-0.9-0.8-2-0.8-3.1v-0.4c0-2.4,1.2-4.3,3.2-5.5c0.9-0.6,2-0.8,3.1-0.8h0.4
|
||||||
|
C32.5,79.1,33.9,79.7,35,80.7z"/>
|
||||||
|
<path id="outline_1_" class="st3" d="M65.8,44.4h6.5v6.6h3.3c1.5,0,3.1-0.3,4.5-0.8c0.7-0.2,1.5-0.6,2.2-1
|
||||||
|
c-0.9-1.2-1.4-2.7-1.5-4.2c-0.2-2,0.2-4.6,1.6-6.2l0.7-0.8l0.8,0.7c2,1.6,3.8,3.9,4.1,6.5c2.5-0.7,5.3-0.6,7.5,0.7l0.9,0.5
|
||||||
|
l-0.5,0.9c-1.8,3.6-5.7,4.7-9.4,4.5c-5.6,13.9-17.8,20.5-32.5,20.5c-7.6,0-14.6-2.9-18.6-9.6l-0.1-0.1l-0.6-1.2
|
||||||
|
c-1.3-3-1.8-6.2-1.5-9.5l0.1-1h5.5v-6.6h6.5V38h12.9v-6.5h7.8V44.4z"/>
|
||||||
|
<g id="body_colors_1_">
|
||||||
|
<path class="st4" d="M86.7,46.9c0.4-3.4-2.1-6-3.6-7.3c-1.8,2.1-2.1,7.5,0.7,9.8c-1.6,1.4-4.9,2.7-8.3,2.7H34.1
|
||||||
|
c-0.3,3.6,0.3,6.8,1.7,9.6l0.5,0.9c0.3,0.5,0.6,1,1,1.5h0c1.7,0.1,3.3,0.1,4.7,0.1c0,0,0,0,0,0c2.8-0.1,5.1-0.4,6.9-1
|
||||||
|
c0.3-0.1,0.5,0,0.6,0.3c0.1,0.3,0,0.5-0.3,0.6c-0.2,0.1-0.5,0.2-0.7,0.2c0,0,0,0,0,0c-1.4,0.4-2.8,0.7-4.7,0.8c0.1,0-0.1,0-0.1,0
|
||||||
|
c-0.1,0-0.1,0-0.2,0c-0.7,0-1.6,0.1-2.4,0.1c-0.9,0-1.8,0-2.8-0.1l0,0c3.5,3.9,8.8,6.2,15.6,6.2c14.3,0,26.5-6.3,31.8-20.6
|
||||||
|
c3.8,0.4,7.5-0.6,9.1-3.8C92.1,45.4,88.7,45.9,86.7,46.9z"/>
|
||||||
|
<path class="st5" d="M86.7,46.9c0.4-3.4-2.1-6-3.6-7.3c-1.8,2.1-2.1,7.5,0.7,9.8c-1.6,1.4-4.9,2.7-8.3,2.7h-39
|
||||||
|
c-0.2,5.4,1.8,9.6,5.4,12.1c0,0,0,0,0,0c2.8-0.1,5.1-0.4,6.9-1c0.3-0.1,0.5,0,0.6,0.3c0.1,0.3,0,0.5-0.3,0.6
|
||||||
|
c-0.2,0.1-0.5,0.2-0.7,0.2c0,0,0,0,0,0c-1.4,0.4-3,0.7-4.9,0.8c0,0,0,0,0,0c4.9,2.5,11.9,2.5,20-0.6C72.7,61,81.1,54.4,87,46.8
|
||||||
|
C86.9,46.8,86.8,46.9,86.7,46.9z"/>
|
||||||
|
<path class="st6" d="M34.2,56.4c0.3,1.9,0.8,3.7,1.6,5.3l0.5,0.9c0.3,0.5,0.6,1,1,1.5c1.7,0.1,3.3,0.1,4.7,0.1
|
||||||
|
c2.8-0.1,5.1-0.4,6.9-1c0.3-0.1,0.5,0,0.6,0.3c0.1,0.3,0,0.5-0.3,0.6c-0.2,0.1-0.5,0.2-0.7,0.2c0,0,0,0,0,0
|
||||||
|
c-1.4,0.4-3,0.7-4.9,0.8c-0.1,0-0.2,0-0.2,0c-0.7,0-1.5,0.1-2.4,0.1c-0.9,0-1.8,0-2.8-0.1c3.5,3.9,8.9,6.2,15.6,6.2
|
||||||
|
c12.3,0,22.9-4.7,29.1-14.9H34.2z"/>
|
||||||
|
<path class="st7" d="M37,56.4c0.7,3.3,2.5,6,5,7.7c2.8-0.1,5.1-0.4,6.9-1c0.3-0.1,0.5,0,0.6,0.3c0.1,0.3,0,0.5-0.3,0.6
|
||||||
|
c-0.2,0.1-0.5,0.2-0.7,0.2c0,0,0,0,0,0c-1.4,0.4-3,0.7-4.9,0.8c4.9,2.5,11.9,2.5,20-0.6c4.9-1.9,9.6-4.7,13.8-8.1H37z"/>
|
||||||
|
</g>
|
||||||
|
<g class="st8">
|
||||||
|
<path class="st9" d="M41,65.2c0.8,0,1.6,0,2.4-0.1c0.1,0,0.1,0,0.2,0c0,0,0,0,0,0c1.9-0.1,3.5-0.4,4.9-0.8c0,0,0,0,0,0
|
||||||
|
c0.2-0.1,0.5-0.1,0.7-0.2c0.3-0.1,0.4-0.4,0.3-0.6c-0.1-0.3-0.4-0.4-0.6-0.3c-1.7,0.6-4,0.9-6.9,1c0,0,0,0,0,0
|
||||||
|
c-1.4,0-3,0-4.7-0.1h0c-0.1,0-0.2,0-0.3,0c-0.3,0-0.5,0.2-0.5,0.5c0,0.3,0.2,0.5,0.5,0.5c0.3,0,0.7,0,1,0.1c0.1,0,0.1,0,0.2,0
|
||||||
|
l0,0C39.1,65.2,40.1,65.2,41,65.2z"/>
|
||||||
|
</g>
|
||||||
|
<g id="Containers_1_">
|
||||||
|
<path class="st10" d="M44.4,46h0.4v4.7h-0.4V46z M43.6,46H44v4.7h-0.5V46z M42.7,46h0.5v4.7h-0.5V46z M41.9,46h0.5v4.7h-0.5V46z
|
||||||
|
M41,46h0.5v4.7H41V46z M40.2,46h0.4v4.7h-0.4V46z M39.7,45.5h5.6v5.6h-5.6V45.5z"/>
|
||||||
|
<path class="st10" d="M50.9,39.5h0.4v4.7h-0.4V39.5z M50.1,39.5h0.5v4.7h-0.5V39.5z M49.2,39.5h0.5v4.7h-0.5V39.5z M48.4,39.5
|
||||||
|
h0.5v4.7h-0.5V39.5z M47.5,39.5H48v4.7h-0.5V39.5z M46.7,39.5h0.4v4.7h-0.4V39.5z M46.2,39.1h5.6v5.6h-5.6V39.1z"/>
|
||||||
|
<path class="st11" d="M50.9,46h0.4v4.7h-0.4V46z M50.1,46h0.5v4.7h-0.5V46z M49.2,46h0.5v4.7h-0.5V46z M48.4,46h0.5v4.7h-0.5V46z
|
||||||
|
M47.5,46H48v4.7h-0.5V46z M46.7,46h0.4v4.7h-0.4V46z M46.2,45.5h5.6v5.6h-5.6V45.5z"/>
|
||||||
|
<path class="st10" d="M57.4,46h0.4v4.7h-0.4V46z M56.5,46H57v4.7h-0.5V46z M55.7,46h0.5v4.7h-0.5V46z M54.8,46h0.5v4.7h-0.5V46z
|
||||||
|
M54,46h0.5v4.7H54V46z M53.1,46h0.4v4.7h-0.4V46z M52.7,45.5h5.6v5.6h-5.6V45.5z"/>
|
||||||
|
<path class="st11" d="M57.4,39.5h0.4v4.7h-0.4V39.5z M56.5,39.5H57v4.7h-0.5V39.5z M55.7,39.5h0.5v4.7h-0.5V39.5z M54.8,39.5h0.5
|
||||||
|
v4.7h-0.5V39.5z M54,39.5h0.5v4.7H54V39.5z M53.1,39.5h0.4v4.7h-0.4V39.5z M52.7,39.1h5.6v5.6h-5.6V39.1z"/>
|
||||||
|
<path class="st11" d="M63.8,46h0.4v4.7h-0.4V46z M63,46h0.5v4.7H63V46z M62.1,46h0.5v4.7h-0.5V46z M61.3,46h0.5v4.7h-0.5V46z
|
||||||
|
M60.4,46h0.5v4.7h-0.5V46z M59.6,46H60v4.7h-0.4V46z M59.1,45.5h5.6v5.6h-5.6V45.5z"/>
|
||||||
|
<path class="st10" d="M63.8,39.5h0.4v4.7h-0.4V39.5z M63,39.5h0.5v4.7H63V39.5z M62.1,39.5h0.5v4.7h-0.5V39.5z M61.3,39.5h0.5
|
||||||
|
v4.7h-0.5V39.5z M60.4,39.5h0.5v4.7h-0.5V39.5z M59.6,39.5H60v4.7h-0.4V39.5z M59.1,39.1h5.6v5.6h-5.6V39.1z"/>
|
||||||
|
<path class="st11" d="M63.8,33.1h0.4v4.7h-0.4V33.1z M63,33.1h0.5v4.7H63V33.1z M62.1,33.1h0.5v4.7h-0.5V33.1z M61.3,33.1h0.5
|
||||||
|
v4.7h-0.5V33.1z M60.4,33.1h0.5v4.7h-0.5V33.1z M59.6,33.1H60v4.7h-0.4V33.1z M59.1,32.6h5.6v5.6h-5.6V32.6z"/>
|
||||||
|
<path class="st10" d="M70.3,46h0.4v4.7h-0.4V46z M69.4,46h0.5v4.7h-0.5V46z M68.6,46H69v4.7h-0.5V46z M67.7,46h0.5v4.7h-0.5V46z
|
||||||
|
M66.9,46h0.5v4.7h-0.5V46z M66.1,46h0.4v4.7h-0.4V46z M65.6,45.5h5.6v5.6h-5.6V45.5z"/>
|
||||||
|
</g>
|
||||||
|
<path class="st12" d="M51.5,60.2c0.9,0,1.5,0.7,1.5,1.5s-0.7,1.5-1.5,1.5c-0.9,0-1.5-0.7-1.5-1.5S50.6,60.2,51.5,60.2"/>
|
||||||
|
<path class="st3" d="M51.5,60.6c0.1,0,0.3,0,0.4,0.1c-0.1,0.1-0.2,0.2-0.2,0.4c0,0.2,0.2,0.5,0.5,0.5c0.2,0,0.3-0.1,0.4-0.2
|
||||||
|
c0.1,0.1,0.1,0.3,0.1,0.4c0,0.6-0.5,1.1-1.1,1.1c-0.6,0-1.1-0.5-1.1-1.1C50.4,61.1,50.8,60.6,51.5,60.6"/>
|
||||||
|
<path class="st3" d="M24.1,57H58h4.2H96c-1.6-0.4-5-0.9-4.4-3c-2.8,3.3-9.7,2.3-11.4,0.7c-1.9,2.8-13.2,1.7-13.9-0.4
|
||||||
|
c-2.4,2.8-9.9,2.8-12.3,0c-0.8,2.2-12,3.2-13.9,0.4c-1.7,1.6-8.6,2.6-11.4-0.7C29.1,56.1,25.7,56.6,24.1,57"/>
|
||||||
|
<path class="st13" d="M55.6,71.3c-3.8-1.8-5.9-4.3-7.1-7c-1.4,0.4-3.1,0.7-5.1,0.8c-0.7,0-1.5,0.1-2.4,0.1c-1,0-2,0-3-0.1
|
||||||
|
c3.5,3.5,7.8,6.2,15.8,6.3C54.4,71.4,55,71.4,55.6,71.3z"/>
|
||||||
|
<path class="st14" d="M49.9,66.8c-0.5-0.7-1-1.6-1.4-2.5c-1.4,0.4-3.1,0.7-5.1,0.8C44.7,65.9,46.7,66.6,49.9,66.8z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 9.1 KiB |
BIN
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/images/dockercompose.gif
vendored
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/images/dockerfile.gif
vendored
Normal file
After Width: | Height: | Size: 139 KiB |
BIN
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/images/installing.gif
vendored
Normal file
After Width: | Height: | Size: 114 KiB |
|
@ -0,0 +1,55 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var vscode_1 = require('vscode');
|
||||||
|
var helper = require('../helpers/suggestSupportHelper');
|
||||||
|
var dockerComposeKeyInfo_1 = require('./dockerComposeKeyInfo');
|
||||||
|
var DockerComposeCompletionItemProvider = (function () {
|
||||||
|
function DockerComposeCompletionItemProvider() {
|
||||||
|
this.triggerCharacters = [];
|
||||||
|
this.excludeTokens = [];
|
||||||
|
}
|
||||||
|
DockerComposeCompletionItemProvider.prototype.provideCompletionItems = function (document, position, token) {
|
||||||
|
var yamlSuggestSupport = new helper.SuggestSupportHelper();
|
||||||
|
// Get the line where intellisense was invoked on (e.g. 'image: u').
|
||||||
|
var line = document.lineAt(position.line).text;
|
||||||
|
if (line.length === 0) {
|
||||||
|
// empty line
|
||||||
|
return Promise.resolve(this.suggestKeys(''));
|
||||||
|
}
|
||||||
|
var range = document.getWordRangeAtPosition(position);
|
||||||
|
// Get the text where intellisense was invoked on (e.g. 'u').
|
||||||
|
var word = range && document.getText(range) || '';
|
||||||
|
var textBefore = line.substring(0, position.character);
|
||||||
|
if (/^\s*[\w_]*$/.test(textBefore)) {
|
||||||
|
// on the first token
|
||||||
|
return Promise.resolve(this.suggestKeys(word));
|
||||||
|
}
|
||||||
|
// Matches strings like: 'image: "ubuntu'
|
||||||
|
var imageTextWithQuoteMatchYaml = textBefore.match(/^\s*image\s*\:\s*"([^"]*)$/);
|
||||||
|
if (imageTextWithQuoteMatchYaml) {
|
||||||
|
var imageText = imageTextWithQuoteMatchYaml[1];
|
||||||
|
return yamlSuggestSupport.suggestImages(imageText);
|
||||||
|
}
|
||||||
|
// Matches strings like: 'image: ubuntu'
|
||||||
|
var imageTextWithoutQuoteMatch = textBefore.match(/^\s*image\s*\:\s*([\w\:\/]*)/);
|
||||||
|
if (imageTextWithoutQuoteMatch) {
|
||||||
|
var imageText = imageTextWithoutQuoteMatch[1];
|
||||||
|
return yamlSuggestSupport.suggestImages(imageText);
|
||||||
|
}
|
||||||
|
return Promise.resolve([]);
|
||||||
|
};
|
||||||
|
DockerComposeCompletionItemProvider.prototype.suggestKeys = function (word) {
|
||||||
|
return Object.keys(dockerComposeKeyInfo_1.DOCKER_COMPOSE_KEY_INFO).map(function (ruleName) {
|
||||||
|
var completionItem = new vscode_1.CompletionItem(ruleName);
|
||||||
|
completionItem.kind = vscode_1.CompletionItemKind.Keyword;
|
||||||
|
completionItem.insertText = ruleName + ': ';
|
||||||
|
completionItem.documentation = dockerComposeKeyInfo_1.DOCKER_COMPOSE_KEY_INFO[ruleName];
|
||||||
|
return completionItem;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return DockerComposeCompletionItemProvider;
|
||||||
|
}());
|
||||||
|
exports.DockerComposeCompletionItemProvider = DockerComposeCompletionItemProvider;
|
||||||
|
//# sourceMappingURL=dockerComposeCompletionItemProvider.js.map
|
51
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/dockerCompose/dockerComposeKeyInfo.js
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
"use strict";
|
||||||
|
// https://docs.docker.com/compose/yml/
|
||||||
|
exports.DOCKER_COMPOSE_KEY_INFO = {
|
||||||
|
'image': ("Tag or partial image ID. Can be local or remote - Compose will attempt to pull if it doesn't exist locally."),
|
||||||
|
'build': ("Path to a directory containing a Dockerfile. When the value supplied is a relative path, it is interpreted as relative to the " +
|
||||||
|
"location of the yml file itself. This directory is also the build context that is sent to the Docker daemon.\n\n" +
|
||||||
|
"Compose will build and tag it with a generated name, and use that image thereafter."),
|
||||||
|
'command': ("Override the default command."),
|
||||||
|
'links': ("Link to containers in another service. Either specify both the service name and the link alias (`CONTAINER:ALIAS`), or " +
|
||||||
|
"just the service name (which will also be used for the alias)."),
|
||||||
|
'external_links': ("Link to containers started outside this `docker-compose.yml` or even outside of Compose, especially for containers that " +
|
||||||
|
"provide shared or common services. `external_links` follow " +
|
||||||
|
"semantics similar to `links` when specifying both the container name and the link alias (`CONTAINER:ALIAS`)."),
|
||||||
|
'ports': ("Expose ports. Either specify both ports (`HOST:CONTAINER`), or just the container port (a random host port will be chosen).\n\n" +
|
||||||
|
"**Note**: When mapping ports in the `HOST:CONTAINER` format, you may experience erroneous results when using a container port " +
|
||||||
|
"lower than 60, because YAML will parse numbers in the format `xx:yy` as sexagesimal (base 60). For this reason, we recommend " +
|
||||||
|
"always explicitly specifying your port mappings as strings."),
|
||||||
|
'expose': ("Expose ports without publishing them to the host machine - they'll only be accessible to linked services. \n" +
|
||||||
|
"Only the internal port can be specified."),
|
||||||
|
'volumes': ("Mount paths as volumes, optionally specifying a path on the host machine (`HOST:CONTAINER`), or an access mode (`HOST:CONTAINER:ro`)."),
|
||||||
|
'volumes_from': ("Mount all of the volumes from another service or container."),
|
||||||
|
'environment': ("Add environment variables. You can use either an array or a dictionary.\n\n" +
|
||||||
|
"Environment variables with only a key are resolved to their values on the machine Compose is running on, which can be helpful for secret or host-specific values."),
|
||||||
|
'env_file': ("Add environment variables from a file. Can be a single value or a list.\n\n" +
|
||||||
|
"If you have specified a Compose file with `docker-compose -f FILE`, paths in `env_file` are relative to the directory that file is in.\n\n" +
|
||||||
|
"Environment variables specified in `environment` override these values."),
|
||||||
|
'net': ("Networking mode. Use the same values as the docker client `--net` parameter."),
|
||||||
|
'pid': ("Sets the PID mode to the host PID mode. This turns on sharing between container and the host operating system the PID address space. " +
|
||||||
|
"Containers launched with this flag will be able to access and manipulate other containers in the bare-metal machine's namespace and vise-versa."),
|
||||||
|
'dns': ("Custom DNS servers. Can be a single value or a list."),
|
||||||
|
'cap_add': ("Add or drop container capabilities. See `man 7 capabilities` for a full list."),
|
||||||
|
'cap_drop': ("Add or drop container capabilities. See `man 7 capabilities` for a full list."),
|
||||||
|
'dns_search': ("Custom DNS search domains. Can be a single value or a list."),
|
||||||
|
'cgroup_parent': ("Specify an optional parent cgroup for the container."),
|
||||||
|
'container_name': ("Specify custom container name, rather than a generated default name."),
|
||||||
|
'devices': ("List of device mappings. Uses the same format as the `--device` docker client create option."),
|
||||||
|
'dockerfile': ("Alternate dockerfile. Compose will use an alternate file to build with. Using `dockerfile` together with `image` is not allowed. Attempting to do so results in an error."),
|
||||||
|
'extends': ("Extend another service, in the current file or another, optionally overriding configuration.\nYou can use `extends` on any service together with other configuration keys. " +
|
||||||
|
"The `extends` value must be a dictionary defined with a required `service` and an optional `file` key."),
|
||||||
|
'extra_hosts': ("Add hostname mappings. Use the same values as the docker client `--add-host` parameter."),
|
||||||
|
'labels': ("Add metadata to containers using Docker labels. You can either use an array or a dictionary.\n" +
|
||||||
|
"It's recommended that you use reverse-DNS notation to prevent your labels from conflicting with those used by other software."),
|
||||||
|
'log_driver': ("Specify a logging driver for the service's containers, as with the `--log-driver` option for docker run. The default value is json-file."),
|
||||||
|
'log_opt': ("Specify logging options with `log_opt` for the logging driver, as with the `--log-opt` option for docker run."),
|
||||||
|
'security_opt': ("Override the default labeling scheme for each container."),
|
||||||
|
'volume_driver': ("If you use a volume name (instead of a volume path), you may also specify a `volume_driver`.")
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=dockerComposeKeyInfo.js.map
|
75
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/dockerCompose/dockerComposeParser.js
vendored
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
var parser_1 = require('../parser');
|
||||||
|
var DockerComposeParser = (function (_super) {
|
||||||
|
__extends(DockerComposeParser, _super);
|
||||||
|
function DockerComposeParser() {
|
||||||
|
var parseRegex = /\:+$/g;
|
||||||
|
_super.call(this, parseRegex);
|
||||||
|
}
|
||||||
|
DockerComposeParser.prototype.parseLine = function (textLine) {
|
||||||
|
var r = [];
|
||||||
|
var lastTokenEndIndex = 0, lastPushedToken = null;
|
||||||
|
var emit = function (end, type) {
|
||||||
|
if (end <= lastTokenEndIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lastPushedToken && lastPushedToken.type === type) {
|
||||||
|
// merge with last pushed token
|
||||||
|
lastPushedToken.endIndex = end;
|
||||||
|
lastTokenEndIndex = end;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastPushedToken = {
|
||||||
|
startIndex: lastTokenEndIndex,
|
||||||
|
endIndex: end,
|
||||||
|
type: type
|
||||||
|
};
|
||||||
|
r.push(lastPushedToken);
|
||||||
|
lastTokenEndIndex = end;
|
||||||
|
};
|
||||||
|
var inString = false;
|
||||||
|
var idx = textLine.firstNonWhitespaceCharacterIndex;
|
||||||
|
var line = textLine.text;
|
||||||
|
for (var i = idx, len = line.length; i < len; i++) {
|
||||||
|
var ch = line.charAt(i);
|
||||||
|
if (inString) {
|
||||||
|
if (ch === '"' && line.charAt(i - 1) !== '\\') {
|
||||||
|
inString = false;
|
||||||
|
emit(i + 1, parser_1.TokenType.String);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ch === '"') {
|
||||||
|
emit(i, parser_1.TokenType.Text);
|
||||||
|
inString = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ch === '#') {
|
||||||
|
// Comment the rest of the line
|
||||||
|
emit(i, parser_1.TokenType.Text);
|
||||||
|
emit(line.length, parser_1.TokenType.Comment);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ch === ':') {
|
||||||
|
emit(i + 1, parser_1.TokenType.Key);
|
||||||
|
}
|
||||||
|
if (ch === ' ' || ch === '\t') {
|
||||||
|
emit(i, parser_1.TokenType.Text);
|
||||||
|
emit(i + 1, parser_1.TokenType.Whitespace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit(line.length, parser_1.TokenType.Text);
|
||||||
|
return r;
|
||||||
|
};
|
||||||
|
return DockerComposeParser;
|
||||||
|
}(parser_1.Parser));
|
||||||
|
exports.DockerComposeParser = DockerComposeParser;
|
||||||
|
//# sourceMappingURL=dockerComposeParser.js.map
|
24
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/dockerExtension.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
"use strict";
|
||||||
|
var dockerHoverProvider_1 = require('./dockerHoverProvider');
|
||||||
|
var dockerfileCompletionItemProvider_1 = require('./dockerfile/dockerfileCompletionItemProvider');
|
||||||
|
var dockerComposeCompletionItemProvider_1 = require('./dockerCompose/dockerComposeCompletionItemProvider');
|
||||||
|
var dockerfileKeyInfo_1 = require('./dockerfile/dockerfileKeyInfo');
|
||||||
|
var dockerComposeKeyInfo_1 = require('./dockerCompose/dockerComposeKeyInfo');
|
||||||
|
var dockerComposeParser_1 = require('./dockerCompose/dockerComposeParser');
|
||||||
|
var dockerfileParser_1 = require('./dockerfile/dockerfileParser');
|
||||||
|
var vscode = require('vscode');
|
||||||
|
function activate(ctx) {
|
||||||
|
var DOCKERFILE_MODE_ID = { language: 'dockerfile', scheme: 'file' };
|
||||||
|
var dockerHoverProvider = new dockerHoverProvider_1.DockerHoverProvider(new dockerfileParser_1.DockerfileParser(), dockerfileKeyInfo_1.DOCKERFILE_KEY_INFO);
|
||||||
|
ctx.subscriptions.push(vscode.languages.registerHoverProvider(DOCKERFILE_MODE_ID, dockerHoverProvider));
|
||||||
|
ctx.subscriptions.push(vscode.languages.registerCompletionItemProvider(DOCKERFILE_MODE_ID, new dockerfileCompletionItemProvider_1.DockerfileCompletionItemProvider(), '.'));
|
||||||
|
var YAML_MODE_ID = { language: 'yaml', scheme: 'file', pattern: '**/docker-compose*.yml' };
|
||||||
|
var yamlHoverProvider = new dockerHoverProvider_1.DockerHoverProvider(new dockerComposeParser_1.DockerComposeParser(), dockerComposeKeyInfo_1.DOCKER_COMPOSE_KEY_INFO);
|
||||||
|
ctx.subscriptions.push(vscode.languages.registerHoverProvider(YAML_MODE_ID, yamlHoverProvider));
|
||||||
|
ctx.subscriptions.push(vscode.languages.registerCompletionItemProvider(YAML_MODE_ID, new dockerComposeCompletionItemProvider_1.DockerComposeCompletionItemProvider(), '.'));
|
||||||
|
}
|
||||||
|
exports.activate = activate;
|
||||||
|
//# sourceMappingURL=dockerExtension.js.map
|
68
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/dockerHoverProvider.js
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var vscode_1 = require('vscode');
|
||||||
|
var parser = require('./parser');
|
||||||
|
var suggestHelper = require('./helpers/suggestSupportHelper');
|
||||||
|
var DockerHoverProvider = (function () {
|
||||||
|
// Provide the parser you want to use as well as keyinfo dictionary.
|
||||||
|
function DockerHoverProvider(wordParser, keyInfo) {
|
||||||
|
this._parser = wordParser;
|
||||||
|
this._keyInfo = keyInfo;
|
||||||
|
}
|
||||||
|
DockerHoverProvider.prototype.provideHover = function (document, position, token) {
|
||||||
|
var line = document.lineAt(position.line);
|
||||||
|
if (line.text.length === 0) {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
var tokens = this._parser.parseLine(line);
|
||||||
|
return this._computeInfoForLineWithTokens(line.text, tokens, position);
|
||||||
|
};
|
||||||
|
DockerHoverProvider.prototype._computeInfoForLineWithTokens = function (line, tokens, position) {
|
||||||
|
var _this = this;
|
||||||
|
var possibleTokens = this._parser.tokensAtColumn(tokens, position.character);
|
||||||
|
return Promise.all(possibleTokens.map(function (tokenIndex) { return _this._computeInfoForToken(line, tokens, tokenIndex); })).then(function (results) {
|
||||||
|
return possibleTokens.map(function (tokenIndex, arrayIndex) {
|
||||||
|
return {
|
||||||
|
startIndex: tokens[tokenIndex].startIndex,
|
||||||
|
endIndex: tokens[tokenIndex].endIndex,
|
||||||
|
result: results[arrayIndex]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}).then(function (results) {
|
||||||
|
var r = results.filter(function (r) { return !!r.result; });
|
||||||
|
if (r.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var range = new vscode_1.Range(position.line, r[0].startIndex, position.line, r[0].endIndex);
|
||||||
|
r[0].result.then(function (t) {
|
||||||
|
var hover = new vscode_1.Hover(t, range);
|
||||||
|
return hover;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
DockerHoverProvider.prototype._computeInfoForToken = function (line, tokens, tokenIndex) {
|
||||||
|
// -------------
|
||||||
|
// Detect hovering on a key
|
||||||
|
if (tokens[tokenIndex].type === parser.TokenType.Key) {
|
||||||
|
var keyName = this._parser.keyNameFromKeyToken(this._parser.tokenValue(line, tokens[tokenIndex])).trim();
|
||||||
|
var r = this._keyInfo[keyName];
|
||||||
|
if (r) {
|
||||||
|
return Promise.resolve([r]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// -------------
|
||||||
|
// Detect <<image: [["something"]]>>
|
||||||
|
// Detect <<image: [[something]]>>
|
||||||
|
var helper = new suggestHelper.SuggestSupportHelper();
|
||||||
|
var r2 = helper.getImageNameHover(line, this._parser, tokens, tokenIndex);
|
||||||
|
if (r2) {
|
||||||
|
return r2;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
return DockerHoverProvider;
|
||||||
|
}());
|
||||||
|
exports.DockerHoverProvider = DockerHoverProvider;
|
||||||
|
//# sourceMappingURL=dockerHoverProvider.js.map
|
119
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/dockerHubApi.js
vendored
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var https = require('https');
|
||||||
|
function tagsForImage(image) {
|
||||||
|
var tags = [];
|
||||||
|
if (image.is_automated) {
|
||||||
|
tags.push('Automated');
|
||||||
|
}
|
||||||
|
else if (image.is_trusted) {
|
||||||
|
tags.push('Trusted');
|
||||||
|
}
|
||||||
|
else if (image.is_official) {
|
||||||
|
tags.push('Official');
|
||||||
|
}
|
||||||
|
if (tags.length > 0) {
|
||||||
|
return '[' + tags.join('] [') + ']';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
exports.tagsForImage = tagsForImage;
|
||||||
|
function searchImageInRegistryHub(imageName, cache) {
|
||||||
|
return invokeHubSearch(imageName, 1, cache).then(function (data) {
|
||||||
|
if (data.results.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return data.results[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.searchImageInRegistryHub = searchImageInRegistryHub;
|
||||||
|
var popular = [
|
||||||
|
{ "is_automated": false, "name": "redis", "is_trusted": false, "is_official": true, "star_count": 1300, "description": "Redis is an open source key-value store that functions as a data structure server." },
|
||||||
|
{ "is_automated": false, "name": "ubuntu", "is_trusted": false, "is_official": true, "star_count": 2600, "description": "Ubuntu is a Debian-based Linux operating system based on free software." },
|
||||||
|
{ "is_automated": false, "name": "wordpress", "is_trusted": false, "is_official": true, "star_count": 582, "description": "The WordPress rich content management system can utilize plugins, widgets, and themes." },
|
||||||
|
{ "is_automated": false, "name": "mysql", "is_trusted": false, "is_official": true, "star_count": 1300, "description": "MySQL is a widely used, open-source relational database management system (RDBMS)." },
|
||||||
|
{ "is_automated": false, "name": "mongo", "is_trusted": false, "is_official": true, "star_count": 1100, "description": "MongoDB document databases provide high availability and easy scalability." },
|
||||||
|
{ "is_automated": false, "name": "centos", "is_trusted": false, "is_official": true, "star_count": 1600, "description": "The official build of CentOS." },
|
||||||
|
{ "is_automated": false, "name": "node", "is_trusted": false, "is_official": true, "star_count": 1200, "description": "Node.js is a JavaScript-based platform for server-side and networking applications." },
|
||||||
|
{ "is_automated": false, "name": "nginx", "is_trusted": false, "is_official": true, "star_count": 1600, "description": "Official build of Nginx." },
|
||||||
|
{ "is_automated": false, "name": "postgres", "is_trusted": false, "is_official": true, "star_count": 1200, "description": "The PostgreSQL object-relational database system provides reliability and data integrity." },
|
||||||
|
{ "is_automated": true, "name": "microsoft/aspnet", "is_trusted": true, "is_official": false, "star_count": 277, "description": "ASP.NET is an open source server-side Web application framework" }
|
||||||
|
];
|
||||||
|
function searchImagesInRegistryHub(prefix, cache) {
|
||||||
|
if (prefix.length === 0) {
|
||||||
|
// return the popular images if user invoked intellisense
|
||||||
|
// right after typing the keyword and ':' (e.g. 'image:').
|
||||||
|
return Promise.resolve(popular.slice(0));
|
||||||
|
}
|
||||||
|
// Do an image search on Docker hub and return the results
|
||||||
|
return invokeHubSearch(prefix, 100, cache).then(function (data) {
|
||||||
|
return data.results;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.searchImagesInRegistryHub = searchImagesInRegistryHub;
|
||||||
|
// https://registry.hub.docker.com/v1/search?q=redis&n=1
|
||||||
|
// {
|
||||||
|
// "num_pages": 10,
|
||||||
|
// "num_results": 10,
|
||||||
|
// "results": [
|
||||||
|
// {
|
||||||
|
// "is_automated": false,
|
||||||
|
// "name": "redis",
|
||||||
|
// "is_trusted": false,
|
||||||
|
// "is_official": true,
|
||||||
|
// "star_count": 830,
|
||||||
|
// "description": "Redis is an open source key-value store that functions as a data structure server."
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// "page_size": 1,
|
||||||
|
// "query": "redis",
|
||||||
|
// "page": 1
|
||||||
|
// }
|
||||||
|
function invokeHubSearch(imageName, count, cache) {
|
||||||
|
// https://registry.hub.docker.com/v1/search?q=redis&n=1
|
||||||
|
return fetchHttpsJson({
|
||||||
|
hostname: 'registry.hub.docker.com',
|
||||||
|
port: 443,
|
||||||
|
path: '/v1/search?q=' + encodeURIComponent(imageName) + '&n=' + count,
|
||||||
|
method: 'GET',
|
||||||
|
}, cache);
|
||||||
|
}
|
||||||
|
var JSON_CACHE = {};
|
||||||
|
function fetchHttpsJson(opts, cache) {
|
||||||
|
if (!cache) {
|
||||||
|
return doFetchHttpsJson(opts);
|
||||||
|
}
|
||||||
|
var cache_key = (opts.method + ' ' + opts.hostname + ' ' + opts.path);
|
||||||
|
if (!JSON_CACHE[cache_key]) {
|
||||||
|
JSON_CACHE[cache_key] = doFetchHttpsJson(opts);
|
||||||
|
}
|
||||||
|
// new promise to avoid cancelling
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
JSON_CACHE[cache_key].then(resolve, reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function doFetchHttpsJson(opts) {
|
||||||
|
opts.headers = opts.headers || {};
|
||||||
|
opts.headers['Accept'] = 'application/json';
|
||||||
|
return httpsRequestAsPromise(opts).then(function (data) {
|
||||||
|
return JSON.parse(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function httpsRequestAsPromise(opts) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var req = https.request(opts, function (res) {
|
||||||
|
var data = '';
|
||||||
|
res.on('data', function (d) {
|
||||||
|
data += d;
|
||||||
|
});
|
||||||
|
res.on('end', function () {
|
||||||
|
resolve(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
req.end();
|
||||||
|
req.on('error', reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=dockerHubApi.js.map
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var helper = require('../helpers/suggestSupportHelper');
|
||||||
|
// IntelliSense
|
||||||
|
var DockerfileCompletionItemProvider = (function () {
|
||||||
|
function DockerfileCompletionItemProvider() {
|
||||||
|
this.triggerCharacters = [];
|
||||||
|
this.excludeTokens = [];
|
||||||
|
}
|
||||||
|
DockerfileCompletionItemProvider.prototype.provideCompletionItems = function (document, position, token) {
|
||||||
|
var dockerSuggestSupport = new helper.SuggestSupportHelper();
|
||||||
|
var textLine = document.lineAt(position.line);
|
||||||
|
// Matches strings like: 'FROM imagename'
|
||||||
|
var fromTextDocker = textLine.text.match(/^\s*FROM\s*([^"]*)$/);
|
||||||
|
if (fromTextDocker) {
|
||||||
|
return dockerSuggestSupport.suggestImages(fromTextDocker[1]);
|
||||||
|
}
|
||||||
|
return Promise.resolve([]);
|
||||||
|
};
|
||||||
|
return DockerfileCompletionItemProvider;
|
||||||
|
}());
|
||||||
|
exports.DockerfileCompletionItemProvider = DockerfileCompletionItemProvider;
|
||||||
|
//# sourceMappingURL=dockerfileCompletionItemProvider.js.map
|
27
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/dockerfile/dockerfileKeyInfo.js
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
"use strict";
|
||||||
|
// https://docs.docker.com/reference/builder/
|
||||||
|
exports.DOCKERFILE_KEY_INFO = {
|
||||||
|
'FROM': ("Sets the **Base Image** for subsequent instructions."),
|
||||||
|
'MAINTAINER': ("Set the **Author** field of the generated images."),
|
||||||
|
'RUN': ("Executes any commands in a new layer on top of the current image and commits the results."),
|
||||||
|
'CMD': ("Provides defaults for an executing container."),
|
||||||
|
'LABEL': ("Adds metadata to an image. A **LABEL** is a key-value pair."),
|
||||||
|
'EXPOSE': ("Informs Docker that the container will listen on the specified network ports at runtime."),
|
||||||
|
'ENV': ("Sets the environment variable `key` to the value `value`."),
|
||||||
|
'ADD': ("The **ADD** instruction copies new files, directories or remote file URLs from `src` and adds them " +
|
||||||
|
"to the filesystem of the container at the path `dest`."),
|
||||||
|
'COPY': ("Copies new files or directories from `src` and adds them to the filesystem of the container at the path `dest`."),
|
||||||
|
'ENTRYPOINT': ("Configures a container that will run as an executable."),
|
||||||
|
'VOLUME': ("Creates a mount point with the specified name and marks it as holding externally mounted volumes " +
|
||||||
|
"from native host or other containers."),
|
||||||
|
'USER': ("Sets the user name or UID to use when running the image and for any `RUN`, `CMD` and `ENTRYPOINT` " +
|
||||||
|
"instructions that follow it in the Dockerfile."),
|
||||||
|
'WORKDIR': ("Sets the working directory for any `RUN`, `CMD`, `ENTRYPOINT`, `COPY` and `ADD` instructions that follow it in the Dockerfile."),
|
||||||
|
'ONBUILD': ("Adds to the image a trigger instruction to be executed at a later time, when the image is used as the " +
|
||||||
|
"base for another build."),
|
||||||
|
'STOPSIGNAL': ("Sets the system call signal that will be sent to the container to exit.")
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=dockerfileKeyInfo.js.map
|
51
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/dockerfile/dockerfileParser.js
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
var parser_1 = require('../parser');
|
||||||
|
var DockerfileParser = (function (_super) {
|
||||||
|
__extends(DockerfileParser, _super);
|
||||||
|
function DockerfileParser() {
|
||||||
|
var parseRegex = /\ +$/g;
|
||||||
|
_super.call(this, parseRegex);
|
||||||
|
}
|
||||||
|
DockerfileParser.prototype.parseLine = function (textLine) {
|
||||||
|
if (textLine.isEmptyOrWhitespace) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var startIndex = textLine.firstNonWhitespaceCharacterIndex;
|
||||||
|
// Check for comment
|
||||||
|
if (textLine.text.charAt(startIndex) === '#') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var tokens = [];
|
||||||
|
var previousTokenIndex = 0;
|
||||||
|
var keyFound = false;
|
||||||
|
for (var j = startIndex, len = textLine.text.length; j < len; j++) {
|
||||||
|
var ch = textLine.text.charAt(j);
|
||||||
|
if (ch === ' ' || ch === '\t') {
|
||||||
|
previousTokenIndex = j;
|
||||||
|
tokens.push({
|
||||||
|
startIndex: 0,
|
||||||
|
endIndex: j,
|
||||||
|
type: parser_1.TokenType.Key
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tokens.push({
|
||||||
|
startIndex: previousTokenIndex,
|
||||||
|
endIndex: textLine.text.length,
|
||||||
|
type: parser_1.TokenType.String
|
||||||
|
});
|
||||||
|
return tokens;
|
||||||
|
};
|
||||||
|
return DockerfileParser;
|
||||||
|
}(parser_1.Parser));
|
||||||
|
exports.DockerfileParser = DockerfileParser;
|
||||||
|
//# sourceMappingURL=dockerfileParser.js.map
|
90
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/helpers/suggestSupportHelper.js
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var vscode = require('vscode');
|
||||||
|
var hub = require('../dockerHubApi');
|
||||||
|
var parser = require('../parser');
|
||||||
|
var SuggestSupportHelper = (function () {
|
||||||
|
function SuggestSupportHelper() {
|
||||||
|
}
|
||||||
|
SuggestSupportHelper.prototype.suggestImages = function (word) {
|
||||||
|
return hub.searchImagesInRegistryHub(word, true).then(function (results) {
|
||||||
|
return results.map(function (image) {
|
||||||
|
var stars = '';
|
||||||
|
if (image.star_count > 0) {
|
||||||
|
stars = ' ' + image.star_count + ' ' + (image.star_count > 1 ? 'stars' : 'star');
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
label: image.name,
|
||||||
|
kind: vscode.CompletionItemKind.Value,
|
||||||
|
detail: hub.tagsForImage(image) + stars,
|
||||||
|
insertText: image.name,
|
||||||
|
documentation: image.description,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
SuggestSupportHelper.prototype.searchImageInRegistryHub = function (imageName) {
|
||||||
|
return hub.searchImageInRegistryHub(imageName, true).then(function (result) {
|
||||||
|
if (result) {
|
||||||
|
var r = [];
|
||||||
|
var tags = hub.tagsForImage(result);
|
||||||
|
// Name, tags and stars.
|
||||||
|
var nameString = '';
|
||||||
|
if (tags.length > 0) {
|
||||||
|
nameString = '**' + result.name + ' ' + tags + '** ';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nameString = '**' + result.name + '**';
|
||||||
|
}
|
||||||
|
if (result.star_count) {
|
||||||
|
var plural = (result.star_count > 1);
|
||||||
|
nameString += '**' + String(result.star_count) + (plural ? ' stars' : ' star') + '**';
|
||||||
|
}
|
||||||
|
r.push(nameString);
|
||||||
|
// Description
|
||||||
|
r.push(result.description);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
SuggestSupportHelper.prototype.getImageNameHover = function (line, _parser, tokens, tokenIndex) {
|
||||||
|
// -------------
|
||||||
|
// Detect <<image: [["something"]]>>
|
||||||
|
// Detect <<image: [[something]]>>
|
||||||
|
var originalValue = _parser.tokenValue(line, tokens[tokenIndex]);
|
||||||
|
var keyToken = null;
|
||||||
|
tokenIndex--;
|
||||||
|
while (tokenIndex >= 0) {
|
||||||
|
var type = tokens[tokenIndex].type;
|
||||||
|
if (type === parser.TokenType.String || type === parser.TokenType.Text) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (type === parser.TokenType.Key) {
|
||||||
|
keyToken = _parser.tokenValue(line, tokens[tokenIndex]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tokenIndex--;
|
||||||
|
}
|
||||||
|
if (!keyToken) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var keyName = _parser.keyNameFromKeyToken(keyToken);
|
||||||
|
if (keyName === 'image' || keyName === 'FROM') {
|
||||||
|
var imageName = originalValue.replace(/^"/, '').replace(/"$/, '');
|
||||||
|
return this.searchImageInRegistryHub(imageName).then(function (results) {
|
||||||
|
if (results[0] && results[1]) {
|
||||||
|
return ['**DockerHub:**', results[0], '**DockerRuntime**', results[1]];
|
||||||
|
}
|
||||||
|
if (results[0]) {
|
||||||
|
return results[0];
|
||||||
|
}
|
||||||
|
return results[1];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return SuggestSupportHelper;
|
||||||
|
}());
|
||||||
|
exports.SuggestSupportHelper = SuggestSupportHelper;
|
||||||
|
//# sourceMappingURL=suggestSupportHelper.js.map
|
40
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/out/parser.js
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*---------------------------------------------------------
|
||||||
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*--------------------------------------------------------*/
|
||||||
|
'use strict';
|
||||||
|
var Parser = (function () {
|
||||||
|
function Parser(parseTokenRegex) {
|
||||||
|
this._tokenParseRegex = parseTokenRegex;
|
||||||
|
}
|
||||||
|
Parser.prototype.keyNameFromKeyToken = function (keyToken) {
|
||||||
|
return keyToken.replace(this._tokenParseRegex, '');
|
||||||
|
};
|
||||||
|
Parser.prototype.tokenValue = function (line, token) {
|
||||||
|
return line.substring(token.startIndex, token.endIndex);
|
||||||
|
};
|
||||||
|
Parser.prototype.tokensAtColumn = function (tokens, charIndex) {
|
||||||
|
for (var i = 0, len = tokens.length; i < len; i++) {
|
||||||
|
var token = tokens[i];
|
||||||
|
if (token.endIndex < charIndex) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (token.endIndex === charIndex && i + 1 < len) {
|
||||||
|
return [i, i + 1];
|
||||||
|
}
|
||||||
|
return [i];
|
||||||
|
}
|
||||||
|
// should not happen: no token found? => return the last one
|
||||||
|
return [tokens.length - 1];
|
||||||
|
};
|
||||||
|
return Parser;
|
||||||
|
}());
|
||||||
|
exports.Parser = Parser;
|
||||||
|
(function (TokenType) {
|
||||||
|
TokenType[TokenType["Whitespace"] = 0] = "Whitespace";
|
||||||
|
TokenType[TokenType["Text"] = 1] = "Text";
|
||||||
|
TokenType[TokenType["String"] = 2] = "String";
|
||||||
|
TokenType[TokenType["Comment"] = 3] = "Comment";
|
||||||
|
TokenType[TokenType["Key"] = 4] = "Key";
|
||||||
|
})(exports.TokenType || (exports.TokenType = {}));
|
||||||
|
var TokenType = exports.TokenType;
|
||||||
|
//# sourceMappingURL=parser.js.map
|
70
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/package.json
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
"name": "vscode-docker",
|
||||||
|
"version": "0.0.6",
|
||||||
|
"publisher": "PeterJausovec",
|
||||||
|
"displayName": "Dockerfile and Docker Compose File (yml) Support",
|
||||||
|
"description": "Adds syntax highlighting, snippets and description on hover for Dockerfiles and Docker compose files.",
|
||||||
|
"license": "SEE LICENSE IN LICENSE.md",
|
||||||
|
"icon": "images/docker_icon.svg",
|
||||||
|
"galleryBanner": {
|
||||||
|
"color": "#5c2d91",
|
||||||
|
"theme": "dark"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Microsoft/vscode-docker/blob/master/README.md",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Microsoft/vscode-docker/issues"
|
||||||
|
},
|
||||||
|
"categories": [
|
||||||
|
"Languages"
|
||||||
|
],
|
||||||
|
"private": true,
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Microsoft/vscode-docker.git"
|
||||||
|
},
|
||||||
|
"activationEvents": [
|
||||||
|
"onLanguage:dockerfile",
|
||||||
|
"onLanguage:yaml"
|
||||||
|
],
|
||||||
|
"main": "./out/dockerExtension",
|
||||||
|
"contributes": {
|
||||||
|
"snippets": [
|
||||||
|
{
|
||||||
|
"language": "dockerfile",
|
||||||
|
"path": "./snippets/dockerfile.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"languages": [
|
||||||
|
{
|
||||||
|
"id": "dockerfile",
|
||||||
|
"aliases": [
|
||||||
|
"Dockerfile"
|
||||||
|
],
|
||||||
|
"filenamePatterns": [
|
||||||
|
"dockerfile*.*",
|
||||||
|
"Dockerfile*.*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^0.10.8"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"vscode:prepublish": "tsc",
|
||||||
|
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||||
|
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./"
|
||||||
|
},
|
||||||
|
"extensionDependencies": [
|
||||||
|
"vscode.docker",
|
||||||
|
"vscode.yaml"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"vscode": "0.11.x"
|
||||||
|
},
|
||||||
|
"__metadata": {
|
||||||
|
"id": "0479fc1c-3d67-49f9-b087-fb9069afe48f",
|
||||||
|
"publisherId": "bc3f1075-3ced-4395-9b1b-3f0ecaee83be",
|
||||||
|
"publisherDisplayName": "Microsoft"
|
||||||
|
}
|
||||||
|
}
|
114
.vscode/extensions/PeterJausovec.vscode-docker-0.0.6/snippets/dockerfile.json
vendored
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
{
|
||||||
|
"FROM": {
|
||||||
|
"prefix": "FROM",
|
||||||
|
"body": [
|
||||||
|
"FROM ${baseImage}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "FROM"
|
||||||
|
},
|
||||||
|
"MAINTAINER": {
|
||||||
|
"prefix": "MAINTAINER",
|
||||||
|
"body": [
|
||||||
|
"MAINTAINER ${name}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "MAINTAINER"
|
||||||
|
},
|
||||||
|
"RUN": {
|
||||||
|
"prefix": "RUN",
|
||||||
|
"body": [
|
||||||
|
"RUN ${cmd}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "RUN"
|
||||||
|
},
|
||||||
|
"CMD": {
|
||||||
|
"prefix": "CMD",
|
||||||
|
"body": [
|
||||||
|
"CMD ${command}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "CMD"
|
||||||
|
},
|
||||||
|
"LABEL": {
|
||||||
|
"prefix": "LABEL",
|
||||||
|
"body": [
|
||||||
|
"LABEL ${key}=${value}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "LABEL"
|
||||||
|
},
|
||||||
|
"EXPOSE": {
|
||||||
|
"prefix": "EXPOSE",
|
||||||
|
"body": [
|
||||||
|
"EXPOSE ${port}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "EXPOSE"
|
||||||
|
},
|
||||||
|
"ENV": {
|
||||||
|
"prefix": "ENV",
|
||||||
|
"body": [
|
||||||
|
"ENV ${key}=${value}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "ENV"
|
||||||
|
},
|
||||||
|
"ADD": {
|
||||||
|
"prefix": "ADD",
|
||||||
|
"body": [
|
||||||
|
"ADD ${source} ${dest}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "ADD"
|
||||||
|
},
|
||||||
|
"COPY": {
|
||||||
|
"prefix": "COPY",
|
||||||
|
"body": [
|
||||||
|
"COPY ${source} ${dest}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "COPY"
|
||||||
|
},
|
||||||
|
"ENTRYPOINT": {
|
||||||
|
"prefix": "ENTRYPOINT",
|
||||||
|
"body": [
|
||||||
|
"ENTRYPOINT ${command}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "ENTRYPOINT"
|
||||||
|
},
|
||||||
|
"VOLUME": {
|
||||||
|
"prefix": "VOLUME",
|
||||||
|
"body": [
|
||||||
|
"VOLUME ${name}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "VOLUME"
|
||||||
|
},
|
||||||
|
"USER": {
|
||||||
|
"prefix": "USER",
|
||||||
|
"body": [
|
||||||
|
"USER ${daemon}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "USER"
|
||||||
|
},
|
||||||
|
"WORKDIR": {
|
||||||
|
"prefix": "WORKDIR",
|
||||||
|
"body": [
|
||||||
|
"WORKDIR ${path}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "WORKDIR"
|
||||||
|
},
|
||||||
|
"ONBUILD": {
|
||||||
|
"prefix": "ONBUILD",
|
||||||
|
"body": [
|
||||||
|
"ONBUILD ${instruction}",
|
||||||
|
"$0"
|
||||||
|
],
|
||||||
|
"description": "ONBUILD"
|
||||||
|
}
|
||||||
|
}
|
32
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/.vsixmanifest
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||||
|
<Metadata>
|
||||||
|
<Identity Language="en-US" Id="path-intellisense" Version="1.0.2" Publisher="christian-kohler"/>
|
||||||
|
<DisplayName>Path Intellisense</DisplayName>
|
||||||
|
<Description xml:space="preserve">Visual Studio Code plugin that autocompletes filenames</Description>
|
||||||
|
<Tags></Tags>
|
||||||
|
<Categories>Other</Categories>
|
||||||
|
<GalleryFlags>Public</GalleryFlags>
|
||||||
|
<Properties>
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/ChristianKohler/PathIntellisense.git" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/ChristianKohler/PathIntellisense.git" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Repository" Value="https://github.com/ChristianKohler/PathIntellisense.git" />
|
||||||
|
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="https://github.com/ChristianKohler/PathIntellisense" />
|
||||||
|
|
||||||
|
|
||||||
|
</Properties>
|
||||||
|
<License>extension/LICENSE.txt</License>
|
||||||
|
<Icon>extension/icon/path-intellisense.png</Icon>
|
||||||
|
</Metadata>
|
||||||
|
<Installation>
|
||||||
|
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
|
||||||
|
</Installation>
|
||||||
|
<Dependencies/>
|
||||||
|
<Assets>
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/icon/path-intellisense.png" Addressable="true" />
|
||||||
|
</Assets>
|
||||||
|
</PackageManifest>
|
21
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/LICENSE.txt
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Christian Kohler
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
39
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/README.md
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Path Intellisense
|
||||||
|
Visual Studio Code plugin that autocompletes filenames.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
In the command palette (cmd-shift-p) select Install Extension and choose Path Intellisense.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
![IDE](http://i.giphy.com/iaHeUiDeTUZuo.gif)
|
||||||
|
|
||||||
|
## Node packages intellisense
|
||||||
|
Use [npm intellisense](https://marketplace.visualstudio.com/items?itemName=christian-kohler.npm-intellisense)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Something missing? Found a bug? - Create a pull request or an issue.
|
||||||
|
[Github](https://github.com/ChristianKohler/PathIntellisense)
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
### File extension in import statements
|
||||||
|
Path Intellisense removes the file extension by default if the statement is a import statement. To enable file extensions set the following setting to true:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"path-intellisense.extensionOnImport": true,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## History
|
||||||
|
* v1.0.2 - Fixed Bug #15 #16
|
||||||
|
* v1.0.1 - Fixed compatibility with VS Code 1.3
|
||||||
|
* v1.0.0 - Added .. on top of each suggestion, Removed trailing slash, bugs fixed
|
||||||
|
* v0.2.0 - Remove file extension within imports (configurable)
|
||||||
|
* v0.1.0 - Added slash after folders, group by folder and files, file icon
|
||||||
|
* v0.0.5 - Fixed windows path issue
|
||||||
|
* v0.0.3 - Fixed unknown publisher issue
|
||||||
|
* v0.0.2 - Updated Readme.md
|
||||||
|
* v0.0.1 - Initial
|
||||||
|
|
||||||
|
## License
|
||||||
|
This software is released under [MIT License](http://www.opensource.org/licenses/mit-license.php)
|
BIN
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/icon/path-intellisense.png
vendored
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/icon/path-intellisense.sketch
vendored
Normal file
12
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/out/src/FileInfo.js
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
"use strict";
|
||||||
|
var fs_1 = require('fs');
|
||||||
|
var path_1 = require('path');
|
||||||
|
var FileInfo = (function () {
|
||||||
|
function FileInfo(path, file) {
|
||||||
|
this.file = file;
|
||||||
|
this.isFile = fs_1.statSync(path_1.join(path, file)).isFile();
|
||||||
|
}
|
||||||
|
return FileInfo;
|
||||||
|
}());
|
||||||
|
exports.FileInfo = FileInfo;
|
||||||
|
//# sourceMappingURL=FileInfo.js.map
|
43
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/out/src/PathCompletionItem.js
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
"use strict";
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
var vscode_1 = require('vscode');
|
||||||
|
var vscode_2 = require('vscode');
|
||||||
|
var withExtension = vscode_2.workspace.getConfiguration('path-intellisense')['extensionOnImport'];
|
||||||
|
var PathCompletionItem = (function (_super) {
|
||||||
|
__extends(PathCompletionItem, _super);
|
||||||
|
function PathCompletionItem(fileInfo, isImport, documentExtension) {
|
||||||
|
_super.call(this, fileInfo.file);
|
||||||
|
this.kind = vscode_1.CompletionItemKind.File;
|
||||||
|
this.addGroupByFolderFile(fileInfo);
|
||||||
|
this.removeExtension(fileInfo, isImport, documentExtension);
|
||||||
|
this.addSlashForFolder(fileInfo);
|
||||||
|
}
|
||||||
|
PathCompletionItem.prototype.addGroupByFolderFile = function (fileInfo) {
|
||||||
|
this.sortText = (fileInfo.isFile ? 'b' : 'a') + "_" + fileInfo.file;
|
||||||
|
};
|
||||||
|
PathCompletionItem.prototype.addSlashForFolder = function (fileInfo) {
|
||||||
|
if (!fileInfo.isFile) {
|
||||||
|
this.label = fileInfo.file + "/";
|
||||||
|
this.insertText = fileInfo.file;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PathCompletionItem.prototype.removeExtension = function (fileInfo, isImport, documentExtension) {
|
||||||
|
if (!fileInfo.isFile || withExtension || !isImport) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var fragments = fileInfo.file.split('.');
|
||||||
|
var extension = fragments[fragments.length - 1];
|
||||||
|
if (extension !== documentExtension) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var index = fileInfo.file.lastIndexOf('.');
|
||||||
|
this.insertText = index != -1 ? fileInfo.file.substring(0, index) : fileInfo.file;
|
||||||
|
};
|
||||||
|
return PathCompletionItem;
|
||||||
|
}(vscode_1.CompletionItem));
|
||||||
|
exports.PathCompletionItem = PathCompletionItem;
|
||||||
|
//# sourceMappingURL=PathCompletionItem.js.map
|
39
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/out/src/PathIntellisense.js
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
"use strict";
|
||||||
|
var text_parser_1 = require('./text-parser');
|
||||||
|
var fs_functions_1 = require('./fs-functions');
|
||||||
|
var PathCompletionItem_1 = require('./PathCompletionItem');
|
||||||
|
var UpCompletionItem_1 = require('./UpCompletionItem');
|
||||||
|
var PathIntellisense = (function () {
|
||||||
|
function PathIntellisense(getChildrenOfPath) {
|
||||||
|
this.getChildrenOfPath = getChildrenOfPath;
|
||||||
|
}
|
||||||
|
PathIntellisense.prototype.provideCompletionItems = function (document, position) {
|
||||||
|
var line = document.getText(document.lineAt(position).range);
|
||||||
|
var isImport = text_parser_1.isImportOrRequire(line);
|
||||||
|
var documentExtension = fs_functions_1.extractExtension(document);
|
||||||
|
var textWithinString = text_parser_1.getTextWithinString(line, position.character);
|
||||||
|
var path = fs_functions_1.getPath(document.fileName, textWithinString);
|
||||||
|
if (this.shouldProvide(textWithinString, isImport)) {
|
||||||
|
return this.getChildrenOfPath(path).then(function (children) {
|
||||||
|
return [
|
||||||
|
new UpCompletionItem_1.UpCompletionItem()
|
||||||
|
].concat(children.map(function (child) { return new PathCompletionItem_1.PathCompletionItem(child, isImport, documentExtension); }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Promise.resolve([]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PathIntellisense.prototype.shouldProvide = function (textWithinString, isImport) {
|
||||||
|
if (!textWithinString || textWithinString.length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isImport && textWithinString[0] !== '.') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
return PathIntellisense;
|
||||||
|
}());
|
||||||
|
exports.PathIntellisense = PathIntellisense;
|
||||||
|
//# sourceMappingURL=PathIntellisense.js.map
|
17
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/out/src/UpCompletionItem.js
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
"use strict";
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
var vscode_1 = require('vscode');
|
||||||
|
var UpCompletionItem = (function (_super) {
|
||||||
|
__extends(UpCompletionItem, _super);
|
||||||
|
function UpCompletionItem() {
|
||||||
|
_super.call(this, '..');
|
||||||
|
this.kind = vscode_1.CompletionItemKind.File;
|
||||||
|
}
|
||||||
|
return UpCompletionItem;
|
||||||
|
}(vscode_1.CompletionItem));
|
||||||
|
exports.UpCompletionItem = UpCompletionItem;
|
||||||
|
//# sourceMappingURL=UpCompletionItem.js.map
|
14
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/out/src/extension.js
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
'use strict';
|
||||||
|
var vscode_1 = require('vscode');
|
||||||
|
var PathIntellisense_1 = require('./PathIntellisense');
|
||||||
|
var fs_functions_1 = require('./fs-functions');
|
||||||
|
function activate(context) {
|
||||||
|
var provider = new PathIntellisense_1.PathIntellisense(fs_functions_1.getChildrenOfPath);
|
||||||
|
var triggers = ['/', '"', '\''];
|
||||||
|
context.subscriptions.push(vscode_1.languages.registerCompletionItemProvider.apply(vscode_1.languages, ['*', provider].concat(triggers)));
|
||||||
|
}
|
||||||
|
exports.activate = activate;
|
||||||
|
function deactivate() {
|
||||||
|
}
|
||||||
|
exports.deactivate = deactivate;
|
||||||
|
//# sourceMappingURL=extension.js.map
|
50
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/out/src/fs-functions.js
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
"use strict";
|
||||||
|
var fs_1 = require('fs');
|
||||||
|
var path_1 = require('path');
|
||||||
|
var FileInfo_1 = require('./FileInfo');
|
||||||
|
function getChildrenOfPath(path) {
|
||||||
|
return readdirPromise(path)
|
||||||
|
.then(function (files) { return files.filter(notHidden).map(function (f) { return new FileInfo_1.FileInfo(path, f); }); })
|
||||||
|
.catch(function () { return []; });
|
||||||
|
}
|
||||||
|
exports.getChildrenOfPath = getChildrenOfPath;
|
||||||
|
function getPath(fileName, text) {
|
||||||
|
console.log(fileName);
|
||||||
|
console.log(text);
|
||||||
|
console.log(path_1.normalize(text));
|
||||||
|
console.log(fileName.substring(0, fileName.lastIndexOf(path_1.sep)));
|
||||||
|
console.log(text.substring(0, text.lastIndexOf(path_1.sep)));
|
||||||
|
console.log(path_1.normalize(text).substring(0, path_1.normalize(text).lastIndexOf(path_1.sep)));
|
||||||
|
console.log('====');
|
||||||
|
return path_1.resolve(fileName.substring(0, fileName.lastIndexOf(path_1.sep)), path_1.normalize(text).substring(0, path_1.normalize(text).lastIndexOf(path_1.sep)));
|
||||||
|
;
|
||||||
|
}
|
||||||
|
exports.getPath = getPath;
|
||||||
|
function extractExtension(document) {
|
||||||
|
if (document.isUntitled) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
var fragments = document.fileName.split('.');
|
||||||
|
var extension = fragments[fragments.length - 1];
|
||||||
|
if (!extension || extension.length > 3) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return extension;
|
||||||
|
}
|
||||||
|
exports.extractExtension = extractExtension;
|
||||||
|
function readdirPromise(path) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
fs_1.readdir(path, function (error, files) {
|
||||||
|
if (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(files);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function notHidden(filename) {
|
||||||
|
return filename[0] !== '.';
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=fs-functions.js.map
|
20
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/out/src/text-parser.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
"use strict";
|
||||||
|
function isInString(text, character) {
|
||||||
|
var inSingleQuoationString = (text.substring(0, character).match(/\'/g) || []).length % 2 === 1;
|
||||||
|
var inDoubleQuoationString = (text.substring(0, character).match(/\"/g) || []).length % 2 === 1;
|
||||||
|
return inSingleQuoationString || inDoubleQuoationString;
|
||||||
|
}
|
||||||
|
exports.isInString = isInString;
|
||||||
|
function isImportOrRequire(text) {
|
||||||
|
var isImport = text.substring(0, 6) === 'import';
|
||||||
|
var isRequire = text.indexOf('require(') != -1;
|
||||||
|
return isImport || isRequire;
|
||||||
|
}
|
||||||
|
exports.isImportOrRequire = isImportOrRequire;
|
||||||
|
function getTextWithinString(text, position) {
|
||||||
|
var textToPosition = text.substring(0, position);
|
||||||
|
var quoatationPosition = Math.max(textToPosition.lastIndexOf('\"'), textToPosition.lastIndexOf('\''));
|
||||||
|
return quoatationPosition != -1 ? textToPosition.substring(quoatationPosition + 1, textToPosition.length) : undefined;
|
||||||
|
}
|
||||||
|
exports.getTextWithinString = getTextWithinString;
|
||||||
|
//# sourceMappingURL=text-parser.js.map
|
50
.vscode/extensions/christian-kohler.path-intellisense-1.0.2/package.json
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"name": "path-intellisense",
|
||||||
|
"displayName": "Path Intellisense",
|
||||||
|
"description": "Visual Studio Code plugin that autocompletes filenames",
|
||||||
|
"version": "1.0.2",
|
||||||
|
"publisher": "christian-kohler",
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.0.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/ChristianKohler/PathIntellisense",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ChristianKohler/PathIntellisense.git"
|
||||||
|
},
|
||||||
|
"categories": [
|
||||||
|
"Other"
|
||||||
|
],
|
||||||
|
"activationEvents": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"contributes": {
|
||||||
|
"configuration": {
|
||||||
|
"type": "object",
|
||||||
|
"title": "path-intellisense",
|
||||||
|
"properties": {
|
||||||
|
"path-intellisense.extensionOnImport": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"description": "Adds the file extension to a import statements"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "./out/src/extension",
|
||||||
|
"icon": "icon/path-intellisense.png",
|
||||||
|
"scripts": {
|
||||||
|
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
|
||||||
|
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
|
||||||
|
"postinstall": "node ./node_modules/vscode/bin/install"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^1.8.5",
|
||||||
|
"vscode": "^0.11.0"
|
||||||
|
},
|
||||||
|
"__metadata": {
|
||||||
|
"id": "a41c1549-4053-44d4-bf30-60fc809b4a86",
|
||||||
|
"publisherId": "a892fb38-060b-475f-9e73-2e06a8a17a68",
|
||||||
|
"publisherDisplayName": "Christian Kohler"
|
||||||
|
}
|
||||||
|
}
|
32
.vscode/extensions/codezombiech.gitignore-0.2.0/.vsixmanifest
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||||
|
<Metadata>
|
||||||
|
<Identity Language="en-US" Id="gitignore" Version="0.2.0" Publisher="codezombiech"/>
|
||||||
|
<DisplayName>gitignore</DisplayName>
|
||||||
|
<Description xml:space="preserve">Language support for .gitignore files. Lets you pull .gitignore files from the https://github.com/github/gitignore repository.</Description>
|
||||||
|
<Tags>vscode</Tags>
|
||||||
|
<Categories>Languages,Other</Categories>
|
||||||
|
<GalleryFlags>Public</GalleryFlags>
|
||||||
|
<Properties>
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/CodeZombieCH/vscode-gitignore" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/CodeZombieCH/vscode-gitignore" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Repository" Value="https://github.com/CodeZombieCH/vscode-gitignore" />
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/CodeZombieCH/vscode-gitignore/issues" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Properties>
|
||||||
|
<License>extension/LICENSE.txt</License>
|
||||||
|
<Icon>extension/icon.png</Icon>
|
||||||
|
</Metadata>
|
||||||
|
<Installation>
|
||||||
|
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
|
||||||
|
</Installation>
|
||||||
|
<Dependencies/>
|
||||||
|
<Assets>
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/icon.png" Addressable="true" />
|
||||||
|
</Assets>
|
||||||
|
</PackageManifest>
|
31
.vscode/extensions/codezombiech.gitignore-0.2.0/CHANGELOG.md
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## v0.1.0
|
||||||
|
|
||||||
|
Basic implementation that allows pulling a single `.gitignore` file
|
||||||
|
|
||||||
|
|
||||||
|
## v0.1.2
|
||||||
|
|
||||||
|
- Fixed unhandled error in the case no workspace is open
|
||||||
|
|
||||||
|
|
||||||
|
## v0.1.3
|
||||||
|
|
||||||
|
- Added icon
|
||||||
|
|
||||||
|
|
||||||
|
## v0.1.4
|
||||||
|
|
||||||
|
- Fixed url to github repository
|
||||||
|
- Added url to github issues
|
||||||
|
- Exposed a setting named "gitignore.cacheExpirationInterval" that controls how long the `.gitignore` files retrieved from the github repository are stored in cache. Defaults to 3600 seconds.
|
||||||
|
- Fixed cancellation of the `Add gitignore` command not beeing handled correctly
|
||||||
|
|
||||||
|
## v0.1.5
|
||||||
|
|
||||||
|
- Properly declared the exposed settings in the package.json. This way the user gets support from Visual Studio Code when authoring the settings files.
|
||||||
|
|
||||||
|
## v0.2.0
|
||||||
|
|
||||||
|
- Added language support for `.gitignore` files
|
21
.vscode/extensions/codezombiech.gitignore-0.2.0/LICENSE.txt
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Marc-André Bühler
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
51
.vscode/extensions/codezombiech.gitignore-0.2.0/README.md
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# gitignore extension for Visual Studio Code
|
||||||
|
|
||||||
|
A extension for Visual Studio Code that assists you in working with `.gitignore` files.
|
||||||
|
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Language support for `.gitignore` files
|
||||||
|
- Add local `.gitignore` by pulling file from the the [github/gitignore](https://github.com/github/gitignore) repository.
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Start command palette (with <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> or <kbd>F1</kbd>) and start typing `Add gitignore`
|
||||||
|
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
```JavaScript
|
||||||
|
{
|
||||||
|
// Number of seconds the list of `.gitignore` files retrieved from github will be cached
|
||||||
|
"gitignore.cacheExpirationInterval": 3600
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Roadmap
|
||||||
|
|
||||||
|
### v0.1
|
||||||
|
Basic implementation that allows to pull a single `.gitignore` file
|
||||||
|
|
||||||
|
### v0.2
|
||||||
|
Add language support for `.gitignore` files
|
||||||
|
|
||||||
|
### v0.3
|
||||||
|
Support adding multiple .gitignore files and merge it to a `.gitignore` file
|
||||||
|
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
See CHANGELOG.md
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
See LICENSE file
|
||||||
|
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
Icon based on the Git logo by Jason Long
|
6
.vscode/extensions/codezombiech.gitignore-0.2.0/gitignore.configuration.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"comments": {
|
||||||
|
// symbol used for single line comment. Remove this entry if your language does not support line comments
|
||||||
|
"lineComment": "#"
|
||||||
|
}
|
||||||
|
}
|
BIN
.vscode/extensions/codezombiech.gitignore-0.2.0/icon.png
vendored
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
.vscode/extensions/codezombiech.gitignore-0.2.0/icon/icon.png
vendored
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
.vscode/extensions/codezombiech.gitignore-0.2.0/icon/icon.xcf
vendored
Normal file
5
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.settings.xml
|
||||||
|
.settings
|
||||||
|
.c9revisions
|
||||||
|
doc/
|
||||||
|
node_modules/
|
21
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2012 Cloud9 IDE, Inc. (Mike de Boer)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
173
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/README.md
generated
vendored
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
# JavaScript GitHub API for Node.JS
|
||||||
|
|
||||||
|
A Node.JS module, which provides an object oriented wrapper for the GitHub v3 API.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install with the Node.JS package manager [npm](http://npmjs.org/) ![NPM version](https://badge.fury.io/js/github.svg):
|
||||||
|
|
||||||
|
$ npm install github
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
Install via git clone:
|
||||||
|
|
||||||
|
$ git clone git://github.com/mikedeboer/node-github.git
|
||||||
|
$ cd node-github
|
||||||
|
$ npm install
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
You can find the docs for the API of this client at [http://mikedeboer.github.com/node-github/](http://mikedeboer.github.com/node-github/)
|
||||||
|
|
||||||
|
Additionally, the [official Github documentation](https://developer.github.com/v3/)
|
||||||
|
is a very useful resource.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Print all followers of the user "mikedeboer" to the console.
|
||||||
|
```javascript
|
||||||
|
var GitHubApi = require("github");
|
||||||
|
|
||||||
|
var github = new GitHubApi({
|
||||||
|
// required
|
||||||
|
version: "3.0.0",
|
||||||
|
// optional
|
||||||
|
debug: true,
|
||||||
|
protocol: "https",
|
||||||
|
host: "github.my-GHE-enabled-company.com", // should be api.github.com for GitHub
|
||||||
|
pathPrefix: "/api/v3", // for some GHEs; none for GitHub
|
||||||
|
timeout: 5000,
|
||||||
|
headers: {
|
||||||
|
"user-agent": "My-Cool-GitHub-App" // GitHub is happy with a unique user agent
|
||||||
|
}
|
||||||
|
});
|
||||||
|
github.user.getFollowingFromUser({
|
||||||
|
// optional:
|
||||||
|
// headers: {
|
||||||
|
// "cookie": "blahblah"
|
||||||
|
// },
|
||||||
|
user: "mikedeboer"
|
||||||
|
}, function(err, res) {
|
||||||
|
console.log(JSON.stringify(res));
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
First the _GitHubApi_ class is imported from the _node-github_ module. This class provides
|
||||||
|
access to all of GitHub's APIs (e.g. user, issues or repo APIs). The _getFollowingFromUser_
|
||||||
|
method lists all followers of a given GitHub user. Is is part of the user API. It
|
||||||
|
takes the user name as first argument and a callback as last argument. Once the
|
||||||
|
follower list is returned from the server, the callback is called.
|
||||||
|
|
||||||
|
Like in Node.JS, callbacks are always the last argument. If the functions fails an
|
||||||
|
error object is passed as first argument to the callback.
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
Most GitHub API calls don't require authentication. As a rule of thumb: If you
|
||||||
|
can see the information by visiting the site without being logged in, you don't
|
||||||
|
have to be authenticated to retrieve the same information through the API. Of
|
||||||
|
course calls, which change data or read sensitive information have to be authenticated.
|
||||||
|
|
||||||
|
You need the GitHub user name and the API key for authentication. The API key can
|
||||||
|
be found in the user's _Account Settings_ page.
|
||||||
|
|
||||||
|
This example shows how to authenticate and then change _location_ field of the
|
||||||
|
account settings to _Argentina_:
|
||||||
|
```javascript
|
||||||
|
github.authenticate({
|
||||||
|
type: "basic",
|
||||||
|
username: username,
|
||||||
|
password: password
|
||||||
|
});
|
||||||
|
github.user.update({
|
||||||
|
location: "Argentina"
|
||||||
|
}, function(err) {
|
||||||
|
console.log("done!");
|
||||||
|
});
|
||||||
|
```
|
||||||
|
Note that the _authenticate_ method is synchronous because it only stores the
|
||||||
|
credentials for the next request.
|
||||||
|
|
||||||
|
Other examples for the various authentication methods:
|
||||||
|
```javascript
|
||||||
|
// OAuth2
|
||||||
|
github.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
|
||||||
|
// OAuth2 Key/Secret
|
||||||
|
github.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
key: "clientID",
|
||||||
|
secret: "clientSecret"
|
||||||
|
})
|
||||||
|
|
||||||
|
// Deprecated Gihub API token (seems not to be working with the v3 API)
|
||||||
|
github.authenticate({
|
||||||
|
type: "token",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating tokens for your application
|
||||||
|
[Create a new authorization](http://developer.github.com/v3/oauth/#create-a-new-authorization) for your application giving it access to the wanted scopes you need instead of relying on username / password and is the way to go if you have [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) on.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
1. Use github.authenticate() to auth with GitHub using your username / password
|
||||||
|
2. Create an application token programmatically with the scopes you need and, if you use two-factor authentication send the `X-GitHub-OTP` header with the one-time-password you get on your token device.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
github.authorization.create({
|
||||||
|
scopes: ["user", "public_repo", "repo", "repo:status", "gist"],
|
||||||
|
note: "what this auth is for",
|
||||||
|
note_url: "http://url-to-this-auth-app",
|
||||||
|
headers: {
|
||||||
|
"X-GitHub-OTP": "two-factor-code"
|
||||||
|
}
|
||||||
|
}, function(err, res) {
|
||||||
|
if (res.token) {
|
||||||
|
//save and use res.token as in the Oauth process above from now on
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implemented GitHub APIs
|
||||||
|
|
||||||
|
* Gists: 100%
|
||||||
|
* Git Data: 100%
|
||||||
|
* Issues: 100%
|
||||||
|
* Orgs: 100%
|
||||||
|
* Pull Requests: 100%
|
||||||
|
* Repos: 100%
|
||||||
|
* Users: 100%
|
||||||
|
* Events: 100%
|
||||||
|
* Search: 100%
|
||||||
|
* Markdown: 100%
|
||||||
|
* Rate Limit: 100%
|
||||||
|
* Releases: 100%
|
||||||
|
* Gitignore: 100%
|
||||||
|
* Meta: 100%
|
||||||
|
* Emojis: 100%
|
||||||
|
|
||||||
|
## Running the Tests
|
||||||
|
|
||||||
|
The unit tests are based on the [mocha](http://visionmedia.github.com/mocha/)
|
||||||
|
module, which may be installed via npm. To run the tests make sure that the
|
||||||
|
npm dependencies are installed by running `npm install` from the project directory.
|
||||||
|
|
||||||
|
Before running unit tests:
|
||||||
|
```shell
|
||||||
|
npm install mocha -g
|
||||||
|
```
|
||||||
|
At the moment, test classes can only be run separately. This will e.g. run the Issues Api test:
|
||||||
|
```shell
|
||||||
|
mocha api/v3.0.0/issuesTest.js
|
||||||
|
```
|
||||||
|
Note that a connection to the internet is required to run the tests.
|
||||||
|
|
||||||
|
## LICENSE
|
||||||
|
|
||||||
|
MIT license. See the LICENSE file for details.
|
3
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v2.0.0/routes.json
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
255
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/authorization.js
generated
vendored
Normal file
|
@ -0,0 +1,255 @@
|
||||||
|
/**
|
||||||
|
* mixin authorization
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var authorization = module.exports = {
|
||||||
|
authorization: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* authorization#getAll(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getAll = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* authorization#get(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.get = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* authorization#create(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - scopes (Array): Optional. A list of scopes that this authorization is in.
|
||||||
|
* - note (String): Optional. A note to remind you what the OAuth token is for.
|
||||||
|
* - note_url (String): Optional. A URL to remind you what app the OAuth token is for.
|
||||||
|
**/
|
||||||
|
this.create = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* authorization#update(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
* - scopes (Array): Optional. A list of scopes that this authorization is in.
|
||||||
|
* - add_scopes (Array): Optional. A list of scopes to add to this authorization.
|
||||||
|
* - remove_scopes (Array): Optional. A list of scopes to remove from this authorization.
|
||||||
|
* - note (String): Optional. A note to remind you what the OAuth token is for.
|
||||||
|
* - note_url (String): Optional. A URL to remind you what app the OAuth token is for.
|
||||||
|
**/
|
||||||
|
this.update = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* authorization#delete(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.delete = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(authorization.authorization);
|
258
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/authorizationTest.js
generated
vendored
Normal file
|
@ -0,0 +1,258 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[authorization]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
this.timeout(10000);
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "basic",
|
||||||
|
username: "mikedeboertest",
|
||||||
|
password: "test1324"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /authorizations (getAll)", function(next) {
|
||||||
|
client.authorization.create(
|
||||||
|
{
|
||||||
|
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"],
|
||||||
|
note: "Authorization created to unit tests auth",
|
||||||
|
note_url: "https://github.com/ajaxorg/node-github"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.authorization.getAll(
|
||||||
|
{
|
||||||
|
page: "1",
|
||||||
|
per_page: "100"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 1);
|
||||||
|
|
||||||
|
client.authorization["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.authorization.getAll(
|
||||||
|
{
|
||||||
|
page: "1",
|
||||||
|
per_page: "100"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 0);
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /authorizations/:id (get)", function(next) {
|
||||||
|
client.authorization.create(
|
||||||
|
{
|
||||||
|
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"],
|
||||||
|
note: "Authorization created to unit tests auth",
|
||||||
|
note_url: "https://github.com/ajaxorg/node-github"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.authorization.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.note, "Authorization created to unit tests auth");
|
||||||
|
Assert.equal(res.note_url, "https://github.com/ajaxorg/node-github");
|
||||||
|
|
||||||
|
client.authorization["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.authorization.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err.code, 404);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /authorizations (create)", function(next) {
|
||||||
|
client.authorization.create(
|
||||||
|
{
|
||||||
|
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"],
|
||||||
|
note: "Authorization created to unit tests auth",
|
||||||
|
note_url: "https://github.com/ajaxorg/node-github"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.authorization.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.note, "Authorization created to unit tests auth");
|
||||||
|
Assert.equal(res.note_url, "https://github.com/ajaxorg/node-github");
|
||||||
|
|
||||||
|
client.authorization["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.authorization.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err.code, 404);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /authorizations/:id (update)", function(next) {
|
||||||
|
client.authorization.create(
|
||||||
|
{
|
||||||
|
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"],
|
||||||
|
note: "Authorization created to unit tests auth",
|
||||||
|
note_url: "https://github.com/ajaxorg/node-github"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.authorization.update(
|
||||||
|
{
|
||||||
|
id: id,
|
||||||
|
remove_scopes: ["repo"],
|
||||||
|
note: "changed"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.authorization.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.ok(res.scopes.indexOf("repo") === -1);
|
||||||
|
Assert.equal(res.note, "changed");
|
||||||
|
Assert.equal(res.note_url, "https://github.com/ajaxorg/node-github");
|
||||||
|
|
||||||
|
client.authorization["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.authorization.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err.code, 404);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /authorizations/:id (delete)", function(next) {
|
||||||
|
client.authorization.create(
|
||||||
|
{
|
||||||
|
scopes: ["user", "public_repo", "repo", "repo:status", "delete_repo", "gist"],
|
||||||
|
note: "Authorization created to unit tests auth",
|
||||||
|
note_url: "https://github.com/ajaxorg/node-github"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.authorization["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.authorization.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err.code, 404);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
495
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/events.js
generated
vendored
Normal file
|
@ -0,0 +1,495 @@
|
||||||
|
/**
|
||||||
|
* mixin events
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var events = module.exports = {
|
||||||
|
events: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* events#get(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.get = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getFromRepo(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFromRepo = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getFromRepoIssues(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFromRepoIssues = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getFromRepoNetwork(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFromRepoNetwork = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getFromOrg(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - org (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFromOrg = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getReceived(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getReceived = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getReceivedPublic(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getReceivedPublic = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getFromUser(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFromUser = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getFromUserPublic(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFromUserPublic = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* events#getFromUserOrg(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - org (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFromUserOrg = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(events.events);
|
212
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/eventsTest.js
generated
vendored
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[events]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /events (get)", function(next) {
|
||||||
|
client.events.get(
|
||||||
|
{
|
||||||
|
page: 1,
|
||||||
|
per_page: 30
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
// other assertions go here
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.length > 1);
|
||||||
|
Assert.equal(typeof res[0].type, "string");
|
||||||
|
Assert.equal(typeof res[0].created_at, "string");
|
||||||
|
Assert.equal(typeof res[0]["public"], "boolean");
|
||||||
|
Assert.equal(typeof res[0].id, "string");
|
||||||
|
Assert.ok("actor" in res[0]);
|
||||||
|
Assert.ok("repo" in res[0]);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/events (getFromRepo)", function(next) {
|
||||||
|
client.events.getFromRepo(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 5);
|
||||||
|
// this is the lastly listed event
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(last.type, "ForkEvent");
|
||||||
|
Assert.equal(last.created_at, "2012-10-05T15:03:11Z");
|
||||||
|
Assert.equal(last.id, "1607304921");
|
||||||
|
Assert.equal(last["public"], true);
|
||||||
|
Assert.equal(last.actor.login, "mikedeboer");
|
||||||
|
Assert.equal(last.repo.name, "mikedeboertest/node_chat");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues/events (getFromRepoIssues)", function(next) {
|
||||||
|
client.events.getFromRepoIssues(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 4);
|
||||||
|
// this is the lastly listed event
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(last.event, "referenced");
|
||||||
|
Assert.equal(last.created_at, "2012-10-05T15:05:31Z");
|
||||||
|
Assert.equal(last.id, "26276344");
|
||||||
|
Assert.equal(last.actor.login, "mikedeboertest");
|
||||||
|
Assert.equal(last.issue.title, "Macaroni");
|
||||||
|
Assert.equal(last.issue.number, 1);
|
||||||
|
Assert.equal(last.issue.state, "closed");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /networks/:user/:repo/events (getFromRepoNetwork)", function(next) {
|
||||||
|
client.events.getFromRepoNetwork(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.length > 1);
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(typeof last.id, "string");
|
||||||
|
Assert.equal(typeof last.created_at, "string");
|
||||||
|
Assert.equal(typeof last.actor, "object");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /orgs/:org/events (getFromOrg)", function(next) {
|
||||||
|
client.events.getFromOrg(
|
||||||
|
{
|
||||||
|
org: "ajaxorg"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.length > 1);
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(typeof last.id, "string");
|
||||||
|
Assert.equal(typeof last.created_at, "string");
|
||||||
|
Assert.equal(typeof last.actor, "object");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/received_events (getReceived)", function(next) {
|
||||||
|
client.events.getReceived(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.length > 0);
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(typeof last.id, "string");
|
||||||
|
Assert.equal(typeof last.created_at, "string");
|
||||||
|
Assert.equal(typeof last.actor, "object");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/received_events/public (getReceivedPublic)", function(next) {
|
||||||
|
client.events.getReceivedPublic(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.length > 0);
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(typeof last.id, "string");
|
||||||
|
Assert.equal(typeof last.created_at, "string");
|
||||||
|
Assert.equal(typeof last.actor, "object");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/events (getFromUser)", function(next) {
|
||||||
|
client.events.getFromUser(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.length > 1);
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(typeof last.id, "string");
|
||||||
|
Assert.equal(typeof last.created_at, "string");
|
||||||
|
Assert.equal(typeof last.actor, "object");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/events/public (getFromUserPublic)", function(next) {
|
||||||
|
client.events.getFromUserPublic(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.length > 1);
|
||||||
|
var last = res.pop();
|
||||||
|
Assert.equal(typeof last.id, "string");
|
||||||
|
Assert.equal(typeof last.created_at, "string");
|
||||||
|
Assert.equal(typeof last.actor, "object");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/events/orgs/:org (getFromUserOrg)", function(next) {
|
||||||
|
client.events.getFromUserOrg(
|
||||||
|
{
|
||||||
|
user: "mikedeboer",
|
||||||
|
org: "ajaxorg"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
// we're not logged in as `mikedeboer` right now, so github API does not allow
|
||||||
|
// us to see the resource.
|
||||||
|
Assert.equal(err.code, 404);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
801
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/gists.js
generated
vendored
Normal file
|
@ -0,0 +1,801 @@
|
||||||
|
/**
|
||||||
|
* mixin gists
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var gists = module.exports = {
|
||||||
|
gists: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* gists#getAll(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||||||
|
**/
|
||||||
|
this.getAll = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#getFromUser(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||||||
|
**/
|
||||||
|
this.getFromUser = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#create(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - description (String): Optional.
|
||||||
|
* - public (Boolean): Required.
|
||||||
|
* - files (Json): Required. Files that make up this gist. The key of which should be a required string filename and the value another required hash with parameters: 'content'
|
||||||
|
**/
|
||||||
|
this.create = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#edit(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
* - description (String): Optional.
|
||||||
|
* - files (Json): Required. Files that make up this gist. The key of which should be a required string filename and the value another required hash with parameters: 'content'
|
||||||
|
**/
|
||||||
|
this.edit = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#public(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||||||
|
**/
|
||||||
|
this.public = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#starred(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||||||
|
**/
|
||||||
|
this.starred = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#get(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.get = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#star(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.star = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#deleteStar(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.deleteStar = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#checkStar(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.checkStar = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#fork(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.fork = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#delete(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.delete = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#getComments(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - gist_id (String): Required. Id (SHA1 hash) of the gist.
|
||||||
|
**/
|
||||||
|
this.getComments = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#getComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - gist_id (String): Required. Id (SHA1 hash) of the gist.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.getComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#createComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - gist_id (String): Required. Id (SHA1 hash) of the gist.
|
||||||
|
* - body (String): Required.
|
||||||
|
**/
|
||||||
|
this.createComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#editComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - gist_id (String): Required. Id (SHA1 hash) of the gist.
|
||||||
|
* - id (String): Required.
|
||||||
|
* - body (String): Required.
|
||||||
|
**/
|
||||||
|
this.editComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gists#deleteComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - gist_id (String): Required. Id (SHA1 hash) of the gist.
|
||||||
|
* - id (String): Required.
|
||||||
|
**/
|
||||||
|
this.deleteComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(gists.gists);
|
605
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/gistsTest.js
generated
vendored
Normal file
|
@ -0,0 +1,605 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[gists]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
timeout(5000);
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /gists (getAll)", function(next) {
|
||||||
|
client.gists.getAll(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 1);
|
||||||
|
var gist = res.pop();
|
||||||
|
Assert.equal(gist.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(gist.html_url, "https://gist.github.com/77dc15615eab09a79b61");
|
||||||
|
Assert.equal(gist.created_at, "2012-10-05T16:10:40Z");
|
||||||
|
Assert.equal(gist.public, false);
|
||||||
|
Assert.equal(gist.id, "77dc15615eab09a79b61");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/gists (getFromUser)", function(next) {
|
||||||
|
client.gists.getFromUser(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 1);
|
||||||
|
var gist = res.pop();
|
||||||
|
Assert.equal(gist.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(gist.html_url, "https://gist.github.com/77dc15615eab09a79b61");
|
||||||
|
Assert.equal(gist.created_at, "2012-10-05T16:10:40Z");
|
||||||
|
Assert.equal(gist.public, false);
|
||||||
|
Assert.equal(gist.id, "77dc15615eab09a79b61");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /gists (create)", function(next) {
|
||||||
|
client.gists.create(
|
||||||
|
{
|
||||||
|
description: "Another bowl of pasta",
|
||||||
|
public: "false",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"want some ketchup with that?\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(res.html_url, "https://gist.github.com/" + id);
|
||||||
|
Assert.equal(res.public, false);
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.description, "Another bowl of pasta");
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /gists/:id (edit)", function(next) {
|
||||||
|
client.gists.create(
|
||||||
|
{
|
||||||
|
description: "Another bowl of pasta",
|
||||||
|
public: "false",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"want some ketchup with that?\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.edit(
|
||||||
|
{
|
||||||
|
id: id,
|
||||||
|
description: "changed",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"no ketchup, please.\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.gists.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(res.html_url, "https://gist.github.com/" + id);
|
||||||
|
Assert.equal(res.public, false);
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.description, "changed");
|
||||||
|
Assert.equal(res.files["ravioli.js"].content, "alert(\"no ketchup, please.\");");
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
it("should successfully execute GET /gists/public (public)", function(next) {
|
||||||
|
client.gists.public(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
console.log(res);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
it("should successfully execute GET /gists/starred (starred)", function(next) {
|
||||||
|
client.gists.starred(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 1);
|
||||||
|
var gist = res.pop();
|
||||||
|
Assert.equal(gist.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(gist.html_url, "https://gist.github.com/77dc15615eab09a79b61");
|
||||||
|
Assert.equal(gist.created_at, "2012-10-05T16:10:40Z");
|
||||||
|
Assert.equal(gist.public, false);
|
||||||
|
Assert.equal(gist.id, "77dc15615eab09a79b61");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /gists/:id (get)", function(next) {
|
||||||
|
client.gists.create(
|
||||||
|
{
|
||||||
|
description: "Another bowl of pasta",
|
||||||
|
public: "false",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"want some ketchup with that?\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.get(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(res.html_url, "https://gist.github.com/" + id);
|
||||||
|
Assert.equal(res.public, false);
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.description, "Another bowl of pasta");
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PUT /gists/:id/star (star)", function(next) {
|
||||||
|
client.gists.create(
|
||||||
|
{
|
||||||
|
description: "Another bowl of pasta",
|
||||||
|
public: "false",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"want some ketchup with that?\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.star(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.gists.checkStar(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
//TODO: NO RESULT HERE???
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /gists/:id/star (deleteStar)", function(next) {
|
||||||
|
client.gists.create(
|
||||||
|
{
|
||||||
|
description: "Another bowl of pasta",
|
||||||
|
public: "false",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"want some ketchup with that?\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.star(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.gists.deleteStar(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /gists/:id/star (checkStar)", function(next) {
|
||||||
|
client.gists.create(
|
||||||
|
{
|
||||||
|
description: "Another bowl of pasta",
|
||||||
|
public: "false",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"want some ketchup with that?\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.star(
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /gists/:id/fork (fork)", function(next) {
|
||||||
|
client.gists.fork(
|
||||||
|
{
|
||||||
|
id: "3047099"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
Assert.equal(res.git_pull_url, "git://gist.github.com/" + id + ".git");
|
||||||
|
Assert.equal(res.git_push_url, "git@gist.github.com:" + id + ".git");
|
||||||
|
Assert.equal(res.description, "Why to call resume() after next()");
|
||||||
|
Assert.equal(typeof res.files["resume_after_next.md"], "object");
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /gists/:id (delete)", function(next) {
|
||||||
|
client.gists.create(
|
||||||
|
{
|
||||||
|
description: "Another bowl of pasta",
|
||||||
|
public: "false",
|
||||||
|
files: {
|
||||||
|
"ravioli.js": {
|
||||||
|
"content": "alert(\"want some ketchup with that?\");"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists["delete"](
|
||||||
|
{
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /gists/:gist_id/comments/:id (getComments)", function(next) {
|
||||||
|
client.gists.createComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
body: "This is a test comment.",
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.getComments(
|
||||||
|
{
|
||||||
|
gist_id: "3047099"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
var comment = res.pop();
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(comment.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(comment.id, id);
|
||||||
|
Assert.equal(comment.body, "This is a test comment.");
|
||||||
|
|
||||||
|
client.gists["deleteComment"](
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /gists/:gist_id/comments/:id (getComment)", function(next) {
|
||||||
|
client.gists.createComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
body: "This is a test comment.",
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.getComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.body, "This is a test comment.");
|
||||||
|
|
||||||
|
client.gists["deleteComment"](
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /gists/:gist_id/comments (createComment)", function(next) {
|
||||||
|
client.gists.createComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
body: "This is a test comment.",
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.getComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.body, "This is a test comment.");
|
||||||
|
|
||||||
|
client.gists["deleteComment"](
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /gists/:gist_id/comments/:id (editComment)", function(next) {
|
||||||
|
client.gists.createComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
body: "This is a test comment.",
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists.editComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id,
|
||||||
|
body: "This comment has been edited."
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
client.gists.getComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.user.login, "mikedeboertest");
|
||||||
|
Assert.equal(res.id, id);
|
||||||
|
Assert.equal(res.body, "This comment has been edited.");
|
||||||
|
|
||||||
|
client.gists["deleteComment"](
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /gists/:gist_id/comments/:id (deleteComment)", function(next) {
|
||||||
|
client.gists.createComment(
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
body: "This is a test comment.",
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var id = res.id;
|
||||||
|
|
||||||
|
client.gists["deleteComment"](
|
||||||
|
{
|
||||||
|
gist_id: "3047099",
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
650
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/gitdata.js
generated
vendored
Normal file
|
@ -0,0 +1,650 @@
|
||||||
|
/**
|
||||||
|
* mixin gitdata
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var gitdata = module.exports = {
|
||||||
|
gitdata: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* gitdata#getBlob(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - sha (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getBlob = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#createBlob(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - content (String): Required.
|
||||||
|
* - encoding (String): Required.
|
||||||
|
**/
|
||||||
|
this.createBlob = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#getCommit(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - sha (String): Required.
|
||||||
|
**/
|
||||||
|
this.getCommit = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#createCommit(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - message (String): Required. String of the commit message
|
||||||
|
* - tree (String): Required. String of the SHA of the tree object this commit points to
|
||||||
|
* - parents (Array): Required. Array of the SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided, for a merge commit, an array of more than one should be provided.
|
||||||
|
* - author (Json): Optional.
|
||||||
|
* - committer (Json): Optional.
|
||||||
|
**/
|
||||||
|
this.createCommit = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#getReference(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - ref (String): Required. String of the name of the fully qualified reference (ie: heads/master). If it doesn’t have at least one slash, it will be rejected.
|
||||||
|
**/
|
||||||
|
this.getReference = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#getAllReferences(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getAllReferences = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#createReference(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - ref (String): Required. String of the name of the fully qualified reference (ie: heads/master). If it doesn’t have at least one slash, it will be rejected.
|
||||||
|
* - sha (String): Required.
|
||||||
|
**/
|
||||||
|
this.createReference = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#updateReference(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - ref (String): Required. String of the name of the fully qualified reference (ie: heads/master). If it doesn’t have at least one slash, it will be rejected.
|
||||||
|
* - sha (String): Required.
|
||||||
|
* - force (Boolean): Optional. Boolean indicating whether to force the update or to make sure the update is a fast-forward update. The default is false, so leaving this out or setting it to false will make sure you’re not overwriting work.
|
||||||
|
**/
|
||||||
|
this.updateReference = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#deleteReference(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - ref (String): Required. String of the name of the fully qualified reference (ie: heads/master). If it doesn’t have at least one slash, it will be rejected.
|
||||||
|
**/
|
||||||
|
this.deleteReference = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#getTag(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - sha (String): Required.
|
||||||
|
**/
|
||||||
|
this.getTag = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#createTag(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - tag (String): Required. String of the tag
|
||||||
|
* - message (String): Required. String of the tag message
|
||||||
|
* - object (String): Required. String of the SHA of the git object this is tagging
|
||||||
|
* - type (String): Required. String of the type of the object we’re tagging. Normally this is a commit but it can also be a tree or a blob.
|
||||||
|
* - tagger (Json): Required. JSON object that contains the following keys: `name` - String of the name of the author of the tag, `email` - String of the email of the author of the tag, `date` - Timestamp of when this object was tagged
|
||||||
|
**/
|
||||||
|
this.createTag = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#getTree(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - sha (String): Required.
|
||||||
|
* - recursive (Boolean): Optional.
|
||||||
|
**/
|
||||||
|
this.getTree = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitdata#createTree(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - tree (Json): Required. Array of Hash objects (of path, mode, type and sha) specifying a tree structure
|
||||||
|
* - base_tree (String): Optional. String of the SHA1 of the tree you want to update with new data
|
||||||
|
**/
|
||||||
|
this.createTree = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(gitdata.gitdata);
|
480
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/gitdataTest.js
generated
vendored
Normal file
|
@ -0,0 +1,480 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[gitdata]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/git/blobs/:sha (getBlob)", function(next) {
|
||||||
|
// found an object after executing:
|
||||||
|
// git rev-list --all | xargs -l1 git diff-tree -r -c -M -C --no-commit-id | awk '{print $3}'
|
||||||
|
client.gitdata.getBlob(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: "8433b682c95edf3fd81f5ee217dc9c874db35e4b"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.sha, "8433b682c95edf3fd81f5ee217dc9c874db35e4b");
|
||||||
|
Assert.equal(res.size, 2654);
|
||||||
|
Assert.equal(res.encoding, "base64");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/git/blobs (createBlob)", function(next) {
|
||||||
|
client.gitdata.createBlob(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
content: "test",
|
||||||
|
encoding: "utf-8"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(typeof res.sha, "string");
|
||||||
|
var sha = res.sha;
|
||||||
|
|
||||||
|
client.gitdata.getBlob(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: sha
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.sha, sha);
|
||||||
|
Assert.equal(res.size, 4);
|
||||||
|
Assert.equal(res.encoding, "base64");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/git/commits/:sha (getCommit)", function(next) {
|
||||||
|
client.gitdata.getCommit(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: "17e0734295ffd8174f91f04ba8e8f8e51954b793"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.author.date, "2012-10-05T08:05:31-07:00");
|
||||||
|
Assert.equal(res.author.name, "Mike de Boer");
|
||||||
|
Assert.equal(res.parents[0].sha, "221140b288a3c64949594c58420cb4ab289b0756");
|
||||||
|
Assert.equal(res.parents[1].sha, "d2836429f4ff7de033c8bc0d16d22d55f2ea39c3");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/git/commits (createCommit)", function(next) {
|
||||||
|
// got valid tree reference by executing
|
||||||
|
// git cat-file -p HEAD
|
||||||
|
client.gitdata.createCommit(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
message: "test",
|
||||||
|
tree: "8ce4393a319b60bc6179509e0c46dee83c179f9f",
|
||||||
|
parents: [],
|
||||||
|
author: {
|
||||||
|
name: "test-chef",
|
||||||
|
email: "test-chef@pasta-nirvana.it",
|
||||||
|
date: "2008-07-09T16:13:30+12:00"
|
||||||
|
},
|
||||||
|
committer: {
|
||||||
|
name: "test-minion",
|
||||||
|
email: "test-minion@pasta-nirvana.it",
|
||||||
|
date: "2008-07-09T16:13:30+12:00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.author.name, "test-chef");
|
||||||
|
Assert.equal(res.author.email, "test-chef@pasta-nirvana.it");
|
||||||
|
Assert.equal(res.committer.name, "test-minion");
|
||||||
|
Assert.equal(res.committer.email, "test-minion@pasta-nirvana.it");
|
||||||
|
Assert.equal(res.message, "test");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/git/refs/:ref (getReference)", function(next) {
|
||||||
|
client.gitdata.getReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/master"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.ref, "refs/heads/master");
|
||||||
|
Assert.equal(res.object.type, "commit");
|
||||||
|
Assert.equal(res.object.sha, "17e0734295ffd8174f91f04ba8e8f8e51954b793");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/git/refs (getAllReferences)", function(next) {
|
||||||
|
client.gitdata.getAllReferences(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var ref = res[0];
|
||||||
|
Assert.equal(ref.ref, "refs/heads/master");
|
||||||
|
Assert.equal(ref.object.type, "commit");
|
||||||
|
Assert.equal(ref.object.sha, "17e0734295ffd8174f91f04ba8e8f8e51954b793");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
DISABLED temporarily due to Internal Server Error from Github!
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/git/refs (createReference)", function(next) {
|
||||||
|
client.gitdata.createReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/tagliatelle",
|
||||||
|
sha: "17e0734295ffd8174f91f04ba8e8f8e51954b793"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
|
// other assertions go here
|
||||||
|
client.gitdata.deleteReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/tagliatelle"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});*/
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:user/:repo/git/refs/:ref (updateReference)", function(next) {
|
||||||
|
client.gitdata.getReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/master"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var sha = res.object.sha;
|
||||||
|
|
||||||
|
// do `force=true` because we go backward in history, which yields a warning
|
||||||
|
// that it's not a reference that can be fast-forwarded to.
|
||||||
|
client.gitdata.updateReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/master",
|
||||||
|
sha: "221140b288a3c64949594c58420cb4ab289b0756",
|
||||||
|
force: true
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.ref, "refs/heads/master");
|
||||||
|
Assert.equal(res.object.type, "commit");
|
||||||
|
Assert.equal(res.object.sha, "221140b288a3c64949594c58420cb4ab289b0756");
|
||||||
|
|
||||||
|
client.gitdata.updateReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/master",
|
||||||
|
sha: sha,
|
||||||
|
force: false
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.ref, "refs/heads/master");
|
||||||
|
Assert.equal(res.object.type, "commit");
|
||||||
|
Assert.equal(res.object.sha, sha);
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
DISABLED temporarily due to Internal Server Error from Github!
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /repos/:user/:repo/git/refs/:ref (deleteReference)", function(next) {
|
||||||
|
client.gitdata.createReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/tagliatelle",
|
||||||
|
sha: "17e0734295ffd8174f91f04ba8e8f8e51954b793"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
|
// other assertions go here
|
||||||
|
client.gitdata.deleteReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "heads/tagliatelle"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});*/
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/git/tags/:sha (getTag)", function(next) {
|
||||||
|
client.gitdata.createTag(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
tag: "test-pasta",
|
||||||
|
message: "Grandma's secret sauce",
|
||||||
|
object: "17e0734295ffd8174f91f04ba8e8f8e51954b793",
|
||||||
|
type: "commit",
|
||||||
|
tagger: {
|
||||||
|
name: "test-chef",
|
||||||
|
email: "test-chef@pasta-nirvana.it",
|
||||||
|
date: "2008-07-09T16:13:30+12:00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var sha = res.sha;
|
||||||
|
|
||||||
|
client.gitdata.getTag(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: sha
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.tag, "test-pasta");
|
||||||
|
Assert.equal(res.message, "Grandma's secret sauce");
|
||||||
|
Assert.equal(res.sha, sha);
|
||||||
|
Assert.equal(res.tagger.name, "test-chef");
|
||||||
|
Assert.equal(res.tagger.email, "test-chef@pasta-nirvana.it");
|
||||||
|
|
||||||
|
// other assertions go here
|
||||||
|
client.gitdata.deleteReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "tags/" + sha
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
//Assert.equal(err, null);
|
||||||
|
// NOTE: Github return 'Validation Failed' error codes back, which makes no sense to me.
|
||||||
|
// ask the guys what's up here...
|
||||||
|
Assert.equal(err.code, 422);
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/git/tags (createTag)", function(next) {
|
||||||
|
client.gitdata.createTag(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
tag: "test-pasta",
|
||||||
|
message: "Grandma's secret sauce",
|
||||||
|
object: "17e0734295ffd8174f91f04ba8e8f8e51954b793",
|
||||||
|
type: "commit",
|
||||||
|
tagger: {
|
||||||
|
name: "test-chef",
|
||||||
|
email: "test-chef@pasta-nirvana.it",
|
||||||
|
date: "2008-07-09T16:13:30+12:00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var sha = res.sha;
|
||||||
|
|
||||||
|
client.gitdata.getTag(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: sha
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.tag, "test-pasta");
|
||||||
|
Assert.equal(res.message, "Grandma's secret sauce");
|
||||||
|
Assert.equal(res.sha, sha);
|
||||||
|
Assert.equal(res.tagger.name, "test-chef");
|
||||||
|
Assert.equal(res.tagger.email, "test-chef@pasta-nirvana.it");
|
||||||
|
|
||||||
|
// other assertions go here
|
||||||
|
client.gitdata.deleteReference(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
ref: "tags/" + sha
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
//Assert.equal(err, null);
|
||||||
|
// NOTE: Github return 'Validation Failed' error codes back, which makes no sense to me.
|
||||||
|
// ask the guys what's up here...
|
||||||
|
Assert.equal(err.code, 422);
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/git/trees/:sha (getTree)", function(next) {
|
||||||
|
client.gitdata.getTree(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: "8ce4393a319b60bc6179509e0c46dee83c179f9f",
|
||||||
|
recursive: false
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.tree[0].type, "blob");
|
||||||
|
Assert.equal(res.tree[0].path, "LICENSE-MIT");
|
||||||
|
Assert.equal(res.tree[0].sha, "f30a31de94635399f42fd05f91f6ed3ff2f013d6");
|
||||||
|
Assert.equal(res.tree[0].mode, "100644");
|
||||||
|
Assert.equal(res.tree[0].size, 1075);
|
||||||
|
|
||||||
|
client.gitdata.getTree(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: "8ce4393a319b60bc6179509e0c46dee83c179f9f",
|
||||||
|
recursive: true
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.tree[0].type, "blob");
|
||||||
|
Assert.equal(res.tree[0].path, "LICENSE-MIT");
|
||||||
|
Assert.equal(res.tree[0].sha, "f30a31de94635399f42fd05f91f6ed3ff2f013d6");
|
||||||
|
Assert.equal(res.tree[0].mode, "100644");
|
||||||
|
Assert.equal(res.tree[0].size, 1075);
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/git/trees (createTree)", function(next) {
|
||||||
|
client.gitdata.getTree(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: "8ce4393a319b60bc6179509e0c46dee83c179f9f",
|
||||||
|
recursive: false
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var file = res.tree[0];
|
||||||
|
|
||||||
|
client.gitdata.createTree(
|
||||||
|
{
|
||||||
|
base_tree: "8ce4393a319b60bc6179509e0c46dee83c179f9f",
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
tree: [
|
||||||
|
{
|
||||||
|
path: file.path,
|
||||||
|
mode: "100755",
|
||||||
|
type: file.type,
|
||||||
|
sha: file.sha
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
var sha = res.sha;
|
||||||
|
|
||||||
|
client.gitdata.getTree(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
sha: sha,
|
||||||
|
recursive: true
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.tree[0].type, "blob");
|
||||||
|
Assert.equal(res.tree[0].path, "LICENSE-MIT");
|
||||||
|
Assert.equal(res.tree[0].sha, "f30a31de94635399f42fd05f91f6ed3ff2f013d6");
|
||||||
|
Assert.equal(res.tree[0].mode, "100755");
|
||||||
|
Assert.equal(res.tree[0].size, 1075);
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
112
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/gitignore.js
generated
vendored
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/**
|
||||||
|
* mixin gitignore
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var gitignore = module.exports = {
|
||||||
|
gitignore: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* gitignore#templates(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* No other params, simply pass an empty Object literal `{}`
|
||||||
|
**/
|
||||||
|
this.templates = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* gitignore#template(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - name (String): Required. The name of the .gitignore template to get
|
||||||
|
**/
|
||||||
|
this.template = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(gitignore.gitignore);
|
54
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/gitignoreTest.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[gitignore]", function() {
|
||||||
|
var client;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /gitignore/templates (templates)", function(next) {
|
||||||
|
client.gitignore.templates(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
Assert.ifError(err);
|
||||||
|
Assert(Array.isArray(res));
|
||||||
|
Assert(res.length > 10);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /gitignore/templates/:name (template)", function(next) {
|
||||||
|
client.gitignore.template(
|
||||||
|
{
|
||||||
|
name: "C"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
Assert.ifError(err);
|
||||||
|
Assert('name' in res);
|
||||||
|
Assert('source' in res);
|
||||||
|
Assert(typeof res.source === 'string');
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
40
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/index.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/**
|
||||||
|
* class Github
|
||||||
|
*
|
||||||
|
* A Node.JS module, which provides an object oriented wrapper for the GitHub v3 API.
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Fs = require("fs");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
var error = require("./../../error");
|
||||||
|
|
||||||
|
var GithubHandler = module.exports = function(client) {
|
||||||
|
this.client = client;
|
||||||
|
this.routes = JSON.parse(Fs.readFileSync(__dirname + "/routes.json", "utf8"));
|
||||||
|
};
|
||||||
|
|
||||||
|
var proto = {
|
||||||
|
sendError: function(err, block, msg, callback) {
|
||||||
|
if (this.client.debug)
|
||||||
|
Util.log(err, block, msg.user, "error");
|
||||||
|
if (typeof err == "string")
|
||||||
|
err = new error.InternalServerError(err);
|
||||||
|
if (callback)
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
["gists", "gitdata", "issues", "authorization", "orgs", "statuses", "pullRequests", "repos", "user", "events", "releases", "search", "markdown", "gitignore", "misc"].forEach(function(api) {
|
||||||
|
Util.extend(proto, require("./" + api));
|
||||||
|
});
|
||||||
|
|
||||||
|
GithubHandler.prototype = proto;
|
1246
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/issues.js
generated
vendored
Normal file
423
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/issuesTest.js
generated
vendored
Normal file
|
@ -0,0 +1,423 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[issues]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /issues (getAll)", function(next) {
|
||||||
|
client.issues.getAll(
|
||||||
|
{
|
||||||
|
filter: "created",
|
||||||
|
state: "open",
|
||||||
|
labels: "",
|
||||||
|
sort: "updated",
|
||||||
|
direction: "asc"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 1);
|
||||||
|
var issue = res[0];
|
||||||
|
Assert.equal(issue.title, "My First Issue");
|
||||||
|
Assert.equal(issue.number, 2);
|
||||||
|
Assert.equal(issue.state, "open");
|
||||||
|
Assert.equal(issue.body, "Willing to start a debate on the best recipe of macaroni.");
|
||||||
|
Assert.equal(issue.assignee.login, "mikedeboertest");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues (repoIssues)", function(next) {
|
||||||
|
client.issues.repoIssues(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
state: "open",
|
||||||
|
sort: "updated",
|
||||||
|
direction: "asc"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.length, 1);
|
||||||
|
var issue = res[0];
|
||||||
|
Assert.equal(issue.title, "My First Issue");
|
||||||
|
Assert.equal(issue.number, 2);
|
||||||
|
Assert.equal(issue.state, "open");
|
||||||
|
Assert.equal(issue.body, "Willing to start a debate on the best recipe of macaroni.");
|
||||||
|
Assert.equal(issue.assignee.login, "mikedeboertest");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues/:number (getRepoIssue)", function(next) {
|
||||||
|
client.issues.getRepoIssue(
|
||||||
|
{
|
||||||
|
user: "mikedeboertest",
|
||||||
|
repo: "node_chat",
|
||||||
|
number: 2
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.title, "My First Issue");
|
||||||
|
Assert.equal(res.number, 2);
|
||||||
|
Assert.equal(res.state, "open");
|
||||||
|
Assert.equal(res.body, "Willing to start a debate on the best recipe of macaroni.");
|
||||||
|
Assert.equal(res.assignee.login, "mikedeboertest");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/issues (create)", function(next) {
|
||||||
|
client.issues.create(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
title: "String",
|
||||||
|
body: "String",
|
||||||
|
assignee: "String",
|
||||||
|
milestone: "Number",
|
||||||
|
labels: "Json"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:user/:repo/issues/:number (edit)", function(next) {
|
||||||
|
client.issues.edit(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
title: "String",
|
||||||
|
body: "String",
|
||||||
|
assignee: "String",
|
||||||
|
milestone: "Number",
|
||||||
|
labels: "Json"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues/:number/comments (getComments)", function(next) {
|
||||||
|
client.issues.getComments(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues/comments/:id (getComment)", function(next) {
|
||||||
|
client.issues.getComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
id: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/issues/:number/comments (createComment)", function(next) {
|
||||||
|
client.issues.createComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
body: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:user/:repo/issues/comments/:id (editComment)", function(next) {
|
||||||
|
client.issues.editComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
id: "String",
|
||||||
|
body: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /repos/:user/:repo/issues/comments/:id (deleteComment)", function(next) {
|
||||||
|
client.issues.deleteComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
id: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues/:number/events (getEvents)", function(next) {
|
||||||
|
client.issues.getEvents(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues/events (getRepoEvents)", function(next) {
|
||||||
|
client.issues.getRepoEvents(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/issues/events/:id (getEvent)", function(next) {
|
||||||
|
client.issues.getEvent(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
id: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/labels (getLabels)", function(next) {
|
||||||
|
client.issues.getLabels(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/labels/:name (getLabel)", function(next) {
|
||||||
|
client.issues.getLabel(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
name: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/labels (createLabel)", function(next) {
|
||||||
|
client.issues.createLabel(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
name: "String",
|
||||||
|
color: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/labels/:name (updateLabel)", function(next) {
|
||||||
|
client.issues.updateLabel(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
name: "String",
|
||||||
|
color: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /repos/:user/:repo/labels/:name (deleteLabel)", function(next) {
|
||||||
|
client.issues.deleteLabel(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
name: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/milestones (getAllMilestones)", function(next) {
|
||||||
|
client.issues.getAllMilestones(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
state: "String",
|
||||||
|
sort: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/milestones/:number (getMilestone)", function(next) {
|
||||||
|
client.issues.getMilestone(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/milestones (createMilestone)", function(next) {
|
||||||
|
client.issues.createMilestone(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
title: "String",
|
||||||
|
state: "String",
|
||||||
|
description: "String",
|
||||||
|
due_on: "Date"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:user/:repo/milestones/:number (updateMilestone)", function(next) {
|
||||||
|
client.issues.updateMilestone(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
title: "String",
|
||||||
|
state: "String",
|
||||||
|
description: "String",
|
||||||
|
due_on: "Date"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /repos/:user/:repo/milestones/:number (deleteMilestone)", function(next) {
|
||||||
|
client.issues.deleteMilestone(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});*/
|
||||||
|
});
|
114
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/markdown.js
generated
vendored
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/**
|
||||||
|
* mixin markdown
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var markdown = module.exports = {
|
||||||
|
markdown: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* markdown#render(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - text (String): Required. The Markdown text to render
|
||||||
|
* - mode (String): Optional. The rendering mode, `markdown` to render a document as plain Markdown, just like README files are rendered. `gfm` to render a document as user-content, e.g. like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly. Validation rule: ` ^(markdown|gfm)$ `.
|
||||||
|
* - context (String): Optional. The repository context, only taken into account when rendering as `gfm`
|
||||||
|
**/
|
||||||
|
this.render = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* markdown#renderRaw(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - data (String): Required. Raw data to send as the body of the request
|
||||||
|
**/
|
||||||
|
this.renderRaw = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(markdown.markdown);
|
56
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/markdownTest.js
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[markdown]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
/*client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});*/
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /markdown (render)", function(next) {
|
||||||
|
client.markdown.render(
|
||||||
|
{
|
||||||
|
text: "Hello world github/linguist#1 **cool**, and #1!",
|
||||||
|
mode: "gfm",
|
||||||
|
context: "github/gollem"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
console.log(res);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /markdown/raw (render)", function(next) {
|
||||||
|
client.markdown.renderRaw(
|
||||||
|
{
|
||||||
|
data: "Hello world github/linguist#1 **cool**, and #1!"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
console.log(res);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
157
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/misc.js
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
/**
|
||||||
|
* mixin misc
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var misc = module.exports = {
|
||||||
|
misc: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* misc#emojis(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* No other params, simply pass an empty Object literal `{}`
|
||||||
|
**/
|
||||||
|
this.emojis = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* misc#meta(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* No other params, simply pass an empty Object literal `{}`
|
||||||
|
**/
|
||||||
|
this.meta = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* misc#rateLimit(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* No other params, simply pass an empty Object literal `{}`
|
||||||
|
**/
|
||||||
|
this.rateLimit = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(misc.misc);
|
69
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/miscTest.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[misc]", function() {
|
||||||
|
var client;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /emojis (emojis)", function(next) {
|
||||||
|
client.misc.emojis(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
Assert.ifError(err);
|
||||||
|
// A common emoji on github
|
||||||
|
Assert('shipit' in res);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /meta (meta)", function(next) {
|
||||||
|
client.misc.meta(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
Assert('hooks' in res);
|
||||||
|
Assert('git' in res);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /rate_limit (rateLimit)", function(next) {
|
||||||
|
client.misc.rateLimit(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert('resources' in res);
|
||||||
|
Assert('core' in res.resources);
|
||||||
|
Assert(typeof res.resources.core.limit === 'number');
|
||||||
|
Assert(typeof res.resources.core.remaining === 'number');
|
||||||
|
Assert(typeof res.resources.core.reset === 'number');
|
||||||
|
Assert('search' in res.resources);
|
||||||
|
Assert(typeof res.resources.search.limit === 'number');
|
||||||
|
Assert(typeof res.resources.search.remaining === 'number');
|
||||||
|
Assert(typeof res.resources.search.reset === 'number');
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
1140
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/orgs.js
generated
vendored
Normal file
361
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/orgsTest.js
generated
vendored
Normal file
|
@ -0,0 +1,361 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[orgs]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/orgs (getFromUser)", function(next) {
|
||||||
|
client.orgs.getFromUser(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /orgs/:org (get)", function(next) {
|
||||||
|
client.orgs.get(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /orgs/:org (update)", function(next) {
|
||||||
|
client.orgs.update(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
billing_email: "String",
|
||||||
|
company: "String",
|
||||||
|
email: "String",
|
||||||
|
location: "String",
|
||||||
|
name: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /orgs/:org/members (getMembers)", function(next) {
|
||||||
|
client.orgs.getMembers(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /orgs/:org/members/:user (getMember)", function(next) {
|
||||||
|
client.orgs.getMember(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /orgs/:org/members/:user (removeMember)", function(next) {
|
||||||
|
client.orgs.removeMember(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /orgs/:org/public_members (getPublicMembers)", function(next) {
|
||||||
|
client.orgs.getPublicMembers(
|
||||||
|
{
|
||||||
|
org: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /orgs/:org/public_members/:user (getPublicMember)", function(next) {
|
||||||
|
client.orgs.getPublicMember(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PUT /orgs/:org/public_members/:user (publicizeMembership)", function(next) {
|
||||||
|
client.orgs.publicizeMembership(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /orgs/:org/public_members/:user (concealMembership)", function(next) {
|
||||||
|
client.orgs.concealMembership(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /orgs/:org/teams (getTeams)", function(next) {
|
||||||
|
client.orgs.getTeams(
|
||||||
|
{
|
||||||
|
org: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /teams/:id (getTeam)", function(next) {
|
||||||
|
client.orgs.getTeam(
|
||||||
|
{
|
||||||
|
id: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /orgs/:org/teams (createTeam)", function(next) {
|
||||||
|
client.orgs.createTeam(
|
||||||
|
{
|
||||||
|
org: "String",
|
||||||
|
name: "String",
|
||||||
|
repo_names: "Array",
|
||||||
|
permission: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /teams/:id (updateTeam)", function(next) {
|
||||||
|
client.orgs.updateTeam(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
name: "String",
|
||||||
|
permission: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /teams/:id (deleteTeam)", function(next) {
|
||||||
|
client.orgs.deleteTeam(
|
||||||
|
{
|
||||||
|
id: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /teams/:id/members (getTeamMembers)", function(next) {
|
||||||
|
client.orgs.getTeamMembers(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /teams/:id/members/:user (getTeamMember)", function(next) {
|
||||||
|
client.orgs.getTeamMember(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PUT /teams/:id/members/:user (addTeamMember)", function(next) {
|
||||||
|
client.orgs.addTeamMember(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /teams/:id/members/:user (deleteTeamMember)", function(next) {
|
||||||
|
client.orgs.deleteTeamMember(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /teams/:id/repos (getTeamRepos)", function(next) {
|
||||||
|
client.orgs.getTeamRepos(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /teams/:id/repos/:user/:repo (getTeamRepo)", function(next) {
|
||||||
|
client.orgs.getTeamRepo(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
user: "String",
|
||||||
|
repo: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PUT /teams/:id/repos/:user/:repo (addTeamRepo)", function(next) {
|
||||||
|
client.orgs.addTeamRepo(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
user: "String",
|
||||||
|
repo: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /teams/:id/repos/:user/:repo (deleteTeamRepo)", function(next) {
|
||||||
|
client.orgs.deleteTeamRepo(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
user: "String",
|
||||||
|
repo: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
757
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/pullRequests.js
generated
vendored
Normal file
|
@ -0,0 +1,757 @@
|
||||||
|
/**
|
||||||
|
* mixin pullRequests
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var pullRequests = module.exports = {
|
||||||
|
pullRequests: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#getAll(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - state (String): Optional. open, closed, or all Validation rule: ` ^(open|closed|all)$ `.
|
||||||
|
* - head (String): Optional.
|
||||||
|
* - base (String): Optional.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - sort (String): Optional. Possible values are: `created`, `updated`, `popularity`, `long-running`, Default: `created` Validation rule: ` ^(created|updated|popularity|long-running)$ `.
|
||||||
|
* - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `.
|
||||||
|
**/
|
||||||
|
this.getAll = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#get(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.get = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#create(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - title (String): Required.
|
||||||
|
* - body (String): Optional.
|
||||||
|
* - base (String): Required. The branch (or git ref) you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repo that requests a merge to a base of another repo.
|
||||||
|
* - head (String): Required. The branch (or git ref) where your changes are implemented.
|
||||||
|
**/
|
||||||
|
this.create = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#createFromIssue(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - issue (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - base (String): Required. The branch (or git ref) you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repo that requests a merge to a base of another repo.
|
||||||
|
* - head (String): Required. The branch (or git ref) where your changes are implemented.
|
||||||
|
**/
|
||||||
|
this.createFromIssue = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#update(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - state (String): Optional. Validation rule: ` ^(open|closed)$ `.
|
||||||
|
* - title (String): Required.
|
||||||
|
* - body (String): Optional.
|
||||||
|
**/
|
||||||
|
this.update = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#getCommits(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getCommits = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#getFiles(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getFiles = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#getMerged(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getMerged = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#merge(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - commit_message (String): Optional. The message that will be used for the merge commit
|
||||||
|
**/
|
||||||
|
this.merge = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#getComments(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getComments = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#getComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.getComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#createComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - body (String): Required.
|
||||||
|
* - commit_id (String): Required. Sha of the commit to comment on.
|
||||||
|
* - path (String): Required. Relative path of the file to comment on.
|
||||||
|
* - position (Number): Required. Column index in the diff to comment on.
|
||||||
|
**/
|
||||||
|
this.createComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#createCommentReply(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - body (String): Required.
|
||||||
|
* - in_reply_to (Number): Required.
|
||||||
|
**/
|
||||||
|
this.createCommentReply = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#updateComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - body (String): Required.
|
||||||
|
**/
|
||||||
|
this.updateComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* pullRequests#deleteComment(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.deleteComment = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(pullRequests.pullRequests);
|
281
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/pullRequestsTest.js
generated
vendored
Normal file
|
@ -0,0 +1,281 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[pullRequests]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/pulls (getAll)", function(next) {
|
||||||
|
client.pullRequests.getAll(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
base: "String",
|
||||||
|
head: "String",
|
||||||
|
state: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/pulls/:number (get)", function(next) {
|
||||||
|
client.pullRequests.get(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/pulls (create)", function(next) {
|
||||||
|
client.pullRequests.create(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
title: "String",
|
||||||
|
body: "String",
|
||||||
|
base: "String",
|
||||||
|
head: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/pulls (createFromIssue)", function(next) {
|
||||||
|
client.pullRequests.createFromIssue(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
issue: "Number",
|
||||||
|
base: "String",
|
||||||
|
head: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:user/:repo/pulls/:number (update)", function(next) {
|
||||||
|
client.pullRequests.update(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
state: "String",
|
||||||
|
title: "String",
|
||||||
|
body: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/pulls/:number/commits (getCommits)", function(next) {
|
||||||
|
client.pullRequests.getCommits(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/pulls/:number/files (getFiles)", function(next) {
|
||||||
|
client.pullRequests.getFiles(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/pulls/:number/merge (getMerged)", function(next) {
|
||||||
|
client.pullRequests.getMerged(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PUT /repos/:user/:repo/pulls/:number/merge (merge)", function(next) {
|
||||||
|
client.pullRequests.merge(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
commit_message: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/pulls/:number/comments (getComments)", function(next) {
|
||||||
|
client.pullRequests.getComments(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/pulls/comments/:number (getComment)", function(next) {
|
||||||
|
client.pullRequests.getComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/pulls/:number/comments (createComment)", function(next) {
|
||||||
|
client.pullRequests.createComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
body: "String",
|
||||||
|
commit_id: "String",
|
||||||
|
path: "String",
|
||||||
|
position: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/pulls/:number/comments (createCommentReply)", function(next) {
|
||||||
|
client.pullRequests.createCommentReply(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
body: "String",
|
||||||
|
in_reply_to: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:user/:repo/pulls/comments/:number (updateComment)", function(next) {
|
||||||
|
client.pullRequests.updateComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number",
|
||||||
|
body: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /repos/:user/:repo/pulls/comments/:number (deleteComment)", function(next) {
|
||||||
|
client.pullRequests.deleteComment(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
number: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
507
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/releases.js
generated
vendored
Normal file
|
@ -0,0 +1,507 @@
|
||||||
|
/**
|
||||||
|
* mixin releases
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var releases = module.exports = {
|
||||||
|
releases: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* releases#listReleases(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.listReleases = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#getRelease(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
**/
|
||||||
|
this.getRelease = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#createRelease(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - tag_name (String): Required. String of the tag
|
||||||
|
* - target_commitish (String): Optional. Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually master).
|
||||||
|
* - name (String): Optional.
|
||||||
|
* - body (String): Optional.
|
||||||
|
* - draft (Boolean): Optional. true to create a draft (unpublished) release, false to create a published one. Default: false
|
||||||
|
* - prerelease (Boolean): Optional. true to identify the release as a prerelease. false to identify the release as a full release. Default: false
|
||||||
|
**/
|
||||||
|
this.createRelease = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#editRelease(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - tag_name (String): Required. String of the tag
|
||||||
|
* - target_commitish (String): Optional. Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually master).
|
||||||
|
* - name (String): Optional.
|
||||||
|
* - body (String): Optional.
|
||||||
|
* - draft (Boolean): Optional. true to create a draft (unpublished) release, false to create a published one. Default: false
|
||||||
|
* - prerelease (Boolean): Optional. true to identify the release as a prerelease. false to identify the release as a full release. Default: false
|
||||||
|
**/
|
||||||
|
this.editRelease = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#deleteRelease(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
**/
|
||||||
|
this.deleteRelease = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#listAssets(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
**/
|
||||||
|
this.listAssets = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#getAsset(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
**/
|
||||||
|
this.getAsset = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#uploadAsset(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - name (String): Required. the file name of the asset
|
||||||
|
**/
|
||||||
|
this.uploadAsset = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#editAsset(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - name (String): Required.
|
||||||
|
* - label (String): Optional. An alternate short description of the asset. Used in place of the filename.
|
||||||
|
**/
|
||||||
|
this.editAsset = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* releases#deleteAsset(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - owner (String): Required.
|
||||||
|
* - id (Number): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
**/
|
||||||
|
this.deleteAsset = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(releases.releases);
|
262
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/releasesTest.js
generated
vendored
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
var fs = require("fs");
|
||||||
|
var mime = require("mime");
|
||||||
|
|
||||||
|
describe("[releases]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
var owner = "greggman";
|
||||||
|
var repo = "test";
|
||||||
|
var haveWriteAccess = true; // set to false if the authenticated person below does not have write access to the repo above
|
||||||
|
var releaseIdWithAsset = 393621; // Some release id from the repo above that has at least 1 asset.
|
||||||
|
var filePathToUpload = __filename;
|
||||||
|
var fileSizeToUpload = fs.statSync(filePathToUpload).size;
|
||||||
|
|
||||||
|
var releaseId; // release id found when listing releases. Used for get release
|
||||||
|
var newReleaseId; // release id created when creating release, used for edit and delete release
|
||||||
|
var assetId; // asset id found when listing assets. Used for get asset
|
||||||
|
var newAssetId; // asset id used when creating asset. Used for edit and delete asset
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:owner/:repo/releases (listReleases)", function(next) {
|
||||||
|
client.releases.listReleases(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res instanceof Array);
|
||||||
|
if (res instanceof Array && res.length > 0) {
|
||||||
|
releaseId = res[0].id;
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:owner/:repo/releases/:id (getRelease)", function(next) {
|
||||||
|
if (!releaseId) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client.releases.getRelease(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
id: releaseId,
|
||||||
|
repo: repo
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.id, releaseId);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:owner/:repo/releases (createRelease)", function(next) {
|
||||||
|
if (!haveWriteAccess) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client.releases.createRelease(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
tag_name: "node-github-tag",
|
||||||
|
target_commitish: "master",
|
||||||
|
name: "node-github-name",
|
||||||
|
body: "node-github-body",
|
||||||
|
draft: false,
|
||||||
|
prerelease: true,
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.tag_name, "node-github-tag");
|
||||||
|
Assert.equal(res.target_commitish, "master");
|
||||||
|
Assert.equal(res.name, "node-github-name");
|
||||||
|
Assert.equal(res.body, "node-github-body");
|
||||||
|
Assert.equal(res.assets.length, 0);
|
||||||
|
Assert.ok(res.prerelease);
|
||||||
|
Assert.ok(!res.draft);
|
||||||
|
newReleaseId = res.id;
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:owner/:repo/releases/:id (editRelease)", function(next) {
|
||||||
|
if (!haveWriteAccess) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client.releases.editRelease(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
id: newReleaseId,
|
||||||
|
repo: repo,
|
||||||
|
tag_name: "node-github-new-tag",
|
||||||
|
target_commitish: "master",
|
||||||
|
name: "node-github-new-name",
|
||||||
|
body: "node-github-new-body",
|
||||||
|
draft: true,
|
||||||
|
prerelease: true,
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.id, newReleaseId);
|
||||||
|
Assert.equal(res.tag_name, "node-github-new-tag");
|
||||||
|
Assert.equal(res.target_commitish, "master");
|
||||||
|
Assert.equal(res.name, "node-github-new-name");
|
||||||
|
Assert.equal(res.body, "node-github-new-body");
|
||||||
|
Assert.equal(res.assets.length, 0);
|
||||||
|
Assert.ok(res.prerelease);
|
||||||
|
Assert.ok(res.draft);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /repos/:owner/:repo/releases/:id (deleteRelease)", function(next) {
|
||||||
|
if (!haveWriteAccess) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client.releases.deleteRelease(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
id: newReleaseId,
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:owner/:repo/releases/:id/assets (listAssets)", function(next) {
|
||||||
|
client.releases.listAssets(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
id: releaseIdWithAsset,
|
||||||
|
repo: repo
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res instanceof Array);
|
||||||
|
if (res instanceof Array && res.length > 0) {
|
||||||
|
assetId = res[0].id;
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:owner/:repo/releases/assets/:id (getAsset)", function(next) {
|
||||||
|
if (!assetId) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client.releases.getAsset(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
id: assetId,
|
||||||
|
repo: repo
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.id, assetId);
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:owner/:repo/releases/:id/assets (uploadAsset)", function(next) {
|
||||||
|
var name = "somenameornot.zip";
|
||||||
|
client.releases.uploadAsset(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
id: releaseIdWithAsset,
|
||||||
|
repo: repo,
|
||||||
|
name: name,
|
||||||
|
filePath: filePathToUpload
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.content_type, mime.lookup(name)); // matches extension of name, not filePath
|
||||||
|
Assert.equal(res.state, "uploaded");
|
||||||
|
Assert.equal(res.size, fileSizeToUpload);
|
||||||
|
Assert.equal(res.name, name);
|
||||||
|
newAssetId = res.id;
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /repos/:owner/:repo/releases/assets/:id (editAsset)", function(next) {
|
||||||
|
if (!newAssetId) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var newName = "somenewname.zip";
|
||||||
|
client.releases.editAsset(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
id: newAssetId,
|
||||||
|
repo: repo,
|
||||||
|
name: newName,
|
||||||
|
label: "foo"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.state, "uploaded");
|
||||||
|
Assert.equal(res.size, fileSizeToUpload);
|
||||||
|
Assert.equal(res.name, newName);
|
||||||
|
Assert.equal(res.label, "foo");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /repos/:owner/:repo/releases/assets/:id (deleteAsset)", function(next) {
|
||||||
|
if (!newAssetId) {
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
client.releases.deleteAsset(
|
||||||
|
{
|
||||||
|
owner: owner,
|
||||||
|
id: newAssetId,
|
||||||
|
repo: repo
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
3548
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/repos.js
generated
vendored
Normal file
1126
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/reposTest.js
generated
vendored
Normal file
3914
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/routes.json
generated
vendored
Normal file
263
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/search.js
generated
vendored
Normal file
|
@ -0,0 +1,263 @@
|
||||||
|
/**
|
||||||
|
* mixin search
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var search = module.exports = {
|
||||||
|
search: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* search#code(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - q (String): Required. Search Term
|
||||||
|
* - sort (String): Optional. indexed only Validation rule: ` ^indexed$ `.
|
||||||
|
* - order (String): Optional. asc or desc Validation rule: ` ^(asc|desc)$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.code = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* search#issues(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - q (String): Required. Search Term
|
||||||
|
* - sort (String): Optional. comments, created, or updated Validation rule: ` ^(comments|created|updated)$ `.
|
||||||
|
* - order (String): Optional. asc or desc Validation rule: ` ^(asc|desc)$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.issues = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* search#repos(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - q (String): Required. Search Term
|
||||||
|
* - sort (String): Optional. stars, forks, or updated Validation rule: ` ^(stars|forks|updated)$ `.
|
||||||
|
* - order (String): Optional. asc or desc Validation rule: ` ^(asc|desc)$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.repos = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* search#users(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - q (String): Required. Search Term
|
||||||
|
* - sort (String): Optional. followers, repositories, or joined Validation rule: ` ^(followers|repositories|joined)$ `.
|
||||||
|
* - order (String): Optional. asc or desc Validation rule: ` ^(asc|desc)$ `.
|
||||||
|
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
|
||||||
|
**/
|
||||||
|
this.users = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* search#email(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - email (String): Required. Email address
|
||||||
|
**/
|
||||||
|
this.email = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(search.search);
|
119
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/searchTest.js
generated
vendored
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[search]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
/*client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});*/
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /search/code/:q (code)", function(next) {
|
||||||
|
client.search.code(
|
||||||
|
{
|
||||||
|
q: ['test', 'repo:mikedeboertest/1423836276146'].join('+')
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.items.length, 1);
|
||||||
|
var file = res.items[0];
|
||||||
|
Assert.equal(file.name, "TEST.md");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /search/issues/:q (issues)", function(next) {
|
||||||
|
client.search.issues(
|
||||||
|
{
|
||||||
|
q: ['debate', 'repo:mikedeboertest/node_chat', 'state:open'].join('+')
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.items.length, 1);
|
||||||
|
var issue = res.items[0];
|
||||||
|
Assert.equal(issue.title, "My First Issue");
|
||||||
|
Assert.equal(issue.state, "open");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /search/repositories/:q (repos)", function(next) {
|
||||||
|
client.search.repos(
|
||||||
|
{
|
||||||
|
q: ['pasta', 'language:JavaScript'].join('+')
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.ok(res.items.length > 0);
|
||||||
|
Assert.equal(res.items[0].language, "JavaScript");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /search/users/:q (users)", function(next) {
|
||||||
|
client.search.users(
|
||||||
|
{
|
||||||
|
q: "mikedeboer"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
Assert.equal(res.items.length, 2);
|
||||||
|
var user = res.items[0];
|
||||||
|
Assert.equal(user.login, "mikedeboer");
|
||||||
|
|
||||||
|
client.search.users(
|
||||||
|
{
|
||||||
|
q: "location:Jyväskylä"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
//XXX: this is likely to change often. I added this for
|
||||||
|
// issue #159.
|
||||||
|
Assert.equal(res.items.length, 30);
|
||||||
|
var user = res.items[0];
|
||||||
|
Assert.equal(user.login, "bebraw");
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
/*it("should successfully execute GET /search/user/email/:email (email)", function(next) {
|
||||||
|
client.search.email(
|
||||||
|
{
|
||||||
|
email: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});*/
|
||||||
|
});
|
167
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/statuses.js
generated
vendored
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
/**
|
||||||
|
* mixin statuses
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var statuses = module.exports = {
|
||||||
|
statuses: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/** section: github
|
||||||
|
* statuses#get(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - sha (String): Required.
|
||||||
|
**/
|
||||||
|
this.get = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* statuses#getCombined(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - sha (String): Required.
|
||||||
|
**/
|
||||||
|
this.getCombined = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* statuses#create(msg, callback) -> null
|
||||||
|
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* ##### Params on the `msg` object:
|
||||||
|
*
|
||||||
|
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
|
||||||
|
* - user (String): Required.
|
||||||
|
* - repo (String): Required.
|
||||||
|
* - sha (String): Required.
|
||||||
|
* - state (String): Required. State of the status - can be one of pending, success, error, or failure. Validation rule: ` ^(pending|success|error|failure)$ `.
|
||||||
|
* - target_url (String): Optional. Target url to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the ‘source’ of the Status.
|
||||||
|
* - description (String): Optional. Short description of the status.
|
||||||
|
* - context (String): Optional. A string label to differentiate this status from the status of other systems.
|
||||||
|
**/
|
||||||
|
this.create = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(statuses.statuses);
|
76
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/statusesTest.js
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[statuses]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/commits/:sha/statuses (get)", function(next) {
|
||||||
|
client.statuses.get(
|
||||||
|
{
|
||||||
|
user: "mikedeboer",
|
||||||
|
repo: "node-github",
|
||||||
|
sha: "30d607d8fd8002427b61273f25d442c233cbf631"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /repos/:user/:repo/commits/:sha/status (get)", function(next) {
|
||||||
|
client.statuses.getCombined(
|
||||||
|
{
|
||||||
|
user: "mikedeboer",
|
||||||
|
repo: "node-github",
|
||||||
|
sha: "30d607d8fd8002427b61273f25d442c233cbf631"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /repos/:user/:repo/statuses/:sha (create)", function(next) {
|
||||||
|
client.statuses.create(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
repo: "String",
|
||||||
|
sha: "String",
|
||||||
|
state: "String",
|
||||||
|
target_url: "String",
|
||||||
|
description: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
1035
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/user.js
generated
vendored
Normal file
304
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/api/v3.0.0/userTest.js
generated
vendored
Normal file
|
@ -0,0 +1,304 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[user]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user (getFrom)", function(next) {
|
||||||
|
client.user.getFrom(
|
||||||
|
{
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user (get)", function(next) {
|
||||||
|
client.user.get(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /user (update)", function(next) {
|
||||||
|
client.user.update(
|
||||||
|
{
|
||||||
|
name: "String",
|
||||||
|
email: "String",
|
||||||
|
blog: "String",
|
||||||
|
company: "String",
|
||||||
|
location: "String",
|
||||||
|
hireable: "Boolean",
|
||||||
|
bio: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user/orgs (getOrgs)", function(next) {
|
||||||
|
client.user.getOrgs(
|
||||||
|
{
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user/teams (getTeams)", function(next) {
|
||||||
|
client.user.getTeams(
|
||||||
|
{
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user/emails (getEmails)", function(next) {
|
||||||
|
client.user.getEmails(
|
||||||
|
{
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /user/emails (addEmails)", function(next) {
|
||||||
|
client.user.addEmails(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /user/emails (deleteEmails)", function(next) {
|
||||||
|
client.user.deleteEmails(
|
||||||
|
{},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/followers (getFollowers)", function(next) {
|
||||||
|
client.user.getFollowers(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/following (getFollowingFromUser)", function(next) {
|
||||||
|
client.user.getFollowingFromUser(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user/following (getFollowing)", function(next) {
|
||||||
|
client.user.getFollowing(
|
||||||
|
{
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user/following/:user (getFollowUser)", function(next) {
|
||||||
|
client.user.getFollowUser(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PUT /user/following/:user (followUser)", function(next) {
|
||||||
|
client.user.followUser(
|
||||||
|
{
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /user/following/:user (unFollowUser)", function(next) {
|
||||||
|
client.user.unFollowUser(
|
||||||
|
{
|
||||||
|
user: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user/keys (getKeys)", function(next) {
|
||||||
|
client.user.getKeys(
|
||||||
|
{
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /users/:user/keys (getKeysFromUser)", function(next) {
|
||||||
|
client.user.getKeysFromUser(
|
||||||
|
{
|
||||||
|
user: "String",
|
||||||
|
page: "Number",
|
||||||
|
per_page: "Number"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /user/keys/:id (getKey)", function(next) {
|
||||||
|
client.user.getKey(
|
||||||
|
{
|
||||||
|
id: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute POST /user/keys (createKey)", function(next) {
|
||||||
|
client.user.createKey(
|
||||||
|
{
|
||||||
|
title: "String",
|
||||||
|
key: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute PATCH /user/keys/:id (updateKey)", function(next) {
|
||||||
|
client.user.updateKey(
|
||||||
|
{
|
||||||
|
id: "String",
|
||||||
|
title: "String",
|
||||||
|
key: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute DELETE /user/keys/:id (deleteKey)", function(next) {
|
||||||
|
client.user.deleteKey(
|
||||||
|
{
|
||||||
|
id: "String"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
117
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/error.js
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
/** section: github
|
||||||
|
* class HttpError
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <mike@c9.io>
|
||||||
|
**/
|
||||||
|
|
||||||
|
var Util = require("util");
|
||||||
|
|
||||||
|
exports.HttpError = function(message, code) {
|
||||||
|
Error.call(this, message);
|
||||||
|
//Error.captureStackTrace(this, arguments.callee);
|
||||||
|
this.message = message;
|
||||||
|
this.code = code;
|
||||||
|
};
|
||||||
|
Util.inherits(exports.HttpError, Error);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/**
|
||||||
|
* HttpError#toString() -> String
|
||||||
|
*
|
||||||
|
* Returns the stringified version of the error (i.e. the message).
|
||||||
|
**/
|
||||||
|
this.toString = function() {
|
||||||
|
return this.message;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HttpError#toJSON() -> Object
|
||||||
|
*
|
||||||
|
* Returns a JSON object representation of the error.
|
||||||
|
**/
|
||||||
|
this.toJSON = function() {
|
||||||
|
return {
|
||||||
|
code: this.code,
|
||||||
|
status: this.defaultMessage,
|
||||||
|
message: this.message
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(exports.HttpError.prototype);
|
||||||
|
|
||||||
|
|
||||||
|
var statusCodes = {
|
||||||
|
400: "Bad Request",
|
||||||
|
401: "Unauthorized",
|
||||||
|
402: "Payment Required",
|
||||||
|
403: "Forbidden",
|
||||||
|
404: "Not Found",
|
||||||
|
405: "Method Not Allowed",
|
||||||
|
406: "Not Acceptable",
|
||||||
|
407: "Proxy Authentication Required",
|
||||||
|
408: "Request Timeout",
|
||||||
|
409: "Conflict",
|
||||||
|
410: "Gone",
|
||||||
|
411: "Length Required",
|
||||||
|
412: "Precondition Failed",
|
||||||
|
413: "Request Entity Too Large",
|
||||||
|
414: "Request-URI Too Long",
|
||||||
|
415: "Unsupported Media Type",
|
||||||
|
416: "Requested Range Not Satisfiable",
|
||||||
|
417: "Expectation Failed",
|
||||||
|
420: "Enhance Your Calm",
|
||||||
|
422: "Unprocessable Entity",
|
||||||
|
423: "Locked",
|
||||||
|
424: "Failed Dependency",
|
||||||
|
425: "Unordered Collection",
|
||||||
|
426: "Upgrade Required",
|
||||||
|
428: "Precondition Required",
|
||||||
|
429: "Too Many Requests",
|
||||||
|
431: "Request Header Fields Too Large",
|
||||||
|
444: "No Response",
|
||||||
|
449: "Retry With",
|
||||||
|
499: "Client Closed Request",
|
||||||
|
500: "Internal Server Error",
|
||||||
|
501: "Not Implemented",
|
||||||
|
502: "Bad Gateway",
|
||||||
|
503: "Service Unavailable",
|
||||||
|
504: "Gateway Timeout",
|
||||||
|
505: "HTTP Version Not Supported",
|
||||||
|
506: "Variant Also Negotiates",
|
||||||
|
507: "Insufficient Storage",
|
||||||
|
508: "Loop Detected",
|
||||||
|
509: "Bandwidth Limit Exceeded",
|
||||||
|
510: "Not Extended",
|
||||||
|
511: "Network Authentication Required"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var status in statusCodes) {
|
||||||
|
var defaultMsg = statusCodes[status];
|
||||||
|
|
||||||
|
var error = (function(defaultMsg, status) {
|
||||||
|
return function(msg) {
|
||||||
|
this.defaultMessage = defaultMsg;
|
||||||
|
exports.HttpError.call(this, msg || status + ": " + defaultMsg, status);
|
||||||
|
|
||||||
|
if (status >= 500)
|
||||||
|
Error.captureStackTrace(this, arguments.callee);
|
||||||
|
};
|
||||||
|
})(defaultMsg, status);
|
||||||
|
|
||||||
|
Util.inherits(error, exports.HttpError);
|
||||||
|
|
||||||
|
var className = toCamelCase(defaultMsg);
|
||||||
|
exports[className] = error;
|
||||||
|
exports[status] = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toCamelCase(str) {
|
||||||
|
return str.toLowerCase().replace(/(?:(^.)|(\s+.))/g, function(match) {
|
||||||
|
return match.charAt(match.length-1).toUpperCase();
|
||||||
|
});
|
||||||
|
}
|
295
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/generate.js
generated
vendored
Executable file
|
@ -0,0 +1,295 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
/** section: github, internal
|
||||||
|
* class ApiGenerator
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <mike@c9.io>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Fs = require("fs");
|
||||||
|
var Path = require("path");
|
||||||
|
|
||||||
|
var Optimist = require("optimist");
|
||||||
|
var Util = require("./util");
|
||||||
|
|
||||||
|
var IndexTpl = Fs.readFileSync(__dirname + "/templates/index.js.tpl", "utf8");
|
||||||
|
var SectionTpl = Fs.readFileSync(__dirname + "/templates/section.js.tpl", "utf8");
|
||||||
|
var HandlerTpl = Fs.readFileSync(__dirname + "/templates/handler.js.tpl", "utf8");
|
||||||
|
var AfterRequestTpl = Fs.readFileSync(__dirname + "/templates/after_request.js.tpl", "utf8");
|
||||||
|
var TestSectionTpl = Fs.readFileSync(__dirname + "/templates/test_section.js.tpl", "utf8");
|
||||||
|
var TestHandlerTpl = Fs.readFileSync(__dirname + "/templates/test_handler.js.tpl", "utf8");
|
||||||
|
|
||||||
|
var main = module.exports = function(versions, tests, restore) {
|
||||||
|
Util.log("Generating for versions", Object.keys(versions));
|
||||||
|
|
||||||
|
Object.keys(versions).forEach(function(version) {
|
||||||
|
var dir = Path.join(__dirname, "api", version);
|
||||||
|
|
||||||
|
// If we're in restore mode, move .bak file back to their original position
|
||||||
|
// and short-circuit.
|
||||||
|
if (restore) {
|
||||||
|
var bakRE = /\.bak$/;
|
||||||
|
var files = Fs.readdirSync(dir).filter(function(file) {
|
||||||
|
return bakRE.test(file);
|
||||||
|
}).forEach(function(file) {
|
||||||
|
var from = Path.join(dir, file);
|
||||||
|
var to = Path.join(dir, file.replace(/\.bak$/, ""));
|
||||||
|
Fs.renameSync(from, to);
|
||||||
|
Util.log("Restored '" + file + "' (" + version + ")");
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var routes = versions[version];
|
||||||
|
var defines = routes.defines;
|
||||||
|
delete routes.defines;
|
||||||
|
var headers = defines["response-headers"];
|
||||||
|
// cast header names to lowercase.
|
||||||
|
if (headers && headers.length)
|
||||||
|
headers = headers.map(function(header) { return header.toLowerCase(); });
|
||||||
|
var sections = {};
|
||||||
|
var testSections = {};
|
||||||
|
|
||||||
|
function createComment(paramsStruct, section, funcName, indent) {
|
||||||
|
var params = Object.keys(paramsStruct);
|
||||||
|
var comment = [
|
||||||
|
indent + "/** section: github",
|
||||||
|
indent + " * " + section + "#" + funcName + "(msg, callback) -> null",
|
||||||
|
indent + " * - msg (Object): Object that contains the parameters and their values to be sent to the server.",
|
||||||
|
indent + " * - callback (Function): function to call when the request is finished " +
|
||||||
|
"with an error as first argument and result data as second argument.",
|
||||||
|
indent + " *",
|
||||||
|
indent + " * ##### Params on the `msg` object:",
|
||||||
|
indent + " *"
|
||||||
|
];
|
||||||
|
comment.push(indent + " * - headers (Object): Optional. Key/ value pair "
|
||||||
|
+ "of request headers to pass along with the HTTP request. Valid headers are: "
|
||||||
|
+ "'" + defines["request-headers"].join("', '") + "'.");
|
||||||
|
if (!params.length)
|
||||||
|
comment.push(indent + " * No other params, simply pass an empty Object literal `{}`");
|
||||||
|
var paramName, def, line;
|
||||||
|
for (var i = 0, l = params.length; i < l; ++i) {
|
||||||
|
paramName = params[i];
|
||||||
|
if (paramName.charAt(0) == "$") {
|
||||||
|
paramName = paramName.substr(1);
|
||||||
|
if (!defines.params[paramName]) {
|
||||||
|
Util.log("Invalid variable parameter name substitution; param '" +
|
||||||
|
paramName + "' not found in defines block", "fatal");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
def = defines.params[paramName];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
def = paramsStruct[paramName];
|
||||||
|
|
||||||
|
line = indent + " * - " + paramName + " (" + (def.type || "mixed") + "): " +
|
||||||
|
(def.required ? "Required. " : "Optional. ");
|
||||||
|
if (def.description)
|
||||||
|
line += def.description;
|
||||||
|
if (def.validation)
|
||||||
|
line += " Validation rule: ` " + def.validation + " `.";
|
||||||
|
|
||||||
|
comment.push(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return comment.join("\n") + "\n" + indent + " **/";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getParams(paramsStruct, indent) {
|
||||||
|
var params = Object.keys(paramsStruct);
|
||||||
|
if (!params.length)
|
||||||
|
return "{}";
|
||||||
|
var values = [];
|
||||||
|
var paramName, def;
|
||||||
|
for (var i = 0, l = params.length; i < l; ++i) {
|
||||||
|
paramName = params[i];
|
||||||
|
if (paramName.charAt(0) == "$") {
|
||||||
|
paramName = paramName.substr(1);
|
||||||
|
if (!defines.params[paramName]) {
|
||||||
|
Util.log("Invalid variable parameter name substitution; param '" +
|
||||||
|
paramName + "' not found in defines block", "fatal");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
def = defines.params[paramName];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
def = paramsStruct[paramName];
|
||||||
|
|
||||||
|
values.push(indent + " " + paramName + ": \"" + def.type + "\"");
|
||||||
|
}
|
||||||
|
return "{\n" + values.join(",\n") + "\n" + indent + "}";
|
||||||
|
}
|
||||||
|
|
||||||
|
function prepareApi(struct, baseType) {
|
||||||
|
if (!baseType)
|
||||||
|
baseType = "";
|
||||||
|
|
||||||
|
Object.keys(struct).forEach(function(routePart) {
|
||||||
|
var block = struct[routePart];
|
||||||
|
if (!block)
|
||||||
|
return;
|
||||||
|
var messageType = baseType + "/" + routePart;
|
||||||
|
if (block.url && block.params) {
|
||||||
|
// we ended up at an API definition part!
|
||||||
|
var parts = messageType.split("/");
|
||||||
|
var section = Util.toCamelCase(parts[1].toLowerCase());
|
||||||
|
if (!block.method) {
|
||||||
|
throw new Error("No HTTP method specified for " + messageType +
|
||||||
|
"in section " + section);
|
||||||
|
}
|
||||||
|
|
||||||
|
parts.splice(0, 2);
|
||||||
|
var funcName = Util.toCamelCase(parts.join("-"));
|
||||||
|
var comment = createComment(block.params, section, funcName, " ");
|
||||||
|
|
||||||
|
// add the handler to the sections
|
||||||
|
if (!sections[section])
|
||||||
|
sections[section] = [];
|
||||||
|
|
||||||
|
var afterRequest = "";
|
||||||
|
if (headers && headers.length) {
|
||||||
|
afterRequest = AfterRequestTpl.replace("<%headers%>", "\"" +
|
||||||
|
headers.join("\", \"") + "\"");
|
||||||
|
}
|
||||||
|
sections[section].push(HandlerTpl
|
||||||
|
.replace("<%funcName%>", funcName)
|
||||||
|
.replace("<%comment%>", comment)
|
||||||
|
.replace("<%afterRequest%>", afterRequest)
|
||||||
|
);
|
||||||
|
|
||||||
|
// add test to the testSections
|
||||||
|
if (!testSections[section])
|
||||||
|
testSections[section] = [];
|
||||||
|
testSections[section].push(TestHandlerTpl
|
||||||
|
.replace("<%name%>", block.method + " " + block.url + " (" + funcName + ")")
|
||||||
|
.replace("<%funcName%>", section + "." + funcName)
|
||||||
|
.replace("<%params%>", getParams(block.params, " "))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// recurse into this block next:
|
||||||
|
prepareApi(block, messageType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.log("Converting routes to functions");
|
||||||
|
prepareApi(routes);
|
||||||
|
|
||||||
|
Util.log("Writing files to version dir");
|
||||||
|
var sectionNames = Object.keys(sections);
|
||||||
|
|
||||||
|
Util.log("Writing index.js file for version " + version);
|
||||||
|
Fs.writeFileSync(Path.join(dir, "index.js"),
|
||||||
|
IndexTpl
|
||||||
|
.replace("<%name%>", defines.constants.name)
|
||||||
|
.replace("<%description%>", defines.constants.description)
|
||||||
|
.replace("<%scripts%>", "\"" + sectionNames.join("\", \"") + "\""),
|
||||||
|
"utf8");
|
||||||
|
|
||||||
|
Object.keys(sections).forEach(function(section) {
|
||||||
|
var def = sections[section];
|
||||||
|
Util.log("Writing '" + section + ".js' file for version " + version);
|
||||||
|
Fs.writeFileSync(Path.join(dir, section + ".js"), SectionTpl
|
||||||
|
.replace(/<%sectionName%>/g, section)
|
||||||
|
.replace("<%sectionBody%>", def.join("\n")),
|
||||||
|
"utf8"
|
||||||
|
);
|
||||||
|
|
||||||
|
// When we don't need to generate tests, bail out here.
|
||||||
|
if (!tests)
|
||||||
|
return;
|
||||||
|
|
||||||
|
def = testSections[section];
|
||||||
|
// test if previous tests already contained implementations by checking
|
||||||
|
// if the difference in character count between the current test file
|
||||||
|
// and the newly generated one is more than twenty characters.
|
||||||
|
var body = TestSectionTpl
|
||||||
|
.replace("<%version%>", version.replace("v", ""))
|
||||||
|
.replace(/<%sectionName%>/g, section)
|
||||||
|
.replace("<%testBody%>", def.join("\n\n"));
|
||||||
|
var path = Path.join(dir, section + "Test.js");
|
||||||
|
if (Fs.existsSync(path) && Math.abs(Fs.readFileSync(path, "utf8").length - body.length) >= 20) {
|
||||||
|
Util.log("Moving old test file to '" + path + ".bak' to preserve tests " +
|
||||||
|
"that were already implemented. \nPlease be sure te check this file " +
|
||||||
|
"and move all implemented tests back into the newly generated test!", "error");
|
||||||
|
Fs.renameSync(path, path + ".bak");
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.log("Writing test file for " + section + ", version " + version);
|
||||||
|
Fs.writeFileSync(path, body, "utf8");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!module.parent) {
|
||||||
|
var argv = Optimist
|
||||||
|
.wrap(80)
|
||||||
|
.usage("Generate the implementation of the node-github module, including "
|
||||||
|
+ "unit-test scaffolds.\nUsage: $0 [-r] [-v VERSION]")
|
||||||
|
.alias("r", "restore")
|
||||||
|
.describe("r", "Restore .bak files, generated by a previous run, to the original")
|
||||||
|
.alias("v", "version")
|
||||||
|
.describe("v", "Semantic version number of the API to generate. Example: '3.0.0'")
|
||||||
|
.alias("t", "tests")
|
||||||
|
.describe("t", "Also generate unit test scaffolds")
|
||||||
|
.alias("h", "help")
|
||||||
|
.describe("h", "Display this usage information")
|
||||||
|
.boolean(["r", "t", "h"])
|
||||||
|
.argv;
|
||||||
|
|
||||||
|
if (argv.help) {
|
||||||
|
Util.log(Optimist.help());
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
var baseDir = Path.join(__dirname, "api");
|
||||||
|
var availVersions = {};
|
||||||
|
Fs.readdirSync(baseDir).forEach(function(version) {
|
||||||
|
var path = Path.join(baseDir, version, "routes.json");
|
||||||
|
if (!Fs.existsSync(path))
|
||||||
|
return;
|
||||||
|
var routes;
|
||||||
|
try {
|
||||||
|
routes = JSON.parse(Fs.readFileSync(path, "utf8"));
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!routes.defines)
|
||||||
|
return;
|
||||||
|
availVersions[version] = routes;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!Object.keys(availVersions).length) {
|
||||||
|
Util.log("No versions available to generate.", "fatal");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
var versions = {};
|
||||||
|
if (argv.version) {
|
||||||
|
if (argv.version.charAt(0) != "v")
|
||||||
|
argv.version = argv.v = "v" + argv.version;
|
||||||
|
if (!availVersions[argv.version]) {
|
||||||
|
Util.log("Version '" + argv.version + "' is not available", "fatal");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
versions[argv.version] = availVersions[argv.version];
|
||||||
|
}
|
||||||
|
if (!Object.keys(versions).length) {
|
||||||
|
Util.log("No versions specified via the command line, generating for all available versions.");
|
||||||
|
versions = availVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
Util.log("Starting up...");
|
||||||
|
main(versions, argv.tests, argv.restore);
|
||||||
|
}
|
847
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/index.js
generated
vendored
Normal file
|
@ -0,0 +1,847 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./error");
|
||||||
|
var fs = require("fs");
|
||||||
|
var mime = require("mime");
|
||||||
|
var Util = require("./util");
|
||||||
|
var Url = require("url");
|
||||||
|
|
||||||
|
/** section: github
|
||||||
|
* class Client
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <mike@c9.io>
|
||||||
|
*
|
||||||
|
* [[Client]] can load any version of the [[github]] client API, with the
|
||||||
|
* requirement that a valid routes.json definition file is present in the
|
||||||
|
* `api/[VERSION]` directory and that the routes found in this file are
|
||||||
|
* implemented as well.
|
||||||
|
*
|
||||||
|
* Upon instantiation of the [[Client]] class, the routes.json file is loaded
|
||||||
|
* from the API version specified in the configuration and, parsed and from it
|
||||||
|
* the routes for HTTP requests are extracted. For each HTTP endpoint to the
|
||||||
|
* HTTP server, a method is generated which accepts a Javascript Object
|
||||||
|
* with parameters and an optional callback to be invoked when the API request
|
||||||
|
* returns from the server or when the parameters could not be validated.
|
||||||
|
*
|
||||||
|
* When an HTTP endpoint is processed and a method is generated as described
|
||||||
|
* above, [[Client]] also sets up parameter validation with the rules as
|
||||||
|
* defined in the routes.json. A full example that illustrates how this works
|
||||||
|
* is shown below:
|
||||||
|
*
|
||||||
|
* ##### Example
|
||||||
|
*
|
||||||
|
* First, we look at a listing of a sample routes.json routes definition file:
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* "defines": {
|
||||||
|
* "constants": {
|
||||||
|
* "name": "Github",
|
||||||
|
* "description": "A Node.JS module, which provides an object oriented wrapper for the GitHub v3 API.",
|
||||||
|
* "protocol": "https",
|
||||||
|
* "host": "api.github.com",
|
||||||
|
* "port": 443,
|
||||||
|
* "dateFormat": "YYYY-MM-DDTHH:MM:SSZ",
|
||||||
|
* "requestFormat": "json"
|
||||||
|
* },
|
||||||
|
* "response-headers": [
|
||||||
|
* "X-RateLimit-Limit",
|
||||||
|
* "X-RateLimit-Remaining",
|
||||||
|
* "Link"
|
||||||
|
* ],
|
||||||
|
* "params": {
|
||||||
|
* "files": {
|
||||||
|
* "type": "Json",
|
||||||
|
* "required": true,
|
||||||
|
* "validation": "",
|
||||||
|
* "invalidmsg": "",
|
||||||
|
* "description": "Files that make up this gist. The key of which should be a required string filename and the value another required hash with parameters: 'content'"
|
||||||
|
* },
|
||||||
|
* "user": {
|
||||||
|
* "type": "String",
|
||||||
|
* "required": true,
|
||||||
|
* "validation": "",
|
||||||
|
* "invalidmsg": "",
|
||||||
|
* "description": ""
|
||||||
|
* },
|
||||||
|
* "description": {
|
||||||
|
* "type": "String",
|
||||||
|
* "required": false,
|
||||||
|
* "validation": "",
|
||||||
|
* "invalidmsg": "",
|
||||||
|
* "description": ""
|
||||||
|
* },
|
||||||
|
* "page": {
|
||||||
|
* "type": "Number",
|
||||||
|
* "required": false,
|
||||||
|
* "validation": "^[0-9]+$",
|
||||||
|
* "invalidmsg": "",
|
||||||
|
* "description": "Page number of the results to fetch."
|
||||||
|
* },
|
||||||
|
* "per_page": {
|
||||||
|
* "type": "Number",
|
||||||
|
* "required": false,
|
||||||
|
* "validation": "^[0-9]+$",
|
||||||
|
* "invalidmsg": "",
|
||||||
|
* "description": "A custom page size up to 100. Default is 30."
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* },
|
||||||
|
*
|
||||||
|
* "gists": {
|
||||||
|
* "get-from-user": {
|
||||||
|
* "url": ":user/gists",
|
||||||
|
* "method": "GET",
|
||||||
|
* "params": {
|
||||||
|
* "$user": null,
|
||||||
|
* "$page": null,
|
||||||
|
* "$per_page": null
|
||||||
|
* }
|
||||||
|
* },
|
||||||
|
*
|
||||||
|
* "create": {
|
||||||
|
* "url": "/gists",
|
||||||
|
* "method": "POST",
|
||||||
|
* "params": {
|
||||||
|
* "$description": null,
|
||||||
|
* "public": {
|
||||||
|
* "type": "Boolean",
|
||||||
|
* "required": true,
|
||||||
|
* "validation": "",
|
||||||
|
* "invalidmsg": "",
|
||||||
|
* "description": ""
|
||||||
|
* },
|
||||||
|
* "$files": null
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* You probably noticed that the definition is quite verbose and the decision
|
||||||
|
* for its design was made to be verbose whilst still allowing for basic variable
|
||||||
|
* definitions and substitions for request parameters.
|
||||||
|
*
|
||||||
|
* There are two sections; 'defines' and 'gists' in this example.
|
||||||
|
*
|
||||||
|
* The `defines` section contains a list of `constants` that will be used by the
|
||||||
|
* [[Client]] to make requests to the right URL that hosts the API.
|
||||||
|
* The `gists` section defines the endpoints for calls to the API server, for
|
||||||
|
* gists specifically in this example, but the other API sections are defined in
|
||||||
|
* the exact same way.
|
||||||
|
* These definitions are parsed and methods are created that the client can call
|
||||||
|
* to make an HTTP request to the server.
|
||||||
|
* there is one endpoint defined: .
|
||||||
|
* In this example, the endpoint `gists/get-from-user` will be exposed as a member
|
||||||
|
* on the [[Client]] object and may be invoked with
|
||||||
|
*
|
||||||
|
* client.getFromUser({
|
||||||
|
* "user": "bob"
|
||||||
|
* }, function(err, ret) {
|
||||||
|
* // do something with the result here.
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // or to fetch a specfic page:
|
||||||
|
* client.getFromUser({
|
||||||
|
* "user": "bob",
|
||||||
|
* "page": 2,
|
||||||
|
* "per_page": 100
|
||||||
|
* }, function(err, ret) {
|
||||||
|
* // do something with the result here.
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* All the parameters as specified in the Object that is passed to the function
|
||||||
|
* as first argument, will be validated according to the rules in the `params`
|
||||||
|
* block of the route definition.
|
||||||
|
* Thus, in the case of the `user` parameter, according to the definition in
|
||||||
|
* the `params` block, it's a variable that first needs to be looked up in the
|
||||||
|
* `params` block of the `defines` section (at the top of the JSON file). Params
|
||||||
|
* that start with a `$` sign will be substituted with the param with the same
|
||||||
|
* name from the `defines/params` section.
|
||||||
|
* There we see that it is a required parameter (needs to hold a value). In other
|
||||||
|
* words, if the validation requirements are not met, an HTTP error is passed as
|
||||||
|
* first argument of the callback.
|
||||||
|
*
|
||||||
|
* Implementation Notes: the `method` is NOT case sensitive, whereas `url` is.
|
||||||
|
* The `url` parameter also supports denoting parameters inside it as follows:
|
||||||
|
*
|
||||||
|
* "get-from-user": {
|
||||||
|
* "url": ":user/gists",
|
||||||
|
* "method": "GET"
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
**/
|
||||||
|
var Client = module.exports = function(config) {
|
||||||
|
config.headers = config.headers || {};
|
||||||
|
this.config = config;
|
||||||
|
this.debug = Util.isTrue(config.debug);
|
||||||
|
|
||||||
|
this.version = config.version;
|
||||||
|
var cls = require("./api/v" + this.version);
|
||||||
|
this[this.version] = new cls(this);
|
||||||
|
|
||||||
|
var pathPrefix = "";
|
||||||
|
// Check if a prefix is passed in the config and strip any leading or trailing slashes from it.
|
||||||
|
if (typeof config.pathPrefix == "string") {
|
||||||
|
pathPrefix = "/" + config.pathPrefix.replace(/(^[\/]+|[\/]+$)/g, "");
|
||||||
|
this.config.pathPrefix = pathPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setupRoutes();
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
/**
|
||||||
|
* Client#setupRoutes() -> null
|
||||||
|
*
|
||||||
|
* Configures the routes as defined in a routes.json file of an API version
|
||||||
|
*
|
||||||
|
* [[Client#setupRoutes]] is invoked by the constructor, takes the
|
||||||
|
* contents of the JSON document that contains the definitions of all the
|
||||||
|
* available API routes and iterates over them.
|
||||||
|
*
|
||||||
|
* It first recurses through each definition block until it reaches an API
|
||||||
|
* endpoint. It knows that an endpoint is found when the `url` and `param`
|
||||||
|
* definitions are found as a direct member of a definition block.
|
||||||
|
* Then the availability of an implementation by the API is checked; if it's
|
||||||
|
* not present, this means that a portion of the API as defined in the routes.json
|
||||||
|
* file is not implemented properly, thus an exception is thrown.
|
||||||
|
* After this check, a method is attached to the [[Client]] instance
|
||||||
|
* and becomes available for use. Inside this method, the parameter validation
|
||||||
|
* and typecasting is done, according to the definition of the parameters in
|
||||||
|
* the `params` block, upon invocation.
|
||||||
|
*
|
||||||
|
* This mechanism ensures that the handlers ALWAYS receive normalized data
|
||||||
|
* that is of the correct format and type. JSON parameters are parsed, Strings
|
||||||
|
* are trimmed, Numbers and Floats are casted and checked for NaN after that.
|
||||||
|
*
|
||||||
|
* Note: Query escaping for usage with SQL products is something that can be
|
||||||
|
* implemented additionally by adding an additional parameter type.
|
||||||
|
**/
|
||||||
|
this.setupRoutes = function() {
|
||||||
|
var self = this;
|
||||||
|
var api = this[this.version];
|
||||||
|
var routes = api.routes;
|
||||||
|
var defines = routes.defines;
|
||||||
|
this.constants = defines.constants;
|
||||||
|
this.requestHeaders = defines["request-headers"].map(function(header) {
|
||||||
|
return header.toLowerCase();
|
||||||
|
});
|
||||||
|
delete routes.defines;
|
||||||
|
|
||||||
|
function trim(s) {
|
||||||
|
if (typeof s != "string")
|
||||||
|
return s;
|
||||||
|
return s.replace(/^[\s\t\r\n]+/, "").replace(/[\s\t\r\n]+$/, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseParams(msg, paramsStruct) {
|
||||||
|
var params = Object.keys(paramsStruct);
|
||||||
|
var paramName, def, value, type;
|
||||||
|
for (var i = 0, l = params.length; i < l; ++i) {
|
||||||
|
paramName = params[i];
|
||||||
|
if (paramName.charAt(0) == "$") {
|
||||||
|
paramName = paramName.substr(1);
|
||||||
|
if (!defines.params[paramName]) {
|
||||||
|
throw new error.BadRequest("Invalid variable parameter name substitution; param '" +
|
||||||
|
paramName + "' not found in defines block", "fatal");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
def = paramsStruct[paramName] = defines.params[paramName];
|
||||||
|
delete paramsStruct["$" + paramName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
def = paramsStruct[paramName];
|
||||||
|
|
||||||
|
value = trim(msg[paramName]);
|
||||||
|
if (typeof value != "boolean" && !value) {
|
||||||
|
// we don't need to validation for undefined parameter values
|
||||||
|
// that are not required.
|
||||||
|
if (!def.required || (def["allow-empty"] && value === ""))
|
||||||
|
continue;
|
||||||
|
throw new error.BadRequest("Empty value for parameter '" +
|
||||||
|
paramName + "': " + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate the value and type of parameter:
|
||||||
|
if (def.validation) {
|
||||||
|
if (!new RegExp(def.validation).test(value)) {
|
||||||
|
throw new error.BadRequest("Invalid value for parameter '" +
|
||||||
|
paramName + "': " + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def.type) {
|
||||||
|
type = def.type.toLowerCase();
|
||||||
|
if (type == "number") {
|
||||||
|
value = parseInt(value, 10);
|
||||||
|
if (isNaN(value)) {
|
||||||
|
throw new error.BadRequest("Invalid value for parameter '" +
|
||||||
|
paramName + "': " + msg[paramName] + " is NaN");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == "float") {
|
||||||
|
value = parseFloat(value);
|
||||||
|
if (isNaN(value)) {
|
||||||
|
throw new error.BadRequest("Invalid value for parameter '" +
|
||||||
|
paramName + "': " + msg[paramName] + " is NaN");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == "json") {
|
||||||
|
if (typeof value == "string") {
|
||||||
|
try {
|
||||||
|
value = JSON.parse(value);
|
||||||
|
}
|
||||||
|
catch(ex) {
|
||||||
|
throw new error.BadRequest("JSON parse error of value for parameter '" +
|
||||||
|
paramName + "': " + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == "date") {
|
||||||
|
value = new Date(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
msg[paramName] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function prepareApi(struct, baseType) {
|
||||||
|
if (!baseType)
|
||||||
|
baseType = "";
|
||||||
|
Object.keys(struct).forEach(function(routePart) {
|
||||||
|
var block = struct[routePart];
|
||||||
|
if (!block)
|
||||||
|
return;
|
||||||
|
var messageType = baseType + "/" + routePart;
|
||||||
|
if (block.url && block.params) {
|
||||||
|
// we ended up at an API definition part!
|
||||||
|
var endPoint = messageType.replace(/^[\/]+/g, "");
|
||||||
|
var parts = messageType.split("/");
|
||||||
|
var section = Util.toCamelCase(parts[1].toLowerCase());
|
||||||
|
parts.splice(0, 2);
|
||||||
|
var funcName = Util.toCamelCase(parts.join("-"));
|
||||||
|
|
||||||
|
if (!api[section]) {
|
||||||
|
throw new Error("Unsupported route section, not implemented in version " +
|
||||||
|
self.version + " for route '" + endPoint + "' and block: " +
|
||||||
|
JSON.stringify(block));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!api[section][funcName]) {
|
||||||
|
if (self.debug)
|
||||||
|
Util.log("Tried to call " + funcName);
|
||||||
|
throw new Error("Unsupported route, not implemented in version " +
|
||||||
|
self.version + " for route '" + endPoint + "' and block: " +
|
||||||
|
JSON.stringify(block));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self[section]) {
|
||||||
|
self[section] = {};
|
||||||
|
// add a utility function 'getFooApi()', which returns the
|
||||||
|
// section to which functions are attached.
|
||||||
|
self[Util.toCamelCase("get-" + section + "-api")] = function() {
|
||||||
|
return self[section];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
self[section][funcName] = function(msg, callback) {
|
||||||
|
try {
|
||||||
|
parseParams(msg, block.params);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
// when the message was sent to the client, we can
|
||||||
|
// reply with the error directly.
|
||||||
|
api.sendError(ex, block, msg, callback);
|
||||||
|
if (self.debug)
|
||||||
|
Util.log(ex.message, "fatal");
|
||||||
|
// on error, there's no need to continue.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
api[section][funcName].call(api, msg, block, callback);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// recurse into this block next:
|
||||||
|
prepareApi(block, messageType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareApi(routes);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#authenticate(options) -> null
|
||||||
|
* - options (Object): Object containing the authentication type and credentials
|
||||||
|
* - type (String): One of the following: `basic` or `oauth`
|
||||||
|
* - username (String): Github username
|
||||||
|
* - password (String): Password to your account
|
||||||
|
* - token (String): OAuth2 token
|
||||||
|
*
|
||||||
|
* Set an authentication method to have access to protected resources.
|
||||||
|
*
|
||||||
|
* ##### Example
|
||||||
|
*
|
||||||
|
* // basic
|
||||||
|
* github.authenticate({
|
||||||
|
* type: "basic",
|
||||||
|
* username: "mikedeboertest",
|
||||||
|
* password: "test1324"
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // or oauth
|
||||||
|
* github.authenticate({
|
||||||
|
* type: "oauth",
|
||||||
|
* token: "e5a4a27487c26e571892846366de023349321a73"
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // or oauth key/ secret
|
||||||
|
* github.authenticate({
|
||||||
|
* type: "oauth",
|
||||||
|
* key: "clientID",
|
||||||
|
* secret: "clientSecret"
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // or token
|
||||||
|
* github.authenticate({
|
||||||
|
* type: "token",
|
||||||
|
* token: "userToken",
|
||||||
|
* });
|
||||||
|
**/
|
||||||
|
this.authenticate = function(options) {
|
||||||
|
if (!options) {
|
||||||
|
this.auth = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!options.type || "basic|oauth|client|token".indexOf(options.type) === -1)
|
||||||
|
throw new Error("Invalid authentication type, must be 'basic', 'oauth' or 'client'");
|
||||||
|
if (options.type == "basic" && (!options.username || !options.password))
|
||||||
|
throw new Error("Basic authentication requires both a username and password to be set");
|
||||||
|
if (options.type == "oauth") {
|
||||||
|
if (!options.token && !(options.key && options.secret))
|
||||||
|
throw new Error("OAuth2 authentication requires a token or key & secret to be set");
|
||||||
|
}
|
||||||
|
if (options.type == "token" && !options.token)
|
||||||
|
throw new Error("Token authentication requires a token to be set");
|
||||||
|
|
||||||
|
this.auth = options;
|
||||||
|
};
|
||||||
|
|
||||||
|
function getPageLinks(link) {
|
||||||
|
if (typeof link == "object" && (link.link || link.meta.link))
|
||||||
|
link = link.link || link.meta.link;
|
||||||
|
|
||||||
|
var links = {};
|
||||||
|
if (typeof link != "string")
|
||||||
|
return links;
|
||||||
|
|
||||||
|
// link format:
|
||||||
|
// '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"'
|
||||||
|
link.replace(/<([^>]*)>;\s*rel="([\w]*)\"/g, function(m, uri, type) {
|
||||||
|
links[type] = uri;
|
||||||
|
});
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#hasNextPage(link) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
*
|
||||||
|
* Check if a request result contains a link to the next page
|
||||||
|
**/
|
||||||
|
this.hasNextPage = function(link) {
|
||||||
|
return getPageLinks(link).next;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#hasPreviousPage(link) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
*
|
||||||
|
* Check if a request result contains a link to the previous page
|
||||||
|
**/
|
||||||
|
this.hasPreviousPage = function(link) {
|
||||||
|
return getPageLinks(link).prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#hasLastPage(link) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
*
|
||||||
|
* Check if a request result contains a link to the last page
|
||||||
|
**/
|
||||||
|
this.hasLastPage = function(link) {
|
||||||
|
return getPageLinks(link).last;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#hasFirstPage(link) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
*
|
||||||
|
* Check if a request result contains a link to the first page
|
||||||
|
**/
|
||||||
|
this.hasFirstPage = function(link) {
|
||||||
|
return getPageLinks(link).first;
|
||||||
|
};
|
||||||
|
|
||||||
|
function getPage(link, which, callback) {
|
||||||
|
var url = getPageLinks(link)[which];
|
||||||
|
if (!url)
|
||||||
|
return callback(new error.NotFound("No " + which + " page found"));
|
||||||
|
|
||||||
|
var api = this[this.version];
|
||||||
|
var parsedUrl = Url.parse(url, true);
|
||||||
|
var block = {
|
||||||
|
url: parsedUrl.pathname,
|
||||||
|
method: "GET",
|
||||||
|
params: parsedUrl.query
|
||||||
|
};
|
||||||
|
this.httpSend(parsedUrl.query, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return api.sendError(err, null, parsedUrl.query, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
["x-ratelimit-limit", "x-ratelimit-remaining", "link"].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#getNextPage(link, callback) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* Get the next page, based on the contents of the `Link` header
|
||||||
|
**/
|
||||||
|
this.getNextPage = function(link, callback) {
|
||||||
|
getPage.call(this, link, "next", callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#getPreviousPage(link, callback) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* Get the previous page, based on the contents of the `Link` header
|
||||||
|
**/
|
||||||
|
this.getPreviousPage = function(link, callback) {
|
||||||
|
getPage.call(this, link, "prev", callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#getLastPage(link, callback) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* Get the last page, based on the contents of the `Link` header
|
||||||
|
**/
|
||||||
|
this.getLastPage = function(link, callback) {
|
||||||
|
getPage.call(this, link, "last", callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#getFirstPage(link, callback) -> null
|
||||||
|
* - link (mixed): response of a request or the contents of the Link header
|
||||||
|
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
|
||||||
|
*
|
||||||
|
* Get the first page, based on the contents of the `Link` header
|
||||||
|
**/
|
||||||
|
this.getFirstPage = function(link, callback) {
|
||||||
|
getPage.call(this, link, "first", callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
function getRequestFormat(hasBody, block) {
|
||||||
|
if (hasBody)
|
||||||
|
return block.requestFormat || this.constants.requestFormat;
|
||||||
|
|
||||||
|
return "query";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQueryAndUrl(msg, def, format, config) {
|
||||||
|
var url = def.url;
|
||||||
|
if (config.pathPrefix && url.indexOf(config.pathPrefix) !== 0) {
|
||||||
|
url = config.pathPrefix + def.url;
|
||||||
|
}
|
||||||
|
var ret = {
|
||||||
|
query: format == "json" ? {} : format == "raw" ? msg.data : []
|
||||||
|
};
|
||||||
|
if (!def || !def.params) {
|
||||||
|
ret.url = url;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(def.params).forEach(function(paramName) {
|
||||||
|
paramName = paramName.replace(/^[$]+/, "");
|
||||||
|
if (!(paramName in msg))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var isUrlParam = url.indexOf(":" + paramName) !== -1;
|
||||||
|
var valFormat = isUrlParam || format != "json" ? "query" : format;
|
||||||
|
var val;
|
||||||
|
if (valFormat != "json") {
|
||||||
|
if (typeof msg[paramName] == "object") {
|
||||||
|
try {
|
||||||
|
msg[paramName] = JSON.stringify(msg[paramName]);
|
||||||
|
val = encodeURIComponent(msg[paramName]);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
return Util.log("httpSend: Error while converting object to JSON: "
|
||||||
|
+ (ex.message || ex), "error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (def.params[paramName] && def.params[paramName].combined) {
|
||||||
|
// Check if this is a combined (search) string.
|
||||||
|
val = msg[paramName].split(/[\s\t\r\n]*\+[\s\t\r\n]*/)
|
||||||
|
.map(function(part) {
|
||||||
|
return encodeURIComponent(part);
|
||||||
|
})
|
||||||
|
.join("+");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
val = encodeURIComponent(msg[paramName]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
val = msg[paramName];
|
||||||
|
|
||||||
|
if (isUrlParam) {
|
||||||
|
url = url.replace(":" + paramName, val);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (format == "json")
|
||||||
|
ret.query[paramName] = val;
|
||||||
|
else if (format != "raw")
|
||||||
|
ret.query.push(paramName + "=" + val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ret.url = url;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client#httpSend(msg, block, callback) -> null
|
||||||
|
* - msg (Object): parameters to send as the request body
|
||||||
|
* - block (Object): parameter definition from the `routes.json` file that
|
||||||
|
* contains validation rules
|
||||||
|
* - callback (Function): function to be called when the request returns.
|
||||||
|
* If the the request returns with an error, the error is passed to
|
||||||
|
* the callback as its first argument (NodeJS-style).
|
||||||
|
*
|
||||||
|
* Send an HTTP request to the server and pass the result to a callback.
|
||||||
|
**/
|
||||||
|
this.httpSend = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
var method = block.method.toLowerCase();
|
||||||
|
var hasFileBody = block.hasFileBody;
|
||||||
|
var hasBody = !hasFileBody && ("head|get|delete".indexOf(method) === -1);
|
||||||
|
var format = getRequestFormat.call(this, hasBody, block);
|
||||||
|
var obj = getQueryAndUrl(msg, block, format, self.config);
|
||||||
|
var query = obj.query;
|
||||||
|
var url = this.config.url ? this.config.url + obj.url : obj.url;
|
||||||
|
|
||||||
|
var path = url;
|
||||||
|
var protocol = this.config.protocol || this.constants.protocol || "http";
|
||||||
|
var host = block.host || this.config.host || this.constants.host;
|
||||||
|
var port = this.config.port || this.constants.port || (protocol == "https" ? 443 : 80);
|
||||||
|
var proxyUrl;
|
||||||
|
if (this.config.proxy !== undefined) {
|
||||||
|
proxyUrl = this.config.proxy;
|
||||||
|
} else {
|
||||||
|
proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
||||||
|
}
|
||||||
|
if (proxyUrl) {
|
||||||
|
path = Url.format({
|
||||||
|
protocol: protocol,
|
||||||
|
hostname: host,
|
||||||
|
port: port,
|
||||||
|
pathname: path
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!/^(http|https):\/\//.test(proxyUrl))
|
||||||
|
proxyUrl = "https://" + proxyUrl;
|
||||||
|
|
||||||
|
var parsedUrl = Url.parse(proxyUrl);
|
||||||
|
protocol = parsedUrl.protocol.replace(":", "");
|
||||||
|
host = parsedUrl.hostname;
|
||||||
|
port = parsedUrl.port || (protocol == "https" ? 443 : 80);
|
||||||
|
}
|
||||||
|
if (!hasBody && query.length)
|
||||||
|
path += "?" + query.join("&");
|
||||||
|
|
||||||
|
var headers = {
|
||||||
|
"host": host,
|
||||||
|
"content-length": "0"
|
||||||
|
};
|
||||||
|
if (hasBody) {
|
||||||
|
if (format == "json")
|
||||||
|
query = JSON.stringify(query);
|
||||||
|
else if (format != "raw")
|
||||||
|
query = query.join("&");
|
||||||
|
headers["content-length"] = Buffer.byteLength(query, "utf8");
|
||||||
|
headers["content-type"] = format == "json"
|
||||||
|
? "application/json; charset=utf-8"
|
||||||
|
: format == "raw"
|
||||||
|
? "text/plain; charset=utf-8"
|
||||||
|
: "application/x-www-form-urlencoded; charset=utf-8";
|
||||||
|
}
|
||||||
|
if (this.auth) {
|
||||||
|
var basic;
|
||||||
|
switch (this.auth.type) {
|
||||||
|
case "oauth":
|
||||||
|
if (this.auth.token) {
|
||||||
|
path += (path.indexOf("?") === -1 ? "?" : "&") +
|
||||||
|
"access_token=" + encodeURIComponent(this.auth.token);
|
||||||
|
} else {
|
||||||
|
path += (path.indexOf("?") === -1 ? "?" : "&") +
|
||||||
|
"client_id=" + encodeURIComponent(this.auth.key) +
|
||||||
|
"&client_secret=" + encodeURIComponent(this.auth.secret);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "token":
|
||||||
|
headers.authorization = "token " + this.auth.token;
|
||||||
|
break;
|
||||||
|
case "basic":
|
||||||
|
basic = new Buffer(this.auth.username + ":" + this.auth.password, "ascii").toString("base64");
|
||||||
|
headers.authorization = "Basic " + basic;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function callCallback(err, result) {
|
||||||
|
if (callback) {
|
||||||
|
var cb = callback;
|
||||||
|
callback = undefined;
|
||||||
|
cb(err, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addCustomHeaders(customHeaders) {
|
||||||
|
Object.keys(customHeaders).forEach(function(header) {
|
||||||
|
var headerLC = header.toLowerCase();
|
||||||
|
if (self.requestHeaders.indexOf(headerLC) == -1)
|
||||||
|
return;
|
||||||
|
headers[headerLC] = customHeaders[header];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
addCustomHeaders(Util.extend(msg.headers || {}, this.config.headers));
|
||||||
|
|
||||||
|
if (!headers["user-agent"])
|
||||||
|
headers["user-agent"] = "NodeJS HTTP Client";
|
||||||
|
|
||||||
|
if (!("accept" in headers))
|
||||||
|
headers.accept = this.config.requestMedia || this.constants.requestMedia;
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
host: host,
|
||||||
|
port: port,
|
||||||
|
path: path,
|
||||||
|
method: method,
|
||||||
|
headers: headers
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.config.rejectUnauthorized !== undefined)
|
||||||
|
options.rejectUnauthorized = this.config.rejectUnauthorized;
|
||||||
|
|
||||||
|
if (this.debug)
|
||||||
|
console.log("REQUEST: ", options);
|
||||||
|
|
||||||
|
function httpSendRequest() {
|
||||||
|
var req = require(protocol).request(options, function(res) {
|
||||||
|
if (self.debug) {
|
||||||
|
console.log("STATUS: " + res.statusCode);
|
||||||
|
console.log("HEADERS: " + JSON.stringify(res.headers));
|
||||||
|
}
|
||||||
|
res.setEncoding("utf8");
|
||||||
|
var data = "";
|
||||||
|
res.on("data", function(chunk) {
|
||||||
|
data += chunk;
|
||||||
|
});
|
||||||
|
res.on("error", function(err) {
|
||||||
|
callCallback(err);
|
||||||
|
});
|
||||||
|
res.on("end", function() {
|
||||||
|
if (res.statusCode >= 400 && res.statusCode < 600 || res.statusCode < 10) {
|
||||||
|
callCallback(new error.HttpError(data, res.statusCode));
|
||||||
|
} else {
|
||||||
|
res.data = data;
|
||||||
|
callCallback(null, res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var timeout = (block.timeout !== undefined) ? block.timeout : self.config.timeout;
|
||||||
|
if (timeout) {
|
||||||
|
req.setTimeout(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
req.on("error", function(e) {
|
||||||
|
if (self.debug)
|
||||||
|
console.log("problem with request: " + e.message);
|
||||||
|
callCallback(e.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on("timeout", function() {
|
||||||
|
if (self.debug)
|
||||||
|
console.log("problem with request: timed out");
|
||||||
|
callCallback(new error.GatewayTimeout());
|
||||||
|
});
|
||||||
|
|
||||||
|
// write data to request body
|
||||||
|
if (hasBody && query.length) {
|
||||||
|
if (self.debug)
|
||||||
|
console.log("REQUEST BODY: " + query + "\n");
|
||||||
|
req.write(query + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block.hasFileBody) {
|
||||||
|
var stream = fs.createReadStream(msg.filePath);
|
||||||
|
stream.pipe(req);
|
||||||
|
} else {
|
||||||
|
req.end();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (hasFileBody) {
|
||||||
|
fs.stat(msg.filePath, function(err, stat) {
|
||||||
|
if (err) {
|
||||||
|
callCallback(err);
|
||||||
|
} else {
|
||||||
|
headers["content-length"] = stat.size;
|
||||||
|
headers["content-type"] = mime.lookup(msg.name);
|
||||||
|
httpSendRequest();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
httpSendRequest();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}).call(Client.prototype);
|
0
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/.npmignore
generated
vendored
Normal file
19
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
90
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/README.md
generated
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
# mime
|
||||||
|
|
||||||
|
Comprehensive MIME type mapping API based on mime-db module.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Install with [npm](http://github.com/isaacs/npm):
|
||||||
|
|
||||||
|
npm install mime
|
||||||
|
|
||||||
|
## Contributing / Testing
|
||||||
|
|
||||||
|
npm run test
|
||||||
|
|
||||||
|
## Command Line
|
||||||
|
|
||||||
|
mime [path_string]
|
||||||
|
|
||||||
|
E.g.
|
||||||
|
|
||||||
|
> mime scripts/jquery.js
|
||||||
|
application/javascript
|
||||||
|
|
||||||
|
## API - Queries
|
||||||
|
|
||||||
|
### mime.lookup(path)
|
||||||
|
Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var mime = require('mime');
|
||||||
|
|
||||||
|
mime.lookup('/path/to/file.txt'); // => 'text/plain'
|
||||||
|
mime.lookup('file.txt'); // => 'text/plain'
|
||||||
|
mime.lookup('.TXT'); // => 'text/plain'
|
||||||
|
mime.lookup('htm'); // => 'text/html'
|
||||||
|
```
|
||||||
|
|
||||||
|
### mime.default_type
|
||||||
|
Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)
|
||||||
|
|
||||||
|
### mime.extension(type)
|
||||||
|
Get the default extension for `type`
|
||||||
|
|
||||||
|
```js
|
||||||
|
mime.extension('text/html'); // => 'html'
|
||||||
|
mime.extension('application/octet-stream'); // => 'bin'
|
||||||
|
```
|
||||||
|
|
||||||
|
### mime.charsets.lookup()
|
||||||
|
|
||||||
|
Map mime-type to charset
|
||||||
|
|
||||||
|
```js
|
||||||
|
mime.charsets.lookup('text/plain'); // => 'UTF-8'
|
||||||
|
```
|
||||||
|
|
||||||
|
(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
|
||||||
|
|
||||||
|
## API - Defining Custom Types
|
||||||
|
|
||||||
|
Custom type mappings can be added on a per-project basis via the following APIs.
|
||||||
|
|
||||||
|
### mime.define()
|
||||||
|
|
||||||
|
Add custom mime/extension mappings
|
||||||
|
|
||||||
|
```js
|
||||||
|
mime.define({
|
||||||
|
'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
|
||||||
|
'application/x-my-type': ['x-mt', 'x-mtt'],
|
||||||
|
// etc ...
|
||||||
|
});
|
||||||
|
|
||||||
|
mime.lookup('x-sft'); // => 'text/x-some-format'
|
||||||
|
```
|
||||||
|
|
||||||
|
The first entry in the extensions array is returned by `mime.extension()`. E.g.
|
||||||
|
|
||||||
|
```js
|
||||||
|
mime.extension('text/x-some-format'); // => 'x-sf'
|
||||||
|
```
|
||||||
|
|
||||||
|
### mime.load(filepath)
|
||||||
|
|
||||||
|
Load mappings from an Apache ".types" format file
|
||||||
|
|
||||||
|
```js
|
||||||
|
mime.load('./my_project.types');
|
||||||
|
```
|
||||||
|
The .types file format is simple - See the `types` dir for examples.
|
11
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/build/build.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
var db = require('mime-db');
|
||||||
|
|
||||||
|
var mapByType = {};
|
||||||
|
Object.keys(db).forEach(function(key) {
|
||||||
|
var extensions = db[key].extensions;
|
||||||
|
if (extensions) {
|
||||||
|
mapByType[key] = extensions;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(JSON.stringify(mapByType));
|
57
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/build/test.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
* Usage: node test.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
var mime = require('../mime');
|
||||||
|
var assert = require('assert');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test mime lookups
|
||||||
|
//
|
||||||
|
|
||||||
|
assert.equal('text/plain', mime.lookup('text.txt')); // normal file
|
||||||
|
assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase
|
||||||
|
assert.equal('text/plain', mime.lookup('dir/text.txt')); // dir + file
|
||||||
|
assert.equal('text/plain', mime.lookup('.text.txt')); // hidden file
|
||||||
|
assert.equal('text/plain', mime.lookup('.txt')); // nameless
|
||||||
|
assert.equal('text/plain', mime.lookup('txt')); // extension-only
|
||||||
|
assert.equal('text/plain', mime.lookup('/txt')); // extension-less ()
|
||||||
|
assert.equal('text/plain', mime.lookup('\\txt')); // Windows, extension-less
|
||||||
|
assert.equal('application/octet-stream', mime.lookup('text.nope')); // unrecognized
|
||||||
|
assert.equal('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test extensions
|
||||||
|
//
|
||||||
|
|
||||||
|
assert.equal('txt', mime.extension(mime.types.text));
|
||||||
|
assert.equal('html', mime.extension(mime.types.htm));
|
||||||
|
assert.equal('bin', mime.extension('application/octet-stream'));
|
||||||
|
assert.equal('bin', mime.extension('application/octet-stream '));
|
||||||
|
assert.equal('html', mime.extension(' text/html; charset=UTF-8'));
|
||||||
|
assert.equal('html', mime.extension('text/html; charset=UTF-8 '));
|
||||||
|
assert.equal('html', mime.extension('text/html; charset=UTF-8'));
|
||||||
|
assert.equal('html', mime.extension('text/html ; charset=UTF-8'));
|
||||||
|
assert.equal('html', mime.extension('text/html;charset=UTF-8'));
|
||||||
|
assert.equal('html', mime.extension('text/Html;charset=UTF-8'));
|
||||||
|
assert.equal(undefined, mime.extension('unrecognized'));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test node.types lookups
|
||||||
|
//
|
||||||
|
|
||||||
|
assert.equal('application/font-woff', mime.lookup('file.woff'));
|
||||||
|
assert.equal('application/octet-stream', mime.lookup('file.buffer'));
|
||||||
|
assert.equal('audio/mp4', mime.lookup('file.m4a'));
|
||||||
|
assert.equal('font/opentype', mime.lookup('file.otf'));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test charsets
|
||||||
|
//
|
||||||
|
|
||||||
|
assert.equal('UTF-8', mime.charsets.lookup('text/plain'));
|
||||||
|
assert.equal(undefined, mime.charsets.lookup(mime.types.js));
|
||||||
|
assert.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
|
||||||
|
|
||||||
|
console.log('\nAll tests passed');
|
8
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/cli.js
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
var mime = require('./mime.js');
|
||||||
|
var file = process.argv[2];
|
||||||
|
var type = mime.lookup(file);
|
||||||
|
|
||||||
|
process.stdout.write(type + '\n');
|
||||||
|
|
108
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/mime.js
generated
vendored
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
var path = require('path');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
function Mime() {
|
||||||
|
// Map of extension -> mime type
|
||||||
|
this.types = Object.create(null);
|
||||||
|
|
||||||
|
// Map of mime type -> extension
|
||||||
|
this.extensions = Object.create(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define mimetype -> extension mappings. Each key is a mime-type that maps
|
||||||
|
* to an array of extensions associated with the type. The first extension is
|
||||||
|
* used as the default extension for the type.
|
||||||
|
*
|
||||||
|
* e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
|
||||||
|
*
|
||||||
|
* @param map (Object) type definitions
|
||||||
|
*/
|
||||||
|
Mime.prototype.define = function (map) {
|
||||||
|
for (var type in map) {
|
||||||
|
var exts = map[type];
|
||||||
|
for (var i = 0; i < exts.length; i++) {
|
||||||
|
if (process.env.DEBUG_MIME && this.types[exts]) {
|
||||||
|
console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
|
||||||
|
this.types[exts] + ' to ' + type);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.types[exts[i]] = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default extension is the first one we encounter
|
||||||
|
if (!this.extensions[type]) {
|
||||||
|
this.extensions[type] = exts[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load an Apache2-style ".types" file
|
||||||
|
*
|
||||||
|
* This may be called multiple times (it's expected). Where files declare
|
||||||
|
* overlapping types/extensions, the last file wins.
|
||||||
|
*
|
||||||
|
* @param file (String) path of file to load.
|
||||||
|
*/
|
||||||
|
Mime.prototype.load = function(file) {
|
||||||
|
this._loading = file;
|
||||||
|
// Read file and split into lines
|
||||||
|
var map = {},
|
||||||
|
content = fs.readFileSync(file, 'ascii'),
|
||||||
|
lines = content.split(/[\r\n]+/);
|
||||||
|
|
||||||
|
lines.forEach(function(line) {
|
||||||
|
// Clean up whitespace/comments, and split into fields
|
||||||
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
|
||||||
|
map[fields.shift()] = fields;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.define(map);
|
||||||
|
|
||||||
|
this._loading = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup a mime type based on extension
|
||||||
|
*/
|
||||||
|
Mime.prototype.lookup = function(path, fallback) {
|
||||||
|
var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase();
|
||||||
|
|
||||||
|
return this.types[ext] || fallback || this.default_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return file extension associated with a mime type
|
||||||
|
*/
|
||||||
|
Mime.prototype.extension = function(mimeType) {
|
||||||
|
var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
|
||||||
|
return this.extensions[type];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Default instance
|
||||||
|
var mime = new Mime();
|
||||||
|
|
||||||
|
// Define built-in types
|
||||||
|
mime.define(require('./types.json'));
|
||||||
|
|
||||||
|
// Default type
|
||||||
|
mime.default_type = mime.lookup('bin');
|
||||||
|
|
||||||
|
//
|
||||||
|
// Additional API specific to the default instance
|
||||||
|
//
|
||||||
|
|
||||||
|
mime.Mime = Mime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup a charset based on mime type.
|
||||||
|
*/
|
||||||
|
mime.charsets = {
|
||||||
|
lookup: function(mimeType, fallback) {
|
||||||
|
// Assume text types are utf8
|
||||||
|
return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = mime;
|
73
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/package.json
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
"author": {
|
||||||
|
"name": "Robert Kieffer",
|
||||||
|
"email": "robert@broofa.com",
|
||||||
|
"url": "http://github.com/broofa"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"prepublish": "node build/build.js > types.json",
|
||||||
|
"test": "node build/test.js"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"mime": "cli.js"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Benjamin Thomas",
|
||||||
|
"email": "benjamin@benjaminthomas.org",
|
||||||
|
"url": "http://github.com/bentomas"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A comprehensive library for mime-type mapping",
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"type": "MIT",
|
||||||
|
"url": "https://raw.github.com/broofa/node-mime/master/LICENSE"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"mime-db": "^1.2.0"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"util",
|
||||||
|
"mime"
|
||||||
|
],
|
||||||
|
"main": "mime.js",
|
||||||
|
"name": "mime",
|
||||||
|
"repository": {
|
||||||
|
"url": "git+https://github.com/broofa/node-mime.git",
|
||||||
|
"type": "git"
|
||||||
|
},
|
||||||
|
"version": "1.3.4",
|
||||||
|
"gitHead": "1628f6e0187095009dcef4805c3a49706f137974",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/broofa/node-mime/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/broofa/node-mime",
|
||||||
|
"_id": "mime@1.3.4",
|
||||||
|
"_shasum": "115f9e3b6b3daf2959983cb38f149a2d40eb5d53",
|
||||||
|
"_from": "mime@>=1.2.11 <2.0.0",
|
||||||
|
"_npmVersion": "1.4.28",
|
||||||
|
"_npmUser": {
|
||||||
|
"name": "broofa",
|
||||||
|
"email": "robert@broofa.com"
|
||||||
|
},
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "broofa",
|
||||||
|
"email": "robert@broofa.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bentomas",
|
||||||
|
"email": "benjamin@benjaminthomas.org"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dist": {
|
||||||
|
"shasum": "115f9e3b6b3daf2959983cb38f149a2d40eb5d53",
|
||||||
|
"tarball": "http://registry.npmjs.org/mime/-/mime-1.3.4.tgz"
|
||||||
|
},
|
||||||
|
"directories": {},
|
||||||
|
"_resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
|
}
|
1
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/node_modules/mime/types.json
generated
vendored
Normal file
70
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/package.json
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
"name": "github",
|
||||||
|
"version": "0.2.4",
|
||||||
|
"description": "NodeJS wrapper for the GitHub API",
|
||||||
|
"author": {
|
||||||
|
"name": "Mike de Boer",
|
||||||
|
"email": "info@mikedeboer.nl"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Mike de Boer",
|
||||||
|
"email": "info@mikedeboer.nl"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Fabian Jakobs",
|
||||||
|
"email": "fabian@c9.io"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"homepage": "http://github.com/mikedeboer/node-github",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+ssh://git@github.com/mikedeboer/node-github.git"
|
||||||
|
},
|
||||||
|
"engine": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"mime": "^1.2.11"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"oauth": "~0.9.7",
|
||||||
|
"optimist": "~0.6.0",
|
||||||
|
"mocha": "~1.13.0"
|
||||||
|
},
|
||||||
|
"main": ".",
|
||||||
|
"scripts": {
|
||||||
|
"test": "node ./test/all.js"
|
||||||
|
},
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"type": "The MIT License",
|
||||||
|
"url": "http://www.opensource.org/licenses/mit-license.php"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"gitHead": "29dedb3022649c27ac1dad79326270b6b2a48047",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/mikedeboer/node-github/issues"
|
||||||
|
},
|
||||||
|
"_id": "github@0.2.4",
|
||||||
|
"_shasum": "24fa7f0e13fa11b946af91134c51982a91ce538b",
|
||||||
|
"_from": "github@*",
|
||||||
|
"_npmVersion": "1.4.21",
|
||||||
|
"_npmUser": {
|
||||||
|
"name": "mikedeboer",
|
||||||
|
"email": "info@mikedeboer.nl"
|
||||||
|
},
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "mikedeboer",
|
||||||
|
"email": "info@mikedeboer.nl"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dist": {
|
||||||
|
"shasum": "24fa7f0e13fa11b946af91134c51982a91ce538b",
|
||||||
|
"tarball": "http://registry.npmjs.org/github/-/github-0.2.4.tgz"
|
||||||
|
},
|
||||||
|
"directories": {},
|
||||||
|
"_resolved": "https://registry.npmjs.org/github/-/github-0.2.4.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
|
}
|
5
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/seed.yml
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
name: node-github
|
||||||
|
description: NodeJS wrapper for the GitHub API
|
||||||
|
tags: git github web
|
||||||
|
version: 0.2.4
|
11
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/templates/after_request.js.tpl
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
ret = {};
|
||||||
|
if (typeof ret == "object") {
|
||||||
|
if (!ret.meta)
|
||||||
|
ret.meta = {};
|
||||||
|
[<%headers%>].forEach(function(header) {
|
||||||
|
if (res.headers[header])
|
||||||
|
ret.meta[header] = res.headers[header];
|
||||||
|
});
|
||||||
|
}
|
24
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/templates/handler.js.tpl
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<%comment%>
|
||||||
|
this.<%funcName%> = function(msg, block, callback) {
|
||||||
|
var self = this;
|
||||||
|
this.client.httpSend(msg, block, function(err, res) {
|
||||||
|
if (err)
|
||||||
|
return self.sendError(err, null, msg, callback);
|
||||||
|
|
||||||
|
var ret;
|
||||||
|
try {
|
||||||
|
ret = res.data;
|
||||||
|
var contentType = res.headers["content-type"];
|
||||||
|
if (contentType && contentType.indexOf("application/json") !== -1)
|
||||||
|
ret = JSON.parse(ret);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
if (callback)
|
||||||
|
callback(new error.InternalServerError(ex.message), res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
<%afterRequest%>
|
||||||
|
if (callback)
|
||||||
|
callback(null, ret);
|
||||||
|
});
|
||||||
|
};
|
40
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/templates/index.js.tpl
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/**
|
||||||
|
* class <%name%>
|
||||||
|
*
|
||||||
|
* <%description%>
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Fs = require("fs");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
var error = require("./../../error");
|
||||||
|
|
||||||
|
var GithubHandler = module.exports = function(client) {
|
||||||
|
this.client = client;
|
||||||
|
this.routes = JSON.parse(Fs.readFileSync(__dirname + "/routes.json", "utf8"));
|
||||||
|
};
|
||||||
|
|
||||||
|
var proto = {
|
||||||
|
sendError: function(err, block, msg, callback) {
|
||||||
|
if (this.client.debug)
|
||||||
|
Util.log(err, block, msg.user, "error");
|
||||||
|
if (typeof err == "string")
|
||||||
|
err = new error.InternalServerError(err);
|
||||||
|
if (callback)
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
[<%scripts%>].forEach(function(api) {
|
||||||
|
Util.extend(proto, require("./" + api));
|
||||||
|
});
|
||||||
|
|
||||||
|
GithubHandler.prototype = proto;
|
23
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/templates/section.js.tpl
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/**
|
||||||
|
* mixin <%sectionName%>
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var error = require("./../../error");
|
||||||
|
var Util = require("./../../util");
|
||||||
|
|
||||||
|
var <%sectionName%> = module.exports = {
|
||||||
|
<%sectionName%>: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
<%sectionBody%>
|
||||||
|
}).call(<%sectionName%>.<%sectionName%>);
|
10
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/templates/test_handler.js.tpl
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
it("should successfully execute <%name%>", function(next) {
|
||||||
|
client.<%funcName%>(
|
||||||
|
<%params%>,
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
// other assertions go here
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
30
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/templates/test_section.js.tpl
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../../index");
|
||||||
|
|
||||||
|
describe("[<%sectionName%>]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "<%version%>"
|
||||||
|
});
|
||||||
|
client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
<%testBody%>
|
||||||
|
});
|
62
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/test/client_test.js
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <mike@c9.io>
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Assert = require("assert");
|
||||||
|
var Client = require("./../index");
|
||||||
|
|
||||||
|
describe("[client]", function() {
|
||||||
|
var client;
|
||||||
|
var token = "e5a4a27487c26e571892846366de023349321a73";
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
client = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
/*client.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: token
|
||||||
|
});*/
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should successfully execute GET /authorizations (getAll)", function(next) {
|
||||||
|
// `aseemk` has two pages of followers right now.
|
||||||
|
client.user.getFollowers(
|
||||||
|
{
|
||||||
|
user: "aseemk"
|
||||||
|
},
|
||||||
|
function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
Assert.ok(!!client.hasNextPage(res));
|
||||||
|
Assert.ok(!!client.hasLastPage(res));
|
||||||
|
Assert.ok(!client.hasPreviousPage(res));
|
||||||
|
|
||||||
|
client.getNextPage(res, function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
Assert.ok(!!client.hasPreviousPage(res));
|
||||||
|
Assert.ok(!!client.hasFirstPage(res));
|
||||||
|
Assert.ok(!client.hasNextPage(res));
|
||||||
|
Assert.ok(!client.hasLastPage(res));
|
||||||
|
|
||||||
|
client.getPreviousPage(res.meta.link, function(err, res) {
|
||||||
|
Assert.equal(err, null);
|
||||||
|
|
||||||
|
Assert.ok(!!client.hasNextPage(res));
|
||||||
|
Assert.ok(!!client.hasLastPage(res));
|
||||||
|
Assert.ok(!client.hasPreviousPage(res));
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
37
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/test/example.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/** section: github, internal
|
||||||
|
* Example
|
||||||
|
*
|
||||||
|
* Github API usage example.
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <mike@c9.io>
|
||||||
|
**/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Client = require("./../index");
|
||||||
|
|
||||||
|
var github = new Client({
|
||||||
|
debug: true,
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
|
||||||
|
github.authenticate({
|
||||||
|
type: "basic",
|
||||||
|
username: "mikedeboer",
|
||||||
|
password: "mysecretpass"
|
||||||
|
});
|
||||||
|
|
||||||
|
github.user.get({}, function(err, res) {
|
||||||
|
console.log("GOT ERR?", err);
|
||||||
|
console.log("GOT RES?", res);
|
||||||
|
|
||||||
|
github.repos.getAll({}, function(err, res) {
|
||||||
|
console.log("GOT ERR?", err);
|
||||||
|
console.log("GOT RES?", res);
|
||||||
|
});
|
||||||
|
});
|
95
.vscode/extensions/codezombiech.gitignore-0.2.0/node_modules/github/test/oauth.js
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/** section: github, internal
|
||||||
|
* OAuth
|
||||||
|
*
|
||||||
|
* OAuth usage example.
|
||||||
|
*
|
||||||
|
* Copyright 2012 Cloud9 IDE, Inc.
|
||||||
|
*
|
||||||
|
* This product includes software developed by
|
||||||
|
* Cloud9 IDE, Inc (http://c9.io).
|
||||||
|
*
|
||||||
|
* Author: Mike de Boer <mike@c9.io>
|
||||||
|
**/
|
||||||
|
|
||||||
|
var http = require("http");
|
||||||
|
var Url = require("url");
|
||||||
|
var querystring = require("querystring");
|
||||||
|
|
||||||
|
var Client = require("../index");
|
||||||
|
var OAuth2 = require("oauth").OAuth2;
|
||||||
|
|
||||||
|
var github = new Client({
|
||||||
|
version: "3.0.0"
|
||||||
|
});
|
||||||
|
|
||||||
|
var clientId = "e8c434a1c92e9de7ff8d";
|
||||||
|
var secret = "1d0fcbb060e1dd86a0aa3d12265419c9bb19a333";
|
||||||
|
var oauth = new OAuth2(clientId, secret, "https://github.com/", "login/oauth/authorize", "login/oauth/access_token");
|
||||||
|
|
||||||
|
// for demo purposes use one global access token
|
||||||
|
// in production this has to be stored in a user session
|
||||||
|
var accessToken = "";
|
||||||
|
|
||||||
|
http.createServer(function(req, res) {
|
||||||
|
var url = Url.parse(req.url);
|
||||||
|
var path = url.pathname;
|
||||||
|
var query = querystring.parse(url.query);
|
||||||
|
|
||||||
|
if (path == "/" || path.match(/^\/user\/?$/)) {
|
||||||
|
// redirect to github if there is no access token
|
||||||
|
if (!accessToken) {
|
||||||
|
res.writeHead(303, {
|
||||||
|
Location: oauth.getAuthorizeUrl({
|
||||||
|
redirect_uri: 'http://localhost:7878/github-callback',
|
||||||
|
scope: "user,repo,gist"
|
||||||
|
})
|
||||||
|
});
|
||||||
|
res.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// use github API
|
||||||
|
github.user.get({}, function(err, user) {
|
||||||
|
if (err) {
|
||||||
|
res.writeHead(err.code);
|
||||||
|
res.end(err + "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.writeHead(200);
|
||||||
|
res.end(JSON.stringify(user));
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// URL called by github after authenticating
|
||||||
|
else if (path.match(/^\/github-callback\/?$/)) {
|
||||||
|
// upgrade the code to an access token
|
||||||
|
oauth.getOAuthAccessToken(query.code, {}, function (err, access_token, refresh_token) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
res.writeHead(500);
|
||||||
|
res.end(err + "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
accessToken = access_token;
|
||||||
|
|
||||||
|
// authenticate github API
|
||||||
|
github.authenticate({
|
||||||
|
type: "oauth",
|
||||||
|
token: accessToken
|
||||||
|
});
|
||||||
|
|
||||||
|
//redirect back
|
||||||
|
res.writeHead(303, {
|
||||||
|
Location: "/"
|
||||||
|
});
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res.writeHead(404);
|
||||||
|
res.end("404 - Not found");
|
||||||
|
}).listen(7878);
|
||||||
|
|
||||||
|
console.log("listening at http://localhost:7878");
|