Class StudentNewsSurvey

Hierarchy

  • StudentNewsItem
    • StudentNewsSurvey

Constructors

  • Parameters

    • client: Pronote
    • data: {
          L?: string;
          N: string;
          auteur: string;
          categorie: PronoteValue<24, {
              L: string;
              N: string;
          }>;
          dateCreation: PronoteValue<7, string>;
          dateDebut: PronoteValue<7, string>;
          dateFin: PronoteValue<7, string>;
          elmauteur: PronoteValue<24, {
              G: number;
              L: string;
              N: string;
          }>;
          estAuteur: boolean;
          estInformation: boolean;
          estProlonge: boolean;
          estSondage: boolean;
          genrePublic: number;
          listeQuestions: PronoteValue<24, {
              L: string;
              N: string;
              P: number;
              avecMaximum: boolean;
              genreReponse: PronoteApiNewsQuestionType;
              listeChoix: PronoteValue<24, {
                  L: string;
                  N: string;
                  estReponseLibre?: boolean;
                  rang: number;
              }[]>;
              listePiecesJointes: PronoteValue<24, PronoteApiAttachment[]>;
              nombreReponsesMax: number;
              rang: number;
              reponse: PronoteValue<24, {
                  N: string;
                  avecReponse: boolean;
                  estRepondant: boolean;
                  estReponseAttendue: boolean;
                  reponduLe?: PronoteValue<7, string>;
                  strRepondant?: string;
                  valeurReponse?: string | {
                      V: string;
                      _T: number;
                  };
                  valeurReponseLibre?: string;
              }>;
              tailleReponse: number;
              texte: PronoteValue<21, string>;
              titre: string;
          }[]>;
          lue: boolean;
          prenom: string;
          public: PronoteValue<24, {
              G: PronoteApiUserResourceType;
              L: string;
              N: string;
              P: number;
          }>;
          reponseAnonyme: boolean;
      }
      • Optional L?: string

        Title of the news.

        Example

        "Coucou tout le monde !"
        
      • N: string
      • auteur: string

        Full name of the author of this news.

        Example

        "John D."
        
      • categorie: PronoteValue<24, {
            L: string;
            N: string;
        }>

        Category this news belongs to.

      • dateCreation: PronoteValue<7, string>

        Full date this news was created.

        Example

        "15/02/2024 23:09:10" // in the server timezone
        
      • dateDebut: PronoteValue<7, string>

        Date this news should be displayed.

        Example

        "15/02/2024"
        
      • dateFin: PronoteValue<7, string>

        Date this news should be stopped from being displayed.

        Example

        "06/07/2024"
        
      • elmauteur: PronoteValue<24, {
            G: number;
            L: string;
            N: string;
        }>

        More information about the author ? TODO: Find out for why this is needed ?

      • estAuteur: boolean

        Whether you are the author of this news.

      • estInformation: boolean

        Whether this news is actually a news or not.

      • estProlonge: boolean

        TODO: Not sure what this does.

      • estSondage: boolean

        Whether this news is actually a survey or not.

      • genrePublic: number
      • listeQuestions: PronoteValue<24, {
            L: string;
            N: string;
            P: number;
            avecMaximum: boolean;
            genreReponse: PronoteApiNewsQuestionType;
            listeChoix: PronoteValue<24, {
                L: string;
                N: string;
                estReponseLibre?: boolean;
                rang: number;
            }[]>;
            listePiecesJointes: PronoteValue<24, PronoteApiAttachment[]>;
            nombreReponsesMax: number;
            rang: number;
            reponse: PronoteValue<24, {
                N: string;
                avecReponse: boolean;
                estRepondant: boolean;
                estReponseAttendue: boolean;
                reponduLe?: PronoteValue<7, string>;
                strRepondant?: string;
                valeurReponse?: string | {
                    V: string;
                    _T: number;
                };
                valeurReponseLibre?: string;
            }>;
            tailleReponse: number;
            texte: PronoteValue<21, string>;
            titre: string;
        }[]>
      • lue: boolean

        Whether this news have been read or not.

      • prenom: string

        Student's first name.

      • public: PronoteValue<24, {
            G: PronoteApiUserResourceType;
            L: string;
            N: string;
            P: number;
        }>

        Student's more info. This is needed to update the news' state.

      • reponseAnonyme: boolean

        Whether your response is anonymous or not.

    • categories: StudentNewsCategory[]

    Returns StudentNewsSurvey

Properties

#author: string
#client: Pronote
#creationDate: Date
#endDate: Date
#id: string
#isAnonymous: boolean
#public: PronoteApiNewsPublicSelf
#read: boolean
#startDate: Date
#title?: string

Accessors

  • get #stateInformation(): {
        id: string;
        public: PronoteApiNewsPublicSelf;
        title: string;
    }
  • Internal helper to get the current news state information.

    Returns {
        id: string;
        public: PronoteApiNewsPublicSelf;
        title: string;
    }

    • id: string
    • public: PronoteApiNewsPublicSelf
    • title: string
  • get author(): string
  • Name of the author of the information / survey.

    Returns string

    Example

    "John D."
    
  • get creationDate(): Date
  • Returns Date

  • get endDate(): Date
  • Returns Date

  • get id(): string
  • Returns string

  • get isAnonymous(): boolean
  • Whether your response is anonymous or not.

    Returns boolean

  • get public(): PronoteApiNewsPublicSelf
  • Low level data about the public information of the user that'll send answers. Used internally when sending answers to the server.

    Most of the time, you won't need this.

    Returns PronoteApiNewsPublicSelf

  • get read(): boolean
  • Whether this news have been read or not.

    Returns boolean

  • get startDate(): Date
  • Returns Date

  • get title(): undefined | string
  • Returns undefined | string

Methods

  • Answers the survey with the given answers. By default, it'll answer with the questions that were given when the survey was created.

    You can either manipulate the questions directly or pass in your own answers.

    Parameters

    Returns Promise<void>

  • Will delete the news from the user's news feed.

    Returns Promise<void>

    Remark

    You can never get the news back after this.

  • Patches the read state of the news to the given value.

    Parameters

    • status: boolean = true

    Returns Promise<void>

    Remark

    Will do nothing if this.read === status.

  • Low level method, used internally to patch questions (from acknowledge() and answer()).

    Most of the time, you won't need this.

    Parameters

    Returns Promise<void>