github.com/456vv/valexa@v1.0.2-0.20200706152242-1fb922d71ce5/valexa.txt (about)

     1  
     2  type Alexa struct{                                                                              // Alexa服务
     3      AppIdAttr       string                                                                          // 程序的名称,如:appid
     4  }
     5      func (T *Alexa) SetEchoApp(alexaAppId string, app *EchoApplication)                             // 设置echoApp
     6      func (T *Alexa) ServeHTTP(w http.ResponseWriter, r *http.Request)                               // 服务器启用
     7  func NewEchoResponse() *EchoResponse                                                            // Echo响应
     8      func (T *EchoResponse) SetEndSession(ok bool)                                                   // 结束对话
     9      func (T *EchoResponse) OutputSpeech(text string) *EchoResponse                                  // 输出语音
    10      func (T *EchoResponse) OutputSpeechSSML(text string) *EchoResponse                              // 输出语音(有语气)
    11      func (T *EchoResponse) SimpleCard(title string, content string) *EchoResponse                   // 纯文本卡片
    12      func (T *EchoResponse) StandardCard(title string, text string, smallImg string, largeImg string) *EchoResponse      // 带图文本卡片
    13      func (T *EchoResponse) LinkAccountCard() *EchoResponse                                          // 登录卡片
    14      func (T *EchoResponse) RepromptText(text string) *EchoResponse                                  // 回应
    15      func (T *EchoResponse) RepromptSSML(text string) *EchoResponse                                  // 回应(有语气)
    16      func (T *EchoResponse) String() string                                                          // 字符串
    17  type EchoRequest struct {                                                                       // Echo请求
    18      Context EchoRequestContext                                                                      // 上下文
    19      Request EchoRequestRequest                                                                      // 请求
    20      Session EchoRequestSession                                                                      // 会话
    21      Version string                                                                                  // 版本
    22  }
    23      func (T *EchoRequest) VerifyTimestamp(second int) bool                                              // 验证请求时间
    24      func (T *EchoRequest) GetLocale() string															// 语言类型
    25      func (T *EchoRequest) GetApplicationID() string                                                     // 程序ID
    26      func (T *EchoRequest) GetSessionID() string                                                         // 会话ID
    27      func (T *EchoRequest) GetUserID() string                                                            // 用户ID
    28      func (T *EchoRequest) GetAccessToken() string                                                       // 用户Token
    29      func (T *EchoRequest) GetRequestType() string                                                       // 请求类型
    30      func (T *EchoRequest) GetIntentName() string                                                        // 意图名称
    31      func (T *EchoRequest) GetSlots() (slots map[string]*EchoRequestRequestIntentSlot, err error)        // 所有类型意图对象(含空值)
    32  	func (T *EchoRequest) GetValueSlots() (slots map[string]*EchoRequestRequestIntentSlot, err error)	// 所有类型意图对象(不含空值)
    33      func (T *EchoRequest) GetSlotNames() (names []string)                                               // 所有意图名称
    34      func (T *EchoRequest) GetSlotValue(slotName string) (val string, err error)                         // 意图值
    35      func (T *EchoRequest) GetSlot(slotName string) (slot *EchoRequestRequestIntentSlot, err error)      // 意图对象
    36  type EchoIntent struct{                                                                             // Echo意图
    37      Request     *EchoRequest                                                                            // Echo请求
    38      Response    *EchoResponse                                                                           // Echo响应
    39      App         *EchoApplication                                                                        // Echo配置
    40  }
    41  func (T *EchoIntent) ServeHTTP(w http.ResponseWriter, r *http.Request)
    42  type EchoApplication struct {                                                                       // Echo程序的配置
    43      Version                 []string                                                                    // 支持的版本号
    44      IsDevelop               bool                                                                      	// 调试
    45      ValidReqTimestamp       int                                                                         // 有效时间,秒为单位
    46      CertFolder              string                                                                      // 证书保存目录
    47      HandleFunc              http.HandlerFunc                                                            // 原生处理函数
    48  }
    49  
    50  
    51  
    52  
    53  
    54  
    55  
    56  
    57  
    58  
    59  
    60  
    61  
    62  
    63  
    64  
    65  
    66  
    67  
    68  
    69  
    70