Doing some refactoring and some skeleton work for downloading songs
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by brahmix on 11/25/19.
|
||||
//
|
||||
|
||||
#ifndef MEAR_GENERALUTILITY_H
|
||||
#define MEAR_GENERALUTILITY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../model/Token.h"
|
||||
|
||||
namespace utility {
|
||||
class GeneralUtility {
|
||||
public:
|
||||
template<typename S = std::string>
|
||||
static S appendForwardSlashToUri(const S& uri) {
|
||||
S fullUri(uri);
|
||||
if (fullUri.at(fullUri.size() - 1) != '/') {
|
||||
fullUri.append("/");
|
||||
}
|
||||
|
||||
return fullUri;
|
||||
}
|
||||
template<typename S = std::string, class Token = model::Token>
|
||||
static S authHeader(const Token& token) {
|
||||
std::string header("Authorization: Bearer ");
|
||||
header.append(token.accessToken);
|
||||
|
||||
return header;
|
||||
}
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
#endif //MEAR_GENERALUTILITY_H
|
||||
Reference in New Issue
Block a user