-
Notifications
You must be signed in to change notification settings - Fork 0
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
Entry delete and resend #14
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
|
@@ -1199,7 +1199,7 @@ | |
"__docId__": 65, | ||
"kind": "file", | ||
"name": "src/EntriesClient.js", | ||
"content": "//@flow\nimport {WpClient} from './WpClient';\n\n/**\n * Client for accessing Caldera Forms entry data via Caldera Forms REST API\n */\nexport class EntriesClient extends WpClient {\n\n\t/**\n\t * Get one page of entries for a form\n\t *\n\t * @param {String} formId ID of form to get entries for.\n\t * @param {number} page Optional. Which page of entries to get. Default is 1.\n\t * @return {Promise<any>}\n\t */\n\tgetEntries(formId: string, page: number = 1): Promise<any> {\n\t\treturn this.reqGet({\n\t\t\tpage,\n\t\t\t_wpnonce: this.nonce\n\t\t}, this.getEntriesEndpoint(formId));\n\t}\n\n\t/**\n\t * Get a single entry of a form\n\t *\n\t * @param {String} formId ID of form to get entries for.\n\t * @param {String} entryId ID of entry to find.\n\t * @return {Promise<any>}\n\t */\n\tgetEntry(formId: string, entryId: number): Promise<any> {\n\t\treturn this.reqGet({\n\t\t\t_wpnonce: this.nonce\n\t\t}, this.getEntryEndpoint(formId, entryId));\n\t}\n\n\t/**\n\t * The endpoint URI for a collection of entries for one form.\n\n\t * @param {String} formId ID of form to get entries for.\n\t * @return {string}\n\t */\n\tgetEntriesEndpoint(formId: string): string {\n\t\treturn `entries/${formId}`;\n\t}\n\n\t/**\n\t * The endpoint URI for single entries\n\t *\n\t * @param {String} formId ID of form to get entries for.\n\t * @param {String} entryId ID of entry to find.\n\t * @return {string}\n\t */\n\tgetEntryEndpoint(formId: string, entryId: number): string {\n\t\treturn `${this.getEntriesEndpoint(formId)}/${entryId}`;\n\t}\n\n\n}", | ||
"content": "//@flow\nimport {WpClient} from './WpClient';\n\n/**\n * Client for accessing Caldera Forms entry data via Caldera Forms REST API\n */\nexport class EntriesClient extends WpClient {\n\n\t/**\n\t * Get one page of entries for a form\n\t *\n\t * @param {String} formId ID of form to get entries for.\n\t * @param {number} page Optional. Which page of entries to get. Default is 1.\n\t * @return {Promise<any>}\n\t */\n\tgetEntries(formId: string, page: number = 1): Promise<any> {\n\t\treturn this.reqGet({\n\t\t\tpage,\n\t\t\t_wpnonce: this.nonce\n\t\t}, this.getEntriesEndpoint(formId));\n\t}\n\n\t/**\n\t * Get a single entry of a form\n\t *\n\t * @param {String} formId ID of form to get entries for.\n\t * @param {String} entryId ID of entry to find.\n\t * @return {Promise<any>}\n\t */\n\tgetEntry(formId: string, entryId: number): Promise<any> {\n\t\treturn this.reqGet({\n\t\t\t_wpnonce: this.nonce\n\t\t}, this.getEntryEndpoint(formId, entryId));\n\t}\n\n\td\n\n\n\t/**\n\t * The endpoint URI for a collection of entries for one form.\n\n\t * @param {String} formId ID of form to get entries for.\n\t * @return {string}\n\t */\n\tgetEntriesEndpoint(formId: string): string {\n\t\treturn `entries/${formId}`;\n\t}\n\n\t/**\n\t * The endpoint URI for single entries\n\t *\n\t * @param {String} formId ID of form to get entries for.\n\t * @param {String} entryId ID of entry to find.\n\t * @return {string}\n\t */\n\tgetEntryEndpoint(formId: string, entryId: number): string {\n\t\treturn `${this.getEntriesEndpoint(formId)}/${entryId}`;\n\t}\n\n\n}", | ||
"static": true, | ||
"longname": "/Users/josh/caldera-js/api-client/src/EntriesClient.js", | ||
"access": "public", | ||
|
@@ -1937,7 +1937,7 @@ | |
}, | ||
{ | ||
"kind": "packageJSON", | ||
"content": "{\n \"name\": \"@caldera-labs/api-client\",\n \"version\": \"0.4.1\",\n \"description\": \"API client for Caldera Forms and Caldera Forms Pro\",\n \"main\": \"./dist/index.js\",\n \"scripts\": {\n \"build\": \"npm run build:pre && npm run build:compile && npm run build:post\",\n \"build:pre\": \"npm run test:once\",\n \"build:compile\": \"./node_modules/.bin/babel -d dist src/\",\n \"build:post\": \"npm run compress && npm run document\",\n \"compress\": \" uglifyjs-folder dist -c -m --source-map -o dist/index.min.js\",\n \"test\": \"jest --watch\",\n \"test:once\": \"jest\",\n \"test:coverage\": \"jest --coverage\",\n \"coveralls\": \"cat ./coverage/lcov.info | node node_modules/.bin/coveralls\",\n \"prepublish\": \"npm run build\",\n \"document\": \"./node_modules/.bin/esdoc\",\n \"lint\": \"eslint src/**, __tests__/**\",\n \"lint:watch\": \"esw src/**, __tests__/** --fix --watch\",\n \"lint:fix\": \"eslint src/**, __tests__/** --fix \",\n \"flow:watch\": \"flow-watch\",\n \"flow\": \"flow \",\n \"release\": \"npm run release:patch\",\n \"release:minor\": \"npm version minor -m \\\"version %s\\\" && npm publish\",\n \"release:patch\": \"npm version patch -m \\\"version %s\\\" && npm publish\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/calderawp/caldera-api-client.git\"\n },\n \"keywords\": [\n \"es6\",\n \"boilerplate\",\n \"npm\",\n \"module\",\n \"npm-module\"\n ],\n \"author\": \"Josh Pollock <[email protected]>\",\n \"license\": \"GPL-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/calderawp/caldera-api-client/issues\"\n },\n \"homepage\": \"https://calderalabs.org/caldera-api-client/\",\n \"dependencies\": {},\n \"devDependencies\": {\n \"babel-eslint\": \"^8.2.3\",\n \"babel-preset-flow\": \"^6.23.0\",\n \"eslint\": \"^4.19.1\",\n \"eslint-config-airbnb\": \"^16.1.0\",\n \"eslint-plugin-flowtype\": \"^2.49.3\",\n \"eslint-plugin-import\": \"^2.12.0\",\n \"eslint-plugin-jsx-a11y\": \"^6.0.3\",\n \"eslint-plugin-react\": \"^7.9.1\",\n \"eslint-watch\": \"^3.1.5\",\n \"flow-bin\": \"^0.74.0\",\n \"flow-watch\": \"^1.1.3\",\n \"jest-fetch-mock\": \"^1.6.3\",\n \"locutus\": \"^2.0.9\",\n \"uglify-js\": \"^3.4.0\",\n \"uglifyjs-folder\": \"^1.5.1\",\n \"babel-cli\": \"^6.26.0\",\n \"babel-jest\": \"^20.0.3\",\n \"babel-preset-es2015\": \"^6.24.1\",\n \"babel-preset-stage-2\": \"^6.24.1\",\n \"coveralls\": \"^2.13.3\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-flow-plugin\": \"^1.0.0\",\n \"esdoc-jsx-plugin\": \"^1.0.0\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"eslint-plugin-jest\": \"^21.17.0\",\n \"jest-cli\": \"^23.2\",\n \"istanbul\": \"^0.4.5\",\n \"istanbul-api\": \"1.2.2\",\n \"istanbul-reports\": \"1.1.4\"\n },\n \"standard\": {\n \"plugins\": [\n \"flowtype\"\n ],\n \"parser\": \"babel-eslint\"\n },\n \"jest\": {\n \"collectCoverageFrom\": [\n \"src/**/*.js\"\n ],\n \"coverageThreshold\": {\n \"global\": {\n \"statements\": 85,\n \"branches\": 75,\n \"functions\": 85,\n \"lines\": 85\n }\n },\n \"automock\": false,\n \"setupFiles\": [\n \"./setupJest.js\"\n ]\n }\n}\n", | ||
"content": "{\n \"name\": \"@caldera-labs/api-client\",\n \"version\": \"0.5.0\",\n \"description\": \"API client for Caldera Forms and Caldera Forms Pro\",\n \"main\": \"./dist/index.js\",\n \"scripts\": {\n \"build\": \"npm run build:pre && npm run build:compile && npm run build:post\",\n \"build:pre\": \"npm run test:once\",\n \"build:compile\": \"./node_modules/.bin/babel -d dist src/\",\n \"build:post\": \"npm run compress && npm run document\",\n \"compress\": \" uglifyjs-folder dist -c -m --source-map -o dist/index.min.js\",\n \"test\": \"jest --watch\",\n \"test:once\": \"jest\",\n \"test:coverage\": \"jest --coverage\",\n \"coveralls\": \"cat ./coverage/lcov.info | node node_modules/.bin/coveralls\",\n \"prepublish\": \"npm run build\",\n \"document\": \"./node_modules/.bin/esdoc\",\n \"lint\": \"eslint src/**, __tests__/**\",\n \"lint:watch\": \"esw src/**, __tests__/** --fix --watch\",\n \"lint:fix\": \"eslint src/**, __tests__/** --fix \",\n \"flow:watch\": \"flow-watch\",\n \"flow\": \"flow \",\n \"release\": \"npm run release:patch\",\n \"release:minor\": \"npm version minor -m \\\"version %s\\\" && npm publish\",\n \"release:patch\": \"npm version patch -m \\\"version %s\\\" && npm publish\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/calderawp/caldera-api-client.git\"\n },\n \"keywords\": [\n \"es6\",\n \"boilerplate\",\n \"npm\",\n \"module\",\n \"npm-module\"\n ],\n \"author\": \"Josh Pollock <[email protected]>\",\n \"license\": \"GPL-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/calderawp/caldera-api-client/issues\"\n },\n \"homepage\": \"https://calderalabs.org/caldera-api-client/\",\n \"dependencies\": {},\n \"devDependencies\": {\n \"babel-eslint\": \"^8.2.3\",\n \"babel-preset-flow\": \"^6.23.0\",\n \"eslint\": \"^4.19.1\",\n \"eslint-config-airbnb\": \"^16.1.0\",\n \"eslint-plugin-flowtype\": \"^2.49.3\",\n \"eslint-plugin-import\": \"^2.12.0\",\n \"eslint-plugin-jsx-a11y\": \"^6.0.3\",\n \"eslint-plugin-react\": \"^7.9.1\",\n \"eslint-watch\": \"^3.1.5\",\n \"flow-bin\": \"^0.74.0\",\n \"flow-watch\": \"^1.1.3\",\n \"jest-fetch-mock\": \"^1.6.3\",\n \"locutus\": \"^2.0.9\",\n \"uglify-js\": \"^3.4.0\",\n \"uglifyjs-folder\": \"^1.5.1\",\n \"babel-cli\": \"^6.26.0\",\n \"babel-jest\": \"^20.0.3\",\n \"babel-preset-es2015\": \"^6.24.1\",\n \"babel-preset-stage-2\": \"^6.24.1\",\n \"coveralls\": \"^2.13.3\",\n \"esdoc\": \"^1.1.0\",\n \"esdoc-flow-plugin\": \"^1.0.0\",\n \"esdoc-jsx-plugin\": \"^1.0.0\",\n \"esdoc-standard-plugin\": \"^1.0.0\",\n \"eslint-plugin-jest\": \"^21.17.0\",\n \"jest-cli\": \"^23.2\",\n \"istanbul\": \"^0.4.5\",\n \"istanbul-api\": \"1.2.2\",\n \"istanbul-reports\": \"1.1.4\"\n },\n \"standard\": {\n \"plugins\": [\n \"flowtype\"\n ],\n \"parser\": \"babel-eslint\"\n },\n \"jest\": {\n \"collectCoverageFrom\": [\n \"src/**/*.js\"\n ],\n \"coverageThreshold\": {\n \"global\": {\n \"statements\": 85,\n \"branches\": 75,\n \"functions\": 85,\n \"lines\": 85\n }\n },\n \"automock\": false,\n \"setupFiles\": [\n \"./setupJest.js\"\n ]\n }\n}\n", | ||
"longname": "/Users/josh/caldera-js/api-client/package.json", | ||
"name": "package.json", | ||
"static": true, | ||
|
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
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
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 |
---|---|---|
|
@@ -33,6 +33,39 @@ export class EntriesClient extends WpClient { | |
}, this.getEntryEndpoint(formId, entryId)); | ||
} | ||
|
||
/** | ||
* Delete a single entry of a form | ||
* | ||
* @param {String} formId ID of form to get entries for. | ||
* @param {String} entryId ID of entry to find. | ||
* @return {Promise<any>} | ||
*/ | ||
deleteEntry( formId: string, entryId: number ): Promise<any> { | ||
return this.reqDelete(this.getEntryEndpoint( formId, entryId ) ); | ||
} | ||
|
||
/** | ||
* Delete all entries of a form | ||
* | ||
* @param {String} formId ID of form to get entries for. | ||
* @return {Promise<any>} | ||
*/ | ||
deleteEntries( formId: string ): Promise<any> { | ||
return this.reqDelete(this.getEntriesEndpoint( formId ) ); | ||
} | ||
|
||
/** | ||
* Resent a single entry of a form | ||
* | ||
* @param {String} formId ID of form to get entries for. | ||
* @param {String} entryId ID of entry to find. | ||
* @return {Promise<any>} | ||
*/ | ||
resendEntry( formId: string, entryId: number ): Promise<any> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
return this.reqPost(this.getEntryEndpoint( formId, entryId ) ); | ||
} | ||
|
||
|
||
/** | ||
* The endpoint URI for a collection of entries for one form. | ||
|
@@ -54,5 +87,16 @@ export class EntriesClient extends WpClient { | |
return `${this.getEntriesEndpoint(formId)}/${entryId}`; | ||
} | ||
|
||
/** | ||
* The resend endpoint URI for single entries | ||
* | ||
* @param {String} formId ID of form to get entries for. | ||
* @param {String} entryId ID of entry to find. | ||
* @return {string} | ||
*/ | ||
getEntryResendEndpoint(formId: string, entryId: number): string { | ||
return `${this.getEntriesEndpoint(formId)}/${entryId}/resend`; | ||
} | ||
|
||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.