Skip to content

Commit

Permalink
feat(package): Rename package name from govuk-api to govuk
Browse files Browse the repository at this point in the history
  • Loading branch information
NickColley committed May 12, 2023
1 parent cc3b108 commit 204e3c8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

JavaScript API client for GOV.UK Content and Search APIs.

[![GOVUK API latest npm version](https://img.shields.io/npm/v/govuk-api.svg?v=2)](https://www.npmjs.com/package/govuk-api)
[![GOVUK API latest npm version](https://img.shields.io/npm/v/govuk.svg?v=2)](https://www.npmjs.com/package/govuk)

## Contents

Expand All @@ -17,12 +17,12 @@ JavaScript API client for GOV.UK Content and Search APIs.

```bash
npm init mjs -y # initialise module-ready package.json
npm install govuk-api
npm install govuk
```

```javascript
// index.js;
import { SearchAPI, ContentAPI } from "govuk-api";
import { SearchAPI, ContentAPI } from "govuk";

const searchApi = new SearchAPI();
const contentApi = new ContentAPI();
Expand All @@ -44,7 +44,7 @@ node index.js
```html
<!-- index.html -->
<script type="module">
import { SearchAPI, ContentAPI } from "https://unpkg.com/govuk-api";
import { SearchAPI, ContentAPI } from "https://unpkg.com/govuk";
const searchApi = new SearchAPI();
const contentApi = new ContentAPI();
Expand Down Expand Up @@ -80,7 +80,7 @@ Returns a [content item](https://content-api.publishing.service.gov.uk/reference
#### Getting data from resolved promise

```javascript
import { ContentAPI } from "govuk-api";
import { ContentAPI } from "govuk";
const api = new ContentAPI();
const contentItem = await api.get("Register-to-vote");
console.log(contentItem);
Expand All @@ -89,7 +89,7 @@ console.log(contentItem);
#### Getting data from event

```javascript
import { ContentAPI } from "govuk-api";
import { ContentAPI } from "govuk";
const api = new ContentAPI();
api.on("data", (contentItem) => {
console.log(contentItem);
Expand All @@ -115,7 +115,7 @@ Set the default query and options for all other calls to `get`, `getAll` and `to
#### Getting data from resolved promise

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI("Micro pig", { count: 10 });
const searchResults = await api.get();
console.log(searchResults);
Expand All @@ -133,7 +133,7 @@ Get first page of search items for a query
#### Getting data from resolved promise

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI();
const searchResults = await api.get("Micro pig");
console.log(searchResults);
Expand All @@ -142,7 +142,7 @@ console.log(searchResults);
#### Getting data from event

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI();
api.on("data", (searchResults) => {
console.log(searchResults);
Expand All @@ -163,7 +163,7 @@ Get all pages of search items for a query.
#### Getting data from resolved promise

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI();
const searchResults = await api.getAll("Micro pig");
console.log(searchResults);
Expand All @@ -172,7 +172,7 @@ console.log(searchResults);
#### Getting data from event

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI();
api.on("data", (searchResults) => {
console.log(searchResults);
Expand All @@ -191,7 +191,7 @@ Get metadata for a content item.
#### Getting info from resolved promise

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI();
const contentInfo = await api.info("register-to-vote");
console.log(contentInfo);
Expand All @@ -209,7 +209,7 @@ Get total amount of search items for a query.
#### Getting total from resolved promise

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI();
const totalResults = await api.total("Micro pig");
console.log(totalResults);
Expand All @@ -226,7 +226,7 @@ Get facets for a field.
#### Getting facets from resolved promise

```javascript
import { SearchAPI } from "govuk-api";
import { SearchAPI } from "govuk";
const api = new SearchAPI();
const facets = await api.facets("formats");
console.log(facets);
Expand Down
2 changes: 1 addition & 1 deletion examples/streaming-content-to-json/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createWriteStream } from "node:fs";
import { ContentAPI, SearchAPI } from "govuk-api";
import { ContentAPI, SearchAPI } from "govuk";
import JSONTransform from "./json-transform.js";

const query = "Potato";
Expand Down
2 changes: 1 addition & 1 deletion examples/streaming-content-to-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"license": "MIT",
"dependencies": {
"govuk-api": "../../"
"govuk": "../../"
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "module",
"name": "govuk-api",
"name": "govuk",
"description": "JavaScript API client for GOV.UK Content and Search APIs.",
"version": "0.0.0-development",
"source": "index.js",
Expand Down Expand Up @@ -48,7 +48,7 @@
"semantic-release": "^19.0.5"
},
"engines": {
"node": "16.x"
"node": ">=16.x"
},
"publishConfig": {
"access": "public"
Expand Down

0 comments on commit 204e3c8

Please sign in to comment.