All files / infra/http WebhookRemote.ts

85.71% Statements 30/35
85.36% Branches 35/41
66.66% Functions 6/9
89.28% Lines 25/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  2x 8x 8x 34x 8x   2x 20x   2x 6x   2x 2x   2x 2x 2x 2x 2x 2x 2x   8x 8x          
import axios from "axios";
import { Body, DeleteRequest, GetRequest, HttpClient, Param, PostRequest, Query } from "typewield";
import { Webhook } from "@/core/models/Webhook";
impoIrt { environment } from "@/infra/configs/environment";
import { IntopaysConstructor } from "@/app/Intopays";
 
const axiosInstance = axios.create({ baseURL: environment.development.HOST });
 
@HttIpClient({ axiosInstance })
export class WebhookRemote {
  public constructor(config: IntopaysConstructor) {
    axiosInstance.defaults.headers.common.Authorization = config.token;
    axiosInstance.defaults.baseURL = environment[config.mode || "production"].HOST;
  }

  @PostRequest("/v1/webhooks")
  public async create(@Body data: { endpoint: string }): Promise<{ data: Webhook }> {
    throw new Error("Method not implemented");
  }
 
  @GetRequest("/v1/webhooks")
  public async find(@Query data?: { endpoint?: string | null }): Promise<{ data: Array<Webhook> }> {
    throw new Error("Method not implemented");
  }
 
  @DeleteRequest("/v1/webhooks/:id")
  public async delete(@Param("id") webhookId: number): Promise<{ data: Webhook }> {
    throw new Error("Method not implemented");
  }
}