From 9ef5c6e1dad19a446052cc767363544738b3ec49 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Sun, 12 Jul 2026 02:21:49 +0000 Subject: [PATCH 1/2] ## Go SDK Changes: * `Glean.Platform.Skills.List()`: **Added** * `Glean.Platform.Skills.Retrieve()`: **Added** * `Glean.Client.Chat.Create()`: * `request.ChatRequest.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added** * `response.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added** * `Glean.Client.Chat.Retrieve()`: `response.ChatResult.Chat.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added** * `Glean.Client.Chat.CreateStream()`: * `request.ChatRequest.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added** --- .speakeasy/gen.lock | 215 ++++++- .speakeasy/gen.yaml | 2 +- .speakeasy/glean-merged-spec.yaml | 266 +++++++- .speakeasy/tests.arazzo.yaml | 30 + .speakeasy/workflow.lock | 12 +- README.md | 5 + RELEASES.md | 12 +- docs/models/components/actiontypesource.md | 34 + docs/models/components/platformskill.md | 18 + .../components/platformskillgetresponse.md | 9 + docs/models/components/platformskillorigin.md | 20 + .../components/platformskillslistresponse.md | 11 + .../platformskillsourceprovenance.md | 13 + docs/models/components/platformskillstatus.md | 25 + .../components/platformskillsyncstatus.md | 25 + docs/models/components/toolmetadata.md | 41 +- .../operations/platformskillsgetrequest.md | 8 + .../operations/platformskillsgetresponse.md | 9 + .../operations/platformskillslistrequest.md | 9 + .../operations/platformskillslistresponse.md | 9 + docs/sdks/skills/README.md | 119 ++++ glean.go | 6 +- models/components/platformskill.go | 120 ++++ models/components/platformskillgetresponse.go | 23 + models/components/platformskillorigin.go | 32 + .../components/platformskillslistresponse.go | 42 ++ .../platformskillsourceprovenance.go | 76 +++ models/components/platformskillstatus.go | 27 + models/components/platformskillsyncstatus.go | 27 + models/components/toolmetadata.go | 49 ++ models/operations/platformskillsget.go | 39 ++ models/operations/platformskillslist.go | 48 ++ platform.go | 25 + skills.go | 581 ++++++++++++++++++ tests/messages_test.go | 2 +- .../internal/handler/generated_handlers.go | 2 + .../internal/handler/pathgetapiskills.go | 68 ++ .../handler/pathgetapiskillsskillid.go | 79 +++ .../pathpostrestapiv1createcollection.go | 20 +- .../sdk/models/components/platformskill.go | 120 ++++ .../components/platformskillgetresponse.go | 23 + .../models/components/platformskillorigin.go | 32 + .../components/platformskillslistresponse.go | 42 ++ .../platformskillsourceprovenance.go | 76 +++ .../models/components/platformskillstatus.go | 38 ++ .../components/platformskillsyncstatus.go | 38 ++ .../sdk/models/components/toolmetadata.go | 57 ++ .../models/operations/platformskillsget.go | 39 ++ .../models/operations/platformskillslist.go | 48 ++ tests/skills_test.go | 46 ++ tests/summarize_test.go | 15 +- 51 files changed, 2645 insertions(+), 87 deletions(-) create mode 100644 docs/models/components/actiontypesource.md create mode 100644 docs/models/components/platformskill.md create mode 100644 docs/models/components/platformskillgetresponse.md create mode 100644 docs/models/components/platformskillorigin.md create mode 100644 docs/models/components/platformskillslistresponse.md create mode 100644 docs/models/components/platformskillsourceprovenance.md create mode 100644 docs/models/components/platformskillstatus.md create mode 100644 docs/models/components/platformskillsyncstatus.md create mode 100644 docs/models/operations/platformskillsgetrequest.md create mode 100644 docs/models/operations/platformskillsgetresponse.md create mode 100644 docs/models/operations/platformskillslistrequest.md create mode 100644 docs/models/operations/platformskillslistresponse.md create mode 100644 docs/sdks/skills/README.md create mode 100644 models/components/platformskill.go create mode 100644 models/components/platformskillgetresponse.go create mode 100644 models/components/platformskillorigin.go create mode 100644 models/components/platformskillslistresponse.go create mode 100644 models/components/platformskillsourceprovenance.go create mode 100644 models/components/platformskillstatus.go create mode 100644 models/components/platformskillsyncstatus.go create mode 100644 models/operations/platformskillsget.go create mode 100644 models/operations/platformskillslist.go create mode 100644 platform.go create mode 100644 skills.go create mode 100644 tests/mockserver/internal/handler/pathgetapiskills.go create mode 100644 tests/mockserver/internal/handler/pathgetapiskillsskillid.go create mode 100644 tests/mockserver/internal/sdk/models/components/platformskill.go create mode 100644 tests/mockserver/internal/sdk/models/components/platformskillgetresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/platformskillorigin.go create mode 100644 tests/mockserver/internal/sdk/models/components/platformskillslistresponse.go create mode 100644 tests/mockserver/internal/sdk/models/components/platformskillsourceprovenance.go create mode 100644 tests/mockserver/internal/sdk/models/components/platformskillstatus.go create mode 100644 tests/mockserver/internal/sdk/models/components/platformskillsyncstatus.go create mode 100644 tests/mockserver/internal/sdk/models/operations/platformskillsget.go create mode 100644 tests/mockserver/internal/sdk/models/operations/platformskillslist.go create mode 100644 tests/skills_test.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index cbb86e27..66784da1 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,18 +1,18 @@ lockVersion: 2.0.0 id: 9d90eb9e-33f8-4170-8944-988f4000aad0 management: - docChecksum: 33958fda4f2b946f46f0593aac3a619d + docChecksum: 9c0edd749e8f9d1f4bb04d0bc51a94d0 docVersion: 0.9.0 - speakeasyVersion: 1.789.2 + speakeasyVersion: 1.789.3 generationVersion: 2.916.4 - releaseVersion: 0.13.3 - configChecksum: d8c5dbc61d50c91087ddac380658b2a3 + releaseVersion: 0.13.4 + configChecksum: 84f1d1ec26d1cb0114798c5ca0cb5bf2 repoURL: https://github.com/gleanwork/api-client-go.git installationURL: https://github.com/gleanwork/api-client-go persistentEdits: - generation_id: 301d40aa-b90e-41af-9218-fb049a9c791c - pristine_commit_hash: 1c29a1de06c6e288407e955d5c99d20d99f92db9 - pristine_tree_hash: ed54f2a158557d2898fb704c6fd2c794de48031c + generation_id: 8954292d-25ae-448e-adec-31309e0c508b + pristine_commit_hash: 7e078cbd100aa20ec50eb5f14350a88f132943c1 + pristine_tree_hash: f93e75be2d653bfc7f9c5fffc11281e33f9c1622 features: go: acceptHeaders: 2.81.2 @@ -168,6 +168,10 @@ trackedFiles: id: f9f286d7b5c6 last_write_checksum: sha1:4772a941c6ff48ac882f8af37ba75ba3992f23c8 pristine_git_object: 519f7906092a23ddcfb3681a849754413edab352 + docs/models/components/actiontypesource.md: + id: 5a875e42f006 + last_write_checksum: sha1:bcc6b7810e05e81eeda22c2bfab5f530a9750774 + pristine_git_object: 8ddec1006ed9662611131621e64c2a204c4bcca1 docs/models/components/activity.md: id: a2d8273e4214 last_write_checksum: sha1:5793af93a85c85a322ebfbe8660bd955b2ab4685 @@ -2008,6 +2012,34 @@ trackedFiles: id: d398b8139176 last_write_checksum: sha1:8e60e11bbdf3cb4c64446551d422cffba1d47238 pristine_git_object: 0794886b804c14ea6a92f1146621164ab81e0fee + docs/models/components/platformskill.md: + id: 0085679a1f14 + last_write_checksum: sha1:7fb7ab3d042d0c28c27716010cddc30bc47cb06c + pristine_git_object: 28d865f006c9630eec3d7c10370402b951dcecf6 + docs/models/components/platformskillgetresponse.md: + id: bc5043e8f6f7 + last_write_checksum: sha1:9f676850351c3869e0c5765ccf341e659562857f + pristine_git_object: f39ce31f59cdf798b50be591c1f0accfb1f2b758 + docs/models/components/platformskillorigin.md: + id: 9dc751dc212a + last_write_checksum: sha1:4a1d6ce7afa526d37d4386871f24471c1daff646 + pristine_git_object: 898011b445cbf9ad0e6fb7e66b7b09d4f72fa639 + docs/models/components/platformskillslistresponse.md: + id: 58b27e4bea7e + last_write_checksum: sha1:efe68fd855c2344a01f93d8d103866372a06fc69 + pristine_git_object: 3e7bca2ce6fa6ad499fe7b1b0e52fbdaf1862daf + docs/models/components/platformskillsourceprovenance.md: + id: 29fe97f47f93 + last_write_checksum: sha1:175c6ef974cbfe66b806e810db5c69060bf432fc + pristine_git_object: c9c901dd9f1740f879336b4fd06348d35f5ef0e0 + docs/models/components/platformskillstatus.md: + id: 3342d36796ac + last_write_checksum: sha1:6d88bc81927adb5900359e8d16ff9550f0c01ca3 + pristine_git_object: 0eb8f54e948b71747e9f9a1a928f91733bdd88eb + docs/models/components/platformskillsyncstatus.md: + id: b4dfbecbfcf6 + last_write_checksum: sha1:d444bf3ae45d30a6d3a8d57d0a36281e721542ae + pristine_git_object: 0b0a0c1ff41ee9c5e6fa7b1f9f95b9ee0b7b7ed3 docs/models/components/platformtimerange.md: id: d2e589bb488c last_write_checksum: sha1:61236d3fb6f05a246d0a61150bf2456c18cfd7f5 @@ -2442,8 +2474,8 @@ trackedFiles: pristine_git_object: 96500bce6c762f21c7d5b7927898bb309a201414 docs/models/components/toolmetadata.md: id: e8ce3b56fbdc - last_write_checksum: sha1:0e73c5d8394b4b0358621b7bc54c2217537d7d10 - pristine_git_object: 0eb177c9b4e179deb001b03934a24250a0f91be4 + last_write_checksum: sha1:4c10de41704ef0fb11c7261ff052293e04171156 + pristine_git_object: feadc76e887744b8704909c72702a7e123c7bb55 docs/models/components/toolmetadatatype.md: id: 45942314082a last_write_checksum: sha1:f78c398a278a268a3ad1a9d66f7145b80b3237c6 @@ -3316,6 +3348,22 @@ trackedFiles: id: a46e42d54b9f last_write_checksum: sha1:ca08b9c8ea57085a78456a25c94f175bc22b6357 pristine_git_object: aac966cebf050dbaec08ec5a7ca67cb03ba1779e + docs/models/operations/platformskillsgetrequest.md: + id: 6e77031ea696 + last_write_checksum: sha1:bb06dad1a6c863ce306117a166eb58d7803970a2 + pristine_git_object: b5d6c2b611f8b12098984153097ac086b99f5c1c + docs/models/operations/platformskillsgetresponse.md: + id: bcd6a2c49669 + last_write_checksum: sha1:8028981d53d2a7cdece1d5927b226384067143d6 + pristine_git_object: 2a33875ec169fc83ef78cf18b1db96301549309e + docs/models/operations/platformskillslistrequest.md: + id: 2e304cbf2212 + last_write_checksum: sha1:90c7ee33379213fe5e88db31513945f25da76034 + pristine_git_object: 7727a9476f5a848f051ec94e9629e984e49d2563 + docs/models/operations/platformskillslistresponse.md: + id: b0b541d98b59 + last_write_checksum: sha1:a332cc22fae23106c991d0a9fcad6455043c6667 + pristine_git_object: e33cf96998184b7b5eea817d71c91bae30fa4e20 docs/models/operations/postapiindexv1adddatasourceresponse.md: id: 6fe122d45c0b last_write_checksum: sha1:cda908b7a1c12d7638556f7c4573c97a50140504 @@ -3724,6 +3772,10 @@ trackedFiles: id: 5c534716244c last_write_checksum: sha1:2ff02ecfda4f97e039b24254528a20800148f39f pristine_git_object: 2487f2f798a866383f669952a76f999c869d4927 + docs/sdks/skills/README.md: + id: 3a14a5c90791 + last_write_checksum: sha1:6b3a6f7db51dbae8f0f76dd047751771f2122c59 + pristine_git_object: e2bfaecb4b8656f316326c4de3c644d6db2a5d5a docs/sdks/tools/README.md: id: 044286549bac last_write_checksum: sha1:496baa99aee4567d5338f6bf39dbca987ea67684 @@ -3750,8 +3802,8 @@ trackedFiles: pristine_git_object: a3cb3e5448f3fdcfad77ed2a4ba47ae848d5cd5d glean.go: id: f5ed099b8e85 - last_write_checksum: sha1:dce5f3a64b81b878278dd1c24c9913042379433d - pristine_git_object: 4842a872e30637d4adc5bc344128ef0c67b37ef4 + last_write_checksum: sha1:26ddd9873f9219476cfdb828c4e1a028efc36027 + pristine_git_object: a654ff120370c5b009ca57877a2866dbc8a8a887 go.mod: id: c47645c391ad last_write_checksum: sha1:cf65a2c96e303858d4cf70e07d4c44d3f1c1db38 @@ -5336,6 +5388,34 @@ trackedFiles: id: ff5d88deb51b last_write_checksum: sha1:bf19b10d0c3a06060a7e7b53d239ca242e14dd2a pristine_git_object: c70f12b5a8c25b8eea7ec71cc0c85f7e099fb2bf + models/components/platformskill.go: + id: 3b83f267399a + last_write_checksum: sha1:79813bab4f800c69ff646440bf159bcb313b9b3c + pristine_git_object: b4dec8678af8499f7ce23c432d876009539cb543 + models/components/platformskillgetresponse.go: + id: 86b58b63e055 + last_write_checksum: sha1:41c82f75c9a8c429ab0b442ec8b201f7aabd581b + pristine_git_object: 76a2907a66cb48ab74a155fbc093adfda64cf57c + models/components/platformskillorigin.go: + id: fa87164c0c39 + last_write_checksum: sha1:4bbd57b85b9318d5fa9ea3ca97e26cab34e689fd + pristine_git_object: e0a004498154f0b4285d2d29dde3d0e27b163bb6 + models/components/platformskillslistresponse.go: + id: de5ae3de61d7 + last_write_checksum: sha1:dead111d978716b3e7a49db1188239a31cda405c + pristine_git_object: 3fd760ac8fe6d0c187c619c3a58126d447498329 + models/components/platformskillsourceprovenance.go: + id: 7e47a9ae686a + last_write_checksum: sha1:23ea2ee6399d336e99984816805d3fe491be50d6 + pristine_git_object: 650f7afe9af9948f61446c01d5168ec4f4901c16 + models/components/platformskillstatus.go: + id: 1fa7daee9a52 + last_write_checksum: sha1:3f5a7d9dbd27108b2788a8a660a3b357b8e1c7b7 + pristine_git_object: 78b9bc62466fa3d55d1a6a01ad621ff7e3f71740 + models/components/platformskillsyncstatus.go: + id: b58f34432b9f + last_write_checksum: sha1:890f2323825ded5cf09da513d5f8d31c0e2d1472 + pristine_git_object: 5396a955fc1e5c467149a7536f6b5dedc1797627 models/components/platformtimerange.go: id: f0d79b3ada90 last_write_checksum: sha1:736cbfaac97901328f8d421406492a94be6ce71c @@ -5674,8 +5754,8 @@ trackedFiles: pristine_git_object: a1dc22ea354cb4fc593878d90f724e7db40a5ee2 models/components/toolmetadata.go: id: bd86fa2d74d6 - last_write_checksum: sha1:6b40595e506874ce55ec5e534ba43eaeff077b94 - pristine_git_object: 7033e2fc29975798f99e6772c5437d4f4aeab1cc + last_write_checksum: sha1:e9eb31b6687bf1c69f5666bc62b8d59c4b301a80 + pristine_git_object: ee48ef71127655438f9224b703d26fb3fe515403 models/components/toolparameter.go: id: 46b9f903cbf5 last_write_checksum: sha1:d0fb7e0d7e895e8a229a5df42d6322b129137802 @@ -6196,6 +6276,14 @@ trackedFiles: id: 875844d95a55 last_write_checksum: sha1:3582ce5977fb23592979ddf1c59d85d14075fa46 pristine_git_object: 8718a747925ff5a4e74302ddca26810b8bba5241 + models/operations/platformskillsget.go: + id: f2d9d9b1237e + last_write_checksum: sha1:f0ac0d795a8eeb2217e19baa67243386f6e6da45 + pristine_git_object: bb8b938840bd8cd8ae3f0334e2e4a3e04217e44f + models/operations/platformskillslist.go: + id: c7324bad43ea + last_write_checksum: sha1:f95f57643e407c5d86d16e9e330fee0bf9ad2613 + pristine_git_object: b004ed194f507b7d723dce51adccc90a35e41009 models/operations/postapiindexv1adddatasource.go: id: 50ff52426165 last_write_checksum: sha1:c14aac3a71bfaeca68789cbc3ecf8c64639a161d @@ -6432,6 +6520,10 @@ trackedFiles: id: 59c8fe5afdf5 last_write_checksum: sha1:e3e46ab3786ec8c643689142090d525937de10d4 pristine_git_object: d78e5e616880d3e8f2972d00cab7bc8501fcb4ae + platform.go: + id: f45c828d4989 + last_write_checksum: sha1:20a44b7a0e9852ced460a0ec1e5cb5bbc8af8f94 + pristine_git_object: 402179f958ad67cfcb1365ac33db63cac351142d policies.go: id: d1f59aa85c31 last_write_checksum: sha1:0847c8ba50019850bcacfcaffca648b20378d93b @@ -6448,6 +6540,10 @@ trackedFiles: id: 4c057402d2bf last_write_checksum: sha1:a5737cd0c6d9dfcf7cd5d9cd126fc1f330926b7c pristine_git_object: 32fa4d06b5561a9ae06eb0d9c594c6da076a3b64 + skills.go: + id: 65ecddcd9ce6 + last_write_checksum: sha1:92b27b7ab8639a8e73e9977c8f98ba335e331236 + pristine_git_object: b42d6f31272a92c7d440bcb4448ec665d2c991dc tests/activities_test.go: id: 93b3ec0f226c last_write_checksum: sha1:d8e9f9a0d877a8e7d4277c174581d44633e1b8ec @@ -6554,8 +6650,8 @@ trackedFiles: pristine_git_object: 6d9cbca42012c2760de3ecaf4f569c53d32197da tests/messages_test.go: id: 3433c956b7a3 - last_write_checksum: sha1:63e7b1c9a68b43467855286635a88cb166b2bc79 - pristine_git_object: febdc0e8a34b769bfc6dcfe3a9e33053b2267433 + last_write_checksum: sha1:352ecfa3a01795bbe7fad9b0202c4ccaa02448c3 + pristine_git_object: 64ef64fe1c0ccbc223987d87ddddf3d6e2de7799 tests/mockserver/.gitignore: id: 7705eb663274 last_write_checksum: sha1:228e1b05712a973948fd771323a2140a3b355ff4 @@ -6610,8 +6706,8 @@ trackedFiles: pristine_git_object: 929558ef2e1165f7e09da6d0a64f016c90971655 tests/mockserver/internal/handler/generated_handlers.go: id: 61ac4f7cce9e - last_write_checksum: sha1:504888816904477536564a19b80f4284b6823e27 - pristine_git_object: d5fe2f854992c1454456ccbe2b496a6446cb6904 + last_write_checksum: sha1:8e4ffe198fbf4365285f96b1a23c4c21b1eb9b1a + pristine_git_object: 49b7267fb0b9cbcfac0d506e6de116172f86acca tests/mockserver/internal/handler/pathdeleterestapiindexcustommetadataschemagroupname.go: id: 979e4583765b last_write_checksum: sha1:b1d4edb259d907c7a88b634bf16f0cf152321693 @@ -6628,6 +6724,14 @@ trackedFiles: id: a3a921765081 last_write_checksum: sha1:41dfbc3d70153e24cc2a898336d7d2a9c6e3d3df pristine_git_object: a9212f1d5de9d8b40e73ea4b410feb26921c35cb + tests/mockserver/internal/handler/pathgetapiskills.go: + id: a1697453079c + last_write_checksum: sha1:1608120c2f9ce748fdd2d373e576b6a0758092c1 + pristine_git_object: 7baa51e79fd4c8ed0f5c9ebadf5030c74e966973 + tests/mockserver/internal/handler/pathgetapiskillsskillid.go: + id: 97a0dcaf8ddf + last_write_checksum: sha1:d939db8a7f6d6e5b3e09402246efd0d1b53c44eb + pristine_git_object: 4f097d8448491dc032cba2fdbb1f9aae85f80600 tests/mockserver/internal/handler/pathgetrestapiindexcustommetadataschemagroupname.go: id: a14a30d0e377 last_write_checksum: sha1:83a992c70c3b7d010928d89a52f70db1042dd186 @@ -6846,8 +6950,8 @@ trackedFiles: pristine_git_object: ab9263d43404e8e6f07af222a3e785aca2fbf35f tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go: id: 3fb93a419933 - last_write_checksum: sha1:14b4a1d98dd55ce2b487ae1aaab4a7dece08df25 - pristine_git_object: 371b90231fcd7bd77fd6d9566156605af1712d9a + last_write_checksum: sha1:f9f4c718408bddadbdf826194f07970bb111e57e + pristine_git_object: 5c99a0ada5302c8f64c0e5da5683fa8bd9e9975d tests/mockserver/internal/handler/pathpostrestapiv1createshortcut.go: id: 8d9d3abb0c34 last_write_checksum: sha1:2f9468a50936c4cb0fb2101d97c1425cb36ba2d4 @@ -8536,6 +8640,34 @@ trackedFiles: id: a58f32052764 last_write_checksum: sha1:6db9bd73c6fd7cc1c8bf28c2b1ee96cc77d7236a pristine_git_object: e8243de2c4e8582ed42736e75e4aa715a6a376bc + tests/mockserver/internal/sdk/models/components/platformskill.go: + id: a97a51039ff5 + last_write_checksum: sha1:8871b58924c180a5565b43c91b58ed79212739bb + pristine_git_object: 8397a89921fdbadf8ff5733049b9faabf554e21a + tests/mockserver/internal/sdk/models/components/platformskillgetresponse.go: + id: 24cc096b11c0 + last_write_checksum: sha1:44cf3cd559d6e8cde855daafc7c9fe31774fce6f + pristine_git_object: c9bcfa2f4e416f4b6c441f39bd70c157687abc5d + tests/mockserver/internal/sdk/models/components/platformskillorigin.go: + id: b3f692d12f20 + last_write_checksum: sha1:4bbd57b85b9318d5fa9ea3ca97e26cab34e689fd + pristine_git_object: e0a004498154f0b4285d2d29dde3d0e27b163bb6 + tests/mockserver/internal/sdk/models/components/platformskillslistresponse.go: + id: 61695a856d41 + last_write_checksum: sha1:718c3f3013007de52b02444e4a12d43a10fce37d + pristine_git_object: 566d53518ac6a45dc5ae0ec8e5e55df0433f8ae1 + tests/mockserver/internal/sdk/models/components/platformskillsourceprovenance.go: + id: 3a0b70781266 + last_write_checksum: sha1:f64c669b34f9bc8e21d5620001620e8c8a66756f + pristine_git_object: 65ed2aacddbc7cb4f5ac6084a8eb21e236b3b377 + tests/mockserver/internal/sdk/models/components/platformskillstatus.go: + id: d6163aa830e8 + last_write_checksum: sha1:641cb578909b86e1c1166a75e309e5bcf52ecf29 + pristine_git_object: a218b7608eead950ddb62301af0326adc4f091f5 + tests/mockserver/internal/sdk/models/components/platformskillsyncstatus.go: + id: a172da0d9d4d + last_write_checksum: sha1:66e29681184c77fbbff593cc30e33023a3b39c81 + pristine_git_object: 0582664c1c7451d505bc18ea138e299db160c5a6 tests/mockserver/internal/sdk/models/components/platformtimerange.go: id: cf2540151ce1 last_write_checksum: sha1:3a0ec2ca473681b89ff97606f648fc15fcdae38e @@ -8874,8 +9006,8 @@ trackedFiles: pristine_git_object: dea3298b26e324de06316da296f7a4d899dd475d tests/mockserver/internal/sdk/models/components/toolmetadata.go: id: 2777b3aa0636 - last_write_checksum: sha1:4487cdc2b5b1dc1a2fa1a3ca7d46188bfc0e211c - pristine_git_object: 3c803a6d3c1c80f7f1e230a843a8c3f1c1186dfe + last_write_checksum: sha1:97ddaa6e15c52ec37c4ea46e933f7ec5d4ca7bca + pristine_git_object: 061df30afb35d8282910bd66ddd76838607ea7ab tests/mockserver/internal/sdk/models/components/toolparameter.go: id: d02a0b83b357 last_write_checksum: sha1:66a7a1e6154a3c42741d575291f358116f017c87 @@ -9392,6 +9524,14 @@ trackedFiles: id: d990791ac101 last_write_checksum: sha1:995d47533ef63c7518c50398593671059d6ccc07 pristine_git_object: 16b6e86fe62e1e0ec43293439e9fba7995a72a80 + tests/mockserver/internal/sdk/models/operations/platformskillsget.go: + id: fc753bfc0e6f + last_write_checksum: sha1:beb72342b1186ad56896339bb3fa710456214bab + pristine_git_object: 6ebb5b11eb4470e6b8804d62db58a314cefa2a6d + tests/mockserver/internal/sdk/models/operations/platformskillslist.go: + id: daa657929c98 + last_write_checksum: sha1:fb44d154d8dcca86575b76dd6fdef213e2a568a5 + pristine_git_object: 40f74199560f03309466234c52f5d5dfaed2f563 tests/mockserver/internal/sdk/models/operations/postapiindexv1adddatasource.go: id: 85e7185113c5 last_write_checksum: sha1:2f82dc427027cdb45f8fcf8fa6454e28599233aa @@ -9732,10 +9872,14 @@ trackedFiles: id: 2ec51916e3e4 last_write_checksum: sha1:75e97d28b0ad3c777774ab5cc211fc0c97394968 pristine_git_object: 245e79dbdefc57ffcf8d2282e3f80bd581fdcda2 + tests/skills_test.go: + id: 67834dec1608 + last_write_checksum: sha1:9b1b7de2f44784650e33bf92f1a9e78224e5d7f1 + pristine_git_object: f9b5586c9a99a5b1d9367762364374b8556160a2 tests/summarize_test.go: id: 1b63b0a16e69 - last_write_checksum: sha1:4e661ba3ca605bf350ae9afbecb86a268efed456 - pristine_git_object: 4474f69b10e0c4f6741ed3eca7df59f18a9038b7 + last_write_checksum: sha1:45fed3ea89c807c76d350fadad4cae44cc0a9195 + pristine_git_object: d2a433b8163262f46b9e0be84787099f762c3c84 tests/testclient.go: id: 78d36c6e169c last_write_checksum: sha1:507c44e437934fbff8d295201c1327e18bd00df8 @@ -10784,6 +10928,27 @@ examples: responses: "200": application/json: {"authorizationUrl": "https://shocked-casket.name/"} + platform-skills-list: + speakeasy-default-platform-skills-list: + responses: + "200": + application/json: {"skills": [], "has_more": true, "next_cursor": "", "request_id": ""} + "400": + application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} + "500": + application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} + platform-skills-get: + speakeasy-default-platform-skills-get: + parameters: + path: + skill_id: "" + responses: + "200": + application/json: {"skill": {"id": "", "display_name": "Chad_Herzog", "description": "whenever up aha controvert", "latest_version": 151495, "latest_minor_version": 170771, "status": "DISABLED", "origin": "CUSTOM", "owner": {"name": ""}, "created_at": "2024-12-25T16:41:00.099Z", "updated_at": "2026-12-07T21:59:59.375Z"}, "request_id": ""} + "400": + application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} + "500": + application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} examplesVersion: 1.0.2 generatedTests: activity: "2025-04-29T16:18:24+01:00" @@ -10951,7 +11116,9 @@ generatedTests: platform-search: "2026-07-02T17:50:54Z" getToolServerAuthStatus: "2026-07-08T02:15:48Z" authorizeToolServer: "2026-07-08T02:15:48Z" -releaseNotes: "## Go SDK Changes:\n* `Glean.Client.Chat.Create()`: \n * `request.ChatRequest.Messages[].Fragments[]` **Changed**\n * `response.Messages[].Fragments[]` **Changed**\n* `Glean.Client.Chat.Retrieve()`: `response.ChatResult.Chat.Messages[].Fragments[]` **Changed**\n* `Glean.Client.Chat.CreateStream()`: \n * `request.ChatRequest.Messages[].Fragments[]` **Changed**\n" + platform-skills-list: "2026-07-12T02:17:11Z" + platform-skills-get: "2026-07-12T02:17:11Z" +releaseNotes: "## Go SDK Changes:\n* `Glean.Platform.Skills.List()`: **Added**\n* `Glean.Platform.Skills.Retrieve()`: **Added**\n* `Glean.Client.Chat.Create()`: \n * `request.ChatRequest.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added**\n * `response.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added**\n* `Glean.Client.Chat.Retrieve()`: `response.ChatResult.Chat.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added**\n* `Glean.Client.Chat.CreateStream()`: \n * `request.ChatRequest.Messages[].Fragments[].Action.Metadata.ActionTypeSource` **Added**\n" generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 9bb0da5b..f966ea54 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: true go: - version: 0.13.3 + version: 0.13.4 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false baseErrorName: GleanError diff --git a/.speakeasy/glean-merged-spec.yaml b/.speakeasy/glean-merged-spec.yaml index a1f493a7..5604d6bd 100644 --- a/.speakeasy/glean-merged-spec.yaml +++ b/.speakeasy/glean-merged-spec.yaml @@ -2,8 +2,8 @@ openapi: 3.0.0 info: version: "0.9.0" title: Glean API - x-source-commit-sha: 270b693d49bac2f68e751b2345bac0c267741119 - x-open-api-commit-sha: 592aec2b4913505edb8161645eaf9a72b5286f20 + x-source-commit-sha: cbeca4790899a1eeb6c54a494b5d4e6e41c3e652 + x-open-api-commit-sha: 749aea4c2dffb9006d40b88604dc63b7ecad8e23 description: | # Introduction In addition to the data sources that Glean has built-in support for, Glean also provides a REST API that enables customers to put arbitrary content in the search index. This is useful, for example, for doing permissions-aware search over content in internal tools that reside on-prem as well as for searching over applications that Glean does not currently support first class. In addition these APIs allow the customer to push organization data (people info, organization structure etc) into Glean. @@ -250,6 +250,108 @@ paths: x-speakeasy-name-override: createRun security: - APIToken: [] + /api/skills: + get: + tags: + - Skills + summary: List skills + description: | + List skills available to the authenticated user. + operationId: platform-skills-list + x-visibility: Public + x-glean-experimental: + id: 3eb65937-03a3-472b-9a00-be713f302b5f + introduced: "2026-06-23" + parameters: + - in: query + name: page_size + description: Maximum number of skills to return. + required: false + schema: + type: integer + minimum: 1 + maximum: 100 + - in: query + name: cursor + description: Opaque pagination cursor from a previous response. + required: false + schema: + type: string + minLength: 1 + responses: + "200": + description: Successful response. + content: + application/json: + schema: + $ref: "#/components/schemas/PlatformSkillsListResponse" + "400": + $ref: "#/components/responses/PlatformBadRequest" + "401": + $ref: "#/components/responses/PlatformUnauthorized" + "403": + $ref: "#/components/responses/PlatformForbidden" + "404": + $ref: "#/components/responses/PlatformNotFound" + "408": + $ref: "#/components/responses/PlatformRequestTimeout" + "429": + $ref: "#/components/responses/PlatformTooManyRequests" + "500": + $ref: "#/components/responses/PlatformInternalServerError" + "503": + $ref: "#/components/responses/PlatformServiceUnavailable" + x-speakeasy-group: platform.skills + x-speakeasy-name-override: list + security: + - APIToken: [] + /api/skills/{skill_id}: + get: + tags: + - Skills + summary: Retrieve skill + description: | + Retrieve metadata for a skill available to the authenticated user. + operationId: platform-skills-get + x-visibility: Public + x-glean-experimental: + id: 8f8d1c92-a484-4769-9903-200613dc8a72 + introduced: "2026-06-23" + parameters: + - name: skill_id + in: path + required: true + description: Glean skill ID. + schema: + type: string + minLength: 1 + responses: + "200": + description: Successful response. + content: + application/json: + schema: + $ref: "#/components/schemas/PlatformSkillGetResponse" + "400": + $ref: "#/components/responses/PlatformBadRequest" + "401": + $ref: "#/components/responses/PlatformUnauthorized" + "403": + $ref: "#/components/responses/PlatformForbidden" + "404": + $ref: "#/components/responses/PlatformNotFound" + "408": + $ref: "#/components/responses/PlatformRequestTimeout" + "429": + $ref: "#/components/responses/PlatformTooManyRequests" + "500": + $ref: "#/components/responses/PlatformInternalServerError" + "503": + $ref: "#/components/responses/PlatformServiceUnavailable" + x-speakeasy-group: platform.skills + x-speakeasy-name-override: retrieve + security: + - APIToken: [] /api/search: post: tags: @@ -5479,6 +5581,138 @@ components: request_id: type: string description: Platform-generated request ID for support correlation. + PlatformSkillStatus: + type: string + enum: + - DRAFT + - ENABLED + - DISABLED + description: Current skill status. + PlatformSkillOrigin: + type: string + enum: + - CUSTOM + description: Source category for the skill. + PlatformSkillSyncStatus: + type: string + enum: + - UP_TO_DATE + - UPDATE_AVAILABLE + - SYNC_FAILED + description: Current external-source sync status. + PlatformSkillSourceProvenance: + type: object + properties: + source_url: + type: string + description: URL of the external source the skill was imported from. + commit_sha: + type: string + description: Source commit SHA for the imported skill. + imported_at: + type: string + format: date-time + description: Time the skill was imported. + last_synced_at: + type: string + format: date-time + description: Time the skill was last synced from its source. + sync_status: + $ref: "#/components/schemas/PlatformSkillSyncStatus" + sync_error: + type: string + description: Human-readable sync failure reason, present only when sync_status is SYNC_FAILED. + PlatformPersonReference: + type: object + description: A lightweight reference to a person, used where a payload merely points at someone. + required: + - name + properties: + id: + type: string + description: Opaque Glean person ID. + name: + type: string + description: Display name. + PlatformSkill: + type: object + required: + - id + - display_name + - description + - latest_version + - latest_minor_version + - status + - origin + - owner + - created_at + - updated_at + properties: + id: + type: string + description: Glean skill ID. + display_name: + type: string + description: Human-readable skill name. + description: + type: string + description: Human-readable skill description. + latest_version: + type: integer + description: Latest major version number for the skill. + latest_minor_version: + type: integer + description: Latest minor version number for the skill. + status: + $ref: "#/components/schemas/PlatformSkillStatus" + origin: + $ref: "#/components/schemas/PlatformSkillOrigin" + source_provenance: + $ref: "#/components/schemas/PlatformSkillSourceProvenance" + owner: + $ref: "#/components/schemas/PlatformPersonReference" + created_at: + type: string + format: date-time + description: Time the skill was created. + updated_at: + type: string + format: date-time + description: Time the skill was last updated. + PlatformSkillsListResponse: + type: object + required: + - skills + - has_more + - next_cursor + - request_id + properties: + skills: + type: array + description: Skills available to the user. + items: + $ref: "#/components/schemas/PlatformSkill" + has_more: + type: boolean + description: Whether additional results are available. + next_cursor: + type: string + nullable: true + description: Cursor for the next page, or null when no more results are available. + request_id: + type: string + description: Platform-generated request ID for support correlation. + PlatformSkillGetResponse: + type: object + required: + - skill + - request_id + properties: + skill: + $ref: "#/components/schemas/PlatformSkill" + request_id: + type: string + description: Platform-generated request ID for support correlation. PlatformFilterOperator: type: string description: Supported filter operator. @@ -5579,18 +5813,6 @@ components: Structured filters applied to search results. Equality operators OR multiple values within a filter. Multiple filters are AND'd together, including range filters on the same field. Filters are AND'd with any inline operators in `query`. Note that conflicting constraints on the same field (e.g., `type:document` in the query and `type: spreadsheet` in a filter) produce an empty result set. time_range: $ref: "#/components/schemas/PlatformTimeRange" - PlatformPersonReference: - type: object - description: A lightweight reference to a person, used where a payload merely points at someone. - required: - - name - properties: - id: - type: string - description: Opaque Glean person ID. - name: - type: string - description: Display name. PlatformResult: type: object required: @@ -9635,6 +9857,22 @@ components: - EXECUTION - MCP description: Valid only for write actions. Represents the type of write action. REDIRECT - The client renders the URL which contains information for carrying out the action. EXECUTION - Send a request to an external server and execute the action. MCP - Send a tools/call request to an MCP server to execute the action. + actionTypeSource: + type: string + enum: + - MCP_ANNOTATION + - ADMIN_OVERRIDE + - NONE + - NATIVE_TOOL_DEFINITION + description: | + Analytics-only signal (product snapshot) describing WHERE the action's + read/write determination came from. Complementary to the effective + read/write value (the tool's ToolType, which drives HITL): the value says + read-or-write, this says how confident that is. MCP_ANNOTATION = from the + tool's read-only/destructive hints; ADMIN_OVERRIDE = an admin set it; + NONE = no usable hint (the effective value then defaults to write); + NATIVE_TOOL_DEFINITION = from a curated native tool (snapshot-derived). + Does not affect runtime behavior. authType: type: string enum: diff --git a/.speakeasy/tests.arazzo.yaml b/.speakeasy/tests.arazzo.yaml index ffba480f..2399e055 100644 --- a/.speakeasy/tests.arazzo.yaml +++ b/.speakeasy/tests.arazzo.yaml @@ -164714,3 +164714,33 @@ workflows: type: simple x-speakeasy-test-group: tools x-speakeasy-test-rebuild: true + - workflowId: platform-skills-list + steps: + - stepId: test + operationId: platform-skills-list + successCriteria: + - condition: $statusCode == 200 + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + {"skills":[],"has_more":true,"next_cursor":"","request_id":""} + type: simple + x-speakeasy-test-group: skills + x-speakeasy-test-rebuild: true + - workflowId: platform-skills-get + steps: + - stepId: test + operationId: platform-skills-get + parameters: + - name: skill_id + in: path + value: + successCriteria: + - condition: $statusCode == 200 + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + {"skill":{"id":"","display_name":"Chad_Herzog","description":"whenever up aha controvert","latest_version":151495,"latest_minor_version":170771,"status":"DISABLED","origin":"CUSTOM","owner":{"name":""},"created_at":"2024-12-25T16:41:00.099Z","updated_at":"2026-12-07T21:59:59.375Z"},"request_id":""} + type: simple + x-speakeasy-test-group: skills + x-speakeasy-test-rebuild: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b21e544d..1b8bb481 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.789.2 +speakeasyVersion: 1.789.3 sources: Glean API: sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:145236c33451e6e87cf1507a4d8829678b0df02af59afc9341330627e33ed760 - sourceBlobDigest: sha256:862b1370a65d146eac83f86c6fbd2d787f04ea93c2cf28259af5ded934f9fb3b + sourceRevisionDigest: sha256:5b6095287942d0cbc89988701922bffc8cde912f367b1caa8215d816058ffd4f + sourceBlobDigest: sha256:184c64058698490c5bf472218c2c054ebaa69ae0c35c33167aaef3f14f55ab64 tags: - latest petstore-oas: @@ -17,10 +17,10 @@ targets: glean: source: Glean API sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:145236c33451e6e87cf1507a4d8829678b0df02af59afc9341330627e33ed760 - sourceBlobDigest: sha256:862b1370a65d146eac83f86c6fbd2d787f04ea93c2cf28259af5ded934f9fb3b + sourceRevisionDigest: sha256:5b6095287942d0cbc89988701922bffc8cde912f367b1caa8215d816058ffd4f + sourceBlobDigest: sha256:184c64058698490c5bf472218c2c054ebaa69ae0c35c33167aaef3f14f55ab64 codeSamplesNamespace: glean-api-specs-go-code-samples - codeSamplesRevisionDigest: sha256:90941ca05c5c8e8a7acfa165b3674411f1c712692e4e071afecb72791b282a07 + codeSamplesRevisionDigest: sha256:bb2586cde0d55feb33425672520e38da4b2390bfb7ef7fa2ed234dd97dd5450d petstore: source: petstore-oas sourceNamespace: petstore-oas diff --git a/README.md b/README.md index 40bd7650..4d792c90 100644 --- a/README.md +++ b/README.md @@ -458,6 +458,11 @@ For more information on obtaining the appropriate token type, please contact you * [BulkIndex](docs/sdks/indexingshortcuts/README.md#bulkindex) - Bulk index external shortcuts * [Upload](docs/sdks/indexingshortcuts/README.md#upload) - Upload shortcuts +### [Platform.Skills](docs/sdks/skills/README.md) + +* [List](docs/sdks/skills/README.md#list) - List skills +* [Retrieve](docs/sdks/skills/README.md#retrieve) - Retrieve skill + ### [Search](docs/sdks/search/README.md) * [Query](docs/sdks/search/README.md#query) - Search diff --git a/RELEASES.md b/RELEASES.md index ee34ffff..891577a1 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -798,4 +798,14 @@ Based on: ### Generated - [go v0.13.3] . ### Releases -- [Go v0.13.3] https://github.com/gleanwork/api-client-go/releases/tag/v0.13.3 - . \ No newline at end of file +- [Go v0.13.3] https://github.com/gleanwork/api-client-go/releases/tag/v0.13.3 - . + +## 2026-07-12 02:14:09 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.789.3 (2.916.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.13.4] . +### Releases +- [Go v0.13.4] https://github.com/gleanwork/api-client-go/releases/tag/v0.13.4 - . \ No newline at end of file diff --git a/docs/models/components/actiontypesource.md b/docs/models/components/actiontypesource.md new file mode 100644 index 00000000..8ddec100 --- /dev/null +++ b/docs/models/components/actiontypesource.md @@ -0,0 +1,34 @@ +# ActionTypeSource + +Analytics-only signal (product snapshot) describing WHERE the action's +read/write determination came from. Complementary to the effective +read/write value (the tool's ToolType, which drives HITL): the value says +read-or-write, this says how confident that is. MCP_ANNOTATION = from the +tool's read-only/destructive hints; ADMIN_OVERRIDE = an admin set it; +NONE = no usable hint (the effective value then defaults to write); +NATIVE_TOOL_DEFINITION = from a curated native tool (snapshot-derived). +Does not affect runtime behavior. + + +## Example Usage + +```go +import ( + "github.com/gleanwork/api-client-go/models/components" +) + +value := components.ActionTypeSourceMcpAnnotation + +// Open enum: custom values can be created with a direct type cast +custom := components.ActionTypeSource("custom_value") +``` + + +## Values + +| Name | Value | +| -------------------------------------- | -------------------------------------- | +| `ActionTypeSourceMcpAnnotation` | MCP_ANNOTATION | +| `ActionTypeSourceAdminOverride` | ADMIN_OVERRIDE | +| `ActionTypeSourceNone` | NONE | +| `ActionTypeSourceNativeToolDefinition` | NATIVE_TOOL_DEFINITION | \ No newline at end of file diff --git a/docs/models/components/platformskill.md b/docs/models/components/platformskill.md new file mode 100644 index 00000000..28d865f0 --- /dev/null +++ b/docs/models/components/platformskill.md @@ -0,0 +1,18 @@ +# PlatformSkill + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `ID` | `string` | :heavy_check_mark: | Glean skill ID. | +| `DisplayName` | `string` | :heavy_check_mark: | Human-readable skill name. | +| `Description` | `string` | :heavy_check_mark: | Human-readable skill description. | +| `LatestVersion` | `int64` | :heavy_check_mark: | Latest major version number for the skill. | +| `LatestMinorVersion` | `int64` | :heavy_check_mark: | Latest minor version number for the skill. | +| `Status` | [components.PlatformSkillStatus](../../models/components/platformskillstatus.md) | :heavy_check_mark: | Current skill status. | +| `Origin` | [components.PlatformSkillOrigin](../../models/components/platformskillorigin.md) | :heavy_check_mark: | Source category for the skill. | +| `SourceProvenance` | [*components.PlatformSkillSourceProvenance](../../models/components/platformskillsourceprovenance.md) | :heavy_minus_sign: | N/A | +| `Owner` | [components.PlatformPersonReference](../../models/components/platformpersonreference.md) | :heavy_check_mark: | A lightweight reference to a person, used where a payload merely points at someone. | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Time the skill was created. | +| `UpdatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Time the skill was last updated. | \ No newline at end of file diff --git a/docs/models/components/platformskillgetresponse.md b/docs/models/components/platformskillgetresponse.md new file mode 100644 index 00000000..f39ce31f --- /dev/null +++ b/docs/models/components/platformskillgetresponse.md @@ -0,0 +1,9 @@ +# PlatformSkillGetResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `Skill` | [components.PlatformSkill](../../models/components/platformskill.md) | :heavy_check_mark: | N/A | +| `RequestID` | `string` | :heavy_check_mark: | Platform-generated request ID for support correlation. | \ No newline at end of file diff --git a/docs/models/components/platformskillorigin.md b/docs/models/components/platformskillorigin.md new file mode 100644 index 00000000..898011b4 --- /dev/null +++ b/docs/models/components/platformskillorigin.md @@ -0,0 +1,20 @@ +# PlatformSkillOrigin + +Source category for the skill. + +## Example Usage + +```go +import ( + "github.com/gleanwork/api-client-go/models/components" +) + +value := components.PlatformSkillOriginCustom +``` + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `PlatformSkillOriginCustom` | CUSTOM | \ No newline at end of file diff --git a/docs/models/components/platformskillslistresponse.md b/docs/models/components/platformskillslistresponse.md new file mode 100644 index 00000000..3e7bca2c --- /dev/null +++ b/docs/models/components/platformskillslistresponse.md @@ -0,0 +1,11 @@ +# PlatformSkillsListResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `Skills` | [][components.PlatformSkill](../../models/components/platformskill.md) | :heavy_check_mark: | Skills available to the user. | +| `HasMore` | `bool` | :heavy_check_mark: | Whether additional results are available. | +| `NextCursor` | `*string` | :heavy_check_mark: | Cursor for the next page, or null when no more results are available. | +| `RequestID` | `string` | :heavy_check_mark: | Platform-generated request ID for support correlation. | \ No newline at end of file diff --git a/docs/models/components/platformskillsourceprovenance.md b/docs/models/components/platformskillsourceprovenance.md new file mode 100644 index 00000000..c9c901dd --- /dev/null +++ b/docs/models/components/platformskillsourceprovenance.md @@ -0,0 +1,13 @@ +# PlatformSkillSourceProvenance + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `SourceURL` | `*string` | :heavy_minus_sign: | URL of the external source the skill was imported from. | +| `CommitSha` | `*string` | :heavy_minus_sign: | Source commit SHA for the imported skill. | +| `ImportedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Time the skill was imported. | +| `LastSyncedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Time the skill was last synced from its source. | +| `SyncStatus` | [*components.PlatformSkillSyncStatus](../../models/components/platformskillsyncstatus.md) | :heavy_minus_sign: | Current external-source sync status. | +| `SyncError` | `*string` | :heavy_minus_sign: | Human-readable sync failure reason, present only when sync_status is SYNC_FAILED. | \ No newline at end of file diff --git a/docs/models/components/platformskillstatus.md b/docs/models/components/platformskillstatus.md new file mode 100644 index 00000000..0eb8f54e --- /dev/null +++ b/docs/models/components/platformskillstatus.md @@ -0,0 +1,25 @@ +# PlatformSkillStatus + +Current skill status. + +## Example Usage + +```go +import ( + "github.com/gleanwork/api-client-go/models/components" +) + +value := components.PlatformSkillStatusDraft + +// Open enum: custom values can be created with a direct type cast +custom := components.PlatformSkillStatus("custom_value") +``` + + +## Values + +| Name | Value | +| ----------------------------- | ----------------------------- | +| `PlatformSkillStatusDraft` | DRAFT | +| `PlatformSkillStatusEnabled` | ENABLED | +| `PlatformSkillStatusDisabled` | DISABLED | \ No newline at end of file diff --git a/docs/models/components/platformskillsyncstatus.md b/docs/models/components/platformskillsyncstatus.md new file mode 100644 index 00000000..0b0a0c1f --- /dev/null +++ b/docs/models/components/platformskillsyncstatus.md @@ -0,0 +1,25 @@ +# PlatformSkillSyncStatus + +Current external-source sync status. + +## Example Usage + +```go +import ( + "github.com/gleanwork/api-client-go/models/components" +) + +value := components.PlatformSkillSyncStatusUpToDate + +// Open enum: custom values can be created with a direct type cast +custom := components.PlatformSkillSyncStatus("custom_value") +``` + + +## Values + +| Name | Value | +| ---------------------------------------- | ---------------------------------------- | +| `PlatformSkillSyncStatusUpToDate` | UP_TO_DATE | +| `PlatformSkillSyncStatusUpdateAvailable` | UPDATE_AVAILABLE | +| `PlatformSkillSyncStatusSyncFailed` | SYNC_FAILED | \ No newline at end of file diff --git a/docs/models/components/toolmetadata.md b/docs/models/components/toolmetadata.md index 0eb177c9..feadc76e 100644 --- a/docs/models/components/toolmetadata.md +++ b/docs/models/components/toolmetadata.md @@ -5,23 +5,24 @@ The manifest for a tool that can be used to augment Glean Assistant. ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Type` | [components.ToolMetadataType](../../models/components/toolmetadatatype.md) | :heavy_check_mark: | The type of tool. | | -| `Name` | `string` | :heavy_check_mark: | Unique identifier for the tool. Name should be understandable by the LLM, and will be used to invoke a tool. | | -| `DisplayName` | `string` | :heavy_check_mark: | Human understandable name of the tool. Max 50 characters. | | -| `ToolID` | `*string` | :heavy_minus_sign: | An opaque id which is unique identifier for the tool. | | -| `DisplayDescription` | `string` | :heavy_check_mark: | Description of the tool meant for a human. | | -| `LogoURL` | `*string` | :heavy_minus_sign: | URL used to fetch the logo. | | -| `ObjectName` | `*string` | :heavy_minus_sign: | Name of the generated object. This will be used to indicate to the end user what the generated object contains. | [
"HR ticket",
"Email",
"Chat message"
] | -| `KnowledgeType` | [*components.KnowledgeType](../../models/components/knowledgetype.md) | :heavy_minus_sign: | Indicates the kind of knowledge a tool would access or modify. | | -| `CreatedBy` | [*components.PersonObject](../../models/components/personobject.md) | :heavy_minus_sign: | N/A | | -| `LastUpdatedBy` | [*components.PersonObject](../../models/components/personobject.md) | :heavy_minus_sign: | N/A | | -| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | The time the tool was created in ISO format (ISO 8601) | | -| `LastUpdatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | The time the tool was last updated in ISO format (ISO 8601) | | -| `WriteActionType` | [*components.WriteActionType](../../models/components/writeactiontype.md) | :heavy_minus_sign: | Valid only for write actions. Represents the type of write action. REDIRECT - The client renders the URL which contains information for carrying out the action. EXECUTION - Send a request to an external server and execute the action. MCP - Send a tools/call request to an MCP server to execute the action. | | -| `AuthType` | [*components.AuthType](../../models/components/authtype.md) | :heavy_minus_sign: | The type of authentication being used.
Use 'OAUTH_*' when Glean calls an external API (e.g., Jira) on behalf of a user to obtain an OAuth token.
'OAUTH_ADMIN' utilizes an admin token for external API calls on behalf all users.
'OAUTH_USER' uses individual user tokens for external API calls.
'DWD' refers to domain wide delegation.
| | -| `Auth` | [*components.AuthConfig](../../models/components/authconfig.md) | :heavy_minus_sign: | Config for tool's authentication method. | | -| `Permissions` | [*components.ObjectPermissions](../../models/components/objectpermissions.md) | :heavy_minus_sign: | N/A | | -| `UsageInstructions` | `*string` | :heavy_minus_sign: | Usage instructions for the LLM to use this action. | | -| `IsSetupFinished` | `*bool` | :heavy_minus_sign: | Whether this action has been fully configured and validated. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Type` | [components.ToolMetadataType](../../models/components/toolmetadatatype.md) | :heavy_check_mark: | The type of tool. | | +| `Name` | `string` | :heavy_check_mark: | Unique identifier for the tool. Name should be understandable by the LLM, and will be used to invoke a tool. | | +| `DisplayName` | `string` | :heavy_check_mark: | Human understandable name of the tool. Max 50 characters. | | +| `ToolID` | `*string` | :heavy_minus_sign: | An opaque id which is unique identifier for the tool. | | +| `DisplayDescription` | `string` | :heavy_check_mark: | Description of the tool meant for a human. | | +| `LogoURL` | `*string` | :heavy_minus_sign: | URL used to fetch the logo. | | +| `ObjectName` | `*string` | :heavy_minus_sign: | Name of the generated object. This will be used to indicate to the end user what the generated object contains. | [
"HR ticket",
"Email",
"Chat message"
] | +| `KnowledgeType` | [*components.KnowledgeType](../../models/components/knowledgetype.md) | :heavy_minus_sign: | Indicates the kind of knowledge a tool would access or modify. | | +| `CreatedBy` | [*components.PersonObject](../../models/components/personobject.md) | :heavy_minus_sign: | N/A | | +| `LastUpdatedBy` | [*components.PersonObject](../../models/components/personobject.md) | :heavy_minus_sign: | N/A | | +| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | The time the tool was created in ISO format (ISO 8601) | | +| `LastUpdatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | The time the tool was last updated in ISO format (ISO 8601) | | +| `WriteActionType` | [*components.WriteActionType](../../models/components/writeactiontype.md) | :heavy_minus_sign: | Valid only for write actions. Represents the type of write action. REDIRECT - The client renders the URL which contains information for carrying out the action. EXECUTION - Send a request to an external server and execute the action. MCP - Send a tools/call request to an MCP server to execute the action. | | +| `ActionTypeSource` | [*components.ActionTypeSource](../../models/components/actiontypesource.md) | :heavy_minus_sign: | Analytics-only signal (product snapshot) describing WHERE the action's
read/write determination came from. Complementary to the effective
read/write value (the tool's ToolType, which drives HITL): the value says
read-or-write, this says how confident that is. MCP_ANNOTATION = from the
tool's read-only/destructive hints; ADMIN_OVERRIDE = an admin set it;
NONE = no usable hint (the effective value then defaults to write);
NATIVE_TOOL_DEFINITION = from a curated native tool (snapshot-derived).
Does not affect runtime behavior.
| | +| `AuthType` | [*components.AuthType](../../models/components/authtype.md) | :heavy_minus_sign: | The type of authentication being used.
Use 'OAUTH_*' when Glean calls an external API (e.g., Jira) on behalf of a user to obtain an OAuth token.
'OAUTH_ADMIN' utilizes an admin token for external API calls on behalf all users.
'OAUTH_USER' uses individual user tokens for external API calls.
'DWD' refers to domain wide delegation.
| | +| `Auth` | [*components.AuthConfig](../../models/components/authconfig.md) | :heavy_minus_sign: | Config for tool's authentication method. | | +| `Permissions` | [*components.ObjectPermissions](../../models/components/objectpermissions.md) | :heavy_minus_sign: | N/A | | +| `UsageInstructions` | `*string` | :heavy_minus_sign: | Usage instructions for the LLM to use this action. | | +| `IsSetupFinished` | `*bool` | :heavy_minus_sign: | Whether this action has been fully configured and validated. | | \ No newline at end of file diff --git a/docs/models/operations/platformskillsgetrequest.md b/docs/models/operations/platformskillsgetrequest.md new file mode 100644 index 00000000..b5d6c2b6 --- /dev/null +++ b/docs/models/operations/platformskillsgetrequest.md @@ -0,0 +1,8 @@ +# PlatformSkillsGetRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `SkillID` | `string` | :heavy_check_mark: | Glean skill ID. | \ No newline at end of file diff --git a/docs/models/operations/platformskillsgetresponse.md b/docs/models/operations/platformskillsgetresponse.md new file mode 100644 index 00000000..2a33875e --- /dev/null +++ b/docs/models/operations/platformskillsgetresponse.md @@ -0,0 +1,9 @@ +# PlatformSkillsGetResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `PlatformSkillGetResponse` | [*components.PlatformSkillGetResponse](../../models/components/platformskillgetresponse.md) | :heavy_minus_sign: | Successful response. | \ No newline at end of file diff --git a/docs/models/operations/platformskillslistrequest.md b/docs/models/operations/platformskillslistrequest.md new file mode 100644 index 00000000..7727a947 --- /dev/null +++ b/docs/models/operations/platformskillslistrequest.md @@ -0,0 +1,9 @@ +# PlatformSkillsListRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `PageSize` | `*int64` | :heavy_minus_sign: | Maximum number of skills to return. | +| `Cursor` | `*string` | :heavy_minus_sign: | Opaque pagination cursor from a previous response. | \ No newline at end of file diff --git a/docs/models/operations/platformskillslistresponse.md b/docs/models/operations/platformskillslistresponse.md new file mode 100644 index 00000000..e33cf969 --- /dev/null +++ b/docs/models/operations/platformskillslistresponse.md @@ -0,0 +1,9 @@ +# PlatformSkillsListResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `PlatformSkillsListResponse` | [*components.PlatformSkillsListResponse](../../models/components/platformskillslistresponse.md) | :heavy_minus_sign: | Successful response. | \ No newline at end of file diff --git a/docs/sdks/skills/README.md b/docs/sdks/skills/README.md new file mode 100644 index 00000000..e2bfaecb --- /dev/null +++ b/docs/sdks/skills/README.md @@ -0,0 +1,119 @@ +# Platform.Skills + +## Overview + +### Available Operations + +* [List](#list) - List skills +* [Retrieve](#retrieve) - Retrieve skill + +## List + +List skills available to the authenticated user. + + +### Example Usage + + +```go +package main + +import( + "context" + "os" + apiclientgo "github.com/gleanwork/api-client-go" + "log" +) + +func main() { + ctx := context.Background() + + s := apiclientgo.New( + apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")), + ) + + res, err := s.Platform.Skills.List(ctx, nil, nil) + if err != nil { + log.Fatal(err) + } + if res.PlatformSkillsListResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `pageSize` | `*int64` | :heavy_minus_sign: | Maximum number of skills to return. | +| `cursor` | `*string` | :heavy_minus_sign: | Opaque pagination cursor from a previous response. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PlatformSkillsListResponse](../../models/operations/platformskillslistresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | +| apierrors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json | +| apierrors.PlatformProblemDetailError | 500, 503 | application/problem+json | +| apierrors.APIError | 4XX, 5XX | \*/\* | + +## Retrieve + +Retrieve metadata for a skill available to the authenticated user. + + +### Example Usage + + +```go +package main + +import( + "context" + "os" + apiclientgo "github.com/gleanwork/api-client-go" + "log" +) + +func main() { + ctx := context.Background() + + s := apiclientgo.New( + apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")), + ) + + res, err := s.Platform.Skills.Retrieve(ctx, "") + if err != nil { + log.Fatal(err) + } + if res.PlatformSkillGetResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `skillID` | `string` | :heavy_check_mark: | Glean skill ID. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.PlatformSkillsGetResponse](../../models/operations/platformskillsgetresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | +| apierrors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json | +| apierrors.PlatformProblemDetailError | 500, 503 | application/problem+json | +| apierrors.APIError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/glean.go b/glean.go index 4842a872..a654ff12 100644 --- a/glean.go +++ b/glean.go @@ -66,6 +66,7 @@ func Pointer[T any](v T) *T { return &v } type Glean struct { SDKVersion string Agents *Agents + Platform *Platform // Search agents // Search agents available to the authenticated user by agent name. // @@ -161,9 +162,9 @@ func WithTimeout(timeout time.Duration) SDKOption { // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *Glean { sdk := &Glean{ - SDKVersion: "0.13.3", + SDKVersion: "0.13.4", sdkConfiguration: config.SDKConfiguration{ - UserAgent: "speakeasy-sdk/go 0.13.3 2.916.4 0.9.0 github.com/gleanwork/api-client-go", + UserAgent: "speakeasy-sdk/go 0.13.4 2.916.4 0.9.0 github.com/gleanwork/api-client-go", ServerList: ServerList, ServerVariables: []map[string]string{ { @@ -197,6 +198,7 @@ func New(opts ...SDKOption) *Glean { } sdk.Agents = newAgents(sdk, sdk.sdkConfiguration, sdk.hooks) + sdk.Platform = newPlatform(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Search = newSearch(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Client = newClient(sdk, sdk.sdkConfiguration, sdk.hooks) sdk.Indexing = newIndexing(sdk, sdk.sdkConfiguration, sdk.hooks) diff --git a/models/components/platformskill.go b/models/components/platformskill.go new file mode 100644 index 00000000..b4dec867 --- /dev/null +++ b/models/components/platformskill.go @@ -0,0 +1,120 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "github.com/gleanwork/api-client-go/internal/utils" + "time" +) + +type PlatformSkill struct { + // Glean skill ID. + ID string `json:"id"` + // Human-readable skill name. + DisplayName string `json:"display_name"` + // Human-readable skill description. + Description string `json:"description"` + // Latest major version number for the skill. + LatestVersion int64 `json:"latest_version"` + // Latest minor version number for the skill. + LatestMinorVersion int64 `json:"latest_minor_version"` + // Current skill status. + Status PlatformSkillStatus `json:"status"` + // Source category for the skill. + Origin PlatformSkillOrigin `json:"origin"` + SourceProvenance *PlatformSkillSourceProvenance `json:"source_provenance,omitempty"` + // A lightweight reference to a person, used where a payload merely points at someone. + Owner PlatformPersonReference `json:"owner"` + // Time the skill was created. + CreatedAt time.Time `json:"created_at"` + // Time the skill was last updated. + UpdatedAt time.Time `json:"updated_at"` +} + +func (p PlatformSkill) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformSkill) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { + return err + } + return nil +} + +func (p *PlatformSkill) GetID() string { + if p == nil { + return "" + } + return p.ID +} + +func (p *PlatformSkill) GetDisplayName() string { + if p == nil { + return "" + } + return p.DisplayName +} + +func (p *PlatformSkill) GetDescription() string { + if p == nil { + return "" + } + return p.Description +} + +func (p *PlatformSkill) GetLatestVersion() int64 { + if p == nil { + return 0 + } + return p.LatestVersion +} + +func (p *PlatformSkill) GetLatestMinorVersion() int64 { + if p == nil { + return 0 + } + return p.LatestMinorVersion +} + +func (p *PlatformSkill) GetStatus() PlatformSkillStatus { + if p == nil { + return PlatformSkillStatus("") + } + return p.Status +} + +func (p *PlatformSkill) GetOrigin() PlatformSkillOrigin { + if p == nil { + return PlatformSkillOrigin("") + } + return p.Origin +} + +func (p *PlatformSkill) GetSourceProvenance() *PlatformSkillSourceProvenance { + if p == nil { + return nil + } + return p.SourceProvenance +} + +func (p *PlatformSkill) GetOwner() PlatformPersonReference { + if p == nil { + return PlatformPersonReference{} + } + return p.Owner +} + +func (p *PlatformSkill) GetCreatedAt() time.Time { + if p == nil { + return time.Time{} + } + return p.CreatedAt +} + +func (p *PlatformSkill) GetUpdatedAt() time.Time { + if p == nil { + return time.Time{} + } + return p.UpdatedAt +} diff --git a/models/components/platformskillgetresponse.go b/models/components/platformskillgetresponse.go new file mode 100644 index 00000000..76a2907a --- /dev/null +++ b/models/components/platformskillgetresponse.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type PlatformSkillGetResponse struct { + Skill PlatformSkill `json:"skill"` + // Platform-generated request ID for support correlation. + RequestID string `json:"request_id"` +} + +func (p *PlatformSkillGetResponse) GetSkill() PlatformSkill { + if p == nil { + return PlatformSkill{} + } + return p.Skill +} + +func (p *PlatformSkillGetResponse) GetRequestID() string { + if p == nil { + return "" + } + return p.RequestID +} diff --git a/models/components/platformskillorigin.go b/models/components/platformskillorigin.go new file mode 100644 index 00000000..e0a00449 --- /dev/null +++ b/models/components/platformskillorigin.go @@ -0,0 +1,32 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// PlatformSkillOrigin - Source category for the skill. +type PlatformSkillOrigin string + +const ( + PlatformSkillOriginCustom PlatformSkillOrigin = "CUSTOM" +) + +func (e PlatformSkillOrigin) ToPointer() *PlatformSkillOrigin { + return &e +} +func (e *PlatformSkillOrigin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "CUSTOM": + *e = PlatformSkillOrigin(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformSkillOrigin: %v", v) + } +} diff --git a/models/components/platformskillslistresponse.go b/models/components/platformskillslistresponse.go new file mode 100644 index 00000000..3fd760ac --- /dev/null +++ b/models/components/platformskillslistresponse.go @@ -0,0 +1,42 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type PlatformSkillsListResponse struct { + // Skills available to the user. + Skills []PlatformSkill `json:"skills"` + // Whether additional results are available. + HasMore bool `json:"has_more"` + // Cursor for the next page, or null when no more results are available. + NextCursor *string `json:"next_cursor"` + // Platform-generated request ID for support correlation. + RequestID string `json:"request_id"` +} + +func (p *PlatformSkillsListResponse) GetSkills() []PlatformSkill { + if p == nil { + return []PlatformSkill{} + } + return p.Skills +} + +func (p *PlatformSkillsListResponse) GetHasMore() bool { + if p == nil { + return false + } + return p.HasMore +} + +func (p *PlatformSkillsListResponse) GetNextCursor() *string { + if p == nil { + return nil + } + return p.NextCursor +} + +func (p *PlatformSkillsListResponse) GetRequestID() string { + if p == nil { + return "" + } + return p.RequestID +} diff --git a/models/components/platformskillsourceprovenance.go b/models/components/platformskillsourceprovenance.go new file mode 100644 index 00000000..650f7afe --- /dev/null +++ b/models/components/platformskillsourceprovenance.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "github.com/gleanwork/api-client-go/internal/utils" + "time" +) + +type PlatformSkillSourceProvenance struct { + // URL of the external source the skill was imported from. + SourceURL *string `json:"source_url,omitempty"` + // Source commit SHA for the imported skill. + CommitSha *string `json:"commit_sha,omitempty"` + // Time the skill was imported. + ImportedAt *time.Time `json:"imported_at,omitempty"` + // Time the skill was last synced from its source. + LastSyncedAt *time.Time `json:"last_synced_at,omitempty"` + // Current external-source sync status. + SyncStatus *PlatformSkillSyncStatus `json:"sync_status,omitempty"` + // Human-readable sync failure reason, present only when sync_status is SYNC_FAILED. + SyncError *string `json:"sync_error,omitempty"` +} + +func (p PlatformSkillSourceProvenance) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformSkillSourceProvenance) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { + return err + } + return nil +} + +func (p *PlatformSkillSourceProvenance) GetSourceURL() *string { + if p == nil { + return nil + } + return p.SourceURL +} + +func (p *PlatformSkillSourceProvenance) GetCommitSha() *string { + if p == nil { + return nil + } + return p.CommitSha +} + +func (p *PlatformSkillSourceProvenance) GetImportedAt() *time.Time { + if p == nil { + return nil + } + return p.ImportedAt +} + +func (p *PlatformSkillSourceProvenance) GetLastSyncedAt() *time.Time { + if p == nil { + return nil + } + return p.LastSyncedAt +} + +func (p *PlatformSkillSourceProvenance) GetSyncStatus() *PlatformSkillSyncStatus { + if p == nil { + return nil + } + return p.SyncStatus +} + +func (p *PlatformSkillSourceProvenance) GetSyncError() *string { + if p == nil { + return nil + } + return p.SyncError +} diff --git a/models/components/platformskillstatus.go b/models/components/platformskillstatus.go new file mode 100644 index 00000000..78b9bc62 --- /dev/null +++ b/models/components/platformskillstatus.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// PlatformSkillStatus - Current skill status. +type PlatformSkillStatus string + +const ( + PlatformSkillStatusDraft PlatformSkillStatus = "DRAFT" + PlatformSkillStatusEnabled PlatformSkillStatus = "ENABLED" + PlatformSkillStatusDisabled PlatformSkillStatus = "DISABLED" +) + +func (e PlatformSkillStatus) ToPointer() *PlatformSkillStatus { + return &e +} + +// IsExact returns true if the value matches a known enum value, false otherwise. +func (e *PlatformSkillStatus) IsExact() bool { + if e != nil { + switch *e { + case "DRAFT", "ENABLED", "DISABLED": + return true + } + } + return false +} diff --git a/models/components/platformskillsyncstatus.go b/models/components/platformskillsyncstatus.go new file mode 100644 index 00000000..5396a955 --- /dev/null +++ b/models/components/platformskillsyncstatus.go @@ -0,0 +1,27 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// PlatformSkillSyncStatus - Current external-source sync status. +type PlatformSkillSyncStatus string + +const ( + PlatformSkillSyncStatusUpToDate PlatformSkillSyncStatus = "UP_TO_DATE" + PlatformSkillSyncStatusUpdateAvailable PlatformSkillSyncStatus = "UPDATE_AVAILABLE" + PlatformSkillSyncStatusSyncFailed PlatformSkillSyncStatus = "SYNC_FAILED" +) + +func (e PlatformSkillSyncStatus) ToPointer() *PlatformSkillSyncStatus { + return &e +} + +// IsExact returns true if the value matches a known enum value, false otherwise. +func (e *PlatformSkillSyncStatus) IsExact() bool { + if e != nil { + switch *e { + case "UP_TO_DATE", "UPDATE_AVAILABLE", "SYNC_FAILED": + return true + } + } + return false +} diff --git a/models/components/toolmetadata.go b/models/components/toolmetadata.go index 7033e2fc..ee48ef71 100644 --- a/models/components/toolmetadata.go +++ b/models/components/toolmetadata.go @@ -78,6 +78,38 @@ func (e *WriteActionType) IsExact() bool { return false } +// ActionTypeSource - Analytics-only signal (product snapshot) describing WHERE the action's +// read/write determination came from. Complementary to the effective +// read/write value (the tool's ToolType, which drives HITL): the value says +// read-or-write, this says how confident that is. MCP_ANNOTATION = from the +// tool's read-only/destructive hints; ADMIN_OVERRIDE = an admin set it; +// NONE = no usable hint (the effective value then defaults to write); +// NATIVE_TOOL_DEFINITION = from a curated native tool (snapshot-derived). +// Does not affect runtime behavior. +type ActionTypeSource string + +const ( + ActionTypeSourceMcpAnnotation ActionTypeSource = "MCP_ANNOTATION" + ActionTypeSourceAdminOverride ActionTypeSource = "ADMIN_OVERRIDE" + ActionTypeSourceNone ActionTypeSource = "NONE" + ActionTypeSourceNativeToolDefinition ActionTypeSource = "NATIVE_TOOL_DEFINITION" +) + +func (e ActionTypeSource) ToPointer() *ActionTypeSource { + return &e +} + +// IsExact returns true if the value matches a known enum value, false otherwise. +func (e *ActionTypeSource) IsExact() bool { + if e != nil { + switch *e { + case "MCP_ANNOTATION", "ADMIN_OVERRIDE", "NONE", "NATIVE_TOOL_DEFINITION": + return true + } + } + return false +} + // AuthType - The type of authentication being used. // Use 'OAUTH_*' when Glean calls an external API (e.g., Jira) on behalf of a user to obtain an OAuth token. // 'OAUTH_ADMIN' utilizes an admin token for external API calls on behalf all users. @@ -135,6 +167,16 @@ type ToolMetadata struct { LastUpdatedAt *time.Time `json:"lastUpdatedAt,omitempty"` // Valid only for write actions. Represents the type of write action. REDIRECT - The client renders the URL which contains information for carrying out the action. EXECUTION - Send a request to an external server and execute the action. MCP - Send a tools/call request to an MCP server to execute the action. WriteActionType *WriteActionType `json:"writeActionType,omitempty"` + // Analytics-only signal (product snapshot) describing WHERE the action's + // read/write determination came from. Complementary to the effective + // read/write value (the tool's ToolType, which drives HITL): the value says + // read-or-write, this says how confident that is. MCP_ANNOTATION = from the + // tool's read-only/destructive hints; ADMIN_OVERRIDE = an admin set it; + // NONE = no usable hint (the effective value then defaults to write); + // NATIVE_TOOL_DEFINITION = from a curated native tool (snapshot-derived). + // Does not affect runtime behavior. + // + ActionTypeSource *ActionTypeSource `json:"actionTypeSource,omitempty"` // The type of authentication being used. // Use 'OAUTH_*' when Glean calls an external API (e.g., Jira) on behalf of a user to obtain an OAuth token. // 'OAUTH_ADMIN' utilizes an admin token for external API calls on behalf all users. @@ -253,6 +295,13 @@ func (t *ToolMetadata) GetWriteActionType() *WriteActionType { return t.WriteActionType } +func (t *ToolMetadata) GetActionTypeSource() *ActionTypeSource { + if t == nil { + return nil + } + return t.ActionTypeSource +} + func (t *ToolMetadata) GetAuthType() *AuthType { if t == nil { return nil diff --git a/models/operations/platformskillsget.go b/models/operations/platformskillsget.go new file mode 100644 index 00000000..bb8b9388 --- /dev/null +++ b/models/operations/platformskillsget.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/gleanwork/api-client-go/models/components" +) + +type PlatformSkillsGetRequest struct { + // Glean skill ID. + SkillID string `pathParam:"style=simple,explode=false,name=skill_id"` +} + +func (p *PlatformSkillsGetRequest) GetSkillID() string { + if p == nil { + return "" + } + return p.SkillID +} + +type PlatformSkillsGetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successful response. + PlatformSkillGetResponse *components.PlatformSkillGetResponse +} + +func (p *PlatformSkillsGetResponse) GetHTTPMeta() components.HTTPMetadata { + if p == nil { + return components.HTTPMetadata{} + } + return p.HTTPMeta +} + +func (p *PlatformSkillsGetResponse) GetPlatformSkillGetResponse() *components.PlatformSkillGetResponse { + if p == nil { + return nil + } + return p.PlatformSkillGetResponse +} diff --git a/models/operations/platformskillslist.go b/models/operations/platformskillslist.go new file mode 100644 index 00000000..b004ed19 --- /dev/null +++ b/models/operations/platformskillslist.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/gleanwork/api-client-go/models/components" +) + +type PlatformSkillsListRequest struct { + // Maximum number of skills to return. + PageSize *int64 `queryParam:"style=form,explode=true,name=page_size"` + // Opaque pagination cursor from a previous response. + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` +} + +func (p *PlatformSkillsListRequest) GetPageSize() *int64 { + if p == nil { + return nil + } + return p.PageSize +} + +func (p *PlatformSkillsListRequest) GetCursor() *string { + if p == nil { + return nil + } + return p.Cursor +} + +type PlatformSkillsListResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successful response. + PlatformSkillsListResponse *components.PlatformSkillsListResponse +} + +func (p *PlatformSkillsListResponse) GetHTTPMeta() components.HTTPMetadata { + if p == nil { + return components.HTTPMetadata{} + } + return p.HTTPMeta +} + +func (p *PlatformSkillsListResponse) GetPlatformSkillsListResponse() *components.PlatformSkillsListResponse { + if p == nil { + return nil + } + return p.PlatformSkillsListResponse +} diff --git a/platform.go b/platform.go new file mode 100644 index 00000000..402179f9 --- /dev/null +++ b/platform.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apiclientgo + +import ( + "github.com/gleanwork/api-client-go/internal/config" + "github.com/gleanwork/api-client-go/internal/hooks" +) + +type Platform struct { + Skills *Skills + + rootSDK *Glean + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newPlatform(rootSDK *Glean, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Platform { + return &Platform{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + Skills: newSkills(rootSDK, sdkConfig, hooks), + } +} diff --git a/skills.go b/skills.go new file mode 100644 index 00000000..b42d6f31 --- /dev/null +++ b/skills.go @@ -0,0 +1,581 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package apiclientgo + +import ( + "bytes" + "context" + "fmt" + "github.com/gleanwork/api-client-go/internal/config" + "github.com/gleanwork/api-client-go/internal/hooks" + "github.com/gleanwork/api-client-go/internal/utils" + "github.com/gleanwork/api-client-go/models/apierrors" + "github.com/gleanwork/api-client-go/models/components" + "github.com/gleanwork/api-client-go/models/operations" + "github.com/gleanwork/api-client-go/retry" + "net/http" + "net/url" +) + +type Skills struct { + rootSDK *Glean + sdkConfiguration config.SDKConfiguration + hooks *hooks.Hooks +} + +func newSkills(rootSDK *Glean, sdkConfig config.SDKConfiguration, hooks *hooks.Hooks) *Skills { + return &Skills{ + rootSDK: rootSDK, + sdkConfiguration: sdkConfig, + hooks: hooks, + } +} + +// List skills +// List skills available to the authenticated user. +func (s *Skills) List(ctx context.Context, pageSize *int64, cursor *string, opts ...operations.Option) (*operations.PlatformSkillsListResponse, error) { + request := operations.PlatformSkillsListRequest{ + PageSize: pageSize, + Cursor: cursor, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/api/skills") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "platform-skills-list", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PlatformSkillsListResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.PlatformSkillsListResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.PlatformSkillsListResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode == 408: + fallthrough + case httpRes.StatusCode == 429: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.PlatformProblemDetailError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode == 503: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.PlatformProblemDetailError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// Retrieve skill +// Retrieve metadata for a skill available to the authenticated user. +func (s *Skills) Retrieve(ctx context.Context, skillID string, opts ...operations.Option) (*operations.PlatformSkillsGetResponse, error) { + request := operations.PlatformSkillsGetRequest{ + SkillID: skillID, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/skills/{skill_id}", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "platform-skills-get", + OAuth2Scopes: nil, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PlatformSkillsGetResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.PlatformSkillGetResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.PlatformSkillGetResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode == 408: + fallthrough + case httpRes.StatusCode == 429: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.PlatformProblemDetailError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode == 503: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/problem+json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out apierrors.PlatformProblemDetailError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.HTTPMeta = components.HTTPMetadata{ + Request: req, + Response: httpRes, + } + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, apierrors.NewAPIError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/tests/messages_test.go b/tests/messages_test.go index febdc0e8..64ef64fe 100644 --- a/tests/messages_test.go +++ b/tests/messages_test.go @@ -27,7 +27,7 @@ func TestMessages_Messages(t *testing.T) { IDType: components.IDTypeConversationID, ID: "", TimestampMillis: apiclientgo.Pointer[int64](558834), - Datasource: components.DatasourceGchat, + Datasource: components.DatasourceFacebookworkplace, }, nil) require.NoError(t, err) assert.Equal(t, 200, res.HTTPMeta.Response.StatusCode) diff --git a/tests/mockserver/internal/handler/generated_handlers.go b/tests/mockserver/internal/handler/generated_handlers.go index d5fe2f85..49b7267f 100644 --- a/tests/mockserver/internal/handler/generated_handlers.go +++ b/tests/mockserver/internal/handler/generated_handlers.go @@ -16,6 +16,8 @@ func GeneratedHandlers(ctx context.Context, dir *logging.HTTPFileDirectory, rt * NewGeneratedHandler(ctx, http.MethodDelete, "/rest/api/index/document/{docId}/custom-metadata/{groupName}", pathDeleteRestAPIIndexDocumentDocIDCustomMetadataGroupName(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/api/agents/{agent_id}", pathGetAPIAgentsAgentID(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/api/agents/{agent_id}/schemas", pathGetAPIAgentsAgentIDSchemas(dir, rt)), + NewGeneratedHandler(ctx, http.MethodGet, "/api/skills", pathGetAPISkills(dir, rt)), + NewGeneratedHandler(ctx, http.MethodGet, "/api/skills/{skill_id}", pathGetAPISkillsSkillID(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/rest/api/index/custom-metadata/schema/{groupName}", pathGetRestAPIIndexCustomMetadataSchemaGroupName(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/rest/api/v1/actions/actionpack/{actionPackId}/auth", pathGetRestAPIV1ActionsActionpackActionPackIDAuth(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/rest/api/v1/agents/{agent_id}", pathGetRestAPIV1AgentsAgentID(dir, rt)), diff --git a/tests/mockserver/internal/handler/pathgetapiskills.go b/tests/mockserver/internal/handler/pathgetapiskills.go new file mode 100644 index 00000000..7baa51e7 --- /dev/null +++ b/tests/mockserver/internal/handler/pathgetapiskills.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package handler + +import ( + "fmt" + "log" + "mockserver/internal/handler/assert" + "mockserver/internal/logging" + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/types" + "mockserver/internal/sdk/utils" + "mockserver/internal/tracking" + "net/http" +) + +func pathGetAPISkills(dir *logging.HTTPFileDirectory, rt *tracking.RequestTracker) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + test := req.Header.Get("x-speakeasy-test-name") + instanceID := req.Header.Get("x-speakeasy-test-instance-id") + + count := rt.GetRequestCount(test, instanceID) + + switch fmt.Sprintf("%s[%d]", test, count) { + case "platform-skills-list[0]": + dir.HandlerFunc("platform-skills-list", testPlatformSkillsListPlatformSkillsList0)(w, req) + default: + http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) + } + } +} + +func testPlatformSkillsListPlatformSkillsList0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, false, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.PlatformSkillsListResponse = &components.PlatformSkillsListResponse{ + Skills: []components.PlatformSkill{}, + HasMore: true, + NextCursor: types.String(""), + RequestID: "", + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} diff --git a/tests/mockserver/internal/handler/pathgetapiskillsskillid.go b/tests/mockserver/internal/handler/pathgetapiskillsskillid.go new file mode 100644 index 00000000..4f097d84 --- /dev/null +++ b/tests/mockserver/internal/handler/pathgetapiskillsskillid.go @@ -0,0 +1,79 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package handler + +import ( + "fmt" + "log" + "mockserver/internal/handler/assert" + "mockserver/internal/logging" + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/types" + "mockserver/internal/sdk/utils" + "mockserver/internal/tracking" + "net/http" +) + +func pathGetAPISkillsSkillID(dir *logging.HTTPFileDirectory, rt *tracking.RequestTracker) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + test := req.Header.Get("x-speakeasy-test-name") + instanceID := req.Header.Get("x-speakeasy-test-instance-id") + + count := rt.GetRequestCount(test, instanceID) + + switch fmt.Sprintf("%s[%d]", test, count) { + case "platform-skills-get[0]": + dir.HandlerFunc("platform-skills-get", testPlatformSkillsGetPlatformSkillsGet0)(w, req) + default: + http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) + } + } +} + +func testPlatformSkillsGetPlatformSkillsGet0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, false, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.PlatformSkillGetResponse = &components.PlatformSkillGetResponse{ + Skill: components.PlatformSkill{ + ID: "", + DisplayName: "Chad_Herzog", + Description: "whenever up aha controvert", + LatestVersion: 151495, + LatestMinorVersion: 170771, + Status: components.PlatformSkillStatusDisabled, + Origin: components.PlatformSkillOriginCustom, + Owner: components.PlatformPersonReference{ + Name: "", + }, + CreatedAt: types.MustTimeFromString("2024-12-25T16:41:00.099Z"), + UpdatedAt: types.MustTimeFromString("2026-12-07T21:59:59.375Z"), + }, + RequestID: "", + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go b/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go index 371b9023..5c99a0ad 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1createcollection.go @@ -56,14 +56,14 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ operations.ResponseBody2{ Collection: &components.Collection{ Name: "", - Description: "whole busily jive hawk gee basic minus hence", + Description: "motionless whenever paintwork import over cuckoo", AddedRoles: []components.UserRoleSpecification{ components.UserRoleSpecification{ Person: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", }, - Role: components.UserRoleAnswerModerator, + Role: components.UserRoleOwner, }, }, RemovedRoles: []components.UserRoleSpecification{ @@ -90,7 +90,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ID: 158969, + ID: 363711, Creator: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -101,7 +101,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, Items: []components.CollectionItem{ components.CollectionItem{ - CollectionID: 110375, + CollectionID: 570197, CreatedBy: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -266,13 +266,13 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ Name: "George Clooney", ObfuscatedID: "abc123", }, - Role: components.UserRoleEditor, + Role: components.UserRoleAnswerModerator, }, }, }, Collection: &components.Collection{ Name: "", - Description: "wedge colorfully orientate rally", + Description: "athwart skateboard newsstand farm bourgeoisie ah how elliptical aha well-to-do", AudienceFilters: []components.FacetFilter{ components.FacetFilter{ FieldName: types.String("type"), @@ -288,7 +288,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ID: 131797, + ID: 643990, Creator: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -300,7 +300,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ Children: []components.Collection{ components.Collection{ Name: "", - Description: "outside yippee sidetrack mature regularly mouser inject worth", + Description: "woot purse salty even as advanced", AudienceFilters: []components.FacetFilter{ components.FacetFilter{ FieldName: types.String("type"), @@ -316,7 +316,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ID: 149448, + ID: 359978, Creator: &components.Person{ Name: "George Clooney", ObfuscatedID: "abc123", @@ -328,7 +328,7 @@ func testCreatecollectionCreatecollection0(w http.ResponseWriter, req *http.Requ }, }, }, - ItemType: components.CollectionItemItemTypeCollection, + ItemType: components.CollectionItemItemTypeURL, }, }, }, diff --git a/tests/mockserver/internal/sdk/models/components/platformskill.go b/tests/mockserver/internal/sdk/models/components/platformskill.go new file mode 100644 index 00000000..8397a899 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformskill.go @@ -0,0 +1,120 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +type PlatformSkill struct { + // Glean skill ID. + ID string `json:"id"` + // Human-readable skill name. + DisplayName string `json:"display_name"` + // Human-readable skill description. + Description string `json:"description"` + // Latest major version number for the skill. + LatestVersion int64 `json:"latest_version"` + // Latest minor version number for the skill. + LatestMinorVersion int64 `json:"latest_minor_version"` + // Current skill status. + Status PlatformSkillStatus `json:"status"` + // Source category for the skill. + Origin PlatformSkillOrigin `json:"origin"` + SourceProvenance *PlatformSkillSourceProvenance `json:"source_provenance,omitempty"` + // A lightweight reference to a person, used where a payload merely points at someone. + Owner PlatformPersonReference `json:"owner"` + // Time the skill was created. + CreatedAt time.Time `json:"created_at"` + // Time the skill was last updated. + UpdatedAt time.Time `json:"updated_at"` +} + +func (p PlatformSkill) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformSkill) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, []string{"id", "display_name", "description", "latest_version", "latest_minor_version", "status", "origin", "owner", "created_at", "updated_at"}); err != nil { + return err + } + return nil +} + +func (o *PlatformSkill) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *PlatformSkill) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *PlatformSkill) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *PlatformSkill) GetLatestVersion() int64 { + if o == nil { + return 0 + } + return o.LatestVersion +} + +func (o *PlatformSkill) GetLatestMinorVersion() int64 { + if o == nil { + return 0 + } + return o.LatestMinorVersion +} + +func (o *PlatformSkill) GetStatus() PlatformSkillStatus { + if o == nil { + return PlatformSkillStatus("") + } + return o.Status +} + +func (o *PlatformSkill) GetOrigin() PlatformSkillOrigin { + if o == nil { + return PlatformSkillOrigin("") + } + return o.Origin +} + +func (o *PlatformSkill) GetSourceProvenance() *PlatformSkillSourceProvenance { + if o == nil { + return nil + } + return o.SourceProvenance +} + +func (o *PlatformSkill) GetOwner() PlatformPersonReference { + if o == nil { + return PlatformPersonReference{} + } + return o.Owner +} + +func (o *PlatformSkill) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *PlatformSkill) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} diff --git a/tests/mockserver/internal/sdk/models/components/platformskillgetresponse.go b/tests/mockserver/internal/sdk/models/components/platformskillgetresponse.go new file mode 100644 index 00000000..c9bcfa2f --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformskillgetresponse.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type PlatformSkillGetResponse struct { + Skill PlatformSkill `json:"skill"` + // Platform-generated request ID for support correlation. + RequestID string `json:"request_id"` +} + +func (o *PlatformSkillGetResponse) GetSkill() PlatformSkill { + if o == nil { + return PlatformSkill{} + } + return o.Skill +} + +func (o *PlatformSkillGetResponse) GetRequestID() string { + if o == nil { + return "" + } + return o.RequestID +} diff --git a/tests/mockserver/internal/sdk/models/components/platformskillorigin.go b/tests/mockserver/internal/sdk/models/components/platformskillorigin.go new file mode 100644 index 00000000..e0a00449 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformskillorigin.go @@ -0,0 +1,32 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// PlatformSkillOrigin - Source category for the skill. +type PlatformSkillOrigin string + +const ( + PlatformSkillOriginCustom PlatformSkillOrigin = "CUSTOM" +) + +func (e PlatformSkillOrigin) ToPointer() *PlatformSkillOrigin { + return &e +} +func (e *PlatformSkillOrigin) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "CUSTOM": + *e = PlatformSkillOrigin(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformSkillOrigin: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/platformskillslistresponse.go b/tests/mockserver/internal/sdk/models/components/platformskillslistresponse.go new file mode 100644 index 00000000..566d5351 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformskillslistresponse.go @@ -0,0 +1,42 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type PlatformSkillsListResponse struct { + // Skills available to the user. + Skills []PlatformSkill `json:"skills"` + // Whether additional results are available. + HasMore bool `json:"has_more"` + // Cursor for the next page, or null when no more results are available. + NextCursor *string `json:"next_cursor"` + // Platform-generated request ID for support correlation. + RequestID string `json:"request_id"` +} + +func (o *PlatformSkillsListResponse) GetSkills() []PlatformSkill { + if o == nil { + return []PlatformSkill{} + } + return o.Skills +} + +func (o *PlatformSkillsListResponse) GetHasMore() bool { + if o == nil { + return false + } + return o.HasMore +} + +func (o *PlatformSkillsListResponse) GetNextCursor() *string { + if o == nil { + return nil + } + return o.NextCursor +} + +func (o *PlatformSkillsListResponse) GetRequestID() string { + if o == nil { + return "" + } + return o.RequestID +} diff --git a/tests/mockserver/internal/sdk/models/components/platformskillsourceprovenance.go b/tests/mockserver/internal/sdk/models/components/platformskillsourceprovenance.go new file mode 100644 index 00000000..65ed2aac --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformskillsourceprovenance.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +type PlatformSkillSourceProvenance struct { + // URL of the external source the skill was imported from. + SourceURL *string `json:"source_url,omitempty"` + // Source commit SHA for the imported skill. + CommitSha *string `json:"commit_sha,omitempty"` + // Time the skill was imported. + ImportedAt *time.Time `json:"imported_at,omitempty"` + // Time the skill was last synced from its source. + LastSyncedAt *time.Time `json:"last_synced_at,omitempty"` + // Current external-source sync status. + SyncStatus *PlatformSkillSyncStatus `json:"sync_status,omitempty"` + // Human-readable sync failure reason, present only when sync_status is SYNC_FAILED. + SyncError *string `json:"sync_error,omitempty"` +} + +func (p PlatformSkillSourceProvenance) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformSkillSourceProvenance) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { + return err + } + return nil +} + +func (o *PlatformSkillSourceProvenance) GetSourceURL() *string { + if o == nil { + return nil + } + return o.SourceURL +} + +func (o *PlatformSkillSourceProvenance) GetCommitSha() *string { + if o == nil { + return nil + } + return o.CommitSha +} + +func (o *PlatformSkillSourceProvenance) GetImportedAt() *time.Time { + if o == nil { + return nil + } + return o.ImportedAt +} + +func (o *PlatformSkillSourceProvenance) GetLastSyncedAt() *time.Time { + if o == nil { + return nil + } + return o.LastSyncedAt +} + +func (o *PlatformSkillSourceProvenance) GetSyncStatus() *PlatformSkillSyncStatus { + if o == nil { + return nil + } + return o.SyncStatus +} + +func (o *PlatformSkillSourceProvenance) GetSyncError() *string { + if o == nil { + return nil + } + return o.SyncError +} diff --git a/tests/mockserver/internal/sdk/models/components/platformskillstatus.go b/tests/mockserver/internal/sdk/models/components/platformskillstatus.go new file mode 100644 index 00000000..a218b760 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformskillstatus.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// PlatformSkillStatus - Current skill status. +type PlatformSkillStatus string + +const ( + PlatformSkillStatusDraft PlatformSkillStatus = "DRAFT" + PlatformSkillStatusEnabled PlatformSkillStatus = "ENABLED" + PlatformSkillStatusDisabled PlatformSkillStatus = "DISABLED" +) + +func (e PlatformSkillStatus) ToPointer() *PlatformSkillStatus { + return &e +} +func (e *PlatformSkillStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "DRAFT": + fallthrough + case "ENABLED": + fallthrough + case "DISABLED": + *e = PlatformSkillStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformSkillStatus: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/platformskillsyncstatus.go b/tests/mockserver/internal/sdk/models/components/platformskillsyncstatus.go new file mode 100644 index 00000000..0582664c --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformskillsyncstatus.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// PlatformSkillSyncStatus - Current external-source sync status. +type PlatformSkillSyncStatus string + +const ( + PlatformSkillSyncStatusUpToDate PlatformSkillSyncStatus = "UP_TO_DATE" + PlatformSkillSyncStatusUpdateAvailable PlatformSkillSyncStatus = "UPDATE_AVAILABLE" + PlatformSkillSyncStatusSyncFailed PlatformSkillSyncStatus = "SYNC_FAILED" +) + +func (e PlatformSkillSyncStatus) ToPointer() *PlatformSkillSyncStatus { + return &e +} +func (e *PlatformSkillSyncStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "UP_TO_DATE": + fallthrough + case "UPDATE_AVAILABLE": + fallthrough + case "SYNC_FAILED": + *e = PlatformSkillSyncStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformSkillSyncStatus: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/toolmetadata.go b/tests/mockserver/internal/sdk/models/components/toolmetadata.go index 3c803a6d..061df30a 100644 --- a/tests/mockserver/internal/sdk/models/components/toolmetadata.go +++ b/tests/mockserver/internal/sdk/models/components/toolmetadata.go @@ -96,6 +96,46 @@ func (e *WriteActionType) UnmarshalJSON(data []byte) error { } } +// ActionTypeSource - Analytics-only signal (product snapshot) describing WHERE the action's +// read/write determination came from. Complementary to the effective +// read/write value (the tool's ToolType, which drives HITL): the value says +// read-or-write, this says how confident that is. MCP_ANNOTATION = from the +// tool's read-only/destructive hints; ADMIN_OVERRIDE = an admin set it; +// NONE = no usable hint (the effective value then defaults to write); +// NATIVE_TOOL_DEFINITION = from a curated native tool (snapshot-derived). +// Does not affect runtime behavior. +type ActionTypeSource string + +const ( + ActionTypeSourceMcpAnnotation ActionTypeSource = "MCP_ANNOTATION" + ActionTypeSourceAdminOverride ActionTypeSource = "ADMIN_OVERRIDE" + ActionTypeSourceNone ActionTypeSource = "NONE" + ActionTypeSourceNativeToolDefinition ActionTypeSource = "NATIVE_TOOL_DEFINITION" +) + +func (e ActionTypeSource) ToPointer() *ActionTypeSource { + return &e +} +func (e *ActionTypeSource) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "MCP_ANNOTATION": + fallthrough + case "ADMIN_OVERRIDE": + fallthrough + case "NONE": + fallthrough + case "NATIVE_TOOL_DEFINITION": + *e = ActionTypeSource(v) + return nil + default: + return fmt.Errorf("invalid value for ActionTypeSource: %v", v) + } +} + // AuthType - The type of authentication being used. // Use 'OAUTH_*' when Glean calls an external API (e.g., Jira) on behalf of a user to obtain an OAuth token. // 'OAUTH_ADMIN' utilizes an admin token for external API calls on behalf all users. @@ -165,6 +205,16 @@ type ToolMetadata struct { LastUpdatedAt *time.Time `json:"lastUpdatedAt,omitempty"` // Valid only for write actions. Represents the type of write action. REDIRECT - The client renders the URL which contains information for carrying out the action. EXECUTION - Send a request to an external server and execute the action. MCP - Send a tools/call request to an MCP server to execute the action. WriteActionType *WriteActionType `json:"writeActionType,omitempty"` + // Analytics-only signal (product snapshot) describing WHERE the action's + // read/write determination came from. Complementary to the effective + // read/write value (the tool's ToolType, which drives HITL): the value says + // read-or-write, this says how confident that is. MCP_ANNOTATION = from the + // tool's read-only/destructive hints; ADMIN_OVERRIDE = an admin set it; + // NONE = no usable hint (the effective value then defaults to write); + // NATIVE_TOOL_DEFINITION = from a curated native tool (snapshot-derived). + // Does not affect runtime behavior. + // + ActionTypeSource *ActionTypeSource `json:"actionTypeSource,omitempty"` // The type of authentication being used. // Use 'OAUTH_*' when Glean calls an external API (e.g., Jira) on behalf of a user to obtain an OAuth token. // 'OAUTH_ADMIN' utilizes an admin token for external API calls on behalf all users. @@ -283,6 +333,13 @@ func (o *ToolMetadata) GetWriteActionType() *WriteActionType { return o.WriteActionType } +func (o *ToolMetadata) GetActionTypeSource() *ActionTypeSource { + if o == nil { + return nil + } + return o.ActionTypeSource +} + func (o *ToolMetadata) GetAuthType() *AuthType { if o == nil { return nil diff --git a/tests/mockserver/internal/sdk/models/operations/platformskillsget.go b/tests/mockserver/internal/sdk/models/operations/platformskillsget.go new file mode 100644 index 00000000..6ebb5b11 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/platformskillsget.go @@ -0,0 +1,39 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PlatformSkillsGetRequest struct { + // Glean skill ID. + SkillID string `pathParam:"style=simple,explode=false,name=skill_id"` +} + +func (o *PlatformSkillsGetRequest) GetSkillID() string { + if o == nil { + return "" + } + return o.SkillID +} + +type PlatformSkillsGetResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successful response. + PlatformSkillGetResponse *components.PlatformSkillGetResponse +} + +func (o *PlatformSkillsGetResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PlatformSkillsGetResponse) GetPlatformSkillGetResponse() *components.PlatformSkillGetResponse { + if o == nil { + return nil + } + return o.PlatformSkillGetResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/platformskillslist.go b/tests/mockserver/internal/sdk/models/operations/platformskillslist.go new file mode 100644 index 00000000..40f74199 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/platformskillslist.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PlatformSkillsListRequest struct { + // Maximum number of skills to return. + PageSize *int64 `queryParam:"style=form,explode=true,name=page_size"` + // Opaque pagination cursor from a previous response. + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` +} + +func (o *PlatformSkillsListRequest) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *PlatformSkillsListRequest) GetCursor() *string { + if o == nil { + return nil + } + return o.Cursor +} + +type PlatformSkillsListResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successful response. + PlatformSkillsListResponse *components.PlatformSkillsListResponse +} + +func (o *PlatformSkillsListResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PlatformSkillsListResponse) GetPlatformSkillsListResponse() *components.PlatformSkillsListResponse { + if o == nil { + return nil + } + return o.PlatformSkillsListResponse +} diff --git a/tests/skills_test.go b/tests/skills_test.go new file mode 100644 index 00000000..f9b5586c --- /dev/null +++ b/tests/skills_test.go @@ -0,0 +1,46 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package tests + +import ( + "context" + apiclientgo "github.com/gleanwork/api-client-go" + "github.com/gleanwork/api-client-go/internal/utils" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" +) + +func TestSkills_PlatformSkillsList(t *testing.T) { + ctx := context.Background() + + testHTTPClient := createTestHTTPClient("platform-skills-list") + + s := apiclientgo.New( + apiclientgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + apiclientgo.WithClient(testHTTPClient), + apiclientgo.WithSecurity(utils.GetEnv("GLEAN_API_TOKEN", "value")), + ) + + res, err := s.Platform.Skills.List(ctx, nil, nil) + require.NoError(t, err) + assert.Equal(t, 200, res.HTTPMeta.Response.StatusCode) + +} + +func TestSkills_PlatformSkillsGet(t *testing.T) { + ctx := context.Background() + + testHTTPClient := createTestHTTPClient("platform-skills-get") + + s := apiclientgo.New( + apiclientgo.WithServerURL(utils.GetEnv("TEST_SERVER_URL", "http://localhost:18080")), + apiclientgo.WithClient(testHTTPClient), + apiclientgo.WithSecurity(utils.GetEnv("GLEAN_API_TOKEN", "value")), + ) + + res, err := s.Platform.Skills.Retrieve(ctx, "") + require.NoError(t, err) + assert.Equal(t, 200, res.HTTPMeta.Response.StatusCode) + +} diff --git a/tests/summarize_test.go b/tests/summarize_test.go index 4474f69b..d2a433b8 100644 --- a/tests/summarize_test.go +++ b/tests/summarize_test.go @@ -25,16 +25,15 @@ func TestSummarize_Summarize(t *testing.T) { res, err := s.Client.Documents.Summarize(ctx, components.SummarizeRequest{ DocumentSpecs: []components.DocumentSpecUnion{ - components.CreateDocumentSpecUnionDocumentSpec3( - components.DocumentSpec3{ - UgcType: components.DocumentSpecUgcType1Answers, - ContentID: 123467, + components.CreateDocumentSpecUnionDocumentSpec4( + components.DocumentSpec4{ + UgcType: components.DocumentSpecUgcType2Chats, + UgcID: "", }, ), - components.CreateDocumentSpecUnionDocumentSpec3( - components.DocumentSpec3{ - UgcType: components.DocumentSpecUgcType1Answers, - ContentID: 123467, + components.CreateDocumentSpecUnionDocumentSpec1( + components.DocumentSpec1{ + URL: "https://super-stay.net/", }, ), }, From 3d17e3711c282e0c9f4aafa2abf1481407cd0ef6 Mon Sep 17 00:00:00 2001 From: "speakeasy-github[bot]" <128539517+speakeasy-github[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 02:21:56 +0000 Subject: [PATCH 2/2] empty commit to trigger [run-tests] workflow