beamsocial 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -58,7 +58,7 @@ export class Client {
58
58
  });
59
59
  let session;
60
60
  session = new Session(res.data.id, this.token || null);
61
- session.__load(res.data);
61
+ session.__load(this.baseURL, res.data);
62
62
  return session;
63
63
  }
64
64
  catch (err) {
@@ -2,14 +2,16 @@ import type { Profile, Settings, Relations, Tastes } from "./types/profiles";
2
2
  export declare class Session {
3
3
  readonly id: string;
4
4
  readonly token: string | null;
5
+ avatar: string | null;
5
6
  profile: Profile;
6
7
  settings: Settings;
7
8
  relations: Relations;
8
9
  tastes: Tastes;
9
10
  inbox: {};
10
11
  constructor(id: string, token: string | null);
11
- __load(data: {
12
+ __load(url: string, data: {
12
13
  profile?: Profile;
14
+ avatar?: string;
13
15
  settings?: Settings;
14
16
  relations?: Relations;
15
17
  tastes: Tastes;
@@ -1,6 +1,7 @@
1
1
  export class Session {
2
2
  constructor(id, token) {
3
3
  this.token = null;
4
+ this.avatar = null;
4
5
  this.profile = {};
5
6
  this.settings = {};
6
7
  this.relations = {};
@@ -9,9 +10,11 @@ export class Session {
9
10
  this.id = id;
10
11
  this.token = token;
11
12
  }
12
- __load(data) {
13
+ __load(url, data) {
13
14
  if (data.profile)
14
15
  this.profile = data.profile;
16
+ if (data.avatar)
17
+ this.avatar = url + data.avatar;
15
18
  if (data.settings)
16
19
  this.settings = data.settings;
17
20
  if (data.relations)
@@ -2,14 +2,15 @@ export type Profile = {
2
2
  id: string;
3
3
  name: string;
4
4
  display_name: string | null;
5
+ pronouns: string | null;
6
+ birthday: string | null;
7
+ account_type: string | null;
8
+ status: string | null;
9
+ description: string | null;
5
10
  creation_date: string;
6
11
  update_date: string;
7
12
  followers: number;
8
13
  following: number;
9
- status: string | null;
10
- birthday: string | null;
11
- pronouns: string | null;
12
- account_type: string | null;
13
14
  level: number;
14
15
  };
15
16
  export type Settings = {
@@ -7,14 +7,16 @@ export declare class User {
7
7
  id: string;
8
8
  name: string;
9
9
  display_name: string | null;
10
+ avatar_url: string | null;
11
+ pronouns: string | null;
12
+ birthday: Date | null;
13
+ account_type: string | null;
14
+ status: string | null;
15
+ description: string | null;
10
16
  creation_date: Date;
11
17
  update_date: Date;
12
18
  followers: number;
13
19
  following: number;
14
- status: string | null;
15
- birthday: Date | null;
16
- pronouns: string | null;
17
- account_type: string | null;
18
20
  level: number;
19
21
  constructor(id: string);
20
22
  __load(data: Profile, __session?: Session, __url?: string): void;
@@ -12,14 +12,16 @@ export class User {
12
12
  constructor(id) {
13
13
  this.name = '';
14
14
  this.display_name = null;
15
+ this.avatar_url = null;
16
+ this.pronouns = null;
17
+ this.birthday = null;
18
+ this.account_type = null;
19
+ this.status = null;
20
+ this.description = null;
15
21
  this.creation_date = new Date('1970-01-01T00:00:00Z');
16
22
  this.update_date = new Date('1970-01-01T00:00:00Z');
17
23
  this.followers = 0;
18
24
  this.following = 0;
19
- this.status = null;
20
- this.birthday = null;
21
- this.pronouns = null;
22
- this.account_type = null;
23
25
  this.level = 0;
24
26
  this.id = id;
25
27
  }
@@ -29,14 +31,16 @@ export class User {
29
31
  this.__url = __url + '/users/' + data.name;
30
32
  this.name = data.name;
31
33
  this.display_name = data.display_name;
34
+ this.avatar_url = this.__url + '/avatar';
35
+ this.pronouns = data.pronouns;
36
+ this.birthday = data.birthday ? new Date(data.birthday) : null;
37
+ this.account_type = data.account_type;
38
+ this.status = data.status;
39
+ this.description = data.description;
32
40
  this.creation_date = new Date(data.creation_date);
33
41
  this.update_date = new Date(data.update_date);
34
42
  this.followers = data.followers;
35
43
  this.following = data.following;
36
- this.status = data.status;
37
- this.birthday = data.birthday ? new Date(data.birthday) : null;
38
- this.pronouns = data.pronouns;
39
- this.account_type = data.account_type;
40
44
  this.level = data.level;
41
45
  }
42
46
  follow() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beamsocial",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "description": "API-wrapper pour Beam",
6
6
  "main": "index.js",