feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import * as api from './namespaces/api';
|
||||
import * as common from './namespaces/common';
|
||||
import * as rpc from './namespaces/rpc';
|
||||
|
||||
export { api, common, rpc };
|
||||
export * from './namespaces/api';
|
||||
export * from './namespaces/common';
|
||||
export * from './namespaces/rpc';
|
||||
|
||||
export type Int64 = string | number;
|
||||
|
||||
export default class IncentiveOperationService<T> {
|
||||
private request: any = () => {
|
||||
throw new Error('IncentiveOperationService.request is undefined');
|
||||
};
|
||||
private baseURL: string | ((path: string) => string) = '';
|
||||
|
||||
constructor(options?: {
|
||||
baseURL?: string | ((path: string) => string);
|
||||
request?<R>(
|
||||
params: {
|
||||
url: string;
|
||||
method: 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH';
|
||||
data?: any;
|
||||
params?: any;
|
||||
headers?: any;
|
||||
},
|
||||
options?: T,
|
||||
): Promise<R>;
|
||||
}) {
|
||||
this.request = options?.request || this.request;
|
||||
this.baseURL = options?.baseURL || '';
|
||||
}
|
||||
|
||||
private genBaseURL(path: string) {
|
||||
return typeof this.baseURL === 'string'
|
||||
? this.baseURL + path
|
||||
: this.baseURL(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/marketplace/incentive/user_task/list
|
||||
*
|
||||
* 任务中心展示用户任务
|
||||
*/
|
||||
ListUserTask(
|
||||
req: api.ListUserTaskRequest,
|
||||
options?: T,
|
||||
): Promise<api.ListUserTaskResponse> {
|
||||
const _req = req;
|
||||
const url = this.genBaseURL('/api/marketplace/incentive/user_task/list');
|
||||
const method = 'GET';
|
||||
const params = {
|
||||
page_size: _req['page_size'],
|
||||
page_token: _req['page_token'],
|
||||
};
|
||||
return this.request({ url, method, params }, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/marketplace/admin/incentive/task/list
|
||||
*
|
||||
* 任务管理, 任务查询
|
||||
*/
|
||||
ListTask(
|
||||
req: api.ListTaskRequest,
|
||||
options?: T,
|
||||
): Promise<api.ListTaskResponse> {
|
||||
const _req = req;
|
||||
const url = this.genBaseURL('/api/marketplace/admin/incentive/task/list');
|
||||
const method = 'GET';
|
||||
const params = {
|
||||
page: _req['page'],
|
||||
size: _req['size'],
|
||||
task_id: _req['task_id'],
|
||||
task_status: _req['task_status'],
|
||||
task_name: _req['task_name'],
|
||||
};
|
||||
return this.request({ url, method, params }, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/marketplace/admin/incentive/task/update
|
||||
*
|
||||
* 任务管理, 任务修改
|
||||
*/
|
||||
UpdateTask(
|
||||
req: api.UpdateTaskRequest,
|
||||
options?: T,
|
||||
): Promise<api.UpdateTaskResponse> {
|
||||
const _req = req;
|
||||
const url = this.genBaseURL('/api/marketplace/admin/incentive/task/update');
|
||||
const method = 'POST';
|
||||
const data = {
|
||||
task_id: _req['task_id'],
|
||||
bill_desc_starling_key: _req['bill_desc_starling_key'],
|
||||
user_task_desc_starling_key: _req['user_task_desc_starling_key'],
|
||||
button: _req['button'],
|
||||
reward: _req['reward'],
|
||||
times_limit: _req['times_limit'],
|
||||
limit_restriction: _req['limit_restriction'],
|
||||
peroid_type: _req['peroid_type'],
|
||||
peroid_value: _req['peroid_value'],
|
||||
hide: _req['hide'],
|
||||
drop_when_finish: _req['drop_when_finish'],
|
||||
task_desc: _req['task_desc'],
|
||||
event_trigger_key: _req['event_trigger_key'],
|
||||
user_control: _req['user_control'],
|
||||
black_list: _req['black_list'],
|
||||
white_list: _req['white_list'],
|
||||
};
|
||||
return this.request({ url, method, data }, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/marketplace/admin/incentive/task/status/update
|
||||
*
|
||||
* 任务管理, 任务上架/下架
|
||||
*/
|
||||
UpdateTaskStatus(
|
||||
req: api.UpdateTaskStatusRequest,
|
||||
options?: T,
|
||||
): Promise<api.UpdateTaskStatusResponse> {
|
||||
const _req = req;
|
||||
const url = this.genBaseURL(
|
||||
'/api/marketplace/admin/incentive/task/status/update',
|
||||
);
|
||||
const method = 'POST';
|
||||
const data = { task_id: _req['task_id'], task_status: _req['task_status'] };
|
||||
return this.request({ url, method, data }, options);
|
||||
}
|
||||
}
|
||||
/* eslint-enable */
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import * as common from './common';
|
||||
|
||||
export type Int64 = string | number;
|
||||
|
||||
export interface ListTaskRequest {
|
||||
page: Int64;
|
||||
size: Int64;
|
||||
task_id?: Int64;
|
||||
task_status?: common.TaskStatus;
|
||||
task_name?: string;
|
||||
}
|
||||
|
||||
export interface ListTaskResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
data?: ListTaskResult;
|
||||
}
|
||||
|
||||
export interface ListTaskResult {
|
||||
task_list?: Array<Task>;
|
||||
}
|
||||
|
||||
export interface ListUserTaskRequest {
|
||||
page_size: Int64;
|
||||
page_token?: string;
|
||||
}
|
||||
|
||||
export interface ListUserTaskResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
data?: ListUserTaskResult;
|
||||
}
|
||||
|
||||
export interface ListUserTaskResult {
|
||||
user_task_list?: Array<UserTask>;
|
||||
has_more?: boolean;
|
||||
page_token?: string;
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
task_id?: string;
|
||||
task_name?: string;
|
||||
desc?: string;
|
||||
/** 展示
|
||||
账单文案 */
|
||||
bill_desc_starling_key?: string;
|
||||
/** 用户任务中心展示文案 */
|
||||
user_task_desc_starling_key?: string;
|
||||
/** 按钮相关配置 */
|
||||
button?: common.UserTaskButton;
|
||||
/** 奖励,一期暂定每个任务只发一个奖励,奖励只能是 Token */
|
||||
reward?: common.Reward;
|
||||
/** 限制次数
|
||||
限制次数 */
|
||||
times_limit?: number;
|
||||
/** 是否限制 */
|
||||
limit_restriction?: boolean;
|
||||
/** 刷新
|
||||
刷新类型 */
|
||||
peroid_type?: common.PeriodType;
|
||||
/** 周期时长 */
|
||||
peroid_value?: Int64;
|
||||
/** 状态 */
|
||||
task_status?: common.TaskStatus;
|
||||
}
|
||||
|
||||
export interface UpdateTaskRequest {
|
||||
task_id: string;
|
||||
/** 展示设置
|
||||
账单文案 */
|
||||
bill_desc_starling_key?: string;
|
||||
/** 用户任务中心展示文案 */
|
||||
user_task_desc_starling_key?: string;
|
||||
/** 按钮相关配置 */
|
||||
button?: common.UserTaskButton;
|
||||
/** 奖励设置,一期暂定每个任务只发一个奖励,奖励只能是 Token
|
||||
若出现其他奖励或多个奖励,直接报错 */
|
||||
reward?: common.Reward;
|
||||
/** 限制次数设置
|
||||
限制次数 */
|
||||
times_limit?: number;
|
||||
/** 是否限制 */
|
||||
limit_restriction?: boolean;
|
||||
/** 刷新设置,一期暂定每个任务组下只有一个任务
|
||||
若任务组下出现多个任务,则直接报错
|
||||
刷新类型 */
|
||||
peroid_type?: common.PeriodType;
|
||||
/** 周期时长 */
|
||||
peroid_value?: Int64;
|
||||
/** 其他配置
|
||||
是否一直隐藏 */
|
||||
hide?: boolean;
|
||||
/** 完成后隐藏 */
|
||||
drop_when_finish?: boolean;
|
||||
/** 任务描述 */
|
||||
task_desc?: string;
|
||||
/** 事件触发key, 原tcc配置,改为存储在DB中,用于在规则引擎中将任务名映射为任务ID */
|
||||
event_trigger_key?: string;
|
||||
/** 用户控制 */
|
||||
user_control?: common.UserControl;
|
||||
/** 黑名单 */
|
||||
black_list?: Array<Int64>;
|
||||
/** 白名单 */
|
||||
white_list?: Array<Int64>;
|
||||
}
|
||||
|
||||
export interface UpdateTaskResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface UpdateTaskStatusRequest {
|
||||
task_id: string;
|
||||
task_status?: common.TaskStatus;
|
||||
}
|
||||
|
||||
export interface UpdateTaskStatusResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface UserTask {
|
||||
task_id?: string;
|
||||
task_name?: string;
|
||||
desc?: string;
|
||||
reward_list?: Array<common.Reward>;
|
||||
button?: common.UserTaskButton;
|
||||
user_task_progress?: UserTaskProgress;
|
||||
}
|
||||
|
||||
export interface UserTaskProgress {
|
||||
current?: Int64;
|
||||
total?: Int64;
|
||||
}
|
||||
/* eslint-enable */
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
|
||||
export type Int64 = string | number;
|
||||
|
||||
export enum GroupStatus {
|
||||
Enable = 1,
|
||||
Disable = 2,
|
||||
}
|
||||
|
||||
export enum GroupType {
|
||||
Normal = 1,
|
||||
Continue = 2,
|
||||
}
|
||||
|
||||
export enum PeriodType {
|
||||
None = 1,
|
||||
Day = 2,
|
||||
Week = 3,
|
||||
Month = 4,
|
||||
}
|
||||
|
||||
export enum ReceiveType {
|
||||
Auto = 1,
|
||||
Manual = 2,
|
||||
}
|
||||
|
||||
export enum RewardType {
|
||||
Token = 1,
|
||||
Coin = 2,
|
||||
}
|
||||
|
||||
export enum TaskStatus {
|
||||
Enable = 1,
|
||||
Disable = 2,
|
||||
}
|
||||
|
||||
export enum UserControl {
|
||||
Disable = 0,
|
||||
BlackList = 1,
|
||||
WhiteList = 2,
|
||||
}
|
||||
|
||||
export interface Reward {
|
||||
type: RewardType;
|
||||
amount: Int64;
|
||||
receive_type?: ReceiveType;
|
||||
}
|
||||
|
||||
export interface UserTaskButton {
|
||||
linked?: string;
|
||||
desc?: string;
|
||||
}
|
||||
/* eslint-enable */
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
|
||||
export type Int64 = string | number;
|
||||
|
||||
export enum RewardOperation {
|
||||
ADD = 1,
|
||||
MODIFY = 2,
|
||||
DELETE = 3,
|
||||
}
|
||||
/* eslint-enable */
|
||||
Reference in New Issue
Block a user