@meowinc/meow-sdk 0.10.0 → 0.11.0

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.
@@ -0,0 +1,14 @@
1
+ import { MeowResult } from "../../types";
2
+ export interface Response {
3
+ dateTime: string;
4
+ activity: ActivityType;
5
+ }
6
+ type ActivityType = {
7
+ type: "nothing";
8
+ } | {
9
+ type: "watchUserProfile";
10
+ id: number;
11
+ login: string;
12
+ };
13
+ export declare function request(login: string): Promise<MeowResult<Response>>;
14
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ACCOUNT_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(login) {
5
+ return new HttpClient()
6
+ .withUrl(`${ACCOUNT_API}/v1/user/${login}/activity`)
7
+ .withMethodGet()
8
+ .send()
9
+ .then((r) => r.mapError(ErrorToMessage));
10
+ }
@@ -1,6 +1,9 @@
1
1
  import { AuthorizationProvider } from "../../auth-provider";
2
+ import { type Payload as UpdateUserLastActivityPayload } from "./update-user-last-activity";
2
3
  export declare class UserRequests {
3
4
  private readonly authProvider;
4
5
  constructor(authProvider: AuthorizationProvider);
5
6
  getUserByLogin(login: string): Promise<import("@meowinc/result").Result<import("./get-user-by-login").Response, string>>;
7
+ getUserLastActivity(login: string): Promise<import("../../types").MeowResult<import("./get-user-last-activity").Response>>;
8
+ updateUserLastActivity(payload: UpdateUserLastActivityPayload): Promise<import("../../types").MeowResult<void>>;
6
9
  }
@@ -1,4 +1,6 @@
1
1
  import { request as getUserByLoginRequest } from "./get-user-by-login";
2
+ import { request as getUserLastActivity } from "./get-user-last-activity";
3
+ import { request as updateUserLastActivity, } from "./update-user-last-activity";
2
4
  export class UserRequests {
3
5
  authProvider;
4
6
  constructor(authProvider) {
@@ -7,4 +9,10 @@ export class UserRequests {
7
9
  async getUserByLogin(login) {
8
10
  return await getUserByLoginRequest(login);
9
11
  }
12
+ async getUserLastActivity(login) {
13
+ return await getUserLastActivity(login);
14
+ }
15
+ async updateUserLastActivity(payload) {
16
+ return await updateUserLastActivity(payload, this.authProvider);
17
+ }
10
18
  }
@@ -0,0 +1,9 @@
1
+ import { AuthorizationProvider } from "../..";
2
+ import { MeowResult } from "../../types";
3
+ export type Payload = {
4
+ type: "nothing";
5
+ } | {
6
+ type: "watchUserProfile";
7
+ login: string;
8
+ };
9
+ export declare function request(payload: Payload, auth: AuthorizationProvider): Promise<MeowResult<void>>;
@@ -0,0 +1,12 @@
1
+ import { ACCOUNT_API } from "..";
2
+ import { ErrorToMessage } from "../../error";
3
+ import { HttpClient } from "../../http-client";
4
+ export async function request(payload, auth) {
5
+ return await new HttpClient()
6
+ .withUrl(`${ACCOUNT_API}/v1/user/activity`)
7
+ .withMethodPost()
8
+ .withAuthorization(auth)
9
+ .withJsonBody(payload)
10
+ .send()
11
+ .then((r) => r.mapError(ErrorToMessage));
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meowinc/meow-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Meow SDK",
5
5
  "keywords": [
6
6
  "sdk"