承接 blomstra/linear 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

blomstra/linear

最新稳定版本:0.1.6

Composer 安装命令:

composer require blomstra/linear

包简介

An API client for Linear

README 文档

README

This is a typed PHP SDK for the Linear API. It contains functionality that would be most commonly needed when integrating with Linear, but does not expose every GraphQL endpoint.

Capabilities

Using this SDK you can:

  • Create, retrieve, update, and delete issues
  • Retrieve Teams
  • Retrieve Projects
  • Retrieve an organisation

Requirements

  • PHP 8.2+
  • An token from Linear (the SDK does not support OAuth 2 authentication yet)

Installation

Like all PHP packages, you can install this package using composer:

composer require blomstra/linear

Usage

Retrieve Current Organisation

use Linear\Sdk\Organization;

$o = new Organization('your-token-here');
$organization = $o->get();

// $organization is now an instance of Linear\Dto\Organization
$organization->name;
$organization->id;
$organization->urlKey

Retrieve Teams

A single team can be retrieved by ID:

use Linear\Sdk\Teams;

$t = new Teams('your-token-here');
$team = $t->getOne('team-id-here');

// $team is now an instance of Linear\Dto\Team

Or all teams can be retrieved:

use Linear\Sdk\Teams;

$t = new Teams('your-token-here');
$teams = $t->getAll();
// $teams is now an instance of Linear\Dto\Teams

Retrieve Projects

A single project can be retrieved by ID:

use Linear\Sdk\Projects;

$p = new Projects('your-token-here');
$project = $p->getOne('project-id-here');
// $project is now an instance of Linear\Dto\Project

Or all projects can be retrieved:

use Linear\Sdk\Projects;
   
$p = new Projects('your-token-here');
$projects = $p->getAll();
// $projects is now an instance of Linear\Dto\Projects

Issues

Retrieve an Issue

A single issue can be retrieved by ID:

use Linear\Sdk\Issues;

$i = new Issues('your-token-here');
$issue = $i->getOne('issue-id-here');
// $issue is now an instance of Linear\Dto\Issue

Or all issues can be retrieved:

use Linear\Sdk\Issues;

$i = new Issues('your-token-here');
$issues = $i->getAll();
// $issues is now an instance of Linear\Dto\Issues

Create an Issue

use Linear\Sdk\Issues;
use Linear\Dto\Issue;
use Linear\Sdk\Teams;

$t = new Teams('your-token-here');
$team = $t->getAll()->nodes[0];

$i = new Issues('your-token-here');
$title = 'My new issue';
$description = 'This is a description';

$createdIssue = $i->create($title, $description, $team);

// $createdIssue is now an instance of Linear\Dto\Issue

Update an Issue

use Linear\Sdk\Issues;
use Linear\Dto\Issue;

$i = new Issues('your-token-here');
$issue = $i->getOne('issue-id-here');

$updatedIssueDto = new Issue($issue->id, 'updated title', 'updated description');
$updatedIssue = $i->update($updatedIssue);

// $updatedIssue is now an instance of Linear\Dto\Issue

Delete an Issue

use Linear\Sdk\Issues;

$i = new Issues('your-token-here');
$issue = $i->getOne('issue-id-here');
$i->delete($issue); // returns true or false

Testing

Every method in this SDK is unit tested. Please see the tests/Api folder for more details.

Sponsor

This extension was sponsored by Kagi Search, an ad free search engine

License

MIT

统计信息

  • 总下载量: 73
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-10