Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Commit 239472b

Browse files
committed
Add readme and license
1 parent c128652 commit 239472b

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed

LICENSE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2020-present Shyim
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Admin Node-API Client for Shopware 6
2+
3+
This code highly bases on the [Administration Code](https://github.com/shopware/platform/tree/745f1f7aaa5c47d123e04b5b5b93b81161eae19a/src/Administration/Resources/app/administration/src/core/data-new) and made NodeJs compatible.
4+
5+
## Creation of API Client
6+
7+
### Using Username and Password
8+
9+
```js
10+
import {createFromPasswordAndLogin} from 'shopware-admin-api';
11+
12+
let api = await createFromPasswordAndLogin('http://myshop.com', 'username', 'password', 1);
13+
```
14+
15+
### Using Integration
16+
17+
```js
18+
import {createFromIntegration} from 'shopware-admin-api';
19+
20+
let api = await createFromIntegration('http://myshop.com', 'client_id', 'client_secret', 1);
21+
```
22+
23+
24+
## Usage
25+
26+
```js
27+
// Create repository
28+
const productRepository = api.create('product');
29+
30+
// Access default context
31+
const context = api.defaultContext();
32+
33+
// Acccess entity definition (contains the schema, required fields etc.)
34+
const definition = api.EntityDefinition;
35+
36+
console.log(definition.get('product'))
37+
console.log(definition.getRequiredFields('product'))
38+
```
39+
40+
## License
41+
42+
[MIT](LICENSE.md)

example/definition.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {createFromPasswordAndLogin} from '../src/index.js';
2+
3+
async function test()
4+
{
5+
let api = await createFromPasswordAndLogin('<url>', 'demo', 'demo', 1);
6+
7+
console.log(api.EntityDefinition.getRequiredFields('product'));
8+
}
9+
10+
test();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shopware-admin-api",
3-
"version": "0.1.0",
3+
"version": "0.0.1",
44
"description": "Shopware API",
55
"main": "index.js",
66
"type": "module",

0 commit comments

Comments
 (0)