diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb4918b..c7e3e09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/openregister-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: @@ -48,7 +48,7 @@ jobs: permissions: contents: read id-token: write - runs-on: ${{ github.repository == 'stainless-sdks/openregister-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -95,7 +95,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ${{ github.repository == 'stainless-sdks/openregister-cli' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6bc1697..4208b5c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.3" + ".": "0.6.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index a11b722..d6c218a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 21 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openregister/openregister-9003cf9ba012f57f92e1dbcdec03aa0577f270632a92acd5aabcf65491fe278f.yml -openapi_spec_hash: 783638013b86f0777caae690a60c90f1 -config_hash: 16c97c736c0b7de7fb3470f37f856206 +configured_endpoints: 24 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openregister/openregister-4bd4cc957806a1fc7250db66762de302ee6718d21ebe7159b8753af53acc68df.yml +openapi_spec_hash: 2ada6c644f88094e8e542e539643f724 +config_hash: 42520b3d15dbe4a67577eb9c86e4ed01 diff --git a/CHANGELOG.md b/CHANGELOG.md index fc1e973..a2fea34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## 0.6.0 (2026-07-28) + +Full Changelog: [v0.5.3...v0.6.0](https://github.com/oregister/openregister-cli/compare/v0.5.3...v0.6.0) + +### Features + +* **api:** daily monitor updates for companies ([b73a291](https://github.com/oregister/openregister-cli/commit/b73a2915a51ad04979e8dbbf6ec79f3d277cebe4)) +* **api:** insolvencies & m&a ([47ee27a](https://github.com/oregister/openregister-cli/commit/47ee27a1ed3b9d5f8bb08471af53d1a6243aed6c)) +* **api:** manual updates ([52b28fa](https://github.com/oregister/openregister-cli/commit/52b28fae69706d5b33c5731fcaa1604a88c95644)) +* **api:** manual updates ([1c383bc](https://github.com/oregister/openregister-cli/commit/1c383bc53a93ad236baa6517306adec27f89a34f)) +* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([4d86d0c](https://github.com/oregister/openregister-cli/commit/4d86d0c35f1083ddb887fa3575ea9e7767240b3c)) + + +### Bug Fixes + +* **go:** remove a nonexistent release workflow from release-please extra-files ([c0408fe](https://github.com/oregister/openregister-cli/commit/c0408fe242001d365e48bec66a0e9e9245e4b919)) + + +### Chores + +* **internal:** codegen related update ([956a9dd](https://github.com/oregister/openregister-cli/commit/956a9dd634abf09be5cc1df1ac162d9549edd4f7)) + ## 0.5.3 (2026-07-15) Full Changelog: [v0.5.2...v0.5.3](https://github.com/oregister/openregister-cli/compare/v0.5.2...v0.5.3) diff --git a/go.mod b/go.mod index 5116c3c..f223e7b 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/goccy/go-yaml v1.18.0 github.com/itchyny/json2yaml v0.1.4 github.com/muesli/reflow v0.3.0 - github.com/oregister/openregister-go/v2 v2.8.0 + github.com/oregister/openregister-go/v2 v2.10.0 github.com/stretchr/testify v1.10.0 github.com/tidwall/gjson v1.18.0 github.com/tidwall/pretty v1.2.1 diff --git a/go.sum b/go.sum index 981bc7b..517acf7 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= -github.com/oregister/openregister-go/v2 v2.8.0 h1:sMHkjw+rZhjRfnEN/V21DFIkrjgRPrqDb7hPAXI+OBw= -github.com/oregister/openregister-go/v2 v2.8.0/go.mod h1:CCIHIlKhI2GTYzCGjooEWb+Qmclab0n258lUEVuPKkA= +github.com/oregister/openregister-go/v2 v2.10.0 h1:SKV/Kco04Bd88vNo5jhO4WR2sw7swKsjokNV8ZspUZQ= +github.com/oregister/openregister-go/v2 v2.10.0/go.mod h1:CCIHIlKhI2GTYzCGjooEWb+Qmclab0n258lUEVuPKkA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index 377344e..3002dd4 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -92,6 +92,7 @@ func init() { Commands: []*cli.Command{ &searchAutocompleteCompaniesV1, &searchFindCompaniesV1, + &searchFindInsolvenciesV1, &searchFindPersonV1, &searchLookupCompanyByURL, }, @@ -155,6 +156,22 @@ func init() { &transparenzregisterExtractGetV1, }, }, + { + Name: "usage", + Category: "API RESOURCE", + Suggest: true, + Commands: []*cli.Command{ + &usageGetCreditsV1, + }, + }, + { + Name: "insolvency", + Category: "API RESOURCE", + Suggest: true, + Commands: []*cli.Command{ + &insolvencyGetDetailsV1, + }, + }, { Name: "@manpages", Usage: "Generate documentation for 'man'", diff --git a/pkg/cmd/insolvency.go b/pkg/cmd/insolvency.go new file mode 100644 index 0000000..c32b4ab --- /dev/null +++ b/pkg/cmd/insolvency.go @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "context" + "fmt" + + "github.com/oregister/openregister-cli/internal/apiquery" + "github.com/oregister/openregister-cli/internal/requestflag" + "github.com/oregister/openregister-go/v2" + "github.com/oregister/openregister-go/v2/option" + "github.com/tidwall/gjson" + "github.com/urfave/cli/v3" +) + +var insolvencyGetDetailsV1 = cli.Command{ + Name: "get-details-v1", + Usage: "Get detailed insolvency proceeding information", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[string]{ + Name: "insolvency-id", + Required: true, + PathParam: "insolvency_id", + }, + }, + Action: handleInsolvencyGetDetailsV1, + HideHelpCommand: true, +} + +func handleInsolvencyGetDetailsV1(ctx context.Context, cmd *cli.Command) error { + client := openregister.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + if !cmd.IsSet("insolvency-id") && len(unusedArgs) > 0 { + cmd.Set("insolvency-id", unusedArgs[0]) + unusedArgs = unusedArgs[1:] + } + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Insolvency.GetDetailsV1(ctx, cmd.Value("insolvency-id").(string), options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "insolvency get-details-v1", + Transform: transform, + }) +} diff --git a/pkg/cmd/insolvency_test.go b/pkg/cmd/insolvency_test.go new file mode 100644 index 0000000..ba616cf --- /dev/null +++ b/pkg/cmd/insolvency_test.go @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "testing" + + "github.com/oregister/openregister-cli/internal/mocktest" +) + +func TestInsolvencyGetDetailsV1(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "insolvency", "get-details-v1", + "--insolvency-id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + }) +} diff --git a/pkg/cmd/monitor.go b/pkg/cmd/monitor.go index 4c75b81..307ce8b 100644 --- a/pkg/cmd/monitor.go +++ b/pkg/cmd/monitor.go @@ -37,6 +37,12 @@ var monitorCreate = cli.Command{ Required: true, BodyPath: "preferences", }, + &requestflag.Flag[string]{ + Name: "update-frequency", + Usage: "How often the monitored company is checked for register updates.\nDefaults to `weekly` if not provided.\n\nOnly supported when `entity_type` is `company`. Requests for `person`\nmonitors that include this field are rejected with a validation error.\n\nDaily monitors are billed at a premium: 50 credits at creation and\n50 credits per month while active, instead of the standard 25.\n", + Default: "weekly", + BodyPath: "update_frequency", + }, }, Action: handleMonitorCreate, HideHelpCommand: true, diff --git a/pkg/cmd/monitor_test.go b/pkg/cmd/monitor_test.go index 6f7d5d9..18dbbad 100644 --- a/pkg/cmd/monitor_test.go +++ b/pkg/cmd/monitor_test.go @@ -18,6 +18,7 @@ func TestMonitorCreate(t *testing.T) { "--entity-id", "entity_id", "--entity-type", "company", "--preference", "basic", + "--update-frequency", "daily", ) }) @@ -27,7 +28,8 @@ func TestMonitorCreate(t *testing.T) { "entity_id: entity_id\n" + "entity_type: company\n" + "preferences:\n" + - " - basic\n") + " - basic\n" + + "update_frequency: daily\n") mocktest.TestRunMockTestWithPipeAndFlags( t, pipeData, "--api-key", "string", diff --git a/pkg/cmd/search.go b/pkg/cmd/search.go index a9f5734..1a9b263 100644 --- a/pkg/cmd/search.go +++ b/pkg/cmd/search.go @@ -96,6 +96,50 @@ var searchFindCompaniesV1 = requestflag.WithInnerFlags(cli.Command{ }, }) +var searchFindInsolvenciesV1 = requestflag.WithInnerFlags(cli.Command{ + Name: "find-insolvencies-v1", + Usage: "Search for insolvency proceedings", + Suggest: true, + Flags: []cli.Flag{ + &requestflag.Flag[[]map[string]any]{ + Name: "filter", + Usage: "Filters to filter insolvency proceedings.\n", + BodyPath: "filters", + }, + &requestflag.Flag[map[string]any]{ + Name: "pagination", + BodyPath: "pagination", + }, + &requestflag.Flag[map[string]any]{ + Name: "query", + Usage: "Search query to filter insolvency proceedings.\n", + BodyPath: "query", + }, + }, + Action: handleSearchFindInsolvenciesV1, + HideHelpCommand: true, +}, map[string][]requestflag.HasOuterFlag{ + "pagination": { + &requestflag.InnerFlag[int64]{ + Name: "pagination.page", + Usage: "Page number to return.\n", + InnerField: "page", + }, + &requestflag.InnerFlag[int64]{ + Name: "pagination.per-page", + Usage: "Number of results per page.\n", + InnerField: "per_page", + }, + }, + "query": { + &requestflag.InnerFlag[string]{ + Name: "query.value", + Usage: "Search query to filter insolvency proceedings.\nMatches against debtor name, case number, administrator name and court.\n", + InnerField: "value", + }, + }, +}) + var searchFindPersonV1 = requestflag.WithInnerFlags(cli.Command{ Name: "find-person-v1", Usage: "Search for people", @@ -238,6 +282,47 @@ func handleSearchFindCompaniesV1(ctx context.Context, cmd *cli.Command) error { }) } +func handleSearchFindInsolvenciesV1(ctx context.Context, cmd *cli.Command) error { + client := openregister.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + ApplicationJSON, + false, + ) + if err != nil { + return err + } + + params := openregister.SearchFindInsolvenciesV1Params{} + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Search.FindInsolvenciesV1(ctx, params, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "search find-insolvencies-v1", + Transform: transform, + }) +} + func handleSearchFindPersonV1(ctx context.Context, cmd *cli.Command) error { client := openregister.NewClient(getDefaultRequestOptions(cmd)...) unusedArgs := cmd.Args().Slice() diff --git a/pkg/cmd/search_test.go b/pkg/cmd/search_test.go index acef848..b1569f7 100644 --- a/pkg/cmd/search_test.go +++ b/pkg/cmd/search_test.go @@ -83,6 +83,60 @@ func TestSearchFindCompaniesV1(t *testing.T) { }) } +func TestSearchFindInsolvenciesV1(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "search", "find-insolvencies-v1", + "--filter", "{keywords: [string], max: max, min: min, value: value, values: [string], field: debtor_kind}", + "--pagination", "{page: 0, per_page: 0}", + "--query", "{value: value}", + ) + }) + + t.Run("inner flags", func(t *testing.T) { + // Check that inner flags have been set up correctly + requestflag.CheckInnerFlags(searchFindInsolvenciesV1) + + // Alternative argument passing style using inner flags + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "search", "find-insolvencies-v1", + "--filter", "{keywords: [string], max: max, min: min, value: value, values: [string], field: debtor_kind}", + "--pagination.page", "0", + "--pagination.per-page", "0", + "--query.value", "value", + ) + }) + + t.Run("piping data", func(t *testing.T) { + // Test piping YAML data over stdin + pipeData := []byte("" + + "filters:\n" + + " - keywords:\n" + + " - string\n" + + " max: max\n" + + " min: min\n" + + " value: value\n" + + " values:\n" + + " - string\n" + + " field: debtor_kind\n" + + "pagination:\n" + + " page: 0\n" + + " per_page: 0\n" + + "query:\n" + + " value: value\n") + mocktest.TestRunMockTestWithPipeAndFlags( + t, pipeData, + "--api-key", "string", + "search", "find-insolvencies-v1", + ) + }) +} + func TestSearchFindPersonV1(t *testing.T) { t.Skip("Mock server tests are disabled") t.Run("regular flags", func(t *testing.T) { diff --git a/pkg/cmd/usage.go b/pkg/cmd/usage.go new file mode 100644 index 0000000..a8c7684 --- /dev/null +++ b/pkg/cmd/usage.go @@ -0,0 +1,62 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "context" + "fmt" + + "github.com/oregister/openregister-cli/internal/apiquery" + "github.com/oregister/openregister-go/v2" + "github.com/oregister/openregister-go/v2/option" + "github.com/tidwall/gjson" + "github.com/urfave/cli/v3" +) + +var usageGetCreditsV1 = cli.Command{ + Name: "get-credits-v1", + Usage: "Retrieve public API credit usage", + Suggest: true, + Flags: []cli.Flag{}, + Action: handleUsageGetCreditsV1, + HideHelpCommand: true, +} + +func handleUsageGetCreditsV1(ctx context.Context, cmd *cli.Command) error { + client := openregister.NewClient(getDefaultRequestOptions(cmd)...) + unusedArgs := cmd.Args().Slice() + + if len(unusedArgs) > 0 { + return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs) + } + + options, err := flagOptions( + cmd, + apiquery.NestedQueryFormatBrackets, + apiquery.ArrayQueryFormatComma, + EmptyBody, + false, + ) + if err != nil { + return err + } + + var res []byte + options = append(options, option.WithResponseBodyInto(&res)) + _, err = client.Usage.GetCreditsV1(ctx, options...) + if err != nil { + return err + } + + obj := gjson.ParseBytes(res) + format := cmd.Root().String("format") + explicitFormat := cmd.Root().IsSet("format") + transform := cmd.Root().String("transform") + return ShowJSON(obj, ShowJSONOpts{ + ExplicitFormat: explicitFormat, + Format: format, + RawOutput: cmd.Root().Bool("raw-output"), + Title: "usage get-credits-v1", + Transform: transform, + }) +} diff --git a/pkg/cmd/usage_test.go b/pkg/cmd/usage_test.go new file mode 100644 index 0000000..d37e98c --- /dev/null +++ b/pkg/cmd/usage_test.go @@ -0,0 +1,20 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package cmd + +import ( + "testing" + + "github.com/oregister/openregister-cli/internal/mocktest" +) + +func TestUsageGetCreditsV1(t *testing.T) { + t.Skip("Mock server tests are disabled") + t.Run("regular flags", func(t *testing.T) { + mocktest.TestRunMockTestWithFlags( + t, + "--api-key", "string", + "usage", "get-credits-v1", + ) + }) +} diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 2246d44..c1f2884 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -2,4 +2,4 @@ package cmd -const Version = "0.5.3" // x-release-please-version +const Version = "0.6.0" // x-release-please-version