Skip to content

Add Term ID support to create QBO Invoice #17146

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions components/atlas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
52 changes: 52 additions & 0 deletions components/atlas/actions/get-all-jobs/get-all-jobs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { atlasProps, jobProps } from "../../common/atlas-props.mjs";
import { atlasMixin } from "../../common/atlas-base.mjs";

export default {
key: "atlas-get-all-jobs",
name: "Get All Job Listings",
description: "Retrieve all job listings from ATLAS",
version: "0.0.15",
type: "action",
props: {
...atlasProps,
...jobProps,
},
...atlasMixin,
async run({ $ }) {
try {
// Validate authentication configuration
this.validateAuth();

// Create ATLAS client
const atlas = this.createAtlasClient();

// Prepare parameters
const params = this.cleanParams({
limit: this.limit,
offset: this.offset,
status: this.status,
});

// Make API request
const response = await atlas.getJobs(params);

Comment on lines +24 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Action name promises “All” jobs but only issues a single paged request

With limit, offset passed once, the caller still has to page manually. Either:

  • expose a loop similar to atlas.getAllPages() to aggregate all jobs, or
  • rename/clarify description to “Get Job Listings (single page)”.
🤖 Prompt for AI Agents
In components/atlas/actions/get-all-jobs/get-all-jobs.mjs around lines 24 to 32,
the function named to get "All" jobs only fetches a single page using limit and
offset, which is misleading. To fix this, either implement a loop that
repeatedly calls atlas.getJobs with updated offsets to aggregate all job pages
before returning, or rename the function and update its description to clarify
it only retrieves a single page of job listings.

// Process response
const jobs = response.data || response;
const jobCount = Array.isArray(jobs) ? jobs.length : 0;

const authMethod = this.apiKey ? "API Key" : "Username/Password";
$.export("$summary", `Successfully retrieved ${jobCount} job listing(s) using ${authMethod}`);

return {
success: true,
count: jobCount,
jobs: jobs,
params: params,
authMethod: authMethod,
};

} catch (error) {
this.handleAtlasError(error, "Get jobs");
}
},
};
47 changes: 47 additions & 0 deletions components/atlas/actions/get-candidates/get-candidates.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { atlasProps, candidateProps } from "../../common/atlas-props.mjs";
import { atlasMixin } from "../../common/atlas-base.mjs";

export default {
key: "atlas-get-candidates",
name: "Get All Candidates",
description: "Retrieve all candidates from ATLAS",
version: "0.0.1",
type: "action",
props: {
...atlasProps,
...candidateProps,
},
...atlasMixin,
async run({ $ }) {
try {
// Validate authentication configuration
this.validateAuth();

const atlas = this.createAtlasClient();

const params = this.cleanParams({
limit: this.limit,
stage: this.stage,
});

const response = await atlas.getCandidates(params);

const candidates = response.data || response;
const candidateCount = Array.isArray(candidates) ? candidates.length : 0;

const authMethod = this.apiKey ? "API Key" : "Username/Password";
$.export("$summary", `Successfully retrieved ${candidateCount} candidate(s) using ${authMethod}`);

return {
success: true,
count: candidateCount,
candidates: candidates,
params: params,
authMethod: authMethod,
};

} catch (error) {
this.handleAtlasError(error, "Get candidates");
}
},
};
109 changes: 109 additions & 0 deletions components/atlas/atlas.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "atlas",
propDefinitions: {
apiKey: {
type: "string",
label: "API Key",
description: "Your ATLAS API key from the dashboard",
secret: true,
},
baseUrl: {
type: "string",
label: "Base URL",
description: "ATLAS API base URL default: https://public-apis-prod.workland.com/api",
default: "https://public-apis-prod.workland.com/api",
optional: true,
},
},
methods: {
/**
* Get the authentication headers for API requests
* @returns {Object} Headers object with authorization
*/
_getHeaders() {
return {
"Authorization": `${this.$auth.api_key}`,
"Content-Type": "application/json",
"Accept": "application/json",
};
},
Comment on lines +26 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Auth property names don’t match prop definitions

_getHeaders() reads this.$auth.api_key, but the property is defined as apiKey. Same mismatch exists for baseUrl. This will produce missing headers and bad URLs at runtime.

-return {
-  "Authorization": `${this.$auth.api_key}`,
+return {
+  "Authorization": `${this.$auth.apiKey}`,

Apply the same camelCase change wherever base_url appears.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_getHeaders() {
return {
"Authorization": `${this.$auth.api_key}`,
"Content-Type": "application/json",
"Accept": "application/json",
};
},
_getHeaders() {
return {
"Authorization": `${this.$auth.apiKey}`,
"Content-Type": "application/json",
"Accept": "application/json",
};
},
🤖 Prompt for AI Agents
In components/atlas/atlas.app.mjs around lines 26 to 32, the _getHeaders method
incorrectly accesses this.$auth.api_key instead of this.$auth.apiKey, causing
missing headers at runtime. Update all references from api_key to apiKey and
similarly change base_url to baseUrl wherever it appears to match the camelCase
property definitions and ensure correct header and URL construction.


/**
* Make authenticated API request
* @param {Object} opts - Request options
* @param {string} opts.url - API endpoint URL
* @param {string} [opts.method=GET] - HTTP method
* @param {Object} [opts.data] - Request body data
* @param {Object} [opts.params] - Query parameters
* @returns {Promise} API response
*/
async _makeRequest({
url,
method = "GET",
data,
params,
...opts
}) {
const config = {
method,
url: url.startsWith("http") ? url : `${this.$auth.base_url}${url}`,
headers: this._getHeaders(),
data,
params,
...opts,
Comment on lines +50 to +56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Base URL resolution will fail

url: url.startsWith("http") ? url : \${this.$auth.base_url}${url}`relies onbase_url`, which is undefined. Use the camel-case prop or fall back to default:

-url: url.startsWith("http") ? url : `${this.$auth.base_url}${url}`,
+url: url.startsWith("http") ? url : `${this.$auth.baseUrl}${url}`,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const config = {
method,
url: url.startsWith("http") ? url : `${this.$auth.base_url}${url}`,
headers: this._getHeaders(),
data,
params,
...opts,
const config = {
method,
url: url.startsWith("http") ? url : `${this.$auth.baseUrl}${url}`,
headers: this._getHeaders(),
data,
params,
...opts,
};
🤖 Prompt for AI Agents
In components/atlas/atlas.app.mjs around lines 50 to 56, the code uses
this.$auth.base_url which is undefined, causing base URL resolution to fail.
Update the code to use the camel-case property this.$auth.baseUrl instead, and
provide a fallback default URL if this.$auth.baseUrl is not set. This ensures
the URL is correctly constructed whether or not the baseUrl property is defined.

};

return axios(this, config);
},

/**
* Get all job listings from ATLAS
* @param {Object} params - Query parameters
* @returns {Promise} Job listings response
*/
async getJobs(params = {}) {
return this._makeRequest({
url: "/v3/jobs",
params,
});
},

/**
* Get all candidates from ATLAS
* @param {Object} params - Query parameters
* @returns {Promise} Candidates response
*/
async getCandidates(params = {}) {
return this._makeRequest({
url: "/v3/candidates",
params,
});
},

/**
* Get reports from ATLAS
* @param {Object} params - Query parameters
* @returns {Promise} Reports response
*/
async getReports(params = {}) {
return this._makeRequest({
url: "/v3/reports",
params,
});
},

/**
* Test API connection
* @returns {Promise} Connection test response
*/
async testConnection() {
return this._makeRequest({
url: "/v3/jobs",
params: { limit: 1 },
});
},
},
};
Loading