Skip to content

Commit 26dc690

Browse files
committed
Added shortened url to returned data
1 parent cf875fa commit 26dc690

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,35 @@ const { version } = require('../package.json');
44
const linguist = require('@sourcebin/linguist/dist/linguist.json');
55

66
const [
7-
url_long, ...urls
7+
url_long,
8+
url_short,
9+
...urls
810
] = [
9-
'https://sourceb.in', 'sourceb.in', 'srcb.in'
11+
'https://sourceb.in',
12+
'https://srcb.in',
13+
'sourceb.in',
14+
'srcb.in'
1015
];
1116

1217
export class Bin {
1318
public key: string;
1419
public files: Array<BinFile>;
1520
public created: Date;
1621
public url: string;
22+
public shortened: string;
1723

1824
constructor(options: BinOptions) {
1925
this.key = options.key;
2026
this.url = `${ url_long }/${ this.key }`;
27+
this.shortened = `${ url_short }/${ this.key }`;
2128
this.created = options.created;
2229
this.files = options.files;
2330
}
2431
}
2532

2633
export class BinFile {
2734
public languageId: number;
28-
public language?: Language;
35+
public language: Language;
2936
public content: string;
3037

3138
constructor(options: BinFileOptions) {
@@ -81,7 +88,8 @@ export async function get(k: string): Promise<Bin> {
8188
'User-Agent': 'SourceBin Wrapper/' + version
8289
},
8390
method: 'get'
84-
}).then(checkStatus)
91+
})
92+
.then(checkStatus)
8593
.then(res => res.json());
8694

8795
const binFiles: Array<BinFile> = [];

0 commit comments

Comments
 (0)