@userscripters/stackexchange-api-types
Advanced tools
Comparing version 0.2.0 to 0.3.0
import got from "got"; | ||
import type { Node } from "typescript"; | ||
import type { Node, __String } from "typescript"; | ||
import { URL } from "url"; | ||
@@ -84,4 +84,6 @@ import { InterfaceOptions, parseInterface } from "./parsers.js"; | ||
const nodes: Node[] = []; | ||
const nsName = "StackExchangeAPI"; | ||
const nodes: Map<__String, Node> = new Map(); | ||
const unionRegex = | ||
@@ -111,3 +113,5 @@ /(?:(?:an )?array of )?(?:one of )?'?(\w+)'?(?:,? (?:or )?(?:but new options (?:can|may|might) be added\.)?|$)/i; | ||
nodes.push(iface, factory.createIdentifier("\n")); | ||
const { escapedText } = iface.name; | ||
nodes.has(escapedText) || nodes.set(escapedText, iface); | ||
} | ||
@@ -118,3 +122,10 @@ | ||
const list = factory.createNodeArray(nodes); | ||
const unique: Node[] = []; | ||
for (const [, node] of nodes) { | ||
unique.push(node, factory.createIdentifier("\n")); | ||
} | ||
unique.push(factory.createNamespaceExportDeclaration(nsName)); | ||
const list = factory.createNodeArray(unique); | ||
const content = printer.printList(ts.ListFormat.MultiLine, list, typesFile); | ||
@@ -121,0 +132,0 @@ |
@@ -57,39 +57,2 @@ export interface Answer { | ||
export interface Answer { | ||
accepted?: boolean; | ||
answer_id: number; | ||
awarded_bounty_amount?: number; | ||
awarded_bounty_users?: ShallowUser[]; | ||
body?: string; | ||
body_markdown?: string; | ||
can_comment?: boolean; | ||
can_edit?: boolean; | ||
can_flag?: boolean; | ||
can_suggest_edit?: boolean; | ||
collectives: Collective[]; | ||
comment_count?: number; | ||
comments?: Comment[]; | ||
community_owned_date: Date; | ||
content_license: string; | ||
creation_date: Date; | ||
down_vote_count?: number; | ||
downvoted?: boolean; | ||
is_accepted: boolean; | ||
last_activity_date: Date; | ||
last_edit_date: Date; | ||
last_editor?: ShallowUser; | ||
link?: string; | ||
locked_date: Date; | ||
owner: ShallowUser; | ||
posted_by_collectives: Collective[]; | ||
question_id: number; | ||
recommendations: CollectiveRecommendation[]; | ||
score: number; | ||
share_link?: string; | ||
tags?: string[]; | ||
title?: string; | ||
up_vote_count?: number; | ||
upvoted?: boolean; | ||
} | ||
export interface Badge { | ||
@@ -643,1 +606,2 @@ award_count: number; | ||
export as namespace StackExchangeAPI; |
{ | ||
"name": "@userscripters/stackexchange-api-types", | ||
"description": "Stack Exchange API types generator", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Oleg Valter", |
@@ -9,3 +9,3 @@ | ||
| License | [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later) | | ||
| Version | 0.2.0 | | ||
| Version | 0.3.0 | | ||
@@ -12,0 +12,0 @@ # Support |
34163
858