Skip to content

Commit

Permalink
fix(hub-discussions): remove files/fns that were duplicated between h… (
Browse files Browse the repository at this point in the history
  • Loading branch information
rweber-esri authored Nov 19, 2024
1 parent 12b1ce9 commit 04a7067
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 398 deletions.
54 changes: 33 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/discussions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"peerDependencies": {
"@esri/arcgis-rest-auth": "^2.14.0 || 3",
"@esri/arcgis-rest-request": "^2.14.0 || 3",
"@esri/hub-common": "^15.0.0"
"@esri/hub-common": "^15.7.1"
},
"devDependencies": {
"@esri/hub-common": "^15.0.0",
"@esri/hub-common": "^15.7.1",
"@types/geojson": "^7946.0.7",
"typescript": "^3.8.1"
},
Expand Down
21 changes: 12 additions & 9 deletions packages/discussions/src/channels/channels.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { request } from "../request";
import { discussionsApiRequest } from "@esri/hub-common";
import {
ICreateChannelParams,
IFetchChannelParams,
Expand Down Expand Up @@ -28,7 +28,7 @@ export function createChannel(
options: ICreateChannelParams
): Promise<IChannel> {
options.httpMethod = "POST";
return request(`/channels`, options);
return discussionsApiRequest(`/channels`, options);
}

/**
Expand All @@ -40,7 +40,7 @@ export function createChannel(
*/
export function fetchChannel(options: IFetchChannelParams): Promise<IChannel> {
options.httpMethod = "GET";
return request(`/channels/${options.channelId}`, options);
return discussionsApiRequest(`/channels/${options.channelId}`, options);
}

/**
Expand All @@ -56,7 +56,7 @@ export function updateChannel(
options: IUpdateChannelParams
): Promise<IChannel> {
options.httpMethod = "PATCH";
return request(`/channels/${options.channelId}`, options);
return discussionsApiRequest(`/channels/${options.channelId}`, options);
}

/**
Expand All @@ -70,7 +70,7 @@ export function removeChannel(
options: IRemoveChannelParams
): Promise<IRemoveChannelResponse> {
options.httpMethod = "DELETE";
return request(`/channels/${options.channelId}`, options);
return discussionsApiRequest(`/channels/${options.channelId}`, options);
}

/**
Expand All @@ -84,7 +84,7 @@ export function fetchChannelNotifcationOptOut(
options: IFetchChannelNotificationOptOutParams
): Promise<IChannelNotificationOptOut> {
options.httpMethod = "GET";
return request(
return discussionsApiRequest(
`/channels/${options.channelId}/notifications/opt-out`,
options
);
Expand All @@ -101,7 +101,7 @@ export function createChannelNotificationOptOut(
options: ICreateChannelNotificationOptOutParams
): Promise<IChannelNotificationOptOut> {
options.httpMethod = "POST";
return request(
return discussionsApiRequest(
`/channels/${options.channelId}/notifications/opt-out`,
options
);
Expand All @@ -118,7 +118,7 @@ export function removeChannelNotificationOptOut(
options: IRemoveChannelNotificationOptOutParams
): Promise<IRemoveChannelNotificationOptOutResult> {
options.httpMethod = "DELETE";
return request(
return discussionsApiRequest(
`/channels/${options.channelId}/notifications/opt-out`,
options
);
Expand All @@ -135,5 +135,8 @@ export function removeChannelActivity(
options: IRemoveChannelActivityParams
): Promise<IRemoveChannelActivityResult> {
options.httpMethod = "DELETE";
return request(`/channels/${options.channelId}/activity`, options);
return discussionsApiRequest(
`/channels/${options.channelId}/activity`,
options
);
}
16 changes: 8 additions & 8 deletions packages/discussions/src/posts/posts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* tslint:disable unified-signatures */
import { request } from "../request";
import { discussionsApiRequest } from "@esri/hub-common";
import {
ICreatePostParams,
ICreateReplyParams,
Expand Down Expand Up @@ -35,7 +35,7 @@ export function searchPosts(
: acc,
{ ...(options.data ?? {}) } as any
);
return request(url, {
return discussionsApiRequest(url, {
...options,
data,
httpMethod: "GET",
Expand All @@ -51,7 +51,7 @@ export function searchPosts(
*/
export function createPost(options: ICreatePostParams): Promise<IPost> {
const url = `/posts`;
return request(url, {
return discussionsApiRequest(url, {
httpMethod: "POST",
...getCreateUpdateRequestParams(options),
});
Expand All @@ -67,7 +67,7 @@ export function createPost(options: ICreatePostParams): Promise<IPost> {
*/
export function createReply(options: ICreateReplyParams): Promise<IPost> {
const url = `/posts/${options.postId}/reply`;
return request(url, {
return discussionsApiRequest(url, {
httpMethod: "POST",
...getCreateUpdateRequestParams(options),
});
Expand All @@ -83,7 +83,7 @@ export function createReply(options: ICreateReplyParams): Promise<IPost> {
export function fetchPost(params: IFetchPostParams): Promise<IPost> {
const url = `/posts/${params.postId}`;
params.httpMethod = "GET";
return request(url, params);
return discussionsApiRequest(url, params);
}

/**
Expand All @@ -98,7 +98,7 @@ export function removePost(
): Promise<IRemovePostResponse> {
const url = `/posts/${options.postId}`;
options.httpMethod = "DELETE";
return request(url, options);
return discussionsApiRequest(url, options);
}

/**
Expand All @@ -111,7 +111,7 @@ export function removePost(
*/
export function updatePost(options: IUpdatePostParams): Promise<IPost> {
const url = `/posts/${options.postId}`;
return request(url, {
return discussionsApiRequest(url, {
httpMethod: "PATCH",
...getCreateUpdateRequestParams(options),
});
Expand All @@ -130,7 +130,7 @@ export function updatePostStatus(
): Promise<IPost> {
const url = `/posts/${options.postId}/status`;
options.httpMethod = "PATCH";
return request(url, options);
return discussionsApiRequest(url, options);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/discussions/src/reactions/reactions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { request } from "../request";
import { discussionsApiRequest } from "@esri/hub-common";
import {
ICreateReactionOptions,
IRemoveReactionOptions,
Expand All @@ -17,7 +17,7 @@ export function createReaction(
options: ICreateReactionOptions
): Promise<IReaction> {
options.httpMethod = "POST";
return request(`/reactions`, options);
return discussionsApiRequest(`/reactions`, options);
}

/**
Expand All @@ -32,5 +32,5 @@ export function removeReaction(
): Promise<IRemoveReactionResponse> {
const { reactionId } = options;
options.httpMethod = "DELETE";
return request(`/reactions/${reactionId}`, options);
return discussionsApiRequest(`/reactions/${reactionId}`, options);
}
24 changes: 0 additions & 24 deletions packages/discussions/src/request.ts

This file was deleted.

Loading

0 comments on commit 04a7067

Please sign in to comment.