Skip to main content
This release is 5 versions behind 1.3.5 — the latest version of @fedify/fedify. Jump to latest

@fedify/fedify@1.3.0-dev.492+450a6939
Built and signed on GitHub Actions

An ActivityPub/fediverse server framework

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
2 months ago (1.3.0-dev.492+450a6939)
class Question

Represents a question being asked. Question objects are an extension of IntransitiveActivity. That is, the Question object is an Activity, but the direct object is the question itself and therefore it would not contain an object property.

Either of the inclusiveOptions and exclusiveOptions properties may be used to express possible answers, but a Question object must not have both properties.

Constructors

new
Question(
values: { id?: URL | null; attachments?: ()[]; attribution?: ; attributions?: ()[]; audience?:
Object
| URL
| null
; audiences?: (Object | URL)[]; content?: ; contents?: ((string | LanguageString))[]; contexts?: ()[]; name?: ; names?: ((string | LanguageString))[]; endTime?: Temporal.Instant | null; generators?: ()[]; icon?:
Image
| URL
| null
; icons?: (Image | URL)[]; image?:
Image
| URL
| null
; images?: (Image | URL)[]; replyTarget?:
Object
| Link
| URL
| null
; replyTargets?: ()[]; location?:
Object
| Link
| URL
| null
; locations?: ()[]; preview?:
Link
| Object
| URL
| null
; previews?: ()[]; published?: Temporal.Instant | null; replies?:
Collection
| URL
| null
; startTime?: Temporal.Instant | null; summary?: ; summaries?: ((string | LanguageString))[]; tags?: ()[]; updated?: Temporal.Instant | null; url?:
URL
| Link
| null
; urls?: ((URL | Link))[]; to?:
Object
| URL
| null
; tos?: (Object | URL)[]; bto?:
Object
| URL
| null
; btos?: (Object | URL)[]; cc?:
Object
| URL
| null
; ccs?: (Object | URL)[]; bcc?:
Object
| URL
| null
; bccs?: (Object | URL)[]; mediaType?: string | null; duration?: Temporal.Duration | null; sensitive?: boolean | null; source?: Source | null; proof?: ; proofs?: (DataIntegrityProof | URL)[]; actor?: ; actors?: ()[]; object?:
Object
| URL
| null
; objects?: (Object | URL)[]; target?:
Object
| URL
| null
; targets?: (Object | URL)[]; result?:
Object
| URL
| null
; results?: (Object | URL)[]; origin?:
Object
| URL
| null
; origins?: (Object | URL)[]; instrument?:
Object
| URL
| null
; instruments?: (Object | URL)[]; exclusiveOptions?: (Object | URL)[]; inclusiveOptions?: (Object | URL)[]; closed?: ; voters?: number | null; quoteUrl?: URL | null; }
,
unnamed 1?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; },
)

Constructs a new instance of Question with the given values.

Properties

readonly
closed:

Indicates that a question has been closed, and answers are no longer accepted.

Similar to Question.getExclusiveOptions, but returns their @ids instead of the objects themselves.

Similar to Question.getInclusiveOptions, but returns their @ids instead of the objects themselves.

readonly
quoteUrl: URL | null

The URI of the ActivityStreams object that this object quotes.

This property sets three JSON-LD properties at once under the hood:

  1. https://www.w3.org/ns/activitystreams#quoteUrl
  2. https://misskey-hub.net/ns#_misskey_quote
  3. http://fedibird.com/ns#quoteUri

When a JSON-LD object is parsed, this property is filled with one of the values of those three properties in order.

readonly
voters: number | null

How many people have voted in the poll. Distinct from how many votes have been cast (in the case of multiple-choice polls).

Methods

[Symbol.for("nodejs.util.inspect.custom")](
_depth: number,
options: unknown,
inspect: (
value: unknown,
options: unknown,
) => string
,
): string
protected
_getCustomInspectProxy(): Record<string, unknown>
clone(
values?: { id?: URL | null; attachments?: ()[]; attribution?: ; attributions?: ()[]; audience?:
Object
| URL
| null
; audiences?: (Object | URL)[]; content?: ; contents?: ((string | LanguageString))[]; contexts?: ()[]; name?: ; names?: ((string | LanguageString))[]; endTime?: Temporal.Instant | null; generators?: ()[]; icon?:
Image
| URL
| null
; icons?: (Image | URL)[]; image?:
Image
| URL
| null
; images?: (Image | URL)[]; replyTarget?:
Object
| Link
| URL
| null
; replyTargets?: ()[]; location?:
Object
| Link
| URL
| null
; locations?: ()[]; preview?:
Link
| Object
| URL
| null
; previews?: ()[]; published?: Temporal.Instant | null; replies?:
Collection
| URL
| null
; startTime?: Temporal.Instant | null; summary?: ; summaries?: ((string | LanguageString))[]; tags?: ()[]; updated?: Temporal.Instant | null; url?:
URL
| Link
| null
; urls?: ((URL | Link))[]; to?:
Object
| URL
| null
; tos?: (Object | URL)[]; bto?:
Object
| URL
| null
; btos?: (Object | URL)[]; cc?:
Object
| URL
| null
; ccs?: (Object | URL)[]; bcc?:
Object
| URL
| null
; bccs?: (Object | URL)[]; mediaType?: string | null; duration?: Temporal.Duration | null; sensitive?: boolean | null; source?: Source | null; proof?: ; proofs?: (DataIntegrityProof | URL)[]; actor?: ; actors?: ()[]; object?:
Object
| URL
| null
; objects?: (Object | URL)[]; target?:
Object
| URL
| null
; targets?: (Object | URL)[]; result?:
Object
| URL
| null
; results?: (Object | URL)[]; origin?:
Object
| URL
| null
; origins?: (Object | URL)[]; instrument?:
Object
| URL
| null
; instruments?: (Object | URL)[]; exclusiveOptions?: (Object | URL)[]; inclusiveOptions?: (Object | URL)[]; closed?: ; voters?: number | null; quoteUrl?: URL | null; }
,
options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; },
): Question

Clones this instance, optionally updating it with the given values.

getExclusiveOptions(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object>

Identifies an exclusive option for a Question. Use of exclusiveOptions implies that the Question can have only a single answer. To indicate that a Question can have multiple answers, use inclusiveOptions.

getInclusiveOptions(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object>

Identifies an inclusive option for a Question. Use of inclusiveOptions implies that the Question can have multiple answers. To indicate that a Question can have only one answer, use exclusiveOptions.

toJsonLd(options?: { format?: "compact" | "expand"; contextLoader?: DocumentLoader; context?:
string
| Record<string, string>
| (string | Record<string, string>)[]
; }
): Promise<unknown>

Converts this object to a JSON-LD structure.

Static Properties

readonly
typeId: URL

The type URI of Question: https://www.w3.org/ns/activitystreams#Question.

Static Methods

fromJsonLd(
json: unknown,
options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; },
): Promise<Question>

Converts a JSON-LD structure to an object of this type.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import { Question } from "@fedify/fedify";

---- OR ----

Import directly with a jsr specifier

import { Question } from "jsr:@fedify/fedify";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { Question } from "@fedify/fedify";

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

import { Question } from "@fedify/fedify";

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

import { Question } from "@fedify/fedify";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { Question } from "@fedify/fedify";