gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/human_authentication/v1/model.go (about) 1 // Package human_authentication code generated by oapi sdk gen 2 /* 3 * MIT License 4 * 5 * Copyright (c) 2022 Lark Technologies Pte. Ltd. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 * 9 * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 */ 13 14 package larkhuman_authentication 15 16 import ( 17 "fmt" 18 19 "gitee.com/larksuite/oapi-sdk-go/v3/core" 20 ) 21 22 const ( 23 UserIdTypeOpenId = "open_id" // 以open_id来识别用户 24 UserIdTypeUserId = "user_id" // 以user_id来识别用户 25 UserIdTypeUnionId = "union_id" // 以union_id来识别用户 26 ) 27 28 type Identity struct { 29 IdentityName *string `json:"identity_name,omitempty"` // user identity name 30 IdentityCode *string `json:"identity_code,omitempty"` // user identity code 31 Mobile *string `json:"mobile,omitempty"` // user mobile 32 } 33 34 type IdentityBuilder struct { 35 identityName string // user identity name 36 identityNameFlag bool 37 identityCode string // user identity code 38 identityCodeFlag bool 39 mobile string // user mobile 40 mobileFlag bool 41 } 42 43 func NewIdentityBuilder() *IdentityBuilder { 44 builder := &IdentityBuilder{} 45 return builder 46 } 47 48 // user identity name 49 // 50 // 示例值: 51 func (builder *IdentityBuilder) IdentityName(identityName string) *IdentityBuilder { 52 builder.identityName = identityName 53 builder.identityNameFlag = true 54 return builder 55 } 56 57 // user identity code 58 // 59 // 示例值: 60 func (builder *IdentityBuilder) IdentityCode(identityCode string) *IdentityBuilder { 61 builder.identityCode = identityCode 62 builder.identityCodeFlag = true 63 return builder 64 } 65 66 // user mobile 67 // 68 // 示例值: 69 func (builder *IdentityBuilder) Mobile(mobile string) *IdentityBuilder { 70 builder.mobile = mobile 71 builder.mobileFlag = true 72 return builder 73 } 74 75 func (builder *IdentityBuilder) Build() *Identity { 76 req := &Identity{} 77 if builder.identityNameFlag { 78 req.IdentityName = &builder.identityName 79 80 } 81 if builder.identityCodeFlag { 82 req.IdentityCode = &builder.identityCode 83 84 } 85 if builder.mobileFlag { 86 req.Mobile = &builder.mobile 87 88 } 89 return req 90 } 91 92 type CreateIdentityReqBodyBuilder struct { 93 identityName string // 姓名 94 identityNameFlag bool 95 identityCode string // 身份证号 96 identityCodeFlag bool 97 mobile string // 手机号 98 mobileFlag bool 99 } 100 101 func NewCreateIdentityReqBodyBuilder() *CreateIdentityReqBodyBuilder { 102 builder := &CreateIdentityReqBodyBuilder{} 103 return builder 104 } 105 106 // 姓名 107 // 108 //示例值:张三 109 func (builder *CreateIdentityReqBodyBuilder) IdentityName(identityName string) *CreateIdentityReqBodyBuilder { 110 builder.identityName = identityName 111 builder.identityNameFlag = true 112 return builder 113 } 114 115 // 身份证号 116 // 117 //示例值:4xxxxxxxx 118 func (builder *CreateIdentityReqBodyBuilder) IdentityCode(identityCode string) *CreateIdentityReqBodyBuilder { 119 builder.identityCode = identityCode 120 builder.identityCodeFlag = true 121 return builder 122 } 123 124 // 手机号 125 // 126 //示例值:13xxxxxxx 127 func (builder *CreateIdentityReqBodyBuilder) Mobile(mobile string) *CreateIdentityReqBodyBuilder { 128 builder.mobile = mobile 129 builder.mobileFlag = true 130 return builder 131 } 132 133 func (builder *CreateIdentityReqBodyBuilder) Build() *CreateIdentityReqBody { 134 req := &CreateIdentityReqBody{} 135 if builder.identityNameFlag { 136 req.IdentityName = &builder.identityName 137 } 138 if builder.identityCodeFlag { 139 req.IdentityCode = &builder.identityCode 140 } 141 if builder.mobileFlag { 142 req.Mobile = &builder.mobile 143 } 144 return req 145 } 146 147 type CreateIdentityPathReqBodyBuilder struct { 148 identityName string // 姓名 149 identityNameFlag bool 150 identityCode string // 身份证号 151 identityCodeFlag bool 152 mobile string // 手机号 153 mobileFlag bool 154 } 155 156 func NewCreateIdentityPathReqBodyBuilder() *CreateIdentityPathReqBodyBuilder { 157 builder := &CreateIdentityPathReqBodyBuilder{} 158 return builder 159 } 160 161 // 姓名 162 // 163 // 示例值:张三 164 func (builder *CreateIdentityPathReqBodyBuilder) IdentityName(identityName string) *CreateIdentityPathReqBodyBuilder { 165 builder.identityName = identityName 166 builder.identityNameFlag = true 167 return builder 168 } 169 170 // 身份证号 171 // 172 // 示例值:4xxxxxxxx 173 func (builder *CreateIdentityPathReqBodyBuilder) IdentityCode(identityCode string) *CreateIdentityPathReqBodyBuilder { 174 builder.identityCode = identityCode 175 builder.identityCodeFlag = true 176 return builder 177 } 178 179 // 手机号 180 // 181 // 示例值:13xxxxxxx 182 func (builder *CreateIdentityPathReqBodyBuilder) Mobile(mobile string) *CreateIdentityPathReqBodyBuilder { 183 builder.mobile = mobile 184 builder.mobileFlag = true 185 return builder 186 } 187 188 func (builder *CreateIdentityPathReqBodyBuilder) Build() (*CreateIdentityReqBody, error) { 189 req := &CreateIdentityReqBody{} 190 if builder.identityNameFlag { 191 req.IdentityName = &builder.identityName 192 } 193 if builder.identityCodeFlag { 194 req.IdentityCode = &builder.identityCode 195 } 196 if builder.mobileFlag { 197 req.Mobile = &builder.mobile 198 } 199 return req, nil 200 } 201 202 type CreateIdentityReqBuilder struct { 203 apiReq *larkcore.ApiReq 204 body *CreateIdentityReqBody 205 } 206 207 func NewCreateIdentityReqBuilder() *CreateIdentityReqBuilder { 208 builder := &CreateIdentityReqBuilder{} 209 builder.apiReq = &larkcore.ApiReq{ 210 PathParams: larkcore.PathParams{}, 211 QueryParams: larkcore.QueryParams{}, 212 } 213 return builder 214 } 215 216 // 用户的唯一标识(使用的ID类型见下一参数描述,不同ID类型的区别和获取,参考文档:[如何获得 User ID、Open ID 和 Union ID?](/ssl:ttdoc/home/user-identity-introduction/how-to-get)) 217 // 218 // 示例值:ou_2eb5483cb377daa5054bc6f86e2089a5 219 func (builder *CreateIdentityReqBuilder) UserId(userId string) *CreateIdentityReqBuilder { 220 builder.apiReq.QueryParams.Set("user_id", fmt.Sprint(userId)) 221 return builder 222 } 223 224 // 用户ID类型 open_id/user_id/union_id 225 // 226 // 示例值: 227 func (builder *CreateIdentityReqBuilder) UserIdType(userIdType string) *CreateIdentityReqBuilder { 228 builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType)) 229 return builder 230 } 231 232 // 该接口用于录入实名认证的身份信息,在唤起有源活体认证前,需要使用该接口进行实名认证。 233 func (builder *CreateIdentityReqBuilder) Body(body *CreateIdentityReqBody) *CreateIdentityReqBuilder { 234 builder.body = body 235 return builder 236 } 237 238 func (builder *CreateIdentityReqBuilder) Build() *CreateIdentityReq { 239 req := &CreateIdentityReq{} 240 req.apiReq = &larkcore.ApiReq{} 241 req.apiReq.QueryParams = builder.apiReq.QueryParams 242 req.apiReq.Body = builder.body 243 return req 244 } 245 246 type CreateIdentityReqBody struct { 247 IdentityName *string `json:"identity_name,omitempty"` // 姓名 248 IdentityCode *string `json:"identity_code,omitempty"` // 身份证号 249 Mobile *string `json:"mobile,omitempty"` // 手机号 250 } 251 252 type CreateIdentityReq struct { 253 apiReq *larkcore.ApiReq 254 Body *CreateIdentityReqBody `body:""` 255 } 256 257 type CreateIdentityRespData struct { 258 VerifyUid *string `json:"verify_uid,omitempty"` // 用户绑定实名身份的uid 259 } 260 261 type CreateIdentityResp struct { 262 *larkcore.ApiResp `json:"-"` 263 larkcore.CodeError 264 Data *CreateIdentityRespData `json:"data"` // 业务数据 265 } 266 267 func (resp *CreateIdentityResp) Success() bool { 268 return resp.Code == 0 269 }