Skip to content

Lookup by #5

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

Merged
merged 14 commits into from
Jun 11, 2025
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.1.0 (June 11, 2025)

* Added `Delete Object By ID` Action
* Added `Lookup Object By ID` Action

# 1.0.0 (June 03, 2025)

* Initial component release
Expand Down
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* [Description](#description)
* [Credentials](#credentials)
* [Actions](#actions)
* [Delete Object By ID](#delete-object-by-id)
* [Lookup Object By ID](#lookup-object-by-id)
* [Make Raw Request](#make-raw-request)

## Description
Expand Down Expand Up @@ -37,7 +39,41 @@ Now you can create new credentials for the component on the platform:
* **Number of retries** (number, optional, 5 by default) - How many times component should retry to make request
* **Delay between retries** (number ms, optional, 10000 by default) - How much time wait until new try

## Actions
## Actions

### Delete Object By ID

Deletes a single object using its ID.

#### Configuration Fields

- **Object Type** - (dropdown, required): The type of the object to delete.

#### Input Metadata

- **ID Value** - (string, required): The ID of the object to delete.

#### Output Metadata

Returns the ID of the deleted object.

### Lookup Object By ID

Retrieves a single object using its ID.

#### Configuration Fields

- **Object Type** - (dropdown, required): The type of object to look up.

#### Input Metadata

- **ID Value** - (string, required): The ID of the object to look up.

#### Output Metadata

Returns an object with the result of the lookup.

**Known limitation**: Currently, the `Generate Stub Sample` button only allows generating generic metadata, without specific object type details.

### Make Raw Request

Expand Down
46 changes: 45 additions & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Podio component",
"description": "A smart connector for accessing Podio API",
"version": "1.0.0",
"version": "1.1.0",
"authClientTypes": [
"oauth2"
],
Expand Down Expand Up @@ -33,6 +33,50 @@
}
},
"actions": {
"deleteObjectById": {
"main": "./src/actions/deleteObjectById.js",
"title": "Delete Object By ID",
"help": {
"description": "Delete Object By ID",
"link": "/components/podio/index.html#delete-object-by-id"
},
"fields": {
"objectType": {
"label": "Object Type",
"viewClass": "SelectView",
"prompt": "Please select the type of object to delete",
"required": true,
"order": 10,
"model": "getDeleteByIdObjects"
}
},
"metadata": {
"in": "./src/schemas/metadata/deleteObjectById/in.json",
"out": "./src/schemas/metadata/deleteObjectById/out.json"
}
},
"lookupObjectById": {
"main": "./src/actions/lookupObjectById.js",
"title": "Lookup Object By ID",
"help": {
"description": "Lookup Object By ID",
"link": "/components/podio/index.html#lookup-object-by-id"
},
"fields": {
"objectType": {
"label": "Object Type",
"viewClass": "SelectView",
"prompt": "Please select the type of object to lookup",
"required": true,
"order": 10,
"model": "getLookupByIdObjects"
}
},
"metadata": {
"in": "src/schemas/metadata/lookupObjectById/in.json",
"out": "src/schemas/metadata/lookupObjectById/out.json"
}
},
"makeRawRequest": {
"main": "./src/actions/rawRequest.js",
"title": "Make Raw Request",
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
"scripts": {
"audit": "better-npm-audit audit --level high --production",
"lint": "eslint --ext .ts --quiet --fix",
"pretest": "eslint --ext .ts --quiet --fix && find src spec spec-integration -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js",
"pretest": "eslint --ext .ts --quiet --fix && find src spec -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js",
"test": "mocha --require ts-node/register \"spec/**/*test.ts\"",
"integrationTest": "mocha --require ts-node/register --timeout 50000 \"spec-integration/**/*test.ts\" \"spec-integration/verifyCredentials.test.ts\"",
"dev:test": "find src spec spec-integration -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js && tsc && npm run test",
"dev:integrationTest": "env LOG_LEVEL=debug find src spec spec-integration -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js && tsc && npm run integrationTest",
"dev:test": "find src spec -name \\\"*.js\\\" -type f -delete && rm -f verifyCredentials.js && tsc && npm run test",
"posttest": "tsc"
},
"repository": {
Expand Down
16 changes: 0 additions & 16 deletions spec-integration/actions/rawRequest.test.ts

This file was deleted.

40 changes: 0 additions & 40 deletions spec-integration/common.ts

This file was deleted.

36 changes: 36 additions & 0 deletions spec/actions/deleteObjectById.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import sinon from 'sinon';
import chai, { expect } from 'chai';
import { getContext, StatusCodeError } from '../common';
import Client from '../../src/Client';
import { processAction } from '../../src/actions/deleteObjectById';

const fakeResponse: any = {
data: {},
status: 200,
headers: {},
};

chai.use(require('chai-as-promised'));

describe('"Delete Object by ID" action', async () => {
let execRequest;
describe('One contact found', async () => {
beforeEach(() => {
execRequest = sinon.stub(Client.prototype, 'apiRequest').callsFake(async () => fakeResponse);
});
afterEach(() => {
sinon.restore();
});
it('should successfully delete contact', async () => {
const cfg = {
objectType: 'task'
};
const msg = {
body: { idValue: 'abc123' },
};
const { body } = await processAction.call(getContext(), msg, cfg);
expect(execRequest.callCount).to.equal(1);
expect(body).to.deep.equal({ id: msg.body.idValue });
});
});
});
37 changes: 37 additions & 0 deletions spec/actions/lookupObjectById.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import sinon from 'sinon';
import chai, { expect } from 'chai';
import { getContext, StatusCodeError } from '../common';
import Client from '../../src/Client';
import { processAction } from '../../src/actions/lookupObjectById';
import task from '../resources/task.json';

const fakeResponse: any = {
data: task,
status: 200,
headers: {},
};

chai.use(require('chai-as-promised'));

describe('"Lookup Object by ID" action', async () => {
let execRequest;
describe('One contact found', async () => {
beforeEach(() => {
execRequest = sinon.stub(Client.prototype, 'apiRequest').callsFake(async () => fakeResponse);
});
afterEach(() => {
sinon.restore();
});
it('should successfully emit contact', async () => {
const cfg = {
objectType: 'task'
};
const msg = {
body: { idValue: '300975023' },
};
const { body } = await processAction.call(getContext(), msg, cfg);
expect(execRequest.callCount).to.equal(1);
expect(body).to.deep.equal(task);
});
});
});
Loading