SwaggerToTypeScript 1.1.3

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global SwaggerToTypeScript --version 1.1.3
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local SwaggerToTypeScript --version 1.1.3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SwaggerToTypeScript&version=1.1.3
                    
nuke :add-package SwaggerToTypeScript --version 1.1.3
                    

Swagger To TypeScript

这是一个从 Swagger 生成 TypeScript 接口的简单工具。

安装

dotnet tool install -g SwaggerToTypeScript

升级

dotnet tool update -g SwaggerToTypeScript

使用

SwaggerToTypeScript -url http://localhost:5007/swagger/v1/swagger.json -output ./src/api/ -filename model.ts -namespace @/utils/request

参数

-url                      Swagger Url
-filename                 文件名,默认:model.ts
-output                   保存路径,默认:当前执行目录
-namespace                request 命名空间,默认:@/utils/request

发布

发布到 newget.org

dotnet pack -c Release
dotnet pack --configuration Release

dotnet nuget push ./bin/Release/SwaggerToTypeScript.1.1.0.nupkg -k xxx -s https://api.nuget.org/v3/index.json

dotnet nuget push bin/Release/newgut.1.1.0.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json

示例

/* tslint:disable */
/* eslint-disable */

//----------------------
// <auto-generated>
//     自动生成 Swagger To TypeScript v1.0.0
// </auto-generated>
//----------------------

import request from '@/utils/request';

/**
 * 网页设计器 2.0(platform:91xuanxiao、91goodschool,默认:91xuanxiao)
 */
namespace DesignerApi {

    /**
     * 组件 - 列表
     */
    export const components = (platform: string): Promise<WebDesignerComponentInfo[]> => {
        return request.get(`/api/designer/${platform}/components`);
    };

    /**
     * 组件 - 属性
     */
    export const componentProperties = (platform: string): Promise<ComponentPropertiesResponse> => {
        return request.get(`/api/designer/${platform}/component-properties`);
    };

    /**
     * 机构 - 详情
     */
    export const agencyGet = (platform: string): Promise<WebDesignerAgencyInfo> => {
        return request.get(`/api/designer/${platform}/agency`);
    };

    /**
     * 机构 - 更新
     * @returns OK
     */
    export const agencyPost = (platform: string) => {
        return request.post(`/api/designer/${platform}/agency`);
    };

    /**
     * 上传 - 快速上传
     * @returns OK
     */
    export const upload = (platform: string, file: String) => {
        return request.post(`/api/designer/${platform}/upload`, { file });
    };

    /**
     * 获取机构跳转数据
     */
    export const agencyData = (platform: string, agencyId: string): Promise<XuanXiaoHomeIndex> => {
        return request.get(`/api/designer/${platform}/agency-data/${agencyId}`);
    };

}

export { DesignerApi, EntryApi, HomeApi, OpenApi, SchoolApi, TestApi, TokenApi, UploadApi };

/** 简介组件 01 - 配图方式 */
export enum EIntroduction01MediaType {
    图片 = "图片",
    视频 = "视频",
    轮播 = "轮播",
}

/** 导航图标类型 */
export enum ENavigation01IconType {
    矢量图标 = "矢量图标",
    图片图标 = "图片图标",
}

/** 导航样式 */
export enum ENavigation01Style {
    三个 = "三个",
    四个 = "四个",
    五个 = "五个",
}

/** 通用排序类型 */
export enum ESortType {
    Forward = "Forward",
    Backward = "Backward",
    Top = "Top",
    Bottom = "Bottom",
    Exchange = "Exchange",
    Before = "Before",
    After = "After",
    Custom = "Custom",
}

export enum ESourceService {
    好学校 = "好学校",
    选校 = "选校",
    艺考 = "艺考",
    学历 = "学历",
    高考 = "高考",
    烘焙 = "烘焙",
    复读 = "复读",
    留学 = "留学",
}

export enum ESourceType {
    学校课程 = "学校课程",
    学校资讯 = "学校资讯",
    学校介绍 = "学校介绍",
}

/** 标题模板 */
export enum ETitle01Template {
    默认 = "默认",
    模板1 = "模板1",
    模板2 = "模板2",
}

/** 机构主题样式 */
export enum EWebDesignerAgencyThemeStyle {
    默认 = "默认",
    样式1 = "样式1",
    样式2 = "样式2",
}

/** 网页设计器组件背景 */
export enum EWebDesignerComponentBackground {
    无背景 = "无背景",
    主题色 = "主题色",
    纯色 = "纯色",
    图片 = "图片",
}

/** 组件类别/分类 */
export enum EWebDesignerComponentCategory {
    基础组件 = "基础组件",
    内容组件 = "内容组件",
    营销组件 = "营销组件",
}

/** 网页设计器组件主题 */
export enum EWebDesignerComponentTheme {
    浅色 = "浅色",
    深色 = "深色",
}

/** 组件类型 */
export enum EWebDesignerComponentType {
    标题 = "标题",
    轮播 = "轮播",
    导航 = "导航",
    简介 = "简介",
    统计 = "统计",
    课程 = "课程",
    咨询 = "咨询",
    师资 = "师资",
    优势 = "优势",
    流程 = "流程",
    按钮 = "按钮",
    评价 = "评价",
    相册 = "相册",
    问答 = "问答",
    广告 = "广告",
    荣誉 = "荣誉",
    资讯 = "资讯",
    校区 = "校区",
    留言 = "留言",
    关注 = "关注",
    视频 = "视频",
    引导 = "引导",
    富文本 = "富文本",
}

/** 跳转类型 */
export enum EWebDesignerJumpType {
    无 = "无",
    栏目 = "栏目",
    课程 = "课程",
    资讯 = "资讯",
    师资 = "师资",
    问答 = "问答",
    相册 = "相册",
    咨询 = "咨询",
    页面 = "页面",
}

export enum EXuanXiaoConsultMethod {
    美洽 = "美洽",
    电话 = "电话",
    链接 = "链接",
    企微客服 = "企微客服",
}

export interface EntryArticleParam {
    id?: number | undefined;
    content: string;
    readonly contentHtml?: string | undefined;
    cover?: string | undefined;
    summary?: string | undefined;
    slug?: string | undefined;
    sort?: number;
    readonly thumbnail?: string | undefined;
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.9.1 110 7/17/2025
1.9.0 180 4/10/2025
1.8.1 174 4/8/2025
1.8.0 166 4/8/2025
1.7.1 172 4/8/2025
1.7.0 119 2/27/2025
1.6.0 117 2/9/2025
1.5.0 118 2/9/2025
1.3.0 119 2/9/2025
1.2.0 117 2/5/2025
1.1.5 123 2/5/2025
1.1.4 114 2/5/2025
1.1.3 115 2/5/2025