Update May 23, 2024 (#92)

This commit is contained in:
Kirill
2024-05-24 15:50:40 +03:00
committed by GitHub
parent 2e284d9667
commit 5d62c8ec14
2 changed files with 22 additions and 3 deletions

View File

@@ -1672,15 +1672,25 @@ type CreateTaskForGeneratingLabelResponse struct {
}
type CreateTaskForGeneratingLabelResult struct {
Tasks []CreateTaskForGeneratingLabelTask `json:"tasks"`
}
type CreateTaskForGeneratingLabelTask struct {
// Task identifier for labeling generation
TaskId int64 `json:"task_id"`
// Type of label generation task:
//
// big_label — for a regular label,
// small_label — for a small label
TaskType string `json:"task_type"`
}
// Method for creating a task for asynchronous labeling generation.
//
// To get labels created as a result of the method, use the /v1/posting/fbs/package-label/get method
func (c FBS) CreateTaskForGeneratingLabel(ctx context.Context, params *CreateTaskForGeneratingLabelParams) (*CreateTaskForGeneratingLabelResponse, error) {
url := "/v1/posting/fbs/package-label/create"
url := "/v2/posting/fbs/package-label/create"
resp := &CreateTaskForGeneratingLabelResponse{}

View File

@@ -1278,7 +1278,16 @@ func TestCreateTaskForGeneratingLabel(t *testing.T) {
},
`{
"result": {
"task_id": 5819327210249
"tasks": [
{
"task_id": 5819327210248,
"task_type": "big_label"
},
{
"task_id": 5819327210249,
"task_type": "small_label"
}
]
}
}`,
},
@@ -1310,7 +1319,7 @@ func TestCreateTaskForGeneratingLabel(t *testing.T) {
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
}
if resp.StatusCode == http.StatusOK {
if resp.Result.TaskId == 0 {
if len(resp.Result.Tasks) != 0 && resp.Result.Tasks[0].TaskId == 0 {
t.Errorf("Task id cannot be 0")
}
}