| 
									
										
										
										
											2020-08-03 20:48:58 +08:00
										 |  |  | package jedi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-11 18:16:37 +08:00
										 |  |  | import ( | 
					
						
							|  |  |  | 	"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" | 
					
						
							| 
									
										
										
										
											2020-09-23 20:23:35 +08:00
										 |  |  | 	"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" | 
					
						
							| 
									
										
										
										
											2020-08-11 18:16:37 +08:00
										 |  |  | 	"strings" | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2020-08-03 20:48:58 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-04 12:23:34 +08:00
										 |  |  | const ( | 
					
						
							| 
									
										
										
										
											2020-09-23 20:23:35 +08:00
										 |  |  | 	VERSION = "2020-09-24" | 
					
						
							| 
									
										
										
										
											2020-08-04 12:23:34 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-23 20:23:35 +08:00
										 |  |  | var HOST requests.Host = requests.Host{ | 
					
						
							|  |  |  | 	Default: "jedi.api.gaore.com", | 
					
						
							|  |  |  | 	Func: func(s string) string { | 
					
						
							|  |  |  | 		var a = map[string]string{ | 
					
						
							|  |  |  | 			requests.RELEASE: "jedi.api.gaore.com", | 
					
						
							|  |  |  | 			requests.PRE:     "jedi.api.gaore.com", | 
					
						
							|  |  |  | 			requests.TEST:    "jedi.oapi.gaore.com", | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return a[s] | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-03 20:48:58 +08:00
										 |  |  | type Client struct { | 
					
						
							|  |  |  | 	sdk.Client | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-04 12:23:34 +08:00
										 |  |  | func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err error) { | 
					
						
							| 
									
										
										
										
											2020-08-11 18:16:37 +08:00
										 |  |  | 	if req.ParamsArray != nil && len(req.ParamsArray) > 0 { | 
					
						
							|  |  |  | 		req.Params = strings.Join(req.ParamsArray, ",,,") | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2020-08-04 12:23:34 +08:00
										 |  |  | 	response = CreateSendSmsResponse() | 
					
						
							|  |  |  | 	err = c.DoAction(req, response) | 
					
						
							|  |  |  | 	return | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) { | 
					
						
							|  |  |  | 	client = &Client{} | 
					
						
							| 
									
										
										
										
											2020-08-04 21:14:06 +08:00
										 |  |  | 	err = client.InitWithAccessKey(accesskey, secrect, source) | 
					
						
							| 
									
										
										
										
											2020-08-04 12:23:34 +08:00
										 |  |  | 	return | 
					
						
							| 
									
										
										
										
											2020-08-03 20:48:58 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-09-23 12:14:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-23 20:23:35 +08:00
										 |  |  | func NewClientWithAliAppcode(accesskey, secrect string, env ...string) (client *Client, err error) { | 
					
						
							| 
									
										
										
										
											2020-09-23 12:14:23 +08:00
										 |  |  | 	client = &Client{} | 
					
						
							| 
									
										
										
										
											2020-09-23 20:23:35 +08:00
										 |  |  | 	err = client.InitWithAliAppcode(accesskey, secrect, env...) | 
					
						
							| 
									
										
										
										
											2020-09-23 12:14:23 +08:00
										 |  |  | 	return | 
					
						
							|  |  |  | } |