Skip to content

Commit

Permalink
Rename to workplace (#27)
Browse files Browse the repository at this point in the history
* Remove logo
* Rename files
* Rename Enterprise -> Workplace
* Change API routes
  • Loading branch information
yakhinvadim authored Jan 31, 2020
1 parent c27ab7a commit 9dbf809
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 35 deletions.
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Elastic Enterprise Search Node.js client.
Copyright 2012-2019 Elasticsearch B.V.
Elastic Workplace Search Node.js client.
Copyright 2012-2020 Elasticsearch B.V.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<p align="center"><img src="https://github.com/elastic/enterprise-search-node/blob/master/logo-enterprise-search.png?raw=true" alt="Elastic Enterprise Search Logo"></p>
<p align="center"><a href="https://circleci.com/gh/elastic/workplace-search-node"><img src="https://circleci.com/gh/elastic/workplace-search-node.svg?style=svg" alt="CircleCI build"></a></p>

<p align="center"><a href="https://circleci.com/gh/elastic/enterprise-search-node"><img src="https://circleci.com/gh/elastic/enterprise-search-node.svg?style=svg" alt="CircleCI build"></a></p>

> A first-party Node.js client for [Elastic Enterprise Search](https://www.elastic.co/solutions/enterprise-search).
> A first-party Node.js client for [Elastic Workplace Search](https://www.elastic.co/workplace-search).
## Contents

Expand All @@ -19,33 +17,33 @@
With npm:

```bash
npm install @elastic/enterprise-search-node
npm install @elastic/workplace-search-node
```

or clone locally:

```bash
git clone [email protected]:elastic/enterprise-search-node.git
cd enterprise-search-node
git clone [email protected]:elastic/workplace-search-node.git
cd workplace-search-node
npm install
```

## Usage

Create a new instance of the Elastic Enterprise Search Client with your access token:
Create a new instance of the Elastic Workplace Search Client with your access token:

```javascript
const EnterpriseSearchClient = require('@elastic/enterprise-search-node')
const WorkplaceSearchClient = require('@elastic/workplace-search-node')
const accessToken = '' // your access token
const client = new EnterpriseSearchClient(accessToken)
const client = new WorkplaceSearchClient(accessToken)
```

### Change API endpoint

```javascript
const client = new EnterpriseSearchClient(
const client = new WorkplaceSearchClient(
accessToken,
'https://your-server.example.com/api/v1/ent'
'https://your-server.example.com/api/ws/v1'
)
```

Expand Down Expand Up @@ -193,17 +191,17 @@ $ npm test

### Where do I report issues with the client?

If something is not working as expected, please open an [issue](https://github.com/elastic/enterprise-search-node/issues/new).
If something is not working as expected, please open an [issue](https://github.com/elastic/workplace-search-node/issues/new).

## Contribute 🚀

We welcome contributors to the project. Before you begin, a couple notes...

- Before opening a pull request, please create an issue to [discuss the scope of your proposal](https://github.com/elastic/enterprise-search-node/issues).
- Before opening a pull request, please create an issue to [discuss the scope of your proposal](https://github.com/elastic/workplace-search-node/issues).
- Please write simple code and concise documentation, when appropriate.

## License 📗

[Apache 2.0](https://github.com/elastic/enterprise-search-node/blob/master/LICENSE.txt) © [Elastic](https://github.com/elastic)
[Apache 2.0](https://github.com/elastic/workplace-search-node/blob/master/LICENSE.txt) © [Elastic](https://github.com/elastic)

Thank you to all the [contributors](https://github.com/elastic/enterprise-search-node/graphs/contributors)!
Thank you to all the [contributors](https://github.com/elastic/workplace-search-node/graphs/contributors)!
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const packageJson = require('../package.json')
class Client {
constructor(accessToken, baseUrl) {
this.accessToken = accessToken
this.packageName = 'elastic-enterprise-search-node'
this.packageName = 'elastic-workplace-search-node'
this.baseUrl = baseUrl
}

Expand Down
6 changes: 3 additions & 3 deletions lib/enterpriseSearch.js → lib/workplaceSearch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Client = require('./client')

class EnterpriseSearchClient {
constructor(accessToken, baseUrl = 'http://localhost:3002/api/v1/ent') {
class WorkplaceSearchClient {
constructor(accessToken, baseUrl = 'http://localhost:3002/api/ws/v1') {
this.client = new Client(accessToken, baseUrl)
}

Expand Down Expand Up @@ -74,4 +74,4 @@ class EnterpriseSearchClient {
}
}

module.exports = EnterpriseSearchClient
module.exports = WorkplaceSearchClient
Binary file removed logo-enterprise-search.png
Binary file not shown.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@elastic/enterprise-search-node",
"name": "@elastic/workplace-search-node",
"version": "0.3.0",
"description": "Elastic Enterprise Search client for Node.js",
"description": "Elastic Workplace Search client for Node.js",
"files": [
"lib/"
],
"main": "lib/enterpriseSearch.js",
"main": "lib/workplaceSearch.js",
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/elastic/enterprise-search-node.git"
"url": "git+https://github.com/elastic/workplace-search-node.git"
},
"engines": {
"node": ">= v6.5.0"
},
"author": "Elastic",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/elastic/enterprise-search-node/issues"
"url": "https://github.com/elastic/workplace-search-node/issues"
},
"homepage": "https://github.com/elastic/enterprise-search-node#readme",
"homepage": "https://github.com/elastic/workplace-search-node#readme",
"devDependencies": {
"mocha": "^6.2.0",
"nock": "^10.0.6"
Expand Down
14 changes: 7 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const assert = require('assert')
const nock = require('nock')
const EnterpriseSearchClient = require('../lib/enterpriseSearch')
const WorkplaceSearchClient = require('../lib/workplaceSearch')
const HttpClient = require('../lib/client')
const packageJson = require('../package.json')

Expand All @@ -24,11 +24,11 @@ const mockDocuments = [
url: 'https://www.shopify.com/content/how-to-profit-from-your-passions'
}
]
const clientName = 'elastic-enterprise-search-node'
const clientName = 'elastic-workplace-search-node'
const clientVersion = '0.3.0'

// Mock for Enterprise Search client
nock('https://api.swiftype.com/api/v1/ent', {
// Mock for Workplace Search client
nock('https://api.swiftype.com/api/ws/v1', {
reqheaders: {
authorization: `Bearer ${mockAccessToken}`,
'x-swiftype-client': clientName,
Expand Down Expand Up @@ -107,10 +107,10 @@ nock('https://example.com', {
.post('/error', { foo: 'bar' })
.reply(500, { hello: 'world' })

describe('EnterpriseSearchClient', () => {
const client = new EnterpriseSearchClient(
describe('WorkplaceSearchClient', () => {
const client = new WorkplaceSearchClient(
mockAccessToken,
'https://api.swiftype.com/api/v1/ent'
'https://api.swiftype.com/api/ws/v1'
)

context('#indexDocuments', () => {
Expand Down

0 comments on commit 9dbf809

Please sign in to comment.