Skip to content
This repository has been archived by the owner on Jan 25, 2025. It is now read-only.

Commit

Permalink
1.1.0 (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
JensAstrup authored Apr 12, 2024
2 parents e0f4342 + b8448e0 commit 96de13f
Show file tree
Hide file tree
Showing 27 changed files with 5,873 additions and 10,105 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run Linter

on:
push:
branches: [ develop ]
pull_request:
types: [ opened, synchronize, reopened ]
paths:
- 'src/**'
- 'tests/**'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 21.x
- name: Install Yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install --immutable
- name: Run linter
run: npm run lint
10 changes: 8 additions & 2 deletions .github/workflows/tests.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
types: [ opened, synchronize, reopened ]
paths:
- 'src/**'
- 'tests/**'
- 'package.json' # In case the dependencies change

jobs:
test:
Expand All @@ -21,8 +23,12 @@ jobs:
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
- name: Install Yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install --immutable
- name: Run tests
run: npm run test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
Expand Down
65 changes: 36 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,41 @@ API.

### Example Usage

Navigating between related resources is simplified:

```typescript
const client: Client = new Client()
const story: Story = await client.stories.get('story-id')
const epic: Epic = await story.epic
const owners: Member[] = await epic.owners
const team: Team = await story.team

// Now with that team, we can navigate easily to the team's members
const members: Member[] = await team.members
````

compared to the standard Shortcut Client:

```typescript
const shortcut = new ShortcutClient();
const story = await shortcut.getStory(storyId);
let epic, owners, team;
if (story.epic_id) {
epic = await shortcut.getEpic(story.epic_id);
}
for (const ownerId of story.owner_ids) {
ownerDetails = await shortcut.getMember(ownerId);
owners.push(ownerDetails);
}
if (story.group_id) {
team = await shortcut.getGroup(story.group_id);
}
````
And taking actions on resources is intuitive, here's how you leave a comment on a story:
```typescript
const oneWeekAgo = new Date();
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
Expand All @@ -41,43 +76,15 @@ oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
const shortcut = new ShortcutClient();
const {data} = await shortcut.searchStories('team:engineering is:started');
const outdatedStories = stories.filter(story => story.updated_at < oneWeekAgo)
const outdatedStories = stories.filter(story => new Date(story.updated_at) < oneWeekAgo)
for (const story of outdatedStories) {
const comment = 'This story has not been updated in over a week. Please provide an update.'
await shortcut.createComment(story.id, {text: comment})
}
````
Navigating between related resources is also simplified:
```typescript
const client: Client = new Client()
const story: Story = await client.stories.get('story-id')
const epic: Epic = await story.epic
const owners: Member[] = await epic.owners
const team: Team = await story.team
````

compared to the standard Shortcut Client:

```typescript
const shortcut = new ShortcutClient();
const story = await shortcut.getStory(storyId);
let epic, owners, team;
if (story.epic_id) {
epic = await shortcut.getEpic(story.epic_id);
}
for (const ownerId of story.owner_ids) {
ownerDetails = await shortcut.getMember(ownerId);
owners.push(ownerDetails);
}
if (story.group_id) {
team = await shortcut.getGroup(story.group_id);
}
````
## Installation
Expand Down
Loading

0 comments on commit 96de13f

Please sign in to comment.