Skip to main content

Program

Defined in: src/Program.ts:56

Extends

Implements

Constructors

new Program()

new Program(data?): Program

Defined in: src/lib/Wrapper.ts:36

Creates a new class instance

Parameters

data?

IProgram

Returns

Program

Inherited from

Wrapper<ProgramSchema<UserSchema>, IProgram>.constructor

new Program()

new Program(client, data?): Program

Defined in: src/lib/Wrapper.ts:37

Parameters

client

Client

data?

IProgram

Returns

Program

Inherited from

Wrapper<ProgramSchema<UserSchema>, IProgram>.constructor

Properties

author?

readonly optional author: User

Defined in: src/Program.ts:78

The author of the program.

Implementation of

IProgram.author


client?

optional client: Client

Defined in: src/lib/Wrapper.ts:15

The client that this base was fetched with.

Inherited from

Wrapper.client


code?

readonly optional code: string

Defined in: src/Program.ts:118

The code of the program.

Implementation of

IProgram.code


created?

readonly optional created: Date

Defined in: src/Program.ts:82

The date the program was created.

Implementation of

IProgram.created


deleted?

readonly optional deleted: boolean

Defined in: src/Program.ts:147

Whether the program has been deleted.

Implementation of

IProgram.deleted


description?

readonly optional description: null | string

Defined in: src/Program.ts:143

The description of the program. Set to null if the description is empty string.

Implementation of

IProgram.description


height?

readonly optional height: number

Defined in: src/Program.ts:103

The height of the program in pixels.

Description

Constrained between 400 and 600. May be any value in between.

Implementation of

IProgram.height


helpRequests?

readonly optional helpRequests: Question[]

Defined in: src/Program.ts:164

Implementation of

IProgram.helpRequests


hidden?

readonly optional hidden: boolean

Defined in: src/Program.ts:122

Whether the program is hidden from the hotlist.

Implementation of

IProgram.hidden


id?

readonly optional id: number

Defined in: src/Program.ts:70

The ID of the program.

Implementation of

IProgram.id


key?

readonly optional key: `ag5zfmtoYW4tYWNhZGVteXI${string}CxIKU2NyYXRjaHBhZB${string}${string}`

Defined in: src/Program.ts:132

Implementation of

IProgram.key


origin?

readonly optional origin: null | Program

Defined in: src/Program.ts:131

The original program that this program is a spin-off of.

Implementation of

IProgram.origin


questions?

readonly optional questions: Question[]

Defined in: src/Program.ts:163

Implementation of

IProgram.questions


rawData?

optional rawData: RecursivePartial<ProgramSchema<UserSchema<AvatarSchema, ProfileSchema, ListProgramsSchema<unknown>>>>

Defined in: src/lib/Wrapper.ts:22

The raw base schema data

Remarks

Only set if the base was created from a user schema.

Inherited from

Wrapper.rawData


selfFlagged?

readonly optional selfFlagged: boolean

Defined in: src/Program.ts:154

Whether the program has been flagged by the client's authenticated user.

See

client

Implementation of

IProgram.selfFlagged


selfVoted?

readonly optional selfVoted: boolean

Defined in: src/Program.ts:160

Whether the program has been voted by the client's authenticated user.

See

client

Implementation of

IProgram.selfVoted


spinOffCount?

readonly optional spinOffCount: number

Defined in: src/Program.ts:114

The number of spin-offs the program has.

Implementation of

IProgram.spinOffCount


thumbnailID?

readonly optional thumbnailID: number

Defined in: src/Program.ts:139

The ID of the latest thumbnail image of the program.

Description

Previous thumbnails are not guaranteed to be available.

Implementation of

IProgram.thumbnailID


tipsAndThanks?

readonly optional tipsAndThanks: TipsAndThanks[]

Defined in: src/Program.ts:162

Implementation of

IProgram.tipsAndThanks


title?

readonly optional title: string

Defined in: src/Program.ts:74

The title of the program.

Implementation of

IProgram.title


type?

readonly optional type: ProgramType

Defined in: src/Program.ts:126

The type of program.

Implementation of

IProgram.type


updated?

readonly optional updated: null | Date

Defined in: src/Program.ts:89

The date the program was last updated.

Description

Set to null if the program has never been updated.

Implementation of

IProgram.updated


votes?

readonly optional votes: number

Defined in: src/Program.ts:110

The number of votes the program has received.

Description

Note that a program has 1 vote on creation.

Implementation of

IProgram.votes


width?

readonly optional width: number

Defined in: src/Program.ts:96

The height of the program in pixels.

Description

Constrained between 400 and 600. May be any value in between.

Implementation of

IProgram.width


Type

readonly static Type: typeof ProgramType = ProgramType

Defined in: src/Program.ts:65

Aliases for the program types.

Raw

ProgramRevisionSchema.editorType

Accessors

lines

Get Signature

get lines(): null | number

Defined in: src/Program.ts:173

Number of lines of code in the program.

Returns

null | number


shortUrl

Get Signature

get shortUrl(): null | string

Defined in: src/Program.ts:192

Short URL of the program.

Returns

null | string


spinoff

Get Signature

get spinoff(): null | boolean

Defined in: src/Program.ts:166

Returns

null | boolean


thumbnailUrl

Get Signature

get thumbnailUrl(): null | string

Defined in: src/Program.ts:203

Thumbnail image URL of the program.

Description

To get the latest thumbnail image, use 'latest' as the thumbnail ID instead.

Returns

null | string


url

Get Signature

get url(): null | string

Defined in: src/Program.ts:181

URL of the program.

Returns

null | string

Methods

copy()

copy(data): Program

Defined in: src/lib/Wrapper.ts:53

Updates data into the class

Parameters

data

IProgram

The data to copy from

Returns

Program

The class instance

Inherited from

Wrapper.copy


copyFromSchema()

copyFromSchema(schema): Program

Defined in: src/lib/Wrapper.ts:65

Updates data from a schema into the instance

Parameters

schema

RecursivePartial<ProgramSchema<UserSchema<AvatarSchema, ProfileSchema, ListProgramsSchema<unknown>>>>

The schema to copy from

Returns

Program

The class instance

Inherited from

Wrapper.copyFromSchema


get()

get(client): Promise<Program>

Defined in: src/Program.ts:325

Gets and updates the instance's data

Parameters

client

Client = ...

The API client to use

Returns

Promise<Program>

Overrides

Wrapper.get


getAllHelpRequests()

getAllHelpRequests(client, sort?): Promise<Program>

Defined in: src/Program.ts:405

Parameters

client

Client = ...

sort?

FeedbackSort

Returns

Promise<Program>


getAllQuestions()

getAllQuestions(client, sort?): Promise<Program>

Defined in: src/Program.ts:377

Parameters

client

Client = ...

sort?

FeedbackSort

Returns

Promise<Program>


getAllTipsAndThanks()

getAllTipsAndThanks(client, sort?): Promise<Program>

Defined in: src/Program.ts:349

Parameters

client

Client = ...

sort?

FeedbackSort

Returns

Promise<Program>


getHelpRequests()

getHelpRequests(client, sort?): AsyncGenerator<Question[], Program, unknown>

Defined in: src/Program.ts:389

Parameters

client

Client = ...

sort?

FeedbackSort

Returns

AsyncGenerator<Question[], Program, unknown>


getQuestions()

getQuestions(client, sort?): AsyncGenerator<Question[], Program, unknown>

Defined in: src/Program.ts:361

Parameters

client

Client = ...

sort?

FeedbackSort

Returns

AsyncGenerator<Question[], Program, unknown>


getTipsAndThanks()

getTipsAndThanks(client, sort?): AsyncGenerator<TipsAndThanks[], Program, unknown>

Defined in: src/Program.ts:333

Parameters

client

Client = ...

sort?

FeedbackSort

Returns

AsyncGenerator<TipsAndThanks[], Program, unknown>


is()

is(program): boolean

Defined in: src/Program.ts:417

Checks if the data represents the same instance

Parameters

program

IProgram

Returns

boolean

Overrides

Wrapper.is


isSchema()

isSchema(schema): boolean

Defined in: src/lib/Wrapper.ts:88

Checks if the schema represents the same instance

Parameters

schema

RecursivePartial<ProgramSchema<UserSchema<AvatarSchema, ProfileSchema, ListProgramsSchema<unknown>>>>

Returns

boolean

Inherited from

Wrapper.isSchema


transformSchema()

transformSchema(schema): object

Defined in: src/Program.ts:238

Transforms a API schema into an abstracted interface

Parameters

schema

RecursivePartial<ProgramSchema<UserSchema<AvatarSchema, ProfileSchema, ListProgramsSchema<unknown>>>>

The schema to transform

Returns

object

author

author: undefined | User

code

code: undefined | string = schema.revision.code

created

created: undefined | Date

deleted

deleted: undefined | boolean

description

description: undefined | null | string

height

height: undefined | number = schema.height

hidden

hidden: undefined | boolean = schema.hideFromHotlist

id

id: undefined | number

key

key: undefined | `ag5zfmtoYW4tYWNhZGVteXI${string}CxIKU2NyYXRjaHBhZB${string}${string}` = schema.key

origin

origin: undefined | null | Program

selfFlagged

selfFlagged: undefined | boolean = schema.flaggedByUser

selfVoted

selfVoted: undefined | boolean = schema.upVoted

spinOffCount

spinOffCount: undefined | number

thumbnailID

thumbnailID: undefined | number

title

title: undefined | string = schema.translatedTitle

type

type: ProgramType

updated

updated: undefined | null | Date

votes

votes: undefined | number = schema.sumVotesIncremented

width

width: undefined | number = schema.width

Overrides

Wrapper.transformSchema


fromIdentifier()

static fromIdentifier(identifier): Program

Defined in: src/Program.ts:219

Parameters

identifier

ProgramID | `http${string}://${string}khanacademy.${string}/${string}/${string}/${number}` | `ag5zfmtoYW4tYWNhZGVteXI${string}CxIKU2NyYXRjaHBhZB${string}${string}`

Returns

Program


fromSchema()

static fromSchema(schema): Program

Defined in: src/Program.ts:211

Parameters

schema

RecursivePartial<ProgramSchema<UserSchema<AvatarSchema, ProfileSchema, ListProgramsSchema<unknown>>>>

Returns

Program