Class StudentNewsInformation

Hierarchy

  • StudentNewsItem
    • StudentNewsInformation

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 StudentNewsInformation

Properties

#author: string
#client: Pronote
#creationDate: Date
#endDate: Date
#id: string
#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 acknowledged(): boolean
  • Whether this news have been acknowledged or not.

    Returns boolean

    Remark

    This is not the same as reading the news, see read property.

  • get acknowledgedDate(): undefined | Date
  • Date when the news have been acknowledged. Only available if acknowledged is true.

    Returns undefined | Date

  • get author(): string
  • Name of the author of the information / survey.

    Returns string

    Example

    "John D."
    
  • get content(): string
  • HTML string containing the news.

    Returns string

  • get creationDate(): Date
  • Returns Date

  • get endDate(): Date
  • Returns Date

  • get id(): string
  • Returns string

  • 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 question(): StudentNewsItemQuestion
  • Low level data about the "question" contained inside this information.

    You can use this to serialize the question and finally send it back to the server using pronote.patchNewsState(data, [question], extra).

    Internally, acknowledged, content, attachments, ... are based on this, we're just renaming the properties and adding some sugar on top of it.

    Returns StudentNewsItemQuestion

    Remark

    Most of the time, you won't need this, but it's here if you need it.

  • 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

  • Will acknowledge the news if needed, so if the news doesn't need to be acknowledged (!needToAcknowledge) or is already acknowledged, we will just do the read step.

    When acknowledging, the news will be directly marked as read. If you want to change this behavior, you can change the alsoMarkAsRead parameter.

    Parameters

    • alsoMarkAsRead: boolean = true

    Returns Promise<void>

    Remark

    You can't un-acknowledge a news.

  • 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>