Git Product home page Git Product logo

psgitlab's Introduction

An interface for administering GitLab from a Windows PC using PowerShell.

Build status

Installation

Find-Module -Name PSGitLab | Install-Module

Getting started

Before you start to use PSGitLab you need to

  • obtain your your personal access token
  • save your personal access token and the GitLab URL using Save-GitLabAPIConfiguration
Save-GitLabAPIConfiguration -Domain https://my-gitlab.example.com -Token "mPnTssWyBCMjxxxxxxxJQ"

Your configuration data are saved to the file "$env:appdata\PSGitLab\PSGitLabConfiguration.xml".

API Requests

If you think there is an GitLab API I missed make sure to request it as an issue. I added the API calls that I needed to get work done. You might need others. Let me know.

Contributing

Before issuing a Pull Request make sure to run the following code to make sure your not additions don't get kicked back.

.\build.ps1 -Task Pre-Commit

This will run your code against the PSScriptAnalyzer and Pester tests. If you're writing code against a specific function you can use Pester tags to check against just that one function.

Invoke-Pester -Tag get-gitlabproject

Milestones

Milestones will be used for code coverage. Each API call has it's own issue and each group of API calls will be categorized by the corresponding milestone.

Issues

If you find a bug, please let me know through the issue tracker. The more details you provide the better.

Contributors

psgitlab's People

Contributors

devblackops avatar eduardomourar avatar it-praktyk avatar kanjibates avatar lboening avatar lw-schick avatar markwragg avatar matt2005 avatar ngetchell avatar qmfrederik avatar robinmalik avatar terrapinstation avatar x-guardian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psgitlab's Issues

Get a single user

Single user

Get a single user.

For user

GET /users/:id

Parameters:

  • id (required) - The ID of a user
{
  "id": 1,
  "username": "john_smith",
  "name": "John Smith",
  "state": "active",
  "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
}

For admin

GET /users/:id

Parameters:

  • id (required) - The ID of a user
{
  "id": 1,
  "username": "john_smith",
  "email": "[email protected]",
  "name": "John Smith",
  "state": "active",
  "created_at": "2012-05-23T08:00:58Z",
  "bio": null,
  "skype": "",
  "linkedin": "",
  "twitter": "",
  "website_url": "",
  "extern_uid": "john.smith",
  "provider": "provider_name",
  "theme_id": 1,
  "color_scheme_id": 2,
  "is_admin": false,
  "can_create_group": true,
  "can_create_project": true,
  "projects_limit": 100
}

List SSH Keys for user

List SSH keys for user

Get a list of a specified user's SSH keys. Available only for admin

GET /users/:uid/keys

Parameters:

  • uid (required) - id of specified user

Add SSH Key

Add SSH key

Creates a new key owned by the currently authenticated user.

POST /user/keys

Parameters:

  • title (required) - new SSH Key's title
  • key (required) - new SSH key
{
  "created_at": "2015-01-21T17:44:33.512Z",
  "key": "ssh-dss AAAAB3NzaC1kc3MAAACBAMLrhYgI3atfrSD6KDas1b/3n6R/HP+bLaHHX6oh+L1vg31mdUqK0Ac/NjZoQunavoyzqdPYhFz9zzOezCrZKjuJDS3NRK9rspvjgM0xYR4d47oNZbdZbwkI4cTv/gcMlquRy0OvpfIvJtjtaJWMwTLtM5VhRusRuUlpH99UUVeXAAAAFQCVyX+92hBEjInEKL0v13c/egDCTQAAAIEAvFdWGq0ccOPbw4f/F8LpZqvWDydAcpXHV3thwb7WkFfppvm4SZte0zds1FJ+Hr8Xzzc5zMHe6J4Nlay/rP4ewmIW7iFKNBEYb/yWa+ceLrs+TfR672TaAgO6o7iSRofEq5YLdwgrwkMmIawa21FrZ2D9SPao/IwvENzk/xcHu7YAAACAQFXQH6HQnxOrw4dqf0NqeKy1tfIPxYYUZhPJfo9O0AmBW2S36pD2l14kS89fvz6Y1g8gN/FwFnRncMzlLY/hX70FSc/3hKBSbH6C6j8hwlgFKfizav21eS358JJz93leOakJZnGb8XlWvz1UJbwCsnR2VEY8Dz90uIk1l/UqHkA= loic@call",
  "title": "ABC",
  "id": 4
}

Will return created key with status 201 Created on success. If an
error occurs a 400 Bad Request is returned with a message explaining the error:

{
  "message": {
    "fingerprint": [
      "has already been taken"
    ],
    "key": [
      "has already been taken"
    ]
  }
}

Get Single Project

Get single project

Get a specific project, identified by project ID or NAMESPACE/PROJECT_NAME, which is owned by the authenticated user.
If using namespaced projects call make sure that the NAMESPACE/PROJECT_NAME is URL-encoded, eg. /api/v3/projects/diaspora%2Fdiaspora (where / is represented by %2F).

GET /projects/:id

Parameters:

  • id (required) - The ID or NAMESPACE/PROJECT_NAME of a project
{
  "id": 3,
  "description": null,
  "default_branch": "master",
  "public": false,
  "visibility_level": 0,
  "ssh_url_to_repo": "[email protected]:diaspora/diaspora-project-site.git",
  "http_url_to_repo": "http://example.com/diaspora/diaspora-project-site.git",
  "web_url": "http://example.com/diaspora/diaspora-project-site",
  "tag_list": [
    "example",
    "disapora project"
  ],
  "owner": {
    "id": 3,
    "name": "Diaspora",
    "created_at": "2013-09-30T13: 46: 02Z"
  },
  "name": "Diaspora Project Site",
  "name_with_namespace": "Diaspora / Diaspora Project Site",
  "path": "diaspora-project-site",
  "path_with_namespace": "diaspora/diaspora-project-site",
  "issues_enabled": true,
  "merge_requests_enabled": true,
  "wiki_enabled": true,
  "snippets_enabled": false,
  "created_at": "2013-09-30T13: 46: 02Z",
  "last_activity_at": "2013-09-30T13: 46: 02Z",
  "creator_id": 3,
  "namespace": {
    "created_at": "2013-09-30T13: 46: 02Z",
    "description": "",
    "id": 3,
    "name": "Diaspora",
    "owner_id": 1,
    "path": "diaspora",
    "updated_at": "2013-09-30T13: 46: 02Z"
  },
  "permissions": {
    "project_access": {
      "access_level": 10,
      "notification_level": 3
    },
    "group_access": {
      "access_level": 50,
      "notification_level": 3
    }
  },
  "archived": false,
  "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png"
}

Remove Project

Remove project

Removes a project including all associated resources (issues, merge requests etc.)

DELETE /projects/:id

Parameters:

  • id (required) - The ID of a project

Team members

Better Build Process

A consistent build process is something I should look into. Should do the following.

  • Invoke-Pester
  • Invoke-ScriptAnalyzer
  • Generate MAML help from markdown files #46
  • Update Module Version Number
  • Update FunctionsToExport
  • #48
  • Push to the PSGallery under certain conditions

Create A New Label

Create a new label

Creates a new label for given repository with given name and color.

POST /projects/:id/labels

Parameters:

  • id (required) - The ID of a project
  • name (required) - The name of the label
  • color (required) - Color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)

It returns 200 and the newly created label, if the operation succeeds.
If the label already exists, 409 and an error message is returned.
If label parameters are invalid, 400 and an explaining error message is returned.

Output Types

All Get-* functions should have an output type.

WebsiteURL Parameter Doesn't in New-GitLabUser

The URL is not added to the profile when running new-gitlabuser. Could be a web encoding issue since the characters in a URL could cause issues in JSON.

Note: Get-Gitlabuser retrieves the field if you set it in the web app.

Delete A Label

Delete a label

Deletes a label given by its name.

DELETE /projects/:id/labels
  • id (required) - The ID of a project
  • name (required) - The name of the label to be deleted

It returns 200 if the label successfully was deleted, 400 for wrong parameters
and 404 if the label does not exist.
In case of an error, additionally an error message is returned.

Create Project

Create project

Creates a new project owned by the authenticated user.

POST /projects

Parameters:

  • name (required) - new project name
  • path (optional) - custom repository name for new project. By default generated based on name
  • namespace_id (optional) - namespace for the new project (defaults to user)
  • description (optional) - short project description
  • issues_enabled (optional)
  • merge_requests_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • public (optional) - if true same as setting visibility_level = 20
  • visibility_level (optional)
  • import_url (optional)

Create Project for user

Create project for user

Creates a new project owned by the specified user. Available only for admins.

POST /projects/user/:user_id

Parameters:

  • user_id (required) - user_id of owner
  • name (required) - new project name
  • description (optional) - short project description
  • default_branch (optional) - 'master' by default
  • issues_enabled (optional)
  • merge_requests_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • public (optional) - if true same as setting visibility_level = 20
  • visibility_level (optional)
  • import_url (optional)

Delete SSH Key for current user

Delete SSH key for current user

Deletes key owned by currently authenticated user.
This is an idempotent function and calling it on a key that is already deleted
or not available results in 200 OK.

DELETE /user/keys/:id

Parameters:

  • id (required) - SSH key ID

List SSH Key

List SSH keys

Get a list of currently authenticated user's SSH keys.

GET /user/keys
[
  {
    "id": 1,
    "title": "Public key",
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
    "created_at": "2014-08-01T14:47:39.080Z"
  },
  {
    "id": 3,
    "title": "Another Public key",
    "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
    "created_at": "2014-08-01T14:47:39.080Z"
  }
]

Parameters:

  • none

User Deletion

User deletion

Deletes a user. Available only for administrators.
This is an idempotent function, calling this function for a non-existent user id
still returns a status code 200 OK.
The JSON response differs if the user was actually deleted or not.
In the former the user is returned and in the latter not.

DELETE /users/:id

Parameters:

  • id (required) - The ID of the user

Current User

Current user

Gets currently authenticated user.

GET /user
{
  "id": 1,
  "username": "john_smith",
  "email": "[email protected]",
  "name": "John Smith",
  "private_token": "dd34asd13as",
  "state": "active",
  "created_at": "2012-05-23T08:00:58Z",
  "bio": null,
  "skype": "",
  "linkedin": "",
  "twitter": "",
  "website_url": "",
  "theme_id": 1,
  "color_scheme_id": 2,
  "is_admin": false,
  "can_create_group": true,
  "can_create_project": true,
  "projects_limit": 100
}

Single SSH Key

Single SSH key

Get a single key.

GET /user/keys/:id

Parameters:

  • id (required) - The ID of an SSH key
{
  "id": 1,
  "title": "Public key",
  "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=",
  "created_at": "2014-08-01T14:47:39.080Z"
}

All Users

List users

Get a list of users.

This function takes pagination parameters page and per_page to restrict the list of users.

For normal users

GET /users
[
  {
    "id": 1,
    "username": "john_smith",
    "name": "John Smith",
    "state": "active",
    "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
  },
  {
    "id": 2,
    "username": "jack_smith",
    "name": "Jack Smith",
    "state": "blocked",
    "avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
  }
]

For admins

GET /users
[
  {
    "id": 1,
    "username": "john_smith",
    "email": "[email protected]",
    "name": "John Smith",
    "state": "active",
    "created_at": "2012-05-23T08:00:58Z",
    "bio": null,
    "skype": "",
    "linkedin": "",
    "twitter": "",
    "website_url": "",
    "extern_uid": "john.smith",
    "provider": "provider_name",
    "theme_id": 1,
    "color_scheme_id": 2,
    "is_admin": false,
    "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
    "can_create_group": true,
    "current_sign_in_at": "2014-03-19T13:12:15Z",
    "two_factor_enabled": true
  },
  {
    "id": 2,
    "username": "jack_smith",
    "email": "[email protected]",
    "name": "Jack Smith",
    "state": "blocked",
    "created_at": "2012-05-23T08:01:01Z",
    "bio": null,
    "skype": "",
    "linkedin": "",
    "twitter": "",
    "website_url": "",
    "extern_uid": "jack.smith",
    "provider": "provider_name",
    "theme_id": 1,
    "color_scheme_id": 3,
    "is_admin": false,
    "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
    "can_create_group": true,
    "can_create_project": true,
    "projects_limit": 100,
    "current_sign_in_at": "2014-03-19T17:54:13Z",
    "two_factor_enabled": false
  }
]

You can search for users by email or username with: /users?search=John

Also see def search query in app/models/user.rb.

Edit an Existing Label

Edit an existing label

Updates an existing label with new name or now color. At least one parameter
is required, to update the label.

PUT /projects/:id/labels

Parameters:

  • id (required) - The ID of a project
  • name (required) - The name of the existing label
  • new_name (optional) - The new name of the label
  • color (optional) - New color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)

On success, this method returns 200 with the updated label.
If required parameters are missing or parameters are invalid, 400 is returned.
If the label to be updated is missing, 404 is returned.
In case of an error, additionally an error message is returned.

PSGitLabConfiguration.xml need secure string

This need to be protected, it should not be in cleartext.
also the token should be using secure string, so it's also protected in memory.
this also for the SSH key then it's implemented.

Author Attribution

Right now my name is the only name on PSGitLab but I'd like to add others. I'd like to add the contributor's names to the following places:

  • README
  • Module Manifest
  • PSGallery

Let me know if you want your name added or just your GitHub handle. If you have any personal sites you'd like to have added I think the README would be a perfect place for it.

@TerrapinStation
@lw-schick

List Projects

List projects

Get a list of projects accessible by the authenticated user.

GET /projects

Parameters:

  • archived (optional) - if passed, limit by archived status
  • order_by (optional) - Return requests ordered by id, name, path, created_at, updated_at or last_activity_at fields. Default is created_at
  • sort (optional) - Return requests sorted in asc or desc order. Default is desc
  • search (optional) - Return list of authorized projects according to a search criteria
  • ci_enabled_first - Return projects ordered by ci_enabled flag. Projects with enabled GitLab CI go first
[
  {
    "id": 4,
    "description": null,
    "default_branch": "master",
    "public": false,
    "visibility_level": 0,
    "ssh_url_to_repo": "[email protected]:diaspora/diaspora-client.git",
    "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git",
    "web_url": "http://example.com/diaspora/diaspora-client",
    "tag_list": [
      "example",
      "disapora client"
    ],
    "owner": {
      "id": 3,
      "name": "Diaspora",
      "created_at": "2013-09-30T13: 46: 02Z"
    },
    "name": "Diaspora Client",
    "name_with_namespace": "Diaspora / Diaspora Client",
    "path": "diaspora-client",
    "path_with_namespace": "diaspora/diaspora-client",
    "issues_enabled": true,
    "merge_requests_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
    "created_at": "2013-09-30T13: 46: 02Z",
    "last_activity_at": "2013-09-30T13: 46: 02Z",
    "creator_id": 3,
    "namespace": {
      "created_at": "2013-09-30T13: 46: 02Z",
      "description": "",
      "id": 3,
      "name": "Diaspora",
      "owner_id": 1,
      "path": "diaspora",
      "updated_at": "2013-09-30T13: 46: 02Z"
    },
    "archived": false,
    "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png"
  },
  {
    "id": 6,
    "description": null,
    "default_branch": "master",
    "public": false,
    "visibility_level": 0,
    "ssh_url_to_repo": "[email protected]:brightbox/puppet.git",
    "http_url_to_repo": "http://example.com/brightbox/puppet.git",
    "web_url": "http://example.com/brightbox/puppet",
    "tag_list": [
      "example",
      "puppet"
    ],
    "owner": {
      "id": 4,
      "name": "Brightbox",
      "created_at": "2013-09-30T13:46:02Z"
    },
    "name": "Puppet",
    "name_with_namespace": "Brightbox / Puppet",
    "path": "puppet",
    "path_with_namespace": "brightbox/puppet",
    "issues_enabled": true,
    "merge_requests_enabled": true,
    "wiki_enabled": true,
    "snippets_enabled": false,
    "created_at": "2013-09-30T13:46:02Z",
    "last_activity_at": "2013-09-30T13:46:02Z",
    "creator_id": 3,
    "namespace": {
      "created_at": "2013-09-30T13:46:02Z",
      "description": "",
      "id": 4,
      "name": "Brightbox",
      "owner_id": 1,
      "path": "brightbox",
      "updated_at": "2013-09-30T13:46:02Z"
    },
    "archived": false,
    "avatar_url": null
  }
]

Add SSH Key for user

Add SSH key for user

Create new key owned by specified user. Available only for admin

POST /users/:id/keys

Parameters:

  • id (required) - id of specified user
  • title (required) - new SSH Key's title
  • key (required) - new SSH key

Will return created key with status 201 Created on success, or 404 Not found on fail.

API Aliases

The APIs don't follow the powershell parameter naming conventions but when piping you my need to match the website_url to WebsiteURL properties. Setting up aliases that match the api properties should fix this.

[UX] run build script without administrative privileges

When I run the build function without administrative privileges, i get the following errors:

C:\git\PSGitLab [master ≡]> .\build.ps1
Install-Module : Zur Installation von Modulen in "C:\Program Files\WindowsPowerShell\Modules" sind Administratorrechte
erforderlich. Melden Sie sich unter einem Konto mit Administratorrechten beim Computer an, wiederholen Sie den
Vorgang, oder installieren Sie "C:\Users\leonhard.schick\Documents\WindowsPowerShell\Modules", indem Sie Ihrem Befehl
"-Scope CurrentUser" hinzufügen. Sie können auch versuchen, die Windows PowerShell-Sitzung mit erhöhten Rechten (Als
Administrator) auszuführen.
At C:\git\PSGitLab\build.ps1:39 char:17
+ ...               Install-Module -Name $ModuleName -Verbose:$false -Force
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ArgumentException
    + FullyQualifiedErrorId : InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser,Install-Module

Import-Module : The specified module 'BuildHelpers' was not loaded because no valid module file was found in any
module directory.
At C:\git\PSGitLab\build.ps1:40 char:17
+ ...             Import-Module -Name $ModuleName -Verbose:$false -Force -R ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (BuildHelpers:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Install-Module : Zur Installation von Modulen in "C:\Program Files\WindowsPowerShell\Modules" sind Administratorrechte
erforderlich. Melden Sie sich unter einem Konto mit Administratorrechten beim Computer an, wiederholen Sie den
Vorgang, oder installieren Sie "C:\Users\leonhard.schick\Documents\WindowsPowerShell\Modules", indem Sie Ihrem Befehl
"-Scope CurrentUser" hinzufügen. Sie können auch versuchen, die Windows PowerShell-Sitzung mit erhöhten Rechten (Als
Administrator) auszuführen.
At C:\git\PSGitLab\build.ps1:39 char:17
+ ...               Install-Module -Name $ModuleName -Verbose:$false -Force
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ArgumentException
    + FullyQualifiedErrorId : InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser,Install-Module

Import-Module : The specified module 'psake' was not loaded because no valid module file was found in any module
directory.
At C:\git\PSGitLab\build.ps1:40 char:17
+ ...             Import-Module -Name $ModuleName -Verbose:$false -Force -R ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (psake:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Install-Module : Zur Installation von Modulen in "C:\Program Files\WindowsPowerShell\Modules" sind Administratorrechte
erforderlich. Melden Sie sich unter einem Konto mit Administratorrechten beim Computer an, wiederholen Sie den
Vorgang, oder installieren Sie "C:\Users\leonhard.schick\Documents\WindowsPowerShell\Modules", indem Sie Ihrem Befehl
"-Scope CurrentUser" hinzufügen. Sie können auch versuchen, die Windows PowerShell-Sitzung mit erhöhten Rechten (Als
Administrator) auszuführen.
At C:\git\PSGitLab\build.ps1:39 char:17
+ ...               Install-Module -Name $ModuleName -Verbose:$false -Force
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ArgumentException
    + FullyQualifiedErrorId : InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser,Install-Module

Import-Module : The specified module 'Pester' was not loaded because no valid module file was found in any module
directory.
At C:\git\PSGitLab\build.ps1:40 char:17
+ ...             Import-Module -Name $ModuleName -Verbose:$false -Force -R ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (Pester:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Install-Module : Zur Installation von Modulen in "C:\Program Files\WindowsPowerShell\Modules" sind Administratorrechte
erforderlich. Melden Sie sich unter einem Konto mit Administratorrechten beim Computer an, wiederholen Sie den
Vorgang, oder installieren Sie "C:\Users\leonhard.schick\Documents\WindowsPowerShell\Modules", indem Sie Ihrem Befehl
"-Scope CurrentUser" hinzufügen. Sie können auch versuchen, die Windows PowerShell-Sitzung mit erhöhten Rechten (Als
Administrator) auszuführen.
At C:\git\PSGitLab\build.ps1:39 char:17
+ ...               Install-Module -Name $ModuleName -Verbose:$false -Force
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ArgumentException
    + FullyQualifiedErrorId : InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser,Install-Module

Import-Module : The specified module 'PSDeploy' was not loaded because no valid module file was found in any module
directory.
At C:\git\PSGitLab\build.ps1:40 char:17
+ ...             Import-Module -Name $ModuleName -Verbose:$false -Force -R ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (PSDeploy:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Install-Module : Zur Installation von Modulen in "C:\Program Files\WindowsPowerShell\Modules" sind Administratorrechte
erforderlich. Melden Sie sich unter einem Konto mit Administratorrechten beim Computer an, wiederholen Sie den
Vorgang, oder installieren Sie "C:\Users\leonhard.schick\Documents\WindowsPowerShell\Modules", indem Sie Ihrem Befehl
"-Scope CurrentUser" hinzufügen. Sie können auch versuchen, die Windows PowerShell-Sitzung mit erhöhten Rechten (Als
Administrator) auszuführen.
At C:\git\PSGitLab\build.ps1:39 char:17
+ ...               Install-Module -Name $ModuleName -Verbose:$false -Force
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Module], ArgumentException
    + FullyQualifiedErrorId : InstallModuleNeedsCurrentUserScopeParameterForNonAdminUser,Install-Module

Import-Module : The specified module 'PSScriptAnalyzer' was not loaded because no valid module file was found in any
module directory.
At C:\git\PSGitLab\build.ps1:40 char:17
+ ...             Import-Module -Name $ModuleName -Verbose:$false -Force -R ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (PSScriptAnalyzer:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Set-BuildEnvironment : The term 'Set-BuildEnvironment' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\git\PSGitLab\build.ps1:51 char:1
+ Set-BuildEnvironment
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-BuildEnvironment:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Invoke-psake : The term 'Invoke-psake' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\git\PSGitLab\build.ps1:53 char:1
+ Invoke-psake -buildFile "$PSScriptRoot\psake.ps1" -taskList $Task -no ...
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Invoke-psake:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

It would be nice when the build script would check first if i have administrative privileges and if not throws a single error.

Better README

The README should provide proper attribution to collaborators, examples on using the software, and much better documentation.

New User Password

There are password restrictions that don't meet the minimum length requirement. This should be easy to fix with parameter validation.

The only restriction I can find is that the password must be 8 characters in length.

User Creation

User creation

Creates a new user. Note only administrators can create new users.

POST /users

Parameters:

  • email (required) - Email
  • password (required) - Password
  • username (required) - Username
  • name (required) - Name
  • skype (optional) - Skype ID
  • linkedin (optional) - LinkedIn
  • twitter (optional) - Twitter account
  • website_url (optional) - Website URL
  • projects_limit (optional) - Number of projects user can create
  • extern_uid (optional) - External UID
  • provider (optional) - External provider name
  • bio (optional) - User's biography
  • admin (optional) - User is admin - true or false (default)
  • can_create_group (optional) - User can create groups - true or false
  • confirm (optional) - Require confirmation - true (default) or false

List Owned Projects

List owned projects

Get a list of projects which are owned by the authenticated user.

GET /projects/owned

Parameters:

  • archived (optional) - if passed, limit by archived status
  • order_by (optional) - Return requests ordered by id, name, path, created_at, updated_at or last_activity_at fields. Default is created_at
  • sort (optional) - Return requests sorted in asc or desc order. Default is desc
  • search (optional) - Return list of authorized projects according to a search criteria
  • ci_enabled_first - Return projects ordered by ci_enabled flag. Projects with enabled GitLab CI go first

Edit project

Edit project

Updates an existing project

PUT /projects/:id

Parameters:

  • id (required) - The ID of a project
  • name (optional) - project name
  • path (optional) - repository name for project
  • description (optional) - short project description
  • default_branch (optional)
  • issues_enabled (optional)
  • merge_requests_enabled (optional)
  • wiki_enabled (optional)
  • snippets_enabled (optional)
  • public (optional) - if true same as setting visibility_level = 20
  • visibility_level (optional)

On success, method returns 200 with the updated project. If parameters are
invalid, 400 is returned.

List All Projects

List ALL projects

Get a list of all GitLab projects (admin only).

GET /projects/all

Parameters:

  • archived (optional) - if passed, limit by archived status
  • order_by (optional) - Return requests ordered by id, name, path, created_at, updated_at or last_activity_at fields. Default is created_at
  • sort (optional) - Return requests sorted in asc or desc order. Default is desc
  • search (optional) - Return list of authorized projects according to a search criteria
  • ci_enabled_first - Return projects ordered by ci_enabled flag. Projects with enabled GitLab CI go first

Delete SSH Key for User

Delete SSH key for given user

Deletes key owned by a specified user. Available only for admin.

DELETE /users/:uid/keys/:id

Parameters:

  • uid (required) - id of specified user
  • id (required) - SSH key ID

Will return 200 OK on success, or 404 Not found if either user or key cannot be found.

Save Configuration

Configurations should be stored in the roaming appdata to travel with the user.

$env:appdata\PSGitLab\PSGitLabConfiguration.xml

Merge functions into .psm1

Build Script

$RootPath = get-item $psscriptroot
$ModuleName = ($rootPath.BaseName -split "-")[1]
$ModulePath = "$psscriptroot/$ModuleName"
$release = "$psscriptroot/Release/$ModuleName"
$PublicFunctions = @()
$AliasToExports = @()
$FileList = @()
$manifest = "$release$modulename.psd1"
if(test-path $release) {
Remove-Item -Recurse -Force -Confirm:$false -Path $release
}
new-item $release -Force -ItemType directory

copy-item "$ModulePath$modulename.psd1" $manifest -Force
$FileList += "$modulename.psd1"
$FileList += "$modulename.psm1"

"########################" | Add-Content "$release$ModuleName.psm1"
"### Public Functions ###" | Add-Content "$release$ModuleName.psm1"
"########################" | Add-Content "$release$ModuleName.psm1"
foreach($function in (get-childitem $ModulePath\Public\ -Recurse)) {
$PublicFunctions += $function.basename
$content = Get-Content $function.fullname
$content | Add-Content "$release$ModuleName.psm1"
if($content -match '[Alias(([^)]*)') {
foreach($alias in ($matches[1] -split ",") -replace ("`"",'')) {
$AliasToExports += $alias
}
}
}
"#########################" | Add-Content "$release$ModuleName.psm1"
"### Private Functions ###" | Add-Content "$release$ModuleName.psm1"
"#########################" | Add-Content "$release$ModuleName.psm1"
foreach($function in (get-childitem $ModulePath\Private\ -Recurse)) {
Get-Content $function.fullname | Add-Content "$release$ModuleName.psm1"
}

Update-ModuleManifest -Path $manifest -FunctionsToExport $PublicFunctions -AliasesToExport $AliasToExports -FileList $FileList

User Modification

User modification

Modifies an existing user. Only administrators can change attributes of a user.

PUT /users/:id

Parameters:

  • email - Email
  • username - Username
  • name - Name
  • password - Password
  • skype - Skype ID
  • linkedin - LinkedIn
  • twitter - Twitter account
  • website_url - Website URL
  • projects_limit - Limit projects each user can create
  • extern_uid - External UID
  • provider - External provider name
  • bio - User's biography
  • admin (optional) - User is admin - true or false (default)
  • can_create_group (optional) - User can create groups - true or false

Note, at the moment this method does only return a 404 error,
even in cases where a 409 (Conflict) would be more appropriate,
e.g. when renaming the email address to some existing one.

Test-GitLabAPI

Test-GitLabAPI
Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configuration is
not complete. Specify the UseBasicParsing parameter and try again.
At C:\Users\ngetchell\Documents\Git\PSGitLab\PSGitLab\Public\Configuration\Test-GitLabAPI.ps1:14 char:15

  • ... $Result = Invoke-WebRequest -Uri "$Domain/api/v3/projects?private_t ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
    • FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Fork Project

Fork project

Forks a project into the user namespace of the authenticated user.

POST /projects/fork/:id

Parameters:

  • id (required) - The ID of the project to be forked

[Security BUG] no URL escaping

The API does not use URL encoding f.e. in function Get-GitlabNamespace.

This could end up in erros f.e. when I search for chars like &?# (ok, maybe not the best example but this is an issue!

URL encoding can be done with

[uri]::EscapeDataString($myString)

List Labels

List labels

Get all labels for given project.

GET /projects/:id/labels
[
    {
        "name": "Awesome",
        "color": "#DD10AA"
    },
    {
        "name": "Documentation",
        "color": "#1E80DD"
    },
    {
        "name": "Feature",
        "color": "#11FF22"
    },
    {
        "name": "Bug",
        "color": "#EE1122"
    }
]

Get Project Events

Get project events

Get the events for the specified project.
Sorted from newest to latest

GET /projects/:id/events

Parameters:

  • id (required) - The ID or NAMESPACE/PROJECT_NAME of a project
[
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 830,
    "target_type": "Issue",
    "author_id": 1,
    "author_username": "john",
    "data": null,
    "target_title": "Public project search field"
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "opened",
    "target_id": null,
    "target_type": null,
    "author_id": 1,
    "author_username": "john",
    "data": {
      "before": "50d4420237a9de7be1304607147aec22e4a14af7",
      "after": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
      "ref": "refs/heads/master",
      "user_id": 1,
      "user_name": "Dmitriy Zaporozhets",
      "repository": {
        "name": "gitlabhq",
        "url": "[email protected]:gitlab/gitlabhq.git",
        "description": "GitLab: self hosted Git management software. \r\nDistributed under the MIT License.",
        "homepage": "https://dev.gitlab.org/gitlab/gitlabhq"
      },
      "commits": [
        {
          "id": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
          "message": "Add simple search to projects in public area",
          "timestamp": "2013-05-13T18:18:08+00:00",
          "url": "https://dev.gitlab.org/gitlab/gitlabhq/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428",
          "author": {
            "name": "Dmitriy Zaporozhets",
            "email": "[email protected]"
          }
        }
      ],
      "total_commits_count": 1
    },
    "target_title": null
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 840,
    "target_type": "Issue",
    "author_id": 1,
    "author_username": "john",
    "data": null,
    "target_title": "Finish & merge Code search PR"
  }
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.