Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5469715

Browse files
Added documentation for objects
1 parent 73c51e3 commit 5469715

File tree

17 files changed

+250
-0
lines changed

17 files changed

+250
-0
lines changed

‎src/objects/Answer.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,28 @@ import {ShallowUser} from './ShallowUser';
33

44
import {TypeAnswer} from '../result-types/TypeAnswer';
55

6+
/**
7+
* The equivalent of [Type answer](https://api.stackexchange.com/docs/types/answer).<br>
8+
* This object represents an Answer to a [[Question]] on one of the [Stack Exchange sites](https://stackexchange.com/sites).<br>
9+
* As on the [[Question]] page, it is possible to fetch the [[Comment|Comments]] on an Answer as part of a call; though this is not done by default.
10+
*/
611
export class Answer {
712

813
public accepted?: boolean;
914

15+
/**
16+
* Refers to an [[Answer]]
17+
*/
1018
public answerId: number;
1119

20+
/**
21+
* *May be absent, in which case it is set to `null`*
22+
*/
1223
public awardedBountyAmount?: number;
1324

25+
/**
26+
* *May be absent, in which case it is set to `null`*
27+
*/
1428
public awardedBountyUsers?: ShallowUser[];
1529

1630
public body?: string;
@@ -21,8 +35,14 @@ export class Answer {
2135

2236
public commentCount?: number;
2337

38+
/**
39+
* *May be absent, in which case it is set to `null`*
40+
*/
2441
public comments?: Comment[];
2542

43+
/**
44+
* *May be absent, in which case it is set to `null`*
45+
*/
2646
public communityOwnedDate?: Date;
2747

2848
public creationDate: Date;
@@ -35,16 +55,28 @@ export class Answer {
3555

3656
public lastActivityDate: Date;
3757

58+
/**
59+
* *May be absent, in which case it is set to `null`*
60+
*/
3861
public lastEditDate?: Date;
3962

4063
public lastEditor?: ShallowUser;
4164

4265
public link?: string;
4366

67+
/**
68+
* *May be absent, in which case it is set to `null`*
69+
*/
4470
public lockedDate?: Date;
4571

72+
/**
73+
* *May be absent, in which case it is set to `null`*
74+
*/
4675
public owner?: ShallowUser;
4776

77+
/**
78+
* Refers to a [[Question]]
79+
*/
4880
public questionId: number;
4981

5082
public score: number;

‎src/objects/Badge.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@ import {ShallowUser} from './ShallowUser';
22

33
import {TypeBadge} from '../result-types/TypeBadge';
44

5+
/**
6+
* The equivalent of [Type badge](https://api.stackexchange.com/docs/types/badge).<br>
7+
* This object represents a Badge on a [Stack Exchange site](https://stackexchange.com/sites).<br>
8+
* Some Badges, like "Autobiographer", are held in common across all Stack Exchange sites. Others, like most tag badges, vary on a site by site basis.<br>
9+
* Remember that ids are never guaranteed to be the same between sites, even if a Badge exists on both sites.
10+
*/
511
export class Badge {
612

713
public awardCount: number;
814

15+
/**
16+
* Refers to a [[Badge]]
17+
*/
918
public badgeId: number;
1019

1120
public badgeType: 'named' | 'tag_based';
@@ -18,6 +27,9 @@ export class Badge {
1827

1928
public rank: 'gold' | 'silver' | 'bronze';
2029

30+
/**
31+
* *May be absent, in which case it is set to `null`*
32+
*/
2133
public user?: ShallowUser;
2234

2335
public constructor (badge: TypeBadge) {

‎src/objects/BadgeCount.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import {TypeBadgeCount} from '../result-types/TypeBadgeCount';
22

3+
/**
4+
* The equivalent of [Type badge_count](https://api.stackexchange.com/docs/types/badge-count).<br>
5+
* This object represents the total [[Badge|Badges]], segregated by rank, a user has earned.
6+
*/
37
export class BadgeCount {
48

59
public bronze: number;

‎src/objects/ClosedDetails.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import {ShallowUser} from './ShallowUser';
33

44
import {TypeClosedDetails} from '../result-types/TypeClosedDetails';
55

6+
/**
7+
* The equivalent of [Type closed_details](https://api.stackexchange.com/docs/types/closed-details).<br>
8+
* This object represents details about a [[Question]] closure.
9+
* This object is mostly analogous "gray box" that appears below closed and on hold [[Question|Questions]].
10+
*/
611
export class ClosedDetails {
712

813
public byUsers: ShallowUser[];
@@ -11,6 +16,9 @@ export class ClosedDetails {
1116

1217
public onHold: boolean;
1318

19+
/**
20+
* *May be absent, in which case it is set to `null`*
21+
*/
1422
public originalQuestions?: OriginalQuestion[];
1523

1624
public reason: string;

‎src/objects/Comment.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import {ShallowUser} from './ShallowUser';
22

33
import {TypeComment} from '../result-types/TypeComment';
44

5+
/**
6+
* The equivalent of [Type comment](https://api.stackexchange.com/docs/types/comment).<br>
7+
* All [[Question|Questions]] and [[Answer|Answers]] on a [Stack Exchange site](https://stackexchange.com/sites) can be commented on, and this object represents those Comments.<br>
8+
* Comments can also be optionally directed at users, when this is the case the [[replyToUser]] property is set.
9+
*/
510
export class Comment {
611

712
public body?: string;
@@ -10,6 +15,9 @@ export class Comment {
1015

1116
public canFlag?: boolean;
1217

18+
/**
19+
* Refers to a [[Comment]]
20+
*/
1321
public commentId: number;
1422

1523
public creationDate: Date;
@@ -18,12 +26,21 @@ export class Comment {
1826

1927
public link?: string;
2028

29+
/**
30+
* *May be absent, in which case it is set to `null`*
31+
*/
2132
public owner?: ShallowUser;
2233

34+
/**
35+
* Refers to a [[Post]]
36+
*/
2337
public postId: number;
2438

2539
public postType?: 'question' | 'answer';
2640

41+
/**
42+
* *May be absent, in which case it is set to `null`*
43+
*/
2744
public replyToUser?: ShallowUser;
2845

2946
public score: number;

‎src/objects/Info.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import {Site} from './Site';
22

33
import {TypeInfo} from '../result-types/TypeInfo';
44

5+
/**
6+
* The equivalent of [Type info](https://api.stackexchange.com/docs/types/info).<br>
7+
* This object describes a [[Site]] in the [Stack Exchange network](https://stackexchange.com/sites).
8+
*/
59
export class Info {
610

711
public answersPerMinute: number;

‎src/objects/MigrationInfo.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ import {Site} from './Site';
22

33
import {TypeMigrationInfo} from '../result-types/TypeMigrationInfo';
44

5+
/**
6+
* The equivalent of [Type migration_info](https://api.stackexchange.com/docs/types/migration-info).<br>
7+
* This object represents a [[Question]]'s migration to or from a different [[Site]] in the [Stack Exchange network](https://stackexchange.com/sites).
8+
*/
59
export class MigrationInfo {
610

711
public onDate: Date;
812

913
public otherSite: Site;
1014

15+
/**
16+
* Refers to a [[Question]]
17+
*/
1118
public questionId: number;
1219

1320
public constructor (migration_info: TypeMigrationInfo) {

‎src/objects/Notice.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import {TypeNotice} from '../result-types/TypeNotice';
22

3+
/**
4+
* The equivalent of [Type notice](https://api.stackexchange.com/docs/types/notice).<br>
5+
* Represents a Notice on a [[Post]].
6+
*/
37
export class Notice {
48

59
public body: string;

‎src/objects/OriginalQuestion.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
import {TypeOriginalQuestion} from '../result-types/TypeOriginalQuestion';
22

3+
/**
4+
* The equivalent of [Type original_question](https://api.stackexchange.com/docs/types/original-question).<br>
5+
* This object represents an "original" [[Question]] that another was closed as a duplicate of.<br>
6+
* This object is mostly analogous to a row in the "gray box" that appears in Questions closed as duplicates which lists Original Questions.
7+
*/
38
export class OriginalQuestion {
49

10+
/**
11+
* *May be absent, in which case it is set to `null`*
12+
*/
513
public acceptedAnswerId?: number;
614

715
public answerCount: number;
816

17+
/**
18+
* Refers to a [[Question]]
19+
*/
920
public questionId: number;
1021

1122
public title: string;

‎src/objects/Privilege.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import {TypePrivilege} from '../result-types/TypePrivilege';
22

3+
/**
4+
* The equivalent of [Type privilege](https://api.stackexchange.com/docs/types/privilege).<br>
5+
* Represents a Privilege a User may have on a [Stack Exchange site](https://stackexchange.com/sites).<br>
6+
* Applications should be aware of, and be able to deal with, the possibility of new Privileges being introduced and old ones being removed.
7+
*/
38
export class Privilege {
49

510
public description: string;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /