@inipa/common
v1.0.28
Published
```bash npm install @inipa/common;
Readme
Getting Started
npm install @inipa/common;
import {Ihttp} from '@inipa/common';
使用例子:
注:当需要请求验证接口时,要求传入token. 下面的接口会依次说明 const http = new Ihttp(token?:string);
const result = await http.getTrademarkByNumber("TM_NEW_CHINA_2026022116146743879136"); console.log(result);
===============================以下方法无需登陆============================================
login 会员登陆
- param: email: string (注册邮箱)
- param: password: string (密码)
- 调用方式: await http.login(email, password);
- 操作结果: token ,请此token保存并在需要验证的方法上传入实例化对象
register(data:RegisterDto) 会员注册
- RegisterDto: { email: string; username: string; password: string; confirmPassword: string; captcha: string; }
- 调用方式: await http.register({email:'xxxx', password: 'xxxxx', confirmPassword: 'xxxx', captcha: 'xxxx'})
- 操作结果: 注册成功或错误提示
sendEmailCaptcha 发送邮箱验证码
- param: email: string (注册邮箱)
- 调用方式: await http.sendEmailCaptcha(email);
- 操作结果: 提示信息,并发送验证码到对应邮箱
===============================以下方法都需要先登陆后才可以操作===============================
请在初始化实例时传入token
- const http = new Ihttp('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZW1iZXJJZCI6MSwibWVtYmVyRW1haWwiOiIxMTM2NzAwNDJAcXEuY29tIiwiY3JlYXRlZERhdGUiOiIyMDI2LTAzLTIwVDEzOjMxOjQyLjAwMFoiLCJpYXQiOjE3NzQwODM2OTIsImV4cCI6MTc3NDA4NzI5Mn0.mlKJzMhlEwp1qQMgWBUFzjJCvBtpu-epVpl1jEZTAm4')
getContinent() 方法及数据字段说明
- 调用方式: await http.getContinent();
- 获取五大洲数据,返回数组格式如下:
- 操作结果:[{chineseName: "亚洲", id:1, name:"Asia"}]
getCountryByContinent(continentId: number) 获取各大洲下的国家信息
- 调用方式: await http.getCountryByContinent(1);
- chinesename : string (中文名)
- isHotAnnuityManagement : boolean (年金管理热门国家)
- isHotCopyrightRegistration : boolean (版本登记热门国家)
- isHotDesignPatent : boolen (外观专利热门国家)
- isHotInventionPatent : boolean (发明专利热门国家)
- isHotTrademark : boolean (商标注册热门国家)
- isHotUtilityModel : boolean (实用新型热门国家)
- name : string (英文名)
getServices() 获取服务内容
- 调用方式: await http.getServices()
- 返回数组结构如下
- [{id:1, chineseName: '商标注册', name: 'Trademark Registration', services: [{id:1, name: 'New Application', chineseName: '新申请'}]}]
- 说明,这个数组第一层为项目,对应我们六大项目,每个项目下有对应的服务
getProfile() 获取会员个人资料
- 调用方式: await http.getProfile()
- 操作结果: id: number email: string (邮箱) gender: string (性别) name: string (姓名) address: stirng (详细地址) avatar: string (头像) balance: number (帐户余额) billingAddress: string (账单地址) company:string (公司名称) country:string (国家) city: string (所在城市) createdDate:Date (创建时间) dingding: string (钉钉) facebook:string grade: number (会员等级) instagram: string province: string (省份) taxId: string (税号) totalAmount: number 消息总金额 (包括未付款,已付款,已取消) totalCancelOrders: number (取消订单总数) totalOrders: number (订单总数) totalPaidOrders: number (已付款订单总数) totalSpending: number (总消费金额,只包括已付款) totalUnpaidOrders: number (未付款订单总数) username: string (用户名) weCom: string (微信企业号) website: string (公司网址) wechat: string (微信) whatsapp: string xiaohongshu: string (小红书)
getServiceFee(serviceId:number) 获取服务收费设置
- 调用方式: await http.getServiceFee(1)
- 操作结果: qtyFrom:number 开始数量 qtyTo: number 结束数量 officialFee: number 官方规定费用 calculationMethod: number 官方服务费计算方式: 1(固定金额,无关数量)2(递增固定金额,从第二件开始每件增加50元)3(倍增,官方费用和本地律师费乘以件数) incrementOfficalFee: number 官方服务费递增固定金额, 当calculationMethod等于3时使用 incrementAttorneyFee: number 本地律师服务费递增固定金额, 当calculationMethod等于3时使用 attorneyDirectFilingFee: number 律师直通提交价 attorneyOptimalFee: number 律师最优(竞价) attorneyStandardServiceFee: number 律师标准服务 inipaFee: number INIPA 服务费 optionalFee: number 附加费用 optionalFeeReason: string 附加费用原因 remark: string 备注
- 注: qtyFrom 和 qtyTo 用于判断数量对应价格,如:qtyFrom=1, qtyTo=5,表示在这个区间内的数量都以这个设定价格
createTrademark(data: TrademarkDto) 创建商标注册新申请订单
- 调用方式: await http.createTrademark(data)
- 操作结果,返回提示信息及订单号
- 字段说明: interface TrademarkDto { country: string; 国家 currency: string; 货币 remark?: string; 备注 localAttorneyFeeTire: "Optimal Bid" | "Direct Filing" | "Standard Service"; 本地律师服务费等级,Optimal Bid(最优竞标), Direct Filing(直接递交),Standard Service(标准服务) service: | "New Application" | "Renewal" | "Information Change" | "Transfer" | "OA Reply"; // 服务项目:新申请,续展,信息变更,转让,OA答复 project: | "Trademark Registration" | "Invention Patent" | "Utility Model" | "Design Patent" | "Annuity Management" | "Copyright Registration"; trademarkName: string; // 商标名称 applicantName: string; // 申请人名称或公司名称 priorityClaim: boolean; // 优先权声明 priorityCountry?: string | null; // 优先权国家 priorityDate?: Date | null; // 优先权日期 priorityNumber?: string | null; // 优先权号 servicesList: string; // 商品与服务清单 quantity: number; // 数量 docs: string; // 上传文件之后,会返回一个shasum,将所有shasum用半角逗号 , 拼接起来。 $2b$10$bH9fUB5lhDl9HEM96ebSW.TLeTOg74zYcVLnpTna6bfqSedkm34Iu,$2b$10$kMx1aWFaecYbQT8zDkoFQOjyiJ0la6ZM2Ff5RB0A1lBIQdUXbQuky }
getTrademarkById(orderId:number) 通过订单ID 或 getTrademarkByNumber(number:string)通过订单号获取商标注册订单信息
- 调用方式:await http.getTrademarkById(1);
- 操作结果: id: number number: string // 订单号 service: string // 服务类型 country: string // 国家 totalAmount: number // 总金额 officialFee: number // 官方规定费用 localAttorneyFee: number // 本地律师费 serviceFee: number // INIPO 服务费 currency: string // 货币 remark: string // 备注 status: number // 订单状态:0(待处理)1(处理中)2(已完成)3(已取消) createdDate: Date // 创建时间 localAttorneyFeeTire: string // 本地律师服务费等级 quantity: number // 数量 trademarkName: string // 商标名称 applicantName: string; // 申请人名称或公司名称 priorityClaim: boolean; // 优先权声明 priorityCountry?: string | null; // 优先权国家 priorityDate?: Date | null; // 优先权日期 priorityNumber?: string | null; // 优先权号 servicesList: string; // 商品与服务清单 timelines { // 进度时间线 id name date status } files { // 相关文档 id name type mimeType size extension shasum }
getExchangeRate() 获取当日货币汇率, 每日只需要请求一次接口,数据保存在本地,数据每天凌晨1点采集
- 调用方式:await http.getExchangeRate()
- 操作结果: code: "SUCCESS" data: [{conversionRate: 1,currency: "USD",date:"2026-03-28T17:29:54.000Z"},...] message: "数据获取成功" statusCode: 200
- 字段说明: conversionRate : 相对于美元的汇率 currency : 货币 date : 采集时间
uploadFile(file:File) 文件上传
- 调用方式: await http.uploadFile(file)
- 操作结果 originalName: "01KGRGSMX7CXPB56007DBCFE2Q.jpeg" shasum: "$2b$10$Z1oYiLh71TFmtasIFpwzqOWkPjcDvFKFMOYVIL1UITOBKcOsS80YS url: https://upload.inipaipos.com/uploads/files/a4a7fa4f-263f-4e5a-8f83-c39917396235.jpeg
- 字段说明: originalName: 文件名 shasum: 文件校验码, 此字段在提交订单时放到docs字段中,多个文件以半角逗号隔开 url: 文件地址
updateProfile(data:ProfileDto)更新会员个人资料
调用方式:await http.updateProfile(data)
操作结果: 返回最新结果
ProfileDto 字段说明 name?: string; // 姓名 company?: string; // 公司名称 taxId?: string; // 税号 website?: string; // 公司网站 billingAddress?: string; // 帐单与邮寄地址 wechat?: string; // 微信 weCom?: string; // 企业微信 dingding?: string; // 钉钉 whatsapp?: string; // Whatsapp facebook?: string; // Facebook instagram?: string; // Instagram xiaohongshu?: string; // 小红书 country?: string; // 国家 city?: string; // 城市 gender?: string; // 性别 address?: string; // 详细地址 mobile?: string; // 手机号码
getOrders(data:OrderDto) 获取订单列表
- 调用方式:await http.getOrders(data)
- 操作结果: code: "SUCCESS" data: { list: [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}], meta: {itemsPerPage: 10, totalItems: 34, currentPage: 1, totalPages: 4} } message: "数据获取成功" statusCode: 200
- OrderDto 字段说明 page: number; // 当前页面 pageSize?: number; // 每页显示记录数 orderBy?: string; // 几种排序方式:id: ASC | DESC, number: ASC | DESC, status: ASC | DESC, service: ASC | DESC, createdDate: ASC | DESC
- 注: list 数组里面的对象内容可参考getTrademarkById获取的内容介绍
getCases(data:CaseDto) 获取订单列表
- 调用方式:await http.getOrders(data)
- 操作结果: code: "SUCCESS" data: { list: [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}], meta: {itemsPerPage: 10, totalItems: 34, currentPage: 1, totalPages: 4} } message: "数据获取成功" statusCode: 200
- CaseDto 字段说明 page: number; // 当前页面 pageSize?: number; // 每页显示记录数 orderBy?: string; // 几种排序方式:id: ASC | DESC, number: ASC | DESC, status: ASC | DESC, service: ASC | DESC, createdDate: ASC | DESC
- 注: list 数组里面的对象内容可参考getCaseById获取的内容介绍
getCaseById(caseId:number) 通过案件ID 或 getCaseByNumber(number:string)通过案件编号获取案件信息
调用方式:await http.getCaseById(1);
操作结果: name: string; // 客户/案名 number: string; // 案件编号 status: string; // 当前状态 service: string; // 服务类型 createdDate: Date; // 创建时间 files { // 相关文档 originalName: string; // 文档名称 shasum: string; 文件校验码 } timelines { // 进度时间轴 name: string; // 进度名称 date: Date; // 时间 status: string; // 状态 }
