gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/human_authentication/v1/api.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  	"context"
    18  	"net/http"
    19  
    20  	"gitee.com/larksuite/oapi-sdk-go/v3/core"
    21  )
    22  
    23  func NewService(config *larkcore.Config) *HumanAuthenticationService {
    24  	h := &HumanAuthenticationService{config: config}
    25  	h.Identity = &identity{service: h}
    26  	return h
    27  }
    28  
    29  type HumanAuthenticationService struct {
    30  	config   *larkcore.Config
    31  	Identity *identity // 身份
    32  }
    33  
    34  type identity struct {
    35  	service *HumanAuthenticationService
    36  }
    37  
    38  // 录入身份信息
    39  //
    40  // - 该接口用于录入实名认证的身份信息,在唤起有源活体认证前,需要使用该接口进行实名认证。
    41  //
    42  // - 实名认证接口会有计费管理,接入前请联系飞书开放平台工作人员,邮箱:openplatform@bytedance.com。;;仅通过计费申请的应用,才能在[开发者后台](https://open.feishu.cn/app)查找并申请该接口的权限。
    43  //
    44  // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/human_authentication-v1/identity/create
    45  //
    46  // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/human_authenticationv1/create_identity.go
    47  func (i *identity) Create(ctx context.Context, req *CreateIdentityReq, options ...larkcore.RequestOptionFunc) (*CreateIdentityResp, error) {
    48  	// 发起请求
    49  	apiReq := req.apiReq
    50  	apiReq.ApiPath = "/open-apis/human_authentication/v1/identities"
    51  	apiReq.HttpMethod = http.MethodPost
    52  	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
    53  	apiResp, err := larkcore.Request(ctx, apiReq, i.service.config, options...)
    54  	if err != nil {
    55  		return nil, err
    56  	}
    57  	// 反序列响应结果
    58  	resp := &CreateIdentityResp{ApiResp: apiResp}
    59  	err = apiResp.JSONUnmarshalBody(resp)
    60  	if err != nil {
    61  		return nil, err
    62  	}
    63  	return resp, err
    64  }