diff --git a/push/all/push_all.go b/push/all/push_all.go index e523cb8..24f26ff 100644 --- a/push/all/push_all.go +++ b/push/all/push_all.go @@ -4,35 +4,35 @@ package all import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 群推参数 type PushAllParam struct { - RequestId string `json:"request_id"` // 必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 - GroupName string `json:"group_name"` // 非必须,任务组名 - Audience string `json:"audience"` // 必须字段,必须为all - Settings *Settings `json:"settings"` // 非必须,推送条件设置 - PushMessage *PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 - PushChannel *PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 + RequestId string `json:"request_id"` // 必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 + GroupName string `json:"group_name"` // 非必须,任务组名 + Audience string `json:"audience"` // 必须字段,必须为all + Settings *publics.Settings `json:"settings"` // 非必须,推送条件设置 + PushMessage *publics.PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 + PushChannel *publics.PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 } // 群推返回 type PushAllResult struct { - PublicResult + publics.PublicResult Data map[string]string `json:"data"` } // 群推 -func PushAll(ctx context.Context, config GeTuiConfig, token string, param *PushAllParam) (*PushAllResult, error) { +func PushAll(ctx context.Context, config publics.GeTuiConfig, token string, param *PushAllParam) (*PushAllResult, error) { - url := ApiUrl + config.AppId + "/push/all" + url := publics.ApiUrl + config.AppId + "/push/all" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/all/push_fast_custom_tag.go b/push/all/push_fast_custom_tag.go index 8f9a341..ef46ee4 100644 --- a/push/all/push_fast_custom_tag.go +++ b/push/all/push_fast_custom_tag.go @@ -4,33 +4,33 @@ package all import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 使用标签快速推送参数 type PushFastCustomTagParam struct { - RequestId string `json:"request_id"` // 必须字段,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 - Settings *Settings `json:"settings"` // 非必须,推送条件设置 - Audience *Audience `json:"audience"` // 必须字段,tag数组 - PushMessage *PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 - PushChannel *PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 + RequestId string `json:"request_id"` // 必须字段,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 + Settings *publics.Settings `json:"settings"` // 非必须,推送条件设置 + Audience *publics.Audience `json:"audience"` // 必须字段,tag数组 + PushMessage *publics.PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 + PushChannel *publics.PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 } // 使用标签快速推送返回 type PushFastCustomTagResult struct { - PublicResult + publics.PublicResult Data map[string]map[string]string `json:"data"` } // 根据条件筛选用户推送 -func PushFastCustomTag(ctx context.Context, config GeTuiConfig, token string, param *PushFastCustomTagParam) (*PushFastCustomTagResult, error) { - url := ApiUrl + config.AppId + "/push/fast_custom_tag" +func PushFastCustomTag(ctx context.Context, config publics.GeTuiConfig, token string, param *PushFastCustomTagParam) (*PushFastCustomTagResult, error) { + url := publics.ApiUrl + config.AppId + "/push/fast_custom_tag" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/all/push_tag.go b/push/all/push_tag.go index 3d792d5..7e3ba1e 100644 --- a/push/all/push_tag.go +++ b/push/all/push_tag.go @@ -4,34 +4,34 @@ package all import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 根据条件筛选用户推送参数 type PushTagParam struct { - RequestId string `json:"request_id"` // 必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 - GroupName string `json:"group_name"` // 非必须,任务组名 - Settings *Settings `json:"settings"` // 非必须,推送条件设置 - Audience *Audience `json:"audience"` // 必须字段,tag数组 - PushMessage *PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 - PushChannel *PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 + RequestId string `json:"request_id"` // 必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 + GroupName string `json:"group_name"` // 非必须,任务组名 + Settings *publics.Settings `json:"settings"` // 非必须,推送条件设置 + Audience *publics.Audience `json:"audience"` // 必须字段,tag数组 + PushMessage *publics.PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 + PushChannel *publics.PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 } // 根据条件筛选用户推送返回 type PushTagParamResult struct { - PublicResult + publics.PublicResult Data map[string]string `json:"data"` } // 根据条件筛选用户推送 -func PushTag(ctx context.Context, config GeTuiConfig, token string, param *PushTagParam) (*PushTagParamResult, error) { - url := ApiUrl + config.AppId + "/push/tag" +func PushTag(ctx context.Context, config publics.GeTuiConfig, token string, param *PushTagParam) (*PushTagParamResult, error) { + url := publics.ApiUrl + config.AppId + "/push/tag" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/list/push_list_alias.go b/push/list/push_list_alias.go index e9893f6..232ad82 100644 --- a/push/list/push_list_alias.go +++ b/push/list/push_list_alias.go @@ -4,32 +4,32 @@ package list import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 别名批量推参数 type PushListAliasParam struct { - Audience *Audience `json:"audience"` // 必须字段,用alias数组,,注意这里 !!数组长度不大于200 - IsAsync bool `json:"is_async"` // 非必须,默认值:false,是否异步推送,异步推送不会返回data,is_async为false时返回data - TaskId string `json:"taskid"` // 必须字段,默认值:无,使用创建消息接口返回的taskId,可以多次使用 + Audience *publics.Audience `json:"audience"` // 必须字段,用alias数组,,注意这里 !!数组长度不大于200 + IsAsync bool `json:"is_async"` // 非必须,默认值:false,是否异步推送,异步推送不会返回data,is_async为false时返回data + TaskId string `json:"taskid"` // 必须字段,默认值:无,使用创建消息接口返回的taskId,可以多次使用 } // 别名批量推返回 type PushListAliasResult struct { - PublicResult + publics.PublicResult Data map[string]map[string]string `json:"data"` } // 别名批量推 -func PushListAlias(ctx context.Context, config GeTuiConfig, token string, param *PushListAliasParam) (*PushListAliasResult, error) { +func PushListAlias(ctx context.Context, config publics.GeTuiConfig, token string, param *PushListAliasParam) (*PushListAliasResult, error) { - url := ApiUrl + config.AppId + "/push/list/alias" + url := publics.ApiUrl + config.AppId + "/push/list/alias" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/list/push_list_cid.go b/push/list/push_list_cid.go index bb443c7..2a81a7b 100644 --- a/push/list/push_list_cid.go +++ b/push/list/push_list_cid.go @@ -4,33 +4,33 @@ package list import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // cid批量推参数 type PushListCidParam struct { - Audience *Audience `json:"audience"` // 必须字段,用cid数组,多个cid,注意这里 !!数组长度不大于200 - IsAsync bool `json:"is_async"` // 非必须,默认值:false,是否异步推送,异步推送不会返回data,is_async为false时返回data - TaskId string `json:"taskid"` // 必须字段,默认值:无,使用创建消息接口返回的taskId,可以多次使用 + Audience *publics.Audience `json:"audience"` // 必须字段,用cid数组,多个cid,注意这里 !!数组长度不大于200 + IsAsync bool `json:"is_async"` // 非必须,默认值:false,是否异步推送,异步推送不会返回data,is_async为false时返回data + TaskId string `json:"taskid"` // 必须字段,默认值:无,使用创建消息接口返回的taskId,可以多次使用 } // cid批量推返回 type PushListCidResult struct { - PublicResult + publics.PublicResult Data map[string]map[string]string `json:"data"` } // cid批量推 -func PushListCid(ctx context.Context, config GeTuiConfig, token string, param *PushListCidParam) (*PushListCidResult, error) { +func PushListCid(ctx context.Context, config publics.GeTuiConfig, token string, param *PushListCidParam) (*PushListCidResult, error) { - url := ApiUrl + config.AppId + "/push/list/cid" + url := publics.ApiUrl + config.AppId + "/push/list/cid" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/list/push_list_message.go b/push/list/push_list_message.go index 34879a7..84d2c62 100644 --- a/push/list/push_list_message.go +++ b/push/list/push_list_message.go @@ -4,34 +4,34 @@ package list import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 创建消息体参数 type PushListMessageParam struct { - RequestId string `json:"request_id"` // 非必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 - GroupName string `json:"group_name"` // 非必须,任务组名 - Settings *Settings `json:"settings"` // 非必须,推送条件设置 - PushMessage *PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 - PushChannel *PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 + RequestId string `json:"request_id"` // 非必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 + GroupName string `json:"group_name"` // 非必须,任务组名 + Settings *publics.Settings `json:"settings"` // 非必须,推送条件设置 + PushMessage *publics.PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 + PushChannel *publics.PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 } // 创建消息体返回 type PushListMessageResult struct { - PublicResult + publics.PublicResult Data map[string]string `json:"data"` // taskid:任务编号,用于执行cid批量推和执行别名批量推,此taskid可以多次使用,有效期为用户设置的离线时间 } // 创建消息体 -func PushListMessage(ctx context.Context, config GeTuiConfig, token string, param *PushListMessageParam) (*PushListMessageResult, error) { +func PushListMessage(ctx context.Context, config publics.GeTuiConfig, token string, param *PushListMessageParam) (*PushListMessageResult, error) { - url := ApiUrl + config.AppId + "/push/list/message" + url := publics.ApiUrl + config.AppId + "/push/list/message" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/mission/push_del_task.go b/push/mission/push_del_task.go index 25013fc..3b885c8 100644 --- a/push/mission/push_del_task.go +++ b/push/mission/push_del_task.go @@ -4,7 +4,7 @@ package mission import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 删除定时任务参数 @@ -14,18 +14,18 @@ type PushDelTaskParam struct { // 删除定时任务返回 type PushDelTaskResult struct { - PublicResult + publics.PublicResult } // 删除定时任务 -func PushDelTask(ctx context.Context, config GeTuiConfig, token string, param *PushDelTaskParam) (*PushDelTaskResult, error) { - url := ApiUrl + config.AppId + "/task/schedule" + param.TaskId +func PushDelTask(ctx context.Context, config publics.GeTuiConfig, token string, param *PushDelTaskParam) (*PushDelTaskResult, error) { + url := publics.ApiUrl + config.AppId + "/task/schedule" + param.TaskId bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "DELETE", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "DELETE", token) if err != nil { return nil, err } diff --git a/push/mission/push_get_task.go b/push/mission/push_get_task.go index a1a1bed..8223e32 100644 --- a/push/mission/push_get_task.go +++ b/push/mission/push_get_task.go @@ -4,7 +4,7 @@ package mission import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 查询定时任务参数 @@ -14,7 +14,7 @@ type PushGetTaskParam struct { // 查询定时任务返回 type PushGetTaskResult struct { - PublicResult + publics.PublicResult Data map[string]map[string]string `json:"data"` } @@ -29,14 +29,14 @@ type PushGetTaskResult struct { // } // 停止任务 -func PushGetTask(ctx context.Context, config GeTuiConfig, token string, param *PushGetTaskParam) (*PushGetTaskResult, error) { - url := ApiUrl + config.AppId + "/task/schedule" + param.TaskId +func PushGetTask(ctx context.Context, config publics.GeTuiConfig, token string, param *PushGetTaskParam) (*PushGetTaskResult, error) { + url := publics.ApiUrl + config.AppId + "/task/schedule" + param.TaskId bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "GET", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "GET", token) if err != nil { return nil, err } diff --git a/push/mission/push_stop.go b/push/mission/push_stop.go index 7efd298..fad71cf 100644 --- a/push/mission/push_stop.go +++ b/push/mission/push_stop.go @@ -4,7 +4,7 @@ package mission import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 停止任务参数 @@ -14,18 +14,18 @@ type PushStopParam struct { // 停止任务返回 type PushStopResult struct { - PublicResult + publics.PublicResult } // 停止任务 -func PushStop(ctx context.Context, config GeTuiConfig, token string, param *PushStopParam) (*PushStopResult, error) { - url := ApiUrl + config.AppId + "/task/" + param.TaskId +func PushStop(ctx context.Context, config publics.GeTuiConfig, token string, param *PushStopParam) (*PushStopResult, error) { + url := publics.ApiUrl + config.AppId + "/task/" + param.TaskId bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "DELETE", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "DELETE", token) if err != nil { return nil, err } diff --git a/push/single/push_single_alias.go b/push/single/push_single_alias.go index 5b709f5..ffdbd30 100644 --- a/push/single/push_single_alias.go +++ b/push/single/push_single_alias.go @@ -4,34 +4,34 @@ package single import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 别名单推参数 type PushSingleAliasParam struct { - RequestId string `json:"request_id"` // 必须字段,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 - Audience *Audience `json:"audience"` // 必须字段,别名数组,只能填一个别名 - Settings *Settings `json:"settings"` // 非必须,推送条件设置 - PushMessage *PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 - PushChannel *PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 + RequestId string `json:"request_id"` // 必须字段,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 + Audience *publics.Audience `json:"audience"` // 必须字段,别名数组,只能填一个别名 + Settings *publics.Settings `json:"settings"` // 非必须,推送条件设置 + PushMessage *publics.PushMessage `json:"push_message"` // 必须字段,个推推送消息参数 + PushChannel *publics.PushChannel `json:"push_channel"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数 } // 别名单推返回 type PushSingleAliasResult struct { - PublicResult + publics.PublicResult Data map[string]map[string]string `json:"data"` } // 别名单推 -func PushSingleByAlias(ctx context.Context, config GeTuiConfig, token string, param *PushSingleAliasParam) (*PushSingleAliasResult, error) { +func PushSingleByAlias(ctx context.Context, config publics.GeTuiConfig, token string, param *PushSingleAliasParam) (*PushSingleAliasResult, error) { - url := ApiUrl + config.AppId + "/push/single/alias" + url := publics.ApiUrl + config.AppId + "/push/single/alias" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/single/push_single_batch_alias.go b/push/single/push_single_batch_alias.go index fcbee93..05abd95 100644 --- a/push/single/push_single_batch_alias.go +++ b/push/single/push_single_batch_alias.go @@ -4,7 +4,7 @@ package single import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // 别名批量单推参数 @@ -16,20 +16,20 @@ type PushSingleBatchAliasParam struct { // 别名批量单推返回 type PushSingleBatchAliasResult struct { - PublicResult + publics.PublicResult Data map[string]map[string]string `json:"data"` } // 别名批量单推 -func PushSingleByBatchAlias(ctx context.Context, config GeTuiConfig, token string, param *PushSingleBatchAliasParam) (*PushSingleBatchAliasResult, error) { +func PushSingleByBatchAlias(ctx context.Context, config publics.GeTuiConfig, token string, param *PushSingleBatchAliasParam) (*PushSingleBatchAliasResult, error) { - url := ApiUrl + config.AppId + "/push/single/batch/alias" + url := publics.ApiUrl + config.AppId + "/push/single/batch/alias" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err } diff --git a/push/single/push_single_batch_cid.go b/push/single/push_single_batch_cid.go index d97adf8..1f7f74e 100644 --- a/push/single/push_single_batch_cid.go +++ b/push/single/push_single_batch_cid.go @@ -4,7 +4,7 @@ package single import ( "context" "encoding/json" - . "getui/publics" + "github.com/dacker-soul/getui/publics" ) // cid批量单推参数 @@ -15,20 +15,20 @@ type PushSingleBatchCidParam struct { // cid批量单推返回 type PushSingleBatchCidResult struct { - PublicResult + publics.PublicResult Data map[string]map[string]string `json:"data"` } // cid批量单推 -func PushSingleByBatchCid(ctx context.Context, config GeTuiConfig, token string, param *PushSingleBatchCidParam) (*PushSingleBatchCidResult, error) { +func PushSingleByBatchCid(ctx context.Context, config publics.GeTuiConfig, token string, param *PushSingleBatchCidParam) (*PushSingleBatchCidResult, error) { - url := ApiUrl + config.AppId + "/push/single/batch/cid" + url := publics.ApiUrl + config.AppId + "/push/single/batch/cid" bodyByte, err := json.Marshal(param) if err != nil { return nil, err } - result, err := RestFulRequest(ctx, bodyByte, url, "POST", token) + result, err := publics.RestFulRequest(ctx, bodyByte, url, "POST", token) if err != nil { return nil, err }