pnwkit 3.0 - v4.3.0
    Preparing search index...

    Class BulletinRepliesQuery<F, I>

    Query builder for fetching bulletin reply data from the Politics & War API.

    Create new instances using the factory method: pnwkit.queries.bulletinReplies() Replies are comments posted on bulletins.

    Features:

    • Type-safe field selection and filtering
    • Include author nation and parent bulletin data
    • Filter by ID, bulletin ID, date range, nation
    • Access to reply content and like count
    • Pagination support
    // Get recent replies to a bulletin
    const replies = await pnwkit.queries.bulletinReplies()
    .select('id', 'message', 'date', 'nation_name', 'like_count')
    .where({ bulletin_id: [123456] })
    .first(100)
    .execute();
    // Type: { id: number, message: string, date: string, nation_name: string, like_count: number }[]

    // Query replies with author and bulletin details
    const replies = await pnwkit.queries.bulletinReplies()
    .select('id', 'message', 'date', 'like_count')
    .include('nation', builder => builder
    .select('id', 'nation_name', 'alliance_id')
    )
    .include('bulletin', builder => builder
    .select('id', 'headline')
    )
    .execute();
    // Type: { id: number, ..., nation: {...}, bulletin: {...} }[]

    Type Parameters

    • F extends readonly Exclude<keyof BulletinReplyFields, "__typename">[] = []

      Selected field names

    • I extends Record<string, any> = {}

      Included relations

    Hierarchy

    • QueryBuilder<BulletinReplyFields, BulletinRepliesQueryParams>
      • BulletinRepliesQuery
    Index
    apiKeyOverride?: string

    Per-call API key override, set via apiKey.

    filters: BulletinRepliesQueryParams = ...
    queryName: string = 'bulletin_replies'
    selectedFields: (
        | "nation_id"
        | "id"
        | "bulletin_id"
        | "leader_name"
        | "nation_name"
        | "date"
        | "like_count"
        | "edit_date"
        | "message"
    )[] = []
    skipCacheFlag: boolean = false

    When true, this call bypasses the response cache. Set via skipCache.

    subqueries: Map<string, SubqueryConfig<any, {}, Record<string, any>>> = ...
    MAX_ARRAY_SIZE: 1000
    MAX_FIELD_NAME_LENGTH: 100
    MAX_FIELDS_PER_LEVEL: 100
    MAX_NESTING_DEPTH: 10
    MAX_QUERY_SIZE: 50000
    MAX_STRING_LENGTH: 10000
    QUERIES_WITHOUT_DATA_WRAPPER: Set<string> = ...

    Queries that return data directly without wrapping in a 'data' object. These queries follow a different GraphQL schema structure.

    • Use a specific API key for this call instead of the client's default key.

      Parameters

      • key: string

        The Politics & War API key to authenticate this query with.

      Returns this

      This query builder instance for method chaining.

      await pnwkit.queries.nations()
      .select('id', 'nation_name')
      .apiKey('another-api-key')
      .execute();
    • Build the final GraphQL query string with comprehensive validation.

      Constructs a complete GraphQL query including:

      • Main fields and subqueries with proper formatting
      • Pagination variables (first, page)
      • Filter parameters with type-safe serialization
      • Optional paginator info fields

      Validation includes:

      • Field count limits (max 100 per level)
      • Field name format and length validation (max 100 chars)
      • Query size validation (max 50KB)
      • All filter values properly sanitized and escaped

      Parameters

      • includePaginator: boolean

        Whether to include pagination info in response

      Returns string

      Complete GraphQL query string ready for execution

      Error if field count/name/size limits exceeded or filters contain invalid values

    • Returns Promise<SelectFields<BulletinReplyFields, F, I>[]>

    • Parameters

      • withPaginator: true

      Returns Promise<
          {
              data: SelectFields<BulletinReplyFields, F, I>[];
              paginatorInfo: paginatorInfo;
          },
      >

    • Sanitize and escape a string value for safe GraphQL usage.

      Validates input type and length, checks for null bytes, and escapes special characters including backslashes, quotes, newlines, carriage returns, tabs, form feeds, and backspaces.

      Parameters

      • str: string

        The string to sanitize

      Returns string

      Sanitized string with all special characters properly escaped

      Error if input is not a string, exceeds maximum length (10KB), or contains null bytes

    • Select specific fields to retrieve from bulletin replies

      Type Parameters

      • const Fields extends readonly (
            | "nation_id"
            | "id"
            | "bulletin_id"
            | "leader_name"
            | "nation_name"
            | "date"
            | "like_count"
            | "edit_date"
            | "message"
        )[]

      Parameters

      • ...fields: Fields

        Field names to select

      Returns BulletinRepliesQuery<Fields>

      New query instance with selected fields

      Error if no fields are provided

      .select('id', 'message', 'date', 'nation_name', 'like_count')
      
    • Serialize an object to GraphQL format (enum values without quotes).

      Validates object structure and prevents prototype pollution by:

      • Using own properties only (not inherited)
      • Blocking dangerous keys (proto, constructor, prototype)
      • Validating GraphQL field name format
      • Validating enum value format (uppercase with underscores)
      • Ensuring numbers are finite (rejecting NaN, Infinity)

      Parameters

      • obj: Record<string, any>

        Plain object to serialize (not arrays)

      Returns string

      GraphQL-formatted object string in format {key:value, ...}

      Error if object is null/undefined/array, contains invalid field names, or has unsafe values

    • Bypass the response cache for this call.

      Only meaningful when caching is enabled on the client (cache.enabled). The result is fetched fresh from the API and is neither read from nor written to the cache. No effect when caching is disabled.

      Returns this

      This query builder instance for method chaining.

      await pnwkit.queries.nations()
      .select('id', 'nation_name')
      .skipCache()
      .execute();
    • Apply filters to the query

      Parameters

      • filters: BulletinRepliesQueryParams

        Query parameters for filtering results

      Returns this

      This query instance for method chaining

      .where({ bulletin_id: [12345], after: '2026-01-01' })