Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-gitlab-api

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-gitlab-api

A deadly simple Vue.js plugin to consume GitLab API.

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

vue-gitlab-api

A deadly simple Vue.js plugin to consume GitLab API.

Using it

Install and import

npm install vue-gitlab-api

In your main application JS file (typically main.js if you are using vue-cli webpack template), simply use the plugin:

// vue-resource is needed too
import VueResource from 'vue-resource'
Vue.use(VueResource)

// import vue-gitlab-api
import GitLabAPI from 'vue-gitlab-api'
Vue.use(GitLabAPI, { url: 'https://gitlab.com', token: 'user Private Token' })

You can configure application wide options while Vue.use'ing this plugin:

NameDescription
urlyour GitLab instance URL (defaults to https://gitlab.com)
tokenyour GitLab private token use to connect to the API

Consume GitLab API

From anywhere now, you can simply consume GitLab API:

Vue.GitLabAPI.get('/projects', [], this.projects)

You can also use it in your .vue components with this.GitLabAPI:

this.GitLabAPI.get('/projects', [], this.projects)

Important: if you want to your filled-in variable this.projects to be reactive "the Vue.js way", you MUST define this variable as a data in your components or vues, with a default value of an empty array (read []):

<template>
  <div>
    Projects grabbed: {{ projectsCount }}
  </div>
</template>

<script>
export default {
  data () {
    return {
      // you MUST define it here first,
      // and it MUST be an empty array
      projects: []
    }
  },
  mounted: function () {
  	// then you can fill it that easy way
    this.GitLabAPI.get('/projects', [], this.projects)
  },
  computed: {
    projectsCount: function () {
      return this.projects.length
    }
  }
}
</script>

Methods

Here are the methods available through Vue.GitLabAPI

/**
 * Issue a GET request on 'GitLabAPI_url/api/v3' with params and a variable to fill in
 * @param  {String}   uri     The GitLab API uri to consume such as '/projects'
 * @param  {Object}   params  A parameters object such as { 'project_id': 72 }
 * @param  {Array}    fillIn  The Vue.js defined data to fill in with results from GitLab API
 * @param  {Function} errorCb A callback function in case of error (response is passed to callback)
 */
get: function (uri, params, fillIn, errorCb) {}

/**
 * Set application wide GitLabAPI token value
 * @param {String} newToken The new token value
 */
setToken: function (newToken) {}

/**
 * Set application wide GitLabAPI url value
 * @param {String} newUrl The new GitLab URL value
 */
setUrl: function (newUrl) {}

Contributing

Initial scaffolding was done with vue-cli webpack template. For detailed explanation on how things work, checkout the guide and docs for vue-loader.

Simply said, one can start working on its own customized version of vue-gitlab-api in no time:

# install dependencies
npm install

# run unit tests
npm run unit

# serve with hot reload at localhost:8080
npm run dev

What's next?

Without any obligation nor due date, one could expect to be done this non-exhaustive list of improvements grouped on issues labeled Feature.

You can read on the Changelog too, for historical and upcoming new features, changes, deprecations, removed features, bug and security fixes.

Support

Your are free to open an issue right in this GitLab repository whether you should be facing a problem or a bug. Please advise this is not a commercial product, so one could experience random response time. Positive, friendly and productive conversations are expected on the issues. Screenshots and steps to reproduce are highly appreciated. Chances are you may get your issue solved if you follow these simple guidelines.

Credits

License

The vue-gitlab-api plugin is distributed under the MIT License (MIT). Please have a look at the dependencies licenses if you plan on using, building, or distributing this plugin.

Keywords

FAQs

Package last updated on 25 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc