Skip to content

Commit 16d35be

Browse files
author
JW Wesson
committed
add v2 skills/ontology endpoints that contain certification skills
1 parent 355071e commit 16d35be

File tree

8 files changed

+588
-4
lines changed

8 files changed

+588
-4
lines changed

src/main/java/com/textkernel/tx/ApiEndpoints.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ private String sanitize(String indexOrDocId) throws IllegalArgumentException {
8484
String desSkillsExtract() { return prefix(false) + "/skills/extract"; }
8585
String desSkillsLookup() { return prefix(false) + "/skills/lookup"; }
8686
String desSkillsAutoComplete() { return prefix(false) + "/skills/autoComplete"; }
87+
String desSkillsGetTaxonomyV2(TaxonomyFormat format) { return prefix(false) + "/skills/v2/taxonomy?format="+ format; }
88+
String desSkillsGetMetadataV2() { return prefix(false) + "/skills/v2/metadata"; }
89+
String desSkillsNormalizeV2() { return prefix(false) + "/skills/v2/normalize"; }
90+
String desSkillsExtractV2() { return prefix(false) + "/skills/v2/extract"; }
91+
String desSkillsLookupV2() { return prefix(false) + "/skills/v2/lookup"; }
92+
String desSkillsAutoCompleteV2() { return prefix(false) + "/skills/v2/autoComplete"; }
8793
String desProfessionsGetTaxonomy(TaxonomyFormat format, String language) { return prefix(false) + "/professions/taxonomy?format="+ format +"&language="+ language; }
8894
String desProfessionsGetMetadata() { return prefix(false) + "/professions/metadata"; }
8995
String desProfessionsNormalize() { return prefix(false) + "/professions/normalize"; }
@@ -95,6 +101,12 @@ private String sanitize(String indexOrDocId) throws IllegalArgumentException {
95101
String desOntologySuggestProfessions() { return prefix(false) + "/ontology/suggest-professions"; }
96102
String desOntologyCompareSkillsToProfession() { return prefix(false) + "/ontology/compare-skills-to-profession"; }
97103
String desOntologySkillsSimilarityScore() { return prefix(false) + "/ontology/skills-similarity-score"; }
104+
String desOntologySuggestSkillsFromProfessionsV2() { return prefix(false) + "/ontology/v2/suggest-skills-from-professions"; }
105+
String desOntologySuggestSkillsFromSkillsV2() { return prefix(false) + "/ontology/v2/suggest-skills-from-skills"; }
106+
String desOntologyCompareProfessionsV2() { return prefix(false) + "/ontology/v2/compare-professions"; }
107+
String desOntologySuggestProfessionsV2() { return prefix(false) + "/ontology/v2/suggest-professions"; }
108+
String desOntologyCompareSkillsToProfessionV2() { return prefix(false) + "/ontology/v2/compare-skills-to-profession"; }
109+
String desOntologySkillsSimilarityScoreV2() { return prefix(false) + "/ontology/v2/skills-similarity-score"; }
98110

99111
String jobDescriptionGenerate() { return prefix(false) + "/job-description/generate"; }
100112
String jobDescriptionSuggestSkills() { return prefix(false) + "/job-description/suggest-skills"; }

src/main/java/com/textkernel/tx/TxClient.java

Lines changed: 546 additions & 0 deletions
Large diffs are not rendered by default.

src/main/java/com/textkernel/tx/models/api/dataenrichment/ontology/request/SuggestSkillsFromProfessionsRequest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ public class SuggestSkillsFromProfessionsRequest {
1515
public int Limit = 10;
1616
/** The language to use for the returned descriptions. */
1717
public String OutputLanguage;
18+
/** If specified, only these types of skills will be returned. The following values are acceptable: Professional, IT, Language, Soft, Certification, All. Only applicable in v2 endpoints. */
19+
public List<String> Types;
1820
}

src/main/java/com/textkernel/tx/models/api/dataenrichment/ontology/request/SuggestSkillsFromSkillsRequest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ public class SuggestSkillsFromSkillsRequest {
1717
public int Limit = 25;
1818
/** The language to use for the returned descriptions. */
1919
public String OutputLanguage;
20+
/** If specified, only these types of skills will be returned. The following values are acceptable: Professional, IT, Language, Soft, Certification, All. Only applicable in v2 endpoints. */
21+
public List<String> Types;
2022
}

src/main/java/com/textkernel/tx/models/api/dataenrichment/skills/request/SkillsAutoCompleteRequest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
/** Request body for a 'SkillsAutocomplete' request */
1313
public class SkillsAutoCompleteRequest extends AutocompleteRequest {
14-
/** If specified, only these types of skills will be returned. The following values are acceptable: Professional, IT, Language, Soft, All. */
14+
/** If specified, only these types of skills will be returned. The following
15+
* values are acceptable: Professional, IT, Language, Soft, Certification (only when using v2 endpoints), All.
16+
* */
1517
public List<String> Types;
1618
}

src/main/java/com/textkernel/tx/models/dataenrichment/Skill.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class Skill {
66
public String Description;
77
/** The ID of the skill in the taxonomy. */
88
public String Id;
9-
/** Type of skill. Possible values are Professional, IT, Language, or Soft. */
9+
/** Type of skill. Possible values are Professional, IT, Language, Soft, or Certification (only when using v2 endpoints). */
1010
public String Type;
1111
/** The language ISO 639-1 code. This will only appear for language skills (Type = Language). */
1212
public String IsoCode;

src/test/java/com/textkernel/tx/SDKTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
public class SDKTests extends TestBase {
1515

1616
@Test
17-
public void test404Message(){
17+
public void test401Error(){
1818
DataCenter fakeDC = new DataCenter("https://api.us.textkernel.com/tx/v9/fake");
1919
TxClient client = new TxClient("1234", "1234", fakeDC);
2020

2121
try {
2222
client.getAccountInfo();
2323
}
2424
catch (TxException e){
25-
assertEquals(404, e.HttpStatusCode);
25+
assertEquals(401, e.HttpStatusCode);
2626
}
2727
}
2828

src/test/java/com/textkernel/tx/integration/DataEnrichmentServiceTests.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
import com.textkernel.tx.TestBase;
99
import com.textkernel.tx.models.api.dataenrichment.TaxonomyFormat;
1010
import com.textkernel.tx.models.api.dataenrichment.ontology.response.SkillScore;
11+
import com.textkernel.tx.models.api.dataenrichment.skills.response.AutoCompleteSkillsResponse;
1112

1213
import org.junit.jupiter.api.Test;
1314

1415
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
17+
import static org.junit.jupiter.api.Assertions.assertNotNull;
1518

1619
import java.util.ArrayList;
1720
import java.util.List;
@@ -42,6 +45,23 @@ public void testSkillAutoComplete() {
4245
});
4346
}
4447

48+
@Test
49+
public void testSkillAutoCompleteV2() {
50+
AutoCompleteSkillsResponse[] wrapper = { null};
51+
52+
assertDoesNotThrow(() -> {
53+
ArrayList<String> languages = new ArrayList<String>();
54+
languages.add("en");
55+
ArrayList<String> types = new ArrayList<String>();
56+
types.add("certification");
57+
wrapper[0] = Client.autocompleteSkillV2("soft", languages, "en", types, 10);
58+
});
59+
60+
assertNotNull(wrapper[0].Value);
61+
assertHasItems(wrapper[0].Value.Skills);
62+
assertEquals("Certification", wrapper[0].Value.Skills.get(0).Type);
63+
}
64+
4565
@Test
4666
public void testSkillsLookup() {
4767
assertDoesNotThrow(() -> {

0 commit comments

Comments
 (0)