Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix createObject method #12

Merged
merged 5 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = {
"max-len": ["error", { "code": 180 }],
"no-param-reassign": 0,
"guard-for-in": "off",
"no-return-assign": 0
"no-return-assign": 0,
"no-prototype-builtins": 0
},
'settings': {
'import/extensions': ['.js','.jsx','.ts','.tsx'],
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The official Elastic.io object-storage client.

## Usage

Note: All the code snippets written in Typescript
Note: All the code snippets written in Typescript

### Create client
```
Expand All @@ -19,15 +19,18 @@ const objectStorage = new ObjectStorageWrapper(this);

The method has the following signature:
```
async createObject(data: object, queryKey?: string, queryValue?: string, ttl?: number)
async createObject(data: object, headers?: Header[], ttl?: number)
```
where
- data - object data to create. *Required*
- queryKey, queryValue - searchable field (see below in `Get objects by query parameter` section). *Optional*, but if queryKey is specified, queryValue must be specified as well.
- headers - array of objects `{ key: string, value: string }`, current maximum - 5 items. Where `key` - searchable field name (see below in `Get objects by query parameter` section), must be unique for whole array, if specified - `value` must be specified as well; `value` - searchable field value, if specified - `key` must be specified as well. *Optional*
- ttl - configurable object's time to live, milliseconds. *Optional*

```
const obj = await objectStorage.createObject(data, somequeriablefieldKey, somequeriablefieldValue, 60000);
const obj = await objectStorage.createObject(data);
const obj = await objectStorage.createObject(data, [], 100000);
const obj = await objectStorage.createObject(data, [{key: 'someQueriableFieldKey', value: 'someQueriableFieldValue'}], 60000);
const obj = await objectStorage.createObject(data, [{key: 'anotherQueriableFieldKey', value: 'anotherQueriableFieldValue'}], 60000);
```

### Read operations
Expand Down
Loading