mirror of
https://github.com/Tribufu/TribufuJS
synced 2026-08-20 18:11:06 +00:00
Add oauth2 client
This commit is contained in:
parent
e0e549b5dc
commit
e51ff1249c
8 changed files with 183 additions and 20 deletions
33
src/index.ts
Normal file
33
src/index.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
|
||||
export const VERSION = "0.0.4";
|
||||
|
||||
export class TribufuClient {
|
||||
private id: BigInt;
|
||||
private secret: string;
|
||||
private http: AxiosInstance;
|
||||
|
||||
constructor(id: BigInt, secret: string) {
|
||||
this.id = id;
|
||||
this.secret = secret;
|
||||
|
||||
const targetTriple = "JavaScript";
|
||||
const userAgent = `Tribufu/${VERSION} (+https://api.tribufu.com; ${targetTriple}`;
|
||||
const headers = {
|
||||
"User-Agent": userAgent,
|
||||
"X-Tribufu-Language": "javascript",
|
||||
"X-Tribufu-Version": VERSION,
|
||||
};
|
||||
|
||||
this.http = axios.create({
|
||||
baseURL: 'https://api.tribufu.com',
|
||||
headers,
|
||||
});
|
||||
}
|
||||
|
||||
public getId(): BigInt {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue