From 02ef3f619a4aae7a436135ac72d947c45b5d7944 Mon Sep 17 00:00:00 2001 From: alohihq <43223332+riwanl8@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:02:53 +0000 Subject: [PATCH] liblab SDK update for version v1.0.0 --- .manifest.json | 30 +++++++++++-------- README.md | 10 +++---- cmd/examples/example.go | 3 -- .../models/create_envelope_request.md | 1 - documentation/services/signplus_service.md | 3 -- internal/validation/validate_pattern.go | 13 ++++++-- pkg/signplus/create_envelope_request.go | 13 -------- 7 files changed, 33 insertions(+), 40 deletions(-) diff --git a/.manifest.json b/.manifest.json index 672295b..a3d4522 100644 --- a/.manifest.json +++ b/.manifest.json @@ -1,11 +1,11 @@ { - "liblabVersion": "2.1.24", - "date": "2024-08-02T14:47:05.031Z", + "liblabVersion": "2.1.28", + "date": "2024-08-21T11:02:19.350Z", "config": { "language": "go", "apiId": 947, "sdkName": "signplus", - "sdkVersion": "2.0.0", + "sdkVersion": "1.0.0", "liblabVersion": "2", "deliveryMethods": ["zip"], "languages": ["go"], @@ -19,31 +19,35 @@ "githubRepoName": "signplus-sharp", "ignoreFiles": [], "liblabVersion": "2", - "sdkVersion": "2.0.0" + "sdkVersion": "1.0.0" }, "go": { "goModuleName": "github.com/alohihq/signplus-go", + "additionalConstructorParameters": [], "githubRepoName": "signplus-go", "ignoreFiles": [], "liblabVersion": "2", - "sdkVersion": "2.0.0" + "sdkVersion": "1.0.0" }, "java": { "groupId": "alohi.signplus", + "additionalConstructorParameters": [], "githubRepoName": "signplus-java", "liblabVersion": "2", - "sdkVersion": "2.0.0" + "sdkVersion": "1.0.0" }, "python": { "alwaysInitializeOptionals": false, + "additionalConstructorParameters": [], "pypiPackageName": "signplus-python", "githubRepoName": "signplus-python", "ignoreFiles": [], "liblabVersion": "2", - "sdkVersion": "2.0.0" + "sdkVersion": "1.0.0" }, "php": { "packageName": "alohi/signplus", + "additionalConstructorParameters": [], "githubRepoName": "signplus-php", "ignoreFiles": [], "liblabVersion": "2", @@ -55,10 +59,11 @@ "httpClient": "axios", "npmName": "signplus-typescript", "npmOrg": "alohi", + "additionalConstructorParameters": [], "githubRepoName": "signplus-typescript", "ignoreFiles": [], "liblabVersion": "2", - "sdkVersion": "2.0.0" + "sdkVersion": "1.0.0" } }, "publishing": { @@ -92,9 +97,10 @@ "httpMethodsToRetry": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"] }, "multiTenant": true, - "specUrl": "https://prod-liblab-api-stack-specs.s3.us-east-1.amazonaws.com/947/open-api-spec.yaml?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA5P3QKKDKGVNIJ2H7%2F20240802%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240802T144659Z&X-Amz-Expires=43200&X-Amz-Signature=d40852fad5b0585cd81c33b96446050f5962001285feb78369f2edb87450abf7&X-Amz-SignedHeaders=host&x-id=GetObject", + "specUrl": "https://prod-liblab-api-stack-specs.s3.us-east-1.amazonaws.com/947/open-api-spec.yaml?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA5P3QKKDKGVNIJ2H7%2F20240821%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240821T110214Z&X-Amz-Expires=43200&X-Amz-Signature=009d5622184bfe1c39e60a5d0a55af4a2e741c467ac7da365003bdd60373a218&X-Amz-SignedHeaders=host&x-id=GetObject", "includeWatermark": false, "goModuleName": "github.com/alohihq/signplus-go", + "additionalConstructorParameters": [], "githubRepoName": "signplus-go", "ignoreFiles": [], "deliveryMethod": "zip", @@ -108,7 +114,7 @@ "httpLibrary": { "name": "axios", "packages": { - "axios": "^1.6.8" + "axios": "^1.7.4" }, "languages": ["typescript"] }, @@ -192,8 +198,8 @@ "documentation/models/webhook.md", "documentation/models/list_webhooks_request.md", "documentation/models/list_webhooks_response.md", - "documentation/models/envelope_flow_type.md", "documentation/models/envelope_legality_level.md", + "documentation/models/envelope_flow_type.md", "documentation/models/envelope_status.md", "documentation/models/signing_step.md", "documentation/models/recipient.md", @@ -218,8 +224,8 @@ "documentation/models/template_recipient_role.md", "documentation/models/template_order_field.md", "documentation/models/webhook_event.md", - "pkg/signplus/envelope_flow_type.go", "pkg/signplus/envelope_legality_level.go", + "pkg/signplus/envelope_flow_type.go", "pkg/signplus/envelope_status.go", "pkg/signplus/recipient_role.go", "pkg/signplus/recipient_verification_type.go", diff --git a/README.md b/README.md index 2c46987..21fa66c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Signplus Go SDK 2.0.0 +# Signplus Go SDK 1.0.0 Welcome to the Signplus SDK documentation. This guide will help you get started with integrating and using the Signplus SDK in your project. ## Versions - API version: `2.0.0` -- SDK version: `2.0.0` +- SDK version: `1.0.0` ## About the API @@ -46,7 +46,7 @@ import ( "github.com/alohihq/signplus-go/pkg/signplusconfig" ) -config := signplusconfig.NewConfig{} +config := signplusconfig.NewConfig() config.SetBearerToken("YOUR-TOKEN") sdk := signplus.NewSignplus(config) @@ -60,7 +60,7 @@ import ( "github.com/alohihq/signplus-go/pkg/signplusconfig" ) -config := signplusconfig.NewConfig{} +config := signplusconfig.NewConfig() sdk := signplus.NewSignplus(config) sdk.SetBearerToken("YOUR-TOKEN") @@ -121,8 +121,8 @@ The SDK includes several models that represent the data structures used in API r | [Webhook](documentation/models/webhook.md) | | | [ListWebhooksRequest](documentation/models/list_webhooks_request.md) | | | [ListWebhooksResponse](documentation/models/list_webhooks_response.md) | | -| [EnvelopeFlowType](documentation/models/envelope_flow_type.md) | Flow type of the envelope (REQUEST_SIGNATURE is a request for signature, SIGN_MYSELF is a self-signing flow) | | [EnvelopeLegalityLevel](documentation/models/envelope_legality_level.md) | Legal level of the envelope (SES is Simple Electronic Signature, QES_EIDAS is Qualified Electronic Signature, QES_ZERTES is Qualified Electronic Signature with Zertes) | +| [EnvelopeFlowType](documentation/models/envelope_flow_type.md) | Flow type of the envelope (REQUEST_SIGNATURE is a request for signature, SIGN_MYSELF is a self-signing flow) | | [EnvelopeStatus](documentation/models/envelope_status.md) | Status of the envelope | | [SigningStep](documentation/models/signing_step.md) | | | [Recipient](documentation/models/recipient.md) | | diff --git a/cmd/examples/example.go b/cmd/examples/example.go index 4f831f3..2fe00be 100644 --- a/cmd/examples/example.go +++ b/cmd/examples/example.go @@ -17,13 +17,10 @@ func main() { config := signplusconfig.NewConfig() client := signplus.NewSignplus(config) - envelopeFlowType := signplus.ENVELOPE_FLOW_TYPE_REQUEST_SIGNATURE - envelopeLegalityLevel := signplus.ENVELOPE_LEGALITY_LEVEL_SES request := signplus.CreateEnvelopeRequest{} request.SetName("Name") - request.SetFlowType(envelopeFlowType) request.SetLegalityLevel(envelopeLegalityLevel) response, err := client.Signplus.CreateEnvelope(context.Background(), request) diff --git a/documentation/models/create_envelope_request.md b/documentation/models/create_envelope_request.md index 166cdc9..e112025 100644 --- a/documentation/models/create_envelope_request.md +++ b/documentation/models/create_envelope_request.md @@ -5,7 +5,6 @@ | Name | Type | Required | Description | | :------------ | :----------------------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Name | string | ✅ | Name of the envelope | -| FlowType | signplus.EnvelopeFlowType | ✅ | Flow type of the envelope (REQUEST_SIGNATURE is a request for signature, SIGN_MYSELF is a self-signing flow) | | LegalityLevel | signplus.EnvelopeLegalityLevel | ✅ | Legal level of the envelope (SES is Simple Electronic Signature, QES_EIDAS is Qualified Electronic Signature, QES_ZERTES is Qualified Electronic Signature with Zertes) | | ExpiresAt | int64 | ❌ | Unix timestamp of the expiration date | | Comment | string | ❌ | Comment for the envelope | diff --git a/documentation/services/signplus_service.md b/documentation/services/signplus_service.md index 47b7bd8..2235dcc 100644 --- a/documentation/services/signplus_service.md +++ b/documentation/services/signplus_service.md @@ -77,13 +77,10 @@ import ( config := signplusconfig.NewConfig() client := signplus.NewSignplus(config) -envelopeFlowType := signplus.ENVELOPE_FLOW_TYPE_REQUEST_SIGNATURE - envelopeLegalityLevel := signplus.ENVELOPE_LEGALITY_LEVEL_SES request := signplus.CreateEnvelopeRequest{} request.SetName("Name") -request.SetFlowType(envelopeFlowType) request.SetLegalityLevel(envelopeLegalityLevel) response, err := client.Signplus.CreateEnvelope(context.Background(), request) diff --git a/internal/validation/validate_pattern.go b/internal/validation/validate_pattern.go index 2af9859..695c2f4 100644 --- a/internal/validation/validate_pattern.go +++ b/internal/validation/validate_pattern.go @@ -19,14 +19,21 @@ func validatePattern(field reflect.StructField, value reflect.Value) error { return fmt.Errorf("regex failed to compile") } - kind := utils.GetReflectKind(value.Type()) + if value.IsNil() { + return nil + } + kind := utils.GetReflectKind(value.Type()) if kind != reflect.String { return fmt.Errorf("field %s with value %v cannot match pattern %s because it is not a string", field.Name, value, pattern) } - if !compiledRegex.MatchString(value.String()) { - return fmt.Errorf("field %s with value %v does not match pattern %s", field.Name, value, pattern) + if value.Kind() == reflect.Ptr && !compiledRegex.MatchString(value.Elem().String()) { + return fmt.Errorf("field %s with value %v does not match pattern %s", field.Name, value.Elem().String(), pattern) + } + + if value.Kind() != reflect.Ptr && !compiledRegex.MatchString(value.String()) { + return fmt.Errorf("field %s with value %v does not match pattern %s", field.Name, value.String(), pattern) } return nil diff --git a/pkg/signplus/create_envelope_request.go b/pkg/signplus/create_envelope_request.go index cfc4d67..de12780 100644 --- a/pkg/signplus/create_envelope_request.go +++ b/pkg/signplus/create_envelope_request.go @@ -3,8 +3,6 @@ package signplus type CreateEnvelopeRequest struct { // Name of the envelope Name *string `json:"name,omitempty" required:"true"` - // Flow type of the envelope (REQUEST_SIGNATURE is a request for signature, SIGN_MYSELF is a self-signing flow) - FlowType *EnvelopeFlowType `json:"flow_type,omitempty" required:"true"` // Legal level of the envelope (SES is Simple Electronic Signature, QES_EIDAS is Qualified Electronic Signature, QES_ZERTES is Qualified Electronic Signature with Zertes) LegalityLevel *EnvelopeLegalityLevel `json:"legality_level,omitempty" required:"true"` // Unix timestamp of the expiration date @@ -26,17 +24,6 @@ func (c *CreateEnvelopeRequest) GetName() *string { return c.Name } -func (c *CreateEnvelopeRequest) SetFlowType(flowType EnvelopeFlowType) { - c.FlowType = &flowType -} - -func (c *CreateEnvelopeRequest) GetFlowType() *EnvelopeFlowType { - if c == nil { - return nil - } - return c.FlowType -} - func (c *CreateEnvelopeRequest) SetLegalityLevel(legalityLevel EnvelopeLegalityLevel) { c.LegalityLevel = &legalityLevel }