-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapi_hire_referral_account_create.go
98 lines (84 loc) · 4.72 KB
/
api_hire_referral_account_create.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
* Copyright 2022 chyroc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package lark
import (
"context"
)
// CreateHireReferralAccount 支持通过内推人的手机号或邮箱注册「内推奖励账号」。注册后, 可获取对应内推人的账号 ID, 并查询、操作对应内推人的积分和奖励余额, 配合接口: [「内推账户余额变更事件」](https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/events/assets_update)、[「全额提取内推账号余额」](https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/withdraw)。如需停用账户, 可调用[「停用外部系统内推账户」](https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/deactivate)
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/referral_account/create
func (r *HireService) CreateHireReferralAccount(ctx context.Context, request *CreateHireReferralAccountReq, options ...MethodOptionFunc) (*CreateHireReferralAccountResp, *Response, error) {
if r.cli.mock.mockHireCreateHireReferralAccount != nil {
r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#CreateHireReferralAccount mock enable")
return r.cli.mock.mockHireCreateHireReferralAccount(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Hire",
API: "CreateHireReferralAccount",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/hire/v1/referral_account",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(createHireReferralAccountResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
// MockHireCreateHireReferralAccount mock HireCreateHireReferralAccount method
func (r *Mock) MockHireCreateHireReferralAccount(f func(ctx context.Context, request *CreateHireReferralAccountReq, options ...MethodOptionFunc) (*CreateHireReferralAccountResp, *Response, error)) {
r.mockHireCreateHireReferralAccount = f
}
// UnMockHireCreateHireReferralAccount un-mock HireCreateHireReferralAccount method
func (r *Mock) UnMockHireCreateHireReferralAccount() {
r.mockHireCreateHireReferralAccount = nil
}
// CreateHireReferralAccountReq ...
type CreateHireReferralAccountReq struct {
Mobile *CreateHireReferralAccountReqMobile `json:"mobile,omitempty"` // 电话
Email *string `json:"email,omitempty"` // 邮箱, 示例值: "[email protected]"
}
// CreateHireReferralAccountReqMobile ...
type CreateHireReferralAccountReqMobile struct {
Code *string `json:"code,omitempty"` // 国家代码, 示例值: "86"
Number *string `json:"number,omitempty"` // 手机号码, 示例值: "18900001111"
}
// CreateHireReferralAccountResp ...
type CreateHireReferralAccountResp struct {
Account *CreateHireReferralAccountRespAccount `json:"account,omitempty"` // 账号信息
}
// CreateHireReferralAccountRespAccount ...
type CreateHireReferralAccountRespAccount struct {
AccountID string `json:"account_id,omitempty"` // 账户ID
Assets *CreateHireReferralAccountRespAccountAssets `json:"assets,omitempty"` // 账户资产
Status int64 `json:"status,omitempty"` // 账号状态, 可选值有: 1: 可用, 2: 停用
}
// CreateHireReferralAccountRespAccountAssets ...
type CreateHireReferralAccountRespAccountAssets struct {
ConfirmedBonus *CreateHireReferralAccountRespAccountAssetsConfirmedBonus `json:"confirmed_bonus,omitempty"` // 已确认的奖励
}
// CreateHireReferralAccountRespAccountAssetsConfirmedBonus ...
type CreateHireReferralAccountRespAccountAssetsConfirmedBonus struct {
PointBonus int64 `json:"point_bonus,omitempty"` // 积分奖励
}
// createHireReferralAccountResp ...
type createHireReferralAccountResp struct {
Code int64 `json:"code,omitempty"` // 错误码, 非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *CreateHireReferralAccountResp `json:"data,omitempty"`
Error *ErrorDetail `json:"error,omitempty"`
}