diff --git a/internal/service/douyin/douyin.go b/pkg/client/douyin/douyin.go similarity index 100% rename from internal/service/douyin/douyin.go rename to pkg/client/douyin/douyin.go diff --git a/pkg/client/mediaX.go b/pkg/client/mediaX.go index 55903fa..28c3650 100644 --- a/pkg/client/mediaX.go +++ b/pkg/client/mediaX.go @@ -1,10 +1,10 @@ package client import ( - "github.com/ArtisanCloud/MediaX/internal/service/douyin" - "github.com/ArtisanCloud/MediaX/internal/service/redbook" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount" "github.com/ArtisanCloud/MediaX/pkg/client/config" + "github.com/ArtisanCloud/MediaX/pkg/client/douyin" + "github.com/ArtisanCloud/MediaX/pkg/client/redbook" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount" "github.com/ArtisanCloud/MediaXCore/pkg/cache" "github.com/ArtisanCloud/MediaXCore/pkg/logger" ) diff --git a/internal/service/redbook/redbook.go b/pkg/client/redbook/redbook.go similarity index 100% rename from internal/service/redbook/redbook.go rename to pkg/client/redbook/redbook.go diff --git a/internal/service/wechat/README.md b/pkg/client/wechat/README.md similarity index 100% rename from internal/service/wechat/README.md rename to pkg/client/wechat/README.md diff --git a/internal/service/wechat/core/accessTokenHandler.go b/pkg/client/wechat/core/accessTokenHandler.go similarity index 100% rename from internal/service/wechat/core/accessTokenHandler.go rename to pkg/client/wechat/core/accessTokenHandler.go diff --git a/internal/service/wechat/core/client.go b/pkg/client/wechat/core/client.go similarity index 90% rename from internal/service/wechat/core/client.go rename to pkg/client/wechat/core/client.go index 6c640e9..5a67be4 100644 --- a/internal/service/wechat/core/client.go +++ b/pkg/client/wechat/core/client.go @@ -4,10 +4,11 @@ import ( "bytes" "github.com/ArtisanCloud/MediaX/internal/kernel" response2 "github.com/ArtisanCloud/MediaX/internal/kernel/response" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/material" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/media" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/publish" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/material" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/media" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/publish" + "github.com/ArtisanCloud/MediaX/pkg/client/config" "github.com/ArtisanCloud/MediaXCore/pkg/cache" "github.com/ArtisanCloud/MediaXCore/pkg/logger" diff --git a/internal/service/wechat/core/response/accessToken.go b/pkg/client/wechat/core/response/accessToken.go similarity index 100% rename from internal/service/wechat/core/response/accessToken.go rename to pkg/client/wechat/core/response/accessToken.go diff --git a/internal/service/wechat/core/response/base.go b/pkg/client/wechat/core/response/base.go similarity index 100% rename from internal/service/wechat/core/response/base.go rename to pkg/client/wechat/core/response/base.go diff --git a/internal/service/wechat/officialAccount/base.go b/pkg/client/wechat/officialAccount/base.go similarity index 78% rename from internal/service/wechat/officialAccount/base.go rename to pkg/client/wechat/officialAccount/base.go index 186e211..228b8e8 100644 --- a/internal/service/wechat/officialAccount/base.go +++ b/pkg/client/wechat/officialAccount/base.go @@ -2,7 +2,7 @@ package officialAccount import ( "context" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/response" ) func (srv *WeChatOfficialAccountService) GetCallbackIP(ctx context.Context) (*response.GetCallBackIPRes, error) { diff --git a/internal/service/wechat/officialAccount/material/client.go b/pkg/client/wechat/officialAccount/material/client.go similarity index 95% rename from internal/service/wechat/officialAccount/material/client.go rename to pkg/client/wechat/officialAccount/material/client.go index 0131a60..0d24857 100644 --- a/internal/service/wechat/officialAccount/material/client.go +++ b/pkg/client/wechat/officialAccount/material/client.go @@ -4,10 +4,11 @@ import ( "context" "github.com/ArtisanCloud/MediaX/internal/kernel" request2 "github.com/ArtisanCloud/MediaX/internal/kernel/request" - response3 "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/material/request" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/material/response" - response2 "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/response" + response2 "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/material/request" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/material/response" + response3 "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/response" + "github.com/ArtisanCloud/MediaXCore/utils/object" "net/http" "os" @@ -163,7 +164,7 @@ func (client *Client) UploadArticleImage(ctx context.Context, path string) (*res // https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Getting_Permanent_Assets.html func (client *Client) GetMaterial(ctx context.Context, mediaID string) (*http.Response, error) { - header := &response2.HeaderMediaRes{} + header := &response3.HeaderMediaRes{} res, err := client.RequestRaw(ctx, "cgi-bin/material/get_material", http.MethodPost, &object.HashMap{ "form_params": &object.HashMap{ "media_id": mediaID, @@ -205,9 +206,9 @@ func (client *Client) GetNews(ctx context.Context, mediaID string) (*response.Ma // 删除永久素材 // https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Deleting_Permanent_Assets.html -func (client *Client) Delete(ctx context.Context, mediaID string) (*response3.OfficialAccountRes, error) { +func (client *Client) Delete(ctx context.Context, mediaID string) (*response2.OfficialAccountRes, error) { - result := &response3.OfficialAccountRes{} + result := &response2.OfficialAccountRes{} options := &object.HashMap{ "media_id": mediaID, diff --git a/internal/service/wechat/officialAccount/material/request/AddMaterial.go b/pkg/client/wechat/officialAccount/material/request/AddMaterial.go similarity index 100% rename from internal/service/wechat/officialAccount/material/request/AddMaterial.go rename to pkg/client/wechat/officialAccount/material/request/AddMaterial.go diff --git a/internal/service/wechat/officialAccount/material/request/AddNews.go b/pkg/client/wechat/officialAccount/material/request/AddNews.go similarity index 100% rename from internal/service/wechat/officialAccount/material/request/AddNews.go rename to pkg/client/wechat/officialAccount/material/request/AddNews.go diff --git a/internal/service/wechat/officialAccount/material/request/batchGetMaterial.go b/pkg/client/wechat/officialAccount/material/request/batchGetMaterial.go similarity index 100% rename from internal/service/wechat/officialAccount/material/request/batchGetMaterial.go rename to pkg/client/wechat/officialAccount/material/request/batchGetMaterial.go diff --git a/internal/service/wechat/officialAccount/material/request/updateNews.go b/pkg/client/wechat/officialAccount/material/request/updateNews.go similarity index 100% rename from internal/service/wechat/officialAccount/material/request/updateNews.go rename to pkg/client/wechat/officialAccount/material/request/updateNews.go diff --git a/internal/service/wechat/officialAccount/material/response/addMaterial.go b/pkg/client/wechat/officialAccount/material/response/addMaterial.go similarity index 65% rename from internal/service/wechat/officialAccount/material/response/addMaterial.go rename to pkg/client/wechat/officialAccount/material/response/addMaterial.go index 41e76a7..9e5b850 100644 --- a/internal/service/wechat/officialAccount/material/response/addMaterial.go +++ b/pkg/client/wechat/officialAccount/material/response/addMaterial.go @@ -1,6 +1,6 @@ package response -import "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" +import "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" type MaterialAddMaterialRes struct { response.OfficialAccountRes diff --git a/internal/service/wechat/officialAccount/material/response/addNews.go b/pkg/client/wechat/officialAccount/material/response/addNews.go similarity index 60% rename from internal/service/wechat/officialAccount/material/response/addNews.go rename to pkg/client/wechat/officialAccount/material/response/addNews.go index d7c32de..393b5d6 100644 --- a/internal/service/wechat/officialAccount/material/response/addNews.go +++ b/pkg/client/wechat/officialAccount/material/response/addNews.go @@ -1,6 +1,6 @@ package response -import "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" +import "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" type MaterialAddNewsRes struct { response.OfficialAccountRes diff --git a/internal/service/wechat/officialAccount/material/response/batchGetMaterial.go b/pkg/client/wechat/officialAccount/material/response/batchGetMaterial.go similarity index 80% rename from internal/service/wechat/officialAccount/material/response/batchGetMaterial.go rename to pkg/client/wechat/officialAccount/material/response/batchGetMaterial.go index 1b2db24..de2d9a7 100644 --- a/internal/service/wechat/officialAccount/material/response/batchGetMaterial.go +++ b/pkg/client/wechat/officialAccount/material/response/batchGetMaterial.go @@ -1,7 +1,7 @@ package response import ( - "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" "github.com/ArtisanCloud/MediaXCore/utils/object" ) diff --git a/internal/service/wechat/officialAccount/material/response/getMaterial.go b/pkg/client/wechat/officialAccount/material/response/getMaterial.go similarity index 90% rename from internal/service/wechat/officialAccount/material/response/getMaterial.go rename to pkg/client/wechat/officialAccount/material/response/getMaterial.go index eea66dc..f46fb25 100644 --- a/internal/service/wechat/officialAccount/material/response/getMaterial.go +++ b/pkg/client/wechat/officialAccount/material/response/getMaterial.go @@ -1,7 +1,7 @@ package response import ( - "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" ) type NewsItems struct { diff --git a/internal/service/wechat/officialAccount/material/response/getMaterialCount.go b/pkg/client/wechat/officialAccount/material/response/getMaterialCount.go similarity index 79% rename from internal/service/wechat/officialAccount/material/response/getMaterialCount.go rename to pkg/client/wechat/officialAccount/material/response/getMaterialCount.go index 7771d9c..692b6ef 100644 --- a/internal/service/wechat/officialAccount/material/response/getMaterialCount.go +++ b/pkg/client/wechat/officialAccount/material/response/getMaterialCount.go @@ -1,8 +1,6 @@ package response -import ( - "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" -) +import "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" type MaterialGetMaterialCountRes struct { response.OfficialAccountRes diff --git a/internal/service/wechat/officialAccount/media/client.go b/pkg/client/wechat/officialAccount/media/client.go similarity index 94% rename from internal/service/wechat/officialAccount/media/client.go rename to pkg/client/wechat/officialAccount/media/client.go index 72a8e3b..f8471ff 100644 --- a/internal/service/wechat/officialAccount/media/client.go +++ b/pkg/client/wechat/officialAccount/media/client.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" "github.com/ArtisanCloud/MediaX/internal/kernel" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/media/response" - response2 "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/media/response" + response2 "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/response" "github.com/ArtisanCloud/MediaX/pkg/utils" "github.com/ArtisanCloud/MediaXCore/utils/object" "net/http" diff --git a/internal/service/wechat/officialAccount/media/response/response.go b/pkg/client/wechat/officialAccount/media/response/response.go similarity index 87% rename from internal/service/wechat/officialAccount/media/response/response.go rename to pkg/client/wechat/officialAccount/media/response/response.go index 7bdacac..8791492 100644 --- a/internal/service/wechat/officialAccount/media/response/response.go +++ b/pkg/client/wechat/officialAccount/media/response/response.go @@ -1,7 +1,7 @@ package response import ( - "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" "github.com/ArtisanCloud/MediaXCore/utils/object" ) diff --git a/internal/service/wechat/officialAccount/publish/client.go b/pkg/client/wechat/officialAccount/publish/client.go similarity index 95% rename from internal/service/wechat/officialAccount/publish/client.go rename to pkg/client/wechat/officialAccount/publish/client.go index 36c4b0b..1872b8e 100644 --- a/internal/service/wechat/officialAccount/publish/client.go +++ b/pkg/client/wechat/officialAccount/publish/client.go @@ -3,9 +3,9 @@ package publish import ( "context" "github.com/ArtisanCloud/MediaX/internal/kernel" - response2 "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/publish/request" - "github.com/ArtisanCloud/MediaX/internal/service/wechat/officialAccount/publish/response" + response2 "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/publish/request" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/officialAccount/publish/response" "github.com/ArtisanCloud/MediaXCore/utils/object" ) diff --git a/internal/service/wechat/officialAccount/publish/request/draft.go b/pkg/client/wechat/officialAccount/publish/request/draft.go similarity index 100% rename from internal/service/wechat/officialAccount/publish/request/draft.go rename to pkg/client/wechat/officialAccount/publish/request/draft.go diff --git a/internal/service/wechat/officialAccount/publish/request/publish.go b/pkg/client/wechat/officialAccount/publish/request/publish.go similarity index 100% rename from internal/service/wechat/officialAccount/publish/request/publish.go rename to pkg/client/wechat/officialAccount/publish/request/publish.go diff --git a/internal/service/wechat/officialAccount/publish/response/draft.go b/pkg/client/wechat/officialAccount/publish/response/draft.go similarity index 95% rename from internal/service/wechat/officialAccount/publish/response/draft.go rename to pkg/client/wechat/officialAccount/publish/response/draft.go index e77a251..b3e41c8 100644 --- a/internal/service/wechat/officialAccount/publish/response/draft.go +++ b/pkg/client/wechat/officialAccount/publish/response/draft.go @@ -1,8 +1,6 @@ package response -import ( - "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" -) +import "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" type DraftAddRes struct { response.OfficialAccountRes diff --git a/internal/service/wechat/officialAccount/publish/response/publish.go b/pkg/client/wechat/officialAccount/publish/response/publish.go similarity index 90% rename from internal/service/wechat/officialAccount/publish/response/publish.go rename to pkg/client/wechat/officialAccount/publish/response/publish.go index f4a7352..8504caa 100644 --- a/internal/service/wechat/officialAccount/publish/response/publish.go +++ b/pkg/client/wechat/officialAccount/publish/response/publish.go @@ -1,6 +1,6 @@ package response -import "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" +import "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" type PublishSubmitRes struct { response.OfficialAccountRes diff --git a/internal/service/wechat/officialAccount/request/base.go b/pkg/client/wechat/officialAccount/request/base.go similarity index 100% rename from internal/service/wechat/officialAccount/request/base.go rename to pkg/client/wechat/officialAccount/request/base.go diff --git a/internal/service/wechat/officialAccount/response/base.go b/pkg/client/wechat/officialAccount/response/base.go similarity index 59% rename from internal/service/wechat/officialAccount/response/base.go rename to pkg/client/wechat/officialAccount/response/base.go index bc5898e..553eef4 100644 --- a/internal/service/wechat/officialAccount/response/base.go +++ b/pkg/client/wechat/officialAccount/response/base.go @@ -1,6 +1,6 @@ package response -import "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" +import "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" type GetCallBackIPRes struct { response.OfficialAccountRes diff --git a/internal/service/wechat/officialAccount/response/media.go b/pkg/client/wechat/officialAccount/response/media.go similarity index 91% rename from internal/service/wechat/officialAccount/response/media.go rename to pkg/client/wechat/officialAccount/response/media.go index 9f370aa..888cf69 100644 --- a/internal/service/wechat/officialAccount/response/media.go +++ b/pkg/client/wechat/officialAccount/response/media.go @@ -1,6 +1,6 @@ package response -import "github.com/ArtisanCloud/MediaX/internal/service/wechat/core/response" +import "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core/response" type HeaderMediaRes struct { response.OfficialAccountRes diff --git a/internal/service/wechat/officialAccount/service.go b/pkg/client/wechat/officialAccount/service.go similarity index 94% rename from internal/service/wechat/officialAccount/service.go rename to pkg/client/wechat/officialAccount/service.go index 420eac9..38c88f5 100644 --- a/internal/service/wechat/officialAccount/service.go +++ b/pkg/client/wechat/officialAccount/service.go @@ -1,8 +1,8 @@ package officialAccount import ( - "github.com/ArtisanCloud/MediaX/internal/service/wechat/core" "github.com/ArtisanCloud/MediaX/pkg/client/config" + "github.com/ArtisanCloud/MediaX/pkg/client/wechat/core" "github.com/ArtisanCloud/MediaXCore/pkg/cache" "github.com/ArtisanCloud/MediaXCore/pkg/logger" )