From 2d95eb04d556996b36c79128aaa8bef892510d05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:12:48 +0000 Subject: [PATCH 1/3] Bump github.com/essentialkaos/ek/v13 in the all group Bumps the all group with 1 update: [github.com/essentialkaos/ek/v13](https://github.com/essentialkaos/ek). Updates `github.com/essentialkaos/ek/v13` from 13.10.0 to 13.10.1 - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v13.10.0...v13.10.1) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v13 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 345627b..1ac86d6 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.8 require ( github.com/essentialkaos/check v1.4.1 - github.com/essentialkaos/ek/v13 v13.10.0 + github.com/essentialkaos/ek/v13 v13.10.1 ) require ( diff --git a/go.sum b/go.sum index 581c987..db9ddc5 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.4.1 h1:SuxXzrbokPGTPWxGRnzy0hXvtb44mtVrdNxgPa1s4c8= github.com/essentialkaos/check v1.4.1/go.mod h1:xQOYwFvnxfVZyt5Qvjoa1SxcRqu5VyP77pgALr3iu+M= -github.com/essentialkaos/ek/v13 v13.10.0 h1:uoLNjiDRJ/bOPAciq8Ff92r+XHgTm+rBI4ItOtZje9k= -github.com/essentialkaos/ek/v13 v13.10.0/go.mod h1:6G9EPJ/k4N0mugTLqPuWS/fb7K5JwoEqZSkNSfBCsgg= +github.com/essentialkaos/ek/v13 v13.10.1 h1:pQPSOQn04KPv3LAPzg/2HlRTmv2fPK+A8JthE+1Wdr8= +github.com/essentialkaos/ek/v13 v13.10.1/go.mod h1:GAoS44v5gtd3Yc1qqfgXsaJNoC0dMw1ueW5Fc9TTHUg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= From b501e1c96065e4f8d90b258f9868db6acedcd6f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:09:46 +0000 Subject: [PATCH 2/3] Bump github.com/essentialkaos/ek/v13 in the all group Bumps the all group with 1 update: [github.com/essentialkaos/ek/v13](https://github.com/essentialkaos/ek). Updates `github.com/essentialkaos/ek/v13` from 13.10.1 to 13.11.0 - [Release notes](https://github.com/essentialkaos/ek/releases) - [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md) - [Commits](https://github.com/essentialkaos/ek/compare/v13.10.1...v13.11.0) --- updated-dependencies: - dependency-name: github.com/essentialkaos/ek/v13 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1ac86d6..9138287 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.8 require ( github.com/essentialkaos/check v1.4.1 - github.com/essentialkaos/ek/v13 v13.10.1 + github.com/essentialkaos/ek/v13 v13.11.0 ) require ( diff --git a/go.sum b/go.sum index db9ddc5..df2e787 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/essentialkaos/check v1.4.1 h1:SuxXzrbokPGTPWxGRnzy0hXvtb44mtVrdNxgPa1s4c8= github.com/essentialkaos/check v1.4.1/go.mod h1:xQOYwFvnxfVZyt5Qvjoa1SxcRqu5VyP77pgALr3iu+M= -github.com/essentialkaos/ek/v13 v13.10.1 h1:pQPSOQn04KPv3LAPzg/2HlRTmv2fPK+A8JthE+1Wdr8= -github.com/essentialkaos/ek/v13 v13.10.1/go.mod h1:GAoS44v5gtd3Yc1qqfgXsaJNoC0dMw1ueW5Fc9TTHUg= +github.com/essentialkaos/ek/v13 v13.11.0 h1:vpIk6wiycQGzLcC/zZrxWP2CguJxeoNj9fjuGiYAmJ8= +github.com/essentialkaos/ek/v13 v13.11.0/go.mod h1:GAoS44v5gtd3Yc1qqfgXsaJNoC0dMw1ueW5Fc9TTHUg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= From 9a628670a689d36f17d31f17b06adaa8a799693b Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Thu, 14 Nov 2024 12:01:22 +0300 Subject: [PATCH 3/3] Add new API methods 'ArchiveChat' and 'UnarchiveChat' --- pachca.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/pachca.go b/pachca.go index 2d66333..2f777ac 100644 --- a/pachca.go +++ b/pachca.go @@ -1232,6 +1232,52 @@ func (c *Client) ExcludeChatTag(chatID, tagID uint64) error { return nil } +// ArchiveChat sends chat to archive +// +// https://crm.pachca.com/dev/chats/archive/ +func (c *Client) ArchiveChat(chatID uint64) error { + switch { + case c == nil || c.engine == nil: + return ErrNilClient + case chatID == 0: + return ErrInvalidChatID + } + + err := c.sendRequest( + req.PUT, getURL("/chats/%d/archive", chatID), + nil, nil, nil, + ) + + if err != nil { + return fmt.Errorf("Can't archive chat %d: %w", chatID, err) + } + + return nil +} + +// UnarchiveChat restores chat from archive +// +// https://crm.pachca.com/dev/chats/unarchive/ +func (c *Client) UnarchiveChat(chatID uint64) error { + switch { + case c == nil || c.engine == nil: + return ErrNilClient + case chatID == 0: + return ErrInvalidChatID + } + + err := c.sendRequest( + req.PUT, getURL("/chats/%d/unarchive", chatID), + nil, nil, nil, + ) + + if err != nil { + return fmt.Errorf("Can't unarchive chat %d: %w", chatID, err) + } + + return nil +} + // MESSAGES ///////////////////////////////////////////////////////////////////////// // // GetMessage returns info about message