File indexing completed on 2025-02-23 04:35:13

0001 // SPDX-FileCopyrightText: 2021 Linus Jahn <lnj@kaidan.im>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 #pragma once
0005 
0006 #include <QNetworkCookie>
0007 
0008 #include <optional>
0009 
0010 namespace QInvidious
0011 {
0012 
0013 class Credentials
0014 {
0015 public:
0016     Credentials() = default;
0017     Credentials(QString username, QString cookie);
0018 
0019     QString username() const;
0020     void setUsername(const QString &username);
0021     void setUsername(QStringView username);
0022 
0023     std::optional<QNetworkCookie> cookie() const;
0024     void setCookie(const std::optional<QNetworkCookie> &cookie);
0025 
0026     bool isAnonymous() const;
0027 
0028 private:
0029     QString m_username;
0030     std::optional<QNetworkCookie> m_cookie;
0031 };
0032 
0033 }