gitlab 0.5.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

GitLab API #

This is a dart library to communicate with the GitLab API v4.

This is still work in progress. We are happy about Merge Requests!

This library is already in production use, but it is missing a lot of calls and properties.

The calls that are present should be safe to use.

There are still tests missing for a lot of resources though.

Installation #

Simply add it to your project as a dependency:

dependencies:
  gitlab: any

Usage #

For the full documentation, and usage, please refer to the documentation.

License #

MIT

0.5.0 #

  • Introduced Notes API for Issues.
  • Introduced Discussion API for Issues.
  • Added assumeUtf8 to GitLab (optional, but activated by default) to parse responses correctly.

0.4.2 #

  • Upgrade dependencies

0.4.1 #

  • Fix type casting issue in issues.closedByMergeRequest()

0.4.0 #

  • Rename the Build class to Job in alignment with the GitLab API.
  • Add tests for .list() requests due to regression bug.

0.3.0 #

  • Make changes for dart 2.0.0 release.

0.2.3 #

  • Broaden the intl dependency to include 0.15.x

0.2.2 #

  • Broaden the SDK restriction to include everything up to 2.0.0.

0.2.1 #

  • Rename merge request get parameter to iid (was id before)

0.2.0 #

  • Switch to API version v4

0.1.3 #

  • Add labels to the merge requests
  • Add tests for merge requests

0.1.2 #

  • Introduce commit.createdAt

0.1.1 #

  • Add proper testing and refactor code base a bit

0.1.0 #

First version.

Introduces basic commands and most of the properties of the most important entities

example/example.dart

import 'package:gitlab/gitlab.dart';

const gitLabToken = 'my-secret-token';
const projectId = 123;

void main() async {
  final project = GitLab(gitLabToken).project(projectId);

  // List all commits that have been done in the last 24h
  final commits = await project.commits
      .list(since: new DateTime.now().subtract(new Duration(days: 1)));

  print(commits.first.message);

  /// The internal id of the merge request.
  final iid = 2;
  final mergeRequest = await project.mergeRequests.get(iid);

  print(mergeRequest.title);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  gitlab: ^0.5.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:gitlab/gitlab.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
38
Health:
Code health derived from static analysis. [more]
83
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
74
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Jan 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/gitlab.dart. (-5.36 points)

Analysis of lib/gitlab.dart reported 11 hints, including:

line 39 col 14: Unnecessary new keyword.

line 78 col 23: Unnecessary new keyword.

line 81 col 17: Use = to separate a named parameter from its default value.

line 81 col 44: Use = to separate a named parameter from its default value.

line 88 col 34: Unnecessary new keyword.

Fix lib/src/projects.dart. (-2.96 points)

Analysis of lib/src/projects.dart reported 6 hints, including:

line 12 col 29: Unnecessary new keyword.

line 15 col 42: Unnecessary new keyword.

line 56 col 48: Unnecessary new keyword.

line 59 col 45: Unnecessary new keyword.

line 62 col 36: Unnecessary new keyword.

Fix lib/src/jobs.dart. (-1.99 points)

Analysis of lib/src/jobs.dart reported 4 hints:

line 16 col 12: Unnecessary new keyword.

line 24 col 12: Unnecessary new keyword.

line 44 col 35: Unnecessary new keyword.

line 66 col 24: Unnecessary new keyword.

Fix additional 7 files with analysis or formatting issues. (-7.48 points)

Additional issues in the following files:

  • lib/src/issues.dart (3 hints)
  • lib/src/snippets.dart (3 hints)
  • lib/src/commits.dart (2 hints)
  • lib/src/merge_requests.dart (2 hints)
  • lib/src/pipelines.dart (2 hints)
  • lib/src/utils.dart (2 hints)
  • lib/src/http_client.dart (1 hint)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (intl).

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
http ^0.12.0 0.12.0+4
intl ^0.15.6 0.15.8 0.16.1
logging ^0.11.0 0.11.4
meta ^1.1.6 1.1.8
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
pedantic 1.9.0
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
grind_publish ^0.0.5
grinder ^0.8.1
mockito ^3.0.0
path ^1.6.0 1.6.4
test ^1.5.0