Skip to content

Commit

Permalink
Merge pull request #41 from sumanrana10048483/feature/auto_close_items
Browse files Browse the repository at this point in the history
Add missing field auto_close_items to Task, CreateTask, UpdateTask
  • Loading branch information
yarlson authored Jan 4, 2023
2 parents c8b7ed0 + ed781fa commit 49be4af
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func New(apiToken string, options ...ClientOption) (*Api, error) {
// WithBaseURL returns a ClientOption setting the base URL of the client.
// This should only be used for testing different API versions or for using a mocked
// backend in tests.
//noinspection GoUnusedExportedFunction
// noinspection GoUnusedExportedFunction
func WithBaseURL(url string) ClientOption {
return func(c *Api) error {
c.httpClient.Client.SetHostURL(url)
Expand All @@ -106,7 +106,7 @@ func WithRetryCount(count int) ClientOption {

// Sets default wait time to sleep before retrying request.
// Default is 100 milliseconds.
//noinspection GoUnusedExportedFunction
// noinspection GoUnusedExportedFunction
func WithRetryTimeout(t time.Duration) ClientOption {
return func(c *Api) error {
c.httpClient.Client.SetRetryWaitTime(t)
Expand Down
7 changes: 3 additions & 4 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Initializing the client
token := os.Getenv("lokalise_token")
client, err := lokalise.New(token)
General options
# General options
You can set global API parameters with the ClientOption functions during the initialization. The following functions are available:
Expand All @@ -35,7 +35,7 @@ Usage:
...
)
Objects and models
# Objects and models
Individual objects are represented as instances of according structs. Different objects are used for creating and updating in most cases.
Expand All @@ -47,7 +47,7 @@ Here are some object types:
* List options that are used for sending certain options and pagination, i.e. KeyListOptions.
Request options and pagination
# Request options and pagination
Some resources, such as Projects, Keys, Files, Tasks, Screenshots, Translations have optional parameters for List method (Keys also have an option for Retrieve). These parameters should be set before calling.
Expand All @@ -74,6 +74,5 @@ There are two parameters, used for pagination: Limit and Page.
})
resp, err := t.List()
*/
package lokalise
5 changes: 4 additions & 1 deletion svc_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type TaskService struct {
// Service entity objects
// _____________________________________________________________________________________________________________________

//noinspection GoUnusedConst
// noinspection GoUnusedConst
const (
pathTasks = "tasks"

Expand Down Expand Up @@ -60,6 +60,7 @@ type Task struct {
Languages []TaskLanguage `json:"languages"`
AutoCloseLanguages bool `json:"auto_close_languages"`
AutoCloseTask bool `json:"auto_close_task"`
AutoCloseItems bool `json:"auto_close_items"`
CompletedAt string `json:"completed_at"`
CompletedAtTs int64 `json:"completed_at_timestamp"`
CompletedBy int64 `json:"completed_by"`
Expand Down Expand Up @@ -107,6 +108,7 @@ type CreateTask struct {
Keys []int64 `json:"keys,omitempty"`
AutoCloseLanguages *bool `json:"auto_close_languages,omitempty"`
AutoCloseTask *bool `json:"auto_close_task,omitempty"`
AutoCloseItems *bool `json:"auto_close_items,omitempty"`
InitialTMLeverage bool `json:"initial_tm_leverage,omitempty"`
TaskType TaskType `json:"task_type,omitempty"`
ParentTaskID int64 `json:"parent_task_id,omitempty"`
Expand All @@ -130,6 +132,7 @@ type UpdateTask struct {
Languages []CreateTaskLang `json:"languages,omitempty"`
AutoCloseLanguages *bool `json:"auto_close_languages,omitempty"`
AutoCloseTask *bool `json:"auto_close_task,omitempty"`
AutoCloseItems *bool `json:"auto_close_items,omitempty"`
CloseTask bool `json:"close_task,omitempty"`
ClosingTags []string `json:"closing_tags,omitempty"`
LockTranslations bool `json:"do_lock_translations,omitempty"`
Expand Down
8 changes: 7 additions & 1 deletion svc_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestTaskService_Create(t *testing.T) {
],
"auto_close_languages": true,
"auto_close_task": true,
"auto_close_items": true,
"task_type": "translation",
"parent_task_id": 12345,
"closing_tags": ["tag_one", "tag_two"],
Expand Down Expand Up @@ -95,6 +96,7 @@ func TestTaskService_Create(t *testing.T) {
],
"auto_close_languages": true,
"auto_close_task": true,
"auto_close_items": true,
"completed_at": null,
"completed_at_timestamp": null,
"completed_by": null,
Expand All @@ -115,6 +117,7 @@ func TestTaskService_Create(t *testing.T) {
Keys: []int64{11212, 11241, 11245},
AutoCloseLanguages: Bool(true),
AutoCloseTask: Bool(true),
AutoCloseItems: Bool(true),
TaskType: "translation",
ParentTaskID: 12345,
ClosingTags: []string{"tag_one", "tag_two"},
Expand Down Expand Up @@ -174,6 +177,7 @@ func TestTaskService_Create(t *testing.T) {
},
AutoCloseLanguages: true,
AutoCloseTask: true,
AutoCloseItems: true,
CompletedAt: "",
CompletedAtTs: 0,
CompletedBy: 0,
Expand Down Expand Up @@ -304,7 +308,8 @@ func TestTaskService_Update(t *testing.T) {
data := `{
"due_date": "2019-12-31 12:00:00",
"auto_close_languages": false,
"auto_close_task": false
"auto_close_task": false,
"auto_close_items": false
}`

req := new(bytes.Buffer)
Expand All @@ -324,6 +329,7 @@ func TestTaskService_Update(t *testing.T) {
DueDate: "2019-12-31 12:00:00",
AutoCloseLanguages: Bool(false),
AutoCloseTask: Bool(false),
AutoCloseItems: Bool(false),
})
if err != nil {
t.Errorf("Tasks.Update returned error: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion svc_teamuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type TeamUserService struct {
// Service entity objects
// _____________________________________________________________________________________________________________________

//noinspection GoUnusedConst
// noinspection GoUnusedConst
const (
TeamUserRoleOwner TeamUserRole = "owner"
TeamUserRoleAdmin TeamUserRole = "admin"
Expand Down

0 comments on commit 49be4af

Please sign in to comment.