diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4506513..fa6130c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,14 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: branches-ignore: - 'stl-preview-head/**' diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 383dd5a..6bc1697 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.2" + ".": "0.5.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bc8946a..9c46bf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.5.3 (2026-03-17) + +Full Changelog: [v0.5.2...v0.5.3](https://github.com/CASParser/cas-parser-go/compare/v0.5.2...v0.5.3) + +### Chores + +* **internal:** minor cleanup ([5dcbbb1](https://github.com/CASParser/cas-parser-go/commit/5dcbbb199f0fc37d6676c9d259205773c794406f)) +* **internal:** tweak CI branches ([6377b4a](https://github.com/CASParser/cas-parser-go/commit/6377b4aa8da9f70467ba34dba7a1ddf4ffcc3743)) +* **internal:** use explicit returns ([edbbf41](https://github.com/CASParser/cas-parser-go/commit/edbbf41442d2577fb04903e619b9b67554d10209)) +* **internal:** use explicit returns in more places ([af11842](https://github.com/CASParser/cas-parser-go/commit/af11842d738d5907bde4ba49fcd17679a037dc3e)) + ## 0.5.2 (2026-03-07) Full Changelog: [v0.5.1...v0.5.2](https://github.com/CASParser/cas-parser-go/compare/v0.5.1...v0.5.2) diff --git a/README.md b/README.md index ccad69e..f31c9dd 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Or to pin the version: ```sh -go get -u 'github.com/CASParser/cas-parser-go@v0.5.2' +go get -u 'github.com/CASParser/cas-parser-go@v0.5.3' ``` diff --git a/accesstoken.go b/accesstoken.go index 845eee3..ab9adb3 100644 --- a/accesstoken.go +++ b/accesstoken.go @@ -55,7 +55,7 @@ func (r *AccessTokenService) New(ctx context.Context, body AccessTokenNewParams, opts = slices.Concat(r.Options, opts) path := "v1/token" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type AccessTokenNewResponse struct { diff --git a/camskfintech.go b/camskfintech.go index bf3b16e..ff05d5d 100644 --- a/camskfintech.go +++ b/camskfintech.go @@ -43,7 +43,7 @@ func (r *CamsKfintechService) Parse(ctx context.Context, body CamsKfintechParseP opts = slices.Concat(r.Options, opts) path := "v4/cams_kfintech/parse" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type LinkedHolder struct { diff --git a/cdsl.go b/cdsl.go index 033fa35..dd0ecba 100644 --- a/cdsl.go +++ b/cdsl.go @@ -45,7 +45,7 @@ func (r *CdslService) ParsePdf(ctx context.Context, body CdslParsePdfParams, opt opts = slices.Concat(r.Options, opts) path := "v4/cdsl/parse" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type CdslParsePdfParams struct { diff --git a/cdslfetch.go b/cdslfetch.go index b9a3a65..f0d6047 100644 --- a/cdslfetch.go +++ b/cdslfetch.go @@ -52,7 +52,7 @@ func (r *CdslFetchService) RequestOtp(ctx context.Context, body CdslFetchRequest opts = slices.Concat(r.Options, opts) path := "v4/cdsl/fetch" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } // **Step 2 of 2**: Verify OTP and retrieve CDSL CAS files. @@ -63,11 +63,11 @@ func (r *CdslFetchService) VerifyOtp(ctx context.Context, sessionID string, body opts = slices.Concat(r.Options, opts) if sessionID == "" { err = errors.New("missing required session_id parameter") - return + return nil, err } path := fmt.Sprintf("v4/cdsl/fetch/%s/verify", url.PathEscape(sessionID)) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type CdslFetchRequestOtpResponse struct { diff --git a/client_test.go b/client_test.go index a5e30f8..e821d17 100644 --- a/client_test.go +++ b/client_test.go @@ -38,7 +38,7 @@ func TestUserAgentHeader(t *testing.T) { }, }), ) - client.Credits.Check(context.Background()) + _, _ = client.Credits.Check(context.Background()) if userAgent != fmt.Sprintf("CasParser/Go %s", internal.PackageVersion) { t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent) } diff --git a/contractnote.go b/contractnote.go index f535b83..b261571 100644 --- a/contractnote.go +++ b/contractnote.go @@ -70,7 +70,7 @@ func (r *ContractNoteService) Parse(ctx context.Context, body ContractNoteParseP opts = slices.Concat(r.Options, opts) path := "v4/contract_note/parse" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type ContractNoteParseResponse struct { diff --git a/credit.go b/credit.go index af831de..bbd336a 100644 --- a/credit.go +++ b/credit.go @@ -49,7 +49,7 @@ func (r *CreditService) Check(ctx context.Context, opts ...option.RequestOption) opts = slices.Concat(r.Options, opts) path := "v1/credits" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) - return + return res, err } type CreditCheckResponse struct { diff --git a/inboundemail.go b/inboundemail.go index 134fb93..5836c81 100644 --- a/inboundemail.go +++ b/inboundemail.go @@ -91,7 +91,7 @@ func (r *InboundEmailService) New(ctx context.Context, body InboundEmailNewParam opts = slices.Concat(r.Options, opts) path := "v4/inbound-email" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } // Retrieve details of a specific mailbox including statistics. @@ -99,11 +99,11 @@ func (r *InboundEmailService) Get(ctx context.Context, inboundEmailID string, op opts = slices.Concat(r.Options, opts) if inboundEmailID == "" { err = errors.New("missing required inbound_email_id parameter") - return + return nil, err } path := fmt.Sprintf("v4/inbound-email/%s", url.PathEscape(inboundEmailID)) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) - return + return res, err } // List all mailboxes associated with your API key. Returns active and inactive @@ -112,7 +112,7 @@ func (r *InboundEmailService) List(ctx context.Context, query InboundEmailListPa opts = slices.Concat(r.Options, opts) path := "v4/inbound-email" err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...) - return + return res, err } // Permanently delete an inbound email address. It will stop accepting emails. @@ -123,11 +123,11 @@ func (r *InboundEmailService) Delete(ctx context.Context, inboundEmailID string, opts = slices.Concat(r.Options, opts) if inboundEmailID == "" { err = errors.New("missing required inbound_email_id parameter") - return + return nil, err } path := fmt.Sprintf("v4/inbound-email/%s", url.PathEscape(inboundEmailID)) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) - return + return res, err } // An inbound email address for receiving forwarded CAS emails diff --git a/inbox.go b/inbox.go index e3b42f0..ae22ef0 100644 --- a/inbox.go +++ b/inbox.go @@ -65,7 +65,7 @@ func (r *InboxService) CheckConnectionStatus(ctx context.Context, body InboxChec opts = slices.Concat(r.Options, opts) path := "v4/inbox/status" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) - return + return res, err } // Initiate OAuth flow to connect user's email inbox. @@ -91,7 +91,7 @@ func (r *InboxService) ConnectEmail(ctx context.Context, body InboxConnectEmailP opts = slices.Concat(r.Options, opts) path := "v4/inbox/connect" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } // Revoke email access and invalidate the token. @@ -107,7 +107,7 @@ func (r *InboxService) DisconnectEmail(ctx context.Context, body InboxDisconnect opts = slices.Concat(r.Options, opts) path := "v4/inbox/disconnect" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) - return + return res, err } // Search the user's email inbox for CAS files from known senders (CAMS, KFintech, @@ -126,7 +126,7 @@ func (r *InboxService) ListCasFiles(ctx context.Context, params InboxListCasFile opts = slices.Concat(r.Options, opts) path := "v4/inbox/cas" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...) - return + return res, err } type InboxCheckConnectionStatusResponse struct { diff --git a/internal/apiform/encoder.go b/internal/apiform/encoder.go index c2bfd45..8810511 100644 --- a/internal/apiform/encoder.go +++ b/internal/apiform/encoder.go @@ -469,5 +469,5 @@ func WriteExtras(writer *multipart.Writer, extras map[string]any) (err error) { break } } - return + return err } diff --git a/internal/apiform/form_test.go b/internal/apiform/form_test.go index 0d12f8e..9826914 100644 --- a/internal/apiform/form_test.go +++ b/internal/apiform/form_test.go @@ -585,14 +585,17 @@ func TestEncode(t *testing.T) { t.Run(name, func(t *testing.T) { buf := bytes.NewBuffer(nil) writer := multipart.NewWriter(buf) - writer.SetBoundary("xxx") + err := writer.SetBoundary("xxx") + if err != nil { + t.Errorf("setting boundary for %v failed with error %v", test.val, err) + } - var arrayFmt string = "indices:dots" + arrayFmt := "indices:dots" if tags := strings.Split(name, ","); len(tags) > 1 { arrayFmt = tags[1] } - err := MarshalWithSettings(test.val, writer, arrayFmt) + err = MarshalWithSettings(test.val, writer, arrayFmt) if err != nil { t.Errorf("serialization of %v failed with error %v", test.val, err) } diff --git a/internal/apiform/tag.go b/internal/apiform/tag.go index b353617..d9915d4 100644 --- a/internal/apiform/tag.go +++ b/internal/apiform/tag.go @@ -24,7 +24,7 @@ func parseFormStructTag(field reflect.StructField) (tag parsedStructTag, ok bool raw, ok = field.Tag.Lookup(jsonStructTag) } if !ok { - return + return tag, ok } parts := strings.Split(raw, ",") if len(parts) == 0 { @@ -45,7 +45,7 @@ func parseFormStructTag(field reflect.StructField) (tag parsedStructTag, ok bool } parseApiStructTag(field, &tag) - return + return tag, ok } func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { @@ -60,11 +60,13 @@ func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { tag.extras = true case "required": tag.required = true + case "metadata": + tag.metadata = true } } } func parseFormatStructTag(field reflect.StructField) (format string, ok bool) { format, ok = field.Tag.Lookup(formatStructTag) - return + return format, ok } diff --git a/internal/apijson/decoder.go b/internal/apijson/decoder.go index 0b4aef9..d67d6e5 100644 --- a/internal/apijson/decoder.go +++ b/internal/apijson/decoder.go @@ -393,7 +393,7 @@ func (d *decoderBuilder) newStructTypeDecoder(t reflect.Type) decoderFunc { for _, decoder := range anonymousDecoders { // ignore errors - decoder.fn(node, value.FieldByIndex(decoder.idx), state) + _ = decoder.fn(node, value.FieldByIndex(decoder.idx), state) } for _, inlineDecoder := range inlineDecoders { @@ -462,7 +462,7 @@ func (d *decoderBuilder) newStructTypeDecoder(t reflect.Type) decoderFunc { // Handle null [param.Opt] if itemNode.Type == gjson.Null && dest.IsValid() && dest.Type().Implements(reflect.TypeOf((*param.Optional)(nil)).Elem()) { - dest.Addr().Interface().(json.Unmarshaler).UnmarshalJSON([]byte(itemNode.Raw)) + _ = dest.Addr().Interface().(json.Unmarshaler).UnmarshalJSON([]byte(itemNode.Raw)) continue } @@ -684,8 +684,5 @@ func guardUnknown(state *decoderState, v reflect.Value) bool { constantString, ok := v.Interface().(interface{ Default() string }) named := v.Type() != stringType - if guardStrict(state, ok && named && v.Equal(reflect.ValueOf(constantString.Default()))) { - return true - } - return false + return guardStrict(state, ok && named && v.Equal(reflect.ValueOf(constantString.Default()))) } diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go index ab7a3c1..0decb73 100644 --- a/internal/apijson/encoder.go +++ b/internal/apijson/encoder.go @@ -286,28 +286,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc { return nil, err } } - return - } -} - -func (e *encoder) newFieldTypeEncoder(t reflect.Type) encoderFunc { - f, _ := t.FieldByName("Value") - enc := e.typeEncoder(f.Type) - - return func(value reflect.Value) (json []byte, err error) { - present := value.FieldByName("Present") - if !present.Bool() { - return nil, nil - } - null := value.FieldByName("Null") - if null.Bool() { - return []byte("null"), nil - } - raw := value.FieldByName("Raw") - if !raw.IsNil() { - return e.typeEncoder(raw.Type())(raw) - } - return enc(value.FieldByName("Value")) + return json, err } } diff --git a/internal/apijson/enum.go b/internal/apijson/enum.go index 5bef11c..a1626a5 100644 --- a/internal/apijson/enum.go +++ b/internal/apijson/enum.go @@ -4,7 +4,6 @@ import ( "fmt" "reflect" "slices" - "sync" "github.com/tidwall/gjson" ) @@ -15,7 +14,6 @@ import ( type validationEntry struct { field reflect.StructField - required bool legalValues struct { strings []string // 1 represents true, 0 represents false, -1 represents either @@ -24,9 +22,6 @@ type validationEntry struct { } } -type validatorFunc func(reflect.Value) exactness - -var validators sync.Map var validationRegistry = map[reflect.Type][]validationEntry{} func RegisterFieldValidator[T any, V string | bool | int | float64](fieldName string, values ...V) { @@ -111,9 +106,9 @@ func (state *decoderState) validateBool(v reflect.Value) { return } b := v.Bool() - if state.validator.legalValues.bools == 1 && b == false { + if state.validator.legalValues.bools == 1 && !b { state.exactness = loose - } else if state.validator.legalValues.bools == 0 && b == true { + } else if state.validator.legalValues.bools == 0 && b { state.exactness = loose } } diff --git a/internal/apijson/json_test.go b/internal/apijson/json_test.go index fac9fcc..19b3614 100644 --- a/internal/apijson/json_test.go +++ b/internal/apijson/json_test.go @@ -87,7 +87,7 @@ type JSONFieldStruct struct { C string `json:"c"` D string `json:"d"` ExtraFields map[string]int64 `json:"" api:"extrafields"` - JSON JSONFieldStructJSON `json:",metadata"` + JSON JSONFieldStructJSON `json:"-" api:"metadata"` } type JSONFieldStructJSON struct { @@ -113,12 +113,12 @@ type Union interface { type Inline struct { InlineField Primitives `json:",inline"` - JSON InlineJSON `json:",metadata"` + JSON InlineJSON `json:"-" api:"metadata"` } type InlineArray struct { InlineField []string `json:",inline"` - JSON InlineJSON `json:",metadata"` + JSON InlineJSON `json:"-" api:"metadata"` } type InlineJSON struct { @@ -268,7 +268,7 @@ type MarshallingUnionStruct struct { func (r *MarshallingUnionStruct) UnmarshalJSON(data []byte) (err error) { *r = MarshallingUnionStruct{} err = UnmarshalRoot(data, &r.Union) - return + return err } func (r MarshallingUnionStruct) MarshalJSON() (data []byte, err error) { diff --git a/internal/apijson/tag.go b/internal/apijson/tag.go index 49731b8..17b2130 100644 --- a/internal/apijson/tag.go +++ b/internal/apijson/tag.go @@ -20,7 +20,7 @@ type parsedStructTag struct { func parseJSONStructTag(field reflect.StructField) (tag parsedStructTag, ok bool) { raw, ok := field.Tag.Lookup(jsonStructTag) if !ok { - return + return tag, ok } parts := strings.Split(raw, ",") if len(parts) == 0 { @@ -42,7 +42,7 @@ func parseJSONStructTag(field reflect.StructField) (tag parsedStructTag, ok bool // the `api` struct tag is only used alongside `json` for custom behaviour parseApiStructTag(field, &tag) - return + return tag, ok } func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { @@ -57,11 +57,13 @@ func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) { tag.extras = true case "required": tag.required = true + case "metadata": + tag.metadata = true } } } func parseFormatStructTag(field reflect.StructField) (format string, ok bool) { format, ok = field.Tag.Lookup(formatStructTag) - return + return format, ok } diff --git a/internal/apiquery/encoder.go b/internal/apiquery/encoder.go index 85c69fc..e21285a 100644 --- a/internal/apiquery/encoder.go +++ b/internal/apiquery/encoder.go @@ -103,7 +103,7 @@ func (e *encoder) newTypeEncoder(t reflect.Type) encoderFunc { encoder := e.typeEncoder(t.Elem()) return func(key string, value reflect.Value) (pairs []Pair, err error) { if !value.IsValid() || value.IsNil() { - return + return pairs, err } return encoder(key, value.Elem()) } @@ -193,7 +193,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc { return func(key string, value reflect.Value) (pairs []Pair, err error) { for _, ef := range encoderFields { - var subkey string = e.renderKeyPath(key, ef.tag.name) + subkey := e.renderKeyPath(key, ef.tag.name) if ef.tag.inline { subkey = key } @@ -205,7 +205,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc { } pairs = append(pairs, subpairs...) } - return + return pairs, err } } @@ -256,7 +256,7 @@ func (e *encoder) newMapEncoder(t reflect.Type) encoderFunc { } pairs = append(pairs, subpairs...) } - return + return pairs, err } } @@ -300,7 +300,7 @@ func (e *encoder) newArrayTypeEncoder(t reflect.Type) encoderFunc { } pairs = append(pairs, subpairs...) } - return + return pairs, err } case ArrayQueryFormatIndices: panic("The array indices format is not supported yet") @@ -315,7 +315,7 @@ func (e *encoder) newArrayTypeEncoder(t reflect.Type) encoderFunc { } pairs = append(pairs, subpairs...) } - return + return pairs, err } default: panic(fmt.Sprintf("Unknown ArrayFormat value: %d", e.settings.ArrayFormat)) @@ -372,27 +372,6 @@ func (e *encoder) newPrimitiveTypeEncoder(t reflect.Type) encoderFunc { } } -func (e *encoder) newFieldTypeEncoder(t reflect.Type) encoderFunc { - f, _ := t.FieldByName("Value") - enc := e.typeEncoder(f.Type) - - return func(key string, value reflect.Value) ([]Pair, error) { - present := value.FieldByName("Present") - if !present.Bool() { - return nil, nil - } - null := value.FieldByName("Null") - if null.Bool() { - return nil, fmt.Errorf("apiquery: field cannot be null") - } - raw := value.FieldByName("Raw") - if !raw.IsNil() { - return e.typeEncoder(raw.Type())(key, raw) - } - return enc(key, value.FieldByName("Value")) - } -} - func (e *encoder) newTimeTypeEncoder(_ reflect.Type) encoderFunc { format := e.dateFormat return func(key string, value reflect.Value) ([]Pair, error) { diff --git a/internal/apiquery/tag.go b/internal/apiquery/tag.go index 772c40e..9e413ad 100644 --- a/internal/apiquery/tag.go +++ b/internal/apiquery/tag.go @@ -18,7 +18,7 @@ type parsedStructTag struct { func parseQueryStructTag(field reflect.StructField) (tag parsedStructTag, ok bool) { raw, ok := field.Tag.Lookup(queryStructTag) if !ok { - return + return tag, ok } parts := strings.Split(raw, ",") if len(parts) == 0 { @@ -35,10 +35,10 @@ func parseQueryStructTag(field reflect.StructField) (tag parsedStructTag, ok boo tag.inline = true } } - return + return tag, ok } func parseFormatStructTag(field reflect.StructField) (format string, ok bool) { format, ok = field.Tag.Lookup(formatStructTag) - return + return format, ok } diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 81211f5..b64449f 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -461,7 +461,7 @@ func (cfg *RequestConfig) Execute() (err error) { // Close the response body before retrying to prevent connection leaks if res != nil && res.Body != nil { - res.Body.Close() + _ = res.Body.Close() } select { @@ -489,7 +489,7 @@ func (cfg *RequestConfig) Execute() (err error) { if res.StatusCode >= 400 { contents, err := io.ReadAll(res.Body) - res.Body.Close() + _ = res.Body.Close() if err != nil { return err } @@ -520,7 +520,7 @@ func (cfg *RequestConfig) Execute() (err error) { } contents, err := io.ReadAll(res.Body) - res.Body.Close() + _ = res.Body.Close() if err != nil { return fmt.Errorf("error reading response body: %w", err) } diff --git a/internal/version.go b/internal/version.go index 0ff2820..a2967c7 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.5.2" // x-release-please-version +const PackageVersion = "0.5.3" // x-release-please-version diff --git a/kfintech.go b/kfintech.go index 7ee2e25..aedbcca 100644 --- a/kfintech.go +++ b/kfintech.go @@ -44,7 +44,7 @@ func (r *KfintechService) GenerateCas(ctx context.Context, body KfintechGenerate opts = slices.Concat(r.Options, opts) path := "v4/kfintech/generate" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type KfintechGenerateCasResponse struct { diff --git a/log.go b/log.go index e9d4f43..918354c 100644 --- a/log.go +++ b/log.go @@ -47,7 +47,7 @@ func (r *LogService) New(ctx context.Context, body LogNewParams, opts ...option. opts = slices.Concat(r.Options, opts) path := "v1/usage" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } // Get aggregated usage statistics grouped by feature. @@ -60,7 +60,7 @@ func (r *LogService) GetSummary(ctx context.Context, body LogGetSummaryParams, o opts = slices.Concat(r.Options, opts) path := "v1/usage/summary" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type LogNewResponse struct { diff --git a/nsdl.go b/nsdl.go index ecad89f..cac7743 100644 --- a/nsdl.go +++ b/nsdl.go @@ -41,7 +41,7 @@ func (r *NsdlService) Parse(ctx context.Context, body NsdlParseParams, opts ...o opts = slices.Concat(r.Options, opts) path := "v4/nsdl/parse" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type NsdlParseParams struct { diff --git a/smart.go b/smart.go index d04d1e1..fc63975 100644 --- a/smart.go +++ b/smart.go @@ -42,7 +42,7 @@ func (r *SmartService) ParseCasPdf(ctx context.Context, body SmartParseCasPdfPar opts = slices.Concat(r.Options, opts) path := "v4/smart/parse" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...) - return + return res, err } type SmartParseCasPdfParams struct { diff --git a/usage_test.go b/usage_test.go index a55d2e6..732f129 100644 --- a/usage_test.go +++ b/usage_test.go @@ -13,6 +13,7 @@ import ( ) func TestUsage(t *testing.T) { + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -24,7 +25,6 @@ func TestUsage(t *testing.T) { option.WithBaseURL(baseURL), option.WithAPIKey("My API Key"), ) - t.Skip("Mock server tests are disabled") response, err := client.Credits.Check(context.TODO()) if err != nil { t.Fatalf("err should be nil: %s", err.Error()) diff --git a/verifytoken.go b/verifytoken.go index 49500d6..c800e60 100644 --- a/verifytoken.go +++ b/verifytoken.go @@ -43,7 +43,7 @@ func (r *VerifyTokenService) Verify(ctx context.Context, opts ...option.RequestO opts = slices.Concat(r.Options, opts) path := "v1/token/verify" err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...) - return + return res, err } type VerifyTokenVerifyResponse struct {