forked from PipedreamHQ/pipedream
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Components - bilflo (PipedreamHQ#11840)
* bilflo init * [Components] bilflo PipedreamHQ#11732 Actions - Create Client - Assign Contract Job To Invoice - Create Contract Job * pnpm update * add datetime format description
- Loading branch information
1 parent
880bd75
commit 46d0452
Showing
6 changed files
with
226 additions
and
8 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
components/bilflo/actions/assign-contract-job-to-invoice/assign-contract-job-to-invoice.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import bilflo from "../../bilflo.app.mjs"; | ||
|
||
export default { | ||
key: "bilflo-assign-contract-job-to-invoice", | ||
name: "Assign Contract Job to Invoice Group", | ||
description: "Assigns a contract job to a specified invoice group for a client. [See the documentation](https://developer.bilflo.com/documentation#operations-tag-Clients)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
bilflo, | ||
jobId: { | ||
type: "integer", | ||
label: "Contract Job Identifier", | ||
description: "The unique identifier for the contract job.", | ||
}, | ||
invoiceGroupId: { | ||
type: "integer", | ||
label: "Invoice Group Identifier", | ||
description: "The unique identifier for the invoice group.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.bilflo.assignContractJobToInvoiceGroup({ | ||
$, | ||
data: { | ||
jobId: this.jobId, | ||
invoiceGroupId: this.invoiceGroupId, | ||
}, | ||
}); | ||
$.export("$summary", `Successfully assigned contract job ${this.jobId} to invoice group ${this.invoiceGroupId}`); | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import bilflo from "../../bilflo.app.mjs"; | ||
|
||
export default { | ||
key: "bilflo-create-client", | ||
name: "Create Client", | ||
description: "Creates a new client account in Bilflo. [See the documentation](https://developer.bilflo.com/documentation#operations-tag-Clients)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
bilflo, | ||
businessName: { | ||
type: "string", | ||
label: "Business Name", | ||
description: "The name of the business for the new client account.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.bilflo.createClient({ | ||
$, | ||
data: { | ||
businessName: this.businessName, | ||
}, | ||
}); | ||
$.export("$summary", `Successfully created new client account with Id: ${response.data.clientId}`); | ||
return response; | ||
}, | ||
}; |
93 changes: 93 additions & 0 deletions
93
components/bilflo/actions/create-contract-job/create-contract-job.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import bilflo from "../../bilflo.app.mjs"; | ||
|
||
export default { | ||
key: "bilflo-create-contract-job", | ||
name: "Create Contract Job", | ||
description: "Creates a new contract job in Bilflo. [See the documentation](https://developer.bilflo.com/documentation)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
bilflo, | ||
clientId: { | ||
propDefinition: [ | ||
bilflo, | ||
"clientId", | ||
], | ||
}, | ||
contractorId: { | ||
type: "integer", | ||
label: "Contractor ID", | ||
description: "The unique identifier for the contractor.", | ||
}, | ||
contractorTypeId: { | ||
type: "integer", | ||
label: "Contractor Type ID", | ||
description: "The unique identifier for the contractor type.", | ||
options: [ | ||
{ | ||
label: "W2", | ||
value: 1, | ||
}, | ||
{ | ||
label: "1099", | ||
value: 2, | ||
}, | ||
], | ||
}, | ||
timeCardMethodId: { | ||
type: "integer", | ||
label: "Time Card Method ID", | ||
description: "The unique identifier for the time card method.", | ||
}, | ||
overtimeRuleId: { | ||
type: "integer", | ||
label: "Overtime Rule ID", | ||
description: "The unique identifier for the overtime rule.", | ||
}, | ||
jobTitle: { | ||
type: "string", | ||
label: "Job Title", | ||
description: "The title of the job.", | ||
}, | ||
startDate: { | ||
type: "string", | ||
label: "Start Date", | ||
description: "The start date of the contract job. **Format YYYY-MM-DDTHH:MM:SSZ**", | ||
}, | ||
endDate: { | ||
type: "string", | ||
label: "End Date", | ||
description: "The end date of the contract job. **Format YYYY-MM-DDTHH:MM:SSZ**", | ||
}, | ||
firstWeekEndingDate: { | ||
type: "string", | ||
label: "First Week Ending Date", | ||
description: "The first week ending date of the contract job. **Format YYYY-MM-DDTHH:MM:SSZ**", | ||
}, | ||
burdenTypeId: { | ||
type: "integer", | ||
label: "Burden Type ID", | ||
description: "The unique identifier for the burden type.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.bilflo.createContractJob({ | ||
$, | ||
data: { | ||
clientId: this.clientId, | ||
contractorId: this.contractorId, | ||
contractorTypeId: this.contractorTypeId, | ||
timeCardMethodId: this.timeCardMethodId, | ||
overtimeRuleId: this.overtimeRuleId, | ||
jobTitle: this.jobTitle, | ||
startDate: this.startDate, | ||
endDate: this.endDate, | ||
firstWeekEndingDate: this.firstWeekEndingDate, | ||
burdenTypeId: this.burdenTypeId, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created contract job Id: ${response.data.jobId}`); | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,69 @@ | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
type: "app", | ||
app: "bilflo", | ||
propDefinitions: {}, | ||
propDefinitions: { | ||
clientId: { | ||
type: "string", | ||
label: "Client ID", | ||
description: "The unique identifier for the client.", | ||
async options() { | ||
const { data } = await this.listClients(); | ||
|
||
return data.map(({ | ||
clientId: value, businessName: label, | ||
}) => ({ | ||
label, | ||
value, | ||
})); | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
_baseUrl() { | ||
return "https://api.bilflo.com/v1"; | ||
}, | ||
_headers() { | ||
return { | ||
"company-id": this.$auth.company_id, | ||
"Authorization": `Bearer ${this.$auth.api_key}`, | ||
}; | ||
}, | ||
_makeRequest({ | ||
$ = this, path, ...opts | ||
}) { | ||
return axios($, { | ||
url: this._baseUrl() + path, | ||
headers: this._headers(), | ||
...opts, | ||
}); | ||
}, | ||
createClient(opts = {}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: "/Clients", | ||
...opts, | ||
}); | ||
}, | ||
listClients() { | ||
return this._makeRequest({ | ||
path: "/Clients", | ||
}); | ||
}, | ||
assignContractJobToInvoiceGroup(opts = {}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: "/Clients/contractInvoiceGroups/assignContractJob", | ||
...opts, | ||
}); | ||
}, | ||
createContractJob(opts = {}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: "/ContractJobs", | ||
...opts, | ||
}); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@pipedream/bilflo", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream Bilflo Components", | ||
"main": "bilflo.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,9 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^1.6.5" | ||
} | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.