Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

\ModelsAPI

All URIs are relative to http://localhost:8080

MethodHTTP requestDescription
CreateRecordPost /models/{model}/versions/{version}:createValidate and create a record
QueryRecordsPost /models/{model}/versions/{version}:queryQuery records for a model version
ValidateModelPayloadPost /models/{model}/versions/{version}:validateValidate payload against model rules

CreateRecord

Record CreateRecord(ctx, model, version).IdempotencyKey(idempotencyKey).CreateRequest(createRequest).Execute()

Validate and create a record

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/CE-RISE-software/hex-core-sdk-go"
)

func main() {
	model := "model_example" // string | Model identifier.
	version := "version_example" // string | Model version.
	idempotencyKey := "idempotencyKey_example" // string | Client-generated key used to deduplicate retries for side-effecting requests.
	createRequest := *openapiclient.NewCreateRequest(map[string]interface{}{"key": interface{}(123)}) // CreateRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ModelsAPI.CreateRecord(context.Background(), model, version).IdempotencyKey(idempotencyKey).CreateRequest(createRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ModelsAPI.CreateRecord``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CreateRecord`: Record
	fmt.Fprintf(os.Stdout, "Response from `ModelsAPI.CreateRecord`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
modelstringModel identifier.
versionstringModel version.

Other Parameters

Other parameters are passed through a pointer to a apiCreateRecordRequest struct via the builder pattern

NameTypeDescriptionNotes

idempotencyKey | string | Client-generated key used to deduplicate retries for side-effecting requests. | createRequest | CreateRequest | |

Return type

Record

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

QueryRecords

QueryResponse QueryRecords(ctx, model, version).QueryRequest(queryRequest).Execute()

Query records for a model version

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/CE-RISE-software/hex-core-sdk-go"
)

func main() {
	model := "model_example" // string | Model identifier.
	version := "version_example" // string | Model version.
	queryRequest := *openapiclient.NewQueryRequest(*openapiclient.NewRecordQueryFilter([]openapiclient.RecordQueryCondition{*openapiclient.NewRecordQueryCondition("Field_example", "Op_example", interface{}(123))})) // QueryRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ModelsAPI.QueryRecords(context.Background(), model, version).QueryRequest(queryRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ModelsAPI.QueryRecords``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `QueryRecords`: QueryResponse
	fmt.Fprintf(os.Stdout, "Response from `ModelsAPI.QueryRecords`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
modelstringModel identifier.
versionstringModel version.

Other Parameters

Other parameters are passed through a pointer to a apiQueryRecordsRequest struct via the builder pattern

NameTypeDescriptionNotes

queryRequest | QueryRequest | |

Return type

QueryResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ValidateModelPayload

ValidationReport ValidateModelPayload(ctx, model, version).ValidateRequest(validateRequest).Execute()

Validate payload against model rules

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/CE-RISE-software/hex-core-sdk-go"
)

func main() {
	model := "model_example" // string | Model identifier, for example `re-indicators-specification`.
	version := "version_example" // string | Model version string, for example `0.0.3`.
	validateRequest := *openapiclient.NewValidateRequest(map[string]interface{}{"key": interface{}(123)}) // ValidateRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ModelsAPI.ValidateModelPayload(context.Background(), model, version).ValidateRequest(validateRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ModelsAPI.ValidateModelPayload``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ValidateModelPayload`: ValidationReport
	fmt.Fprintf(os.Stdout, "Response from `ModelsAPI.ValidateModelPayload`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
modelstringModel identifier, for example `re-indicators-specification`.
versionstringModel version string, for example `0.0.3`.

Other Parameters

Other parameters are passed through a pointer to a apiValidateModelPayloadRequest struct via the builder pattern

NameTypeDescriptionNotes

validateRequest | ValidateRequest | |

Return type

ValidationReport

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]