-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(newsletter): add newsletter service, endpoints, and UI components Add Newsletter service to support functionality for unfollowing newsletters Add Newsletter REST controller and routing Implement newsletter-related endpoints and methods in the User Service Create UnfollowRequest for the INewsletterService interface Add MyListNewsletterResponse to user's data fields Add newsletter validation Refactor JS components to support newsletter type and simplify recipient forms by moving logic to FormRecipient component Refactor window global constants to support newsletters Modify server to initialize and use the newsletter services Add UI component for listing newsletters Refactor existing components to use FormRecipient for recipient data input * chore: update documentation feat(openapi.yaml): add newsletter support with new paths and schemas docs(readme.md): update API endpoints including newsletter and images fix(openapi.yaml): correct duplicated summary text for user my newsletters * feat: update package name * feat: Update src/views/components/NewsletterList.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat: Update src/views/components/NewsletterList.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat: Update src/views/components/NewsletterList.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c54d414
commit c419406
Showing
29 changed files
with
766 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: WhatsApp API MultiDevice | ||
version: 4.2.0 | ||
version: 4.3.0 | ||
description: This API is used for sending whatsapp via API | ||
servers: | ||
- url: http://localhost:3000 | ||
|
@@ -16,6 +16,8 @@ tags: | |
description: Message manipulation (revoke/react/update). | ||
- name: group | ||
description: Group setting | ||
- name: newsletter | ||
description: newsletter setting | ||
paths: | ||
/app/login: | ||
get: | ||
|
@@ -212,6 +214,31 @@ paths: | |
- user | ||
summary: User My List Groups | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/UserGroupResponse' | ||
'500': | ||
description: Internal Server Error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorInternalServer' | ||
/user/my/newsletters: | ||
get: | ||
operationId: userMyNewsletter | ||
tags: | ||
- user | ||
summary: User My List Groups | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/NewsletterResponse' | ||
'500': | ||
description: Internal Server Error | ||
content: | ||
|
@@ -1042,6 +1069,40 @@ paths: | |
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorInternalServer' | ||
/newsletter/unfollow: | ||
post: | ||
operationId: unfollowNewsletter | ||
tags: | ||
- newsletter | ||
summary: Unfollow newsletter | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
newsletter_id: | ||
type: string | ||
example: '120363024512399999@newsletter' | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/GenericResponse' | ||
'400': | ||
description: Bad Request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorBadRequest' | ||
'500': | ||
description: Internal Server Error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorInternalServer' | ||
|
||
components: | ||
schemas: | ||
|
@@ -1341,4 +1402,242 @@ components: | |
results: | ||
type: object | ||
example: null | ||
description: 'additional data' | ||
description: 'additional data' | ||
NewsletterResponse: | ||
type: object | ||
properties: | ||
code: | ||
type: string | ||
example: "SUCCESS" | ||
message: | ||
type: string | ||
example: "Success get list newsletter" | ||
results: | ||
type: object | ||
properties: | ||
data: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Newsletter' | ||
Newsletter: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
example: "120363144038483540@newsletter" | ||
state: | ||
type: object | ||
properties: | ||
type: | ||
type: string | ||
example: "active" | ||
thread_metadata: | ||
type: object | ||
properties: | ||
creation_time: | ||
type: string | ||
example: "1688746895" | ||
invite: | ||
type: string | ||
example: "0029Va4K0PZ5a245NkngBA2M" | ||
name: | ||
type: object | ||
properties: | ||
text: | ||
type: string | ||
example: "WhatsApp" | ||
id: | ||
type: string | ||
example: "1688746895480511" | ||
update_time: | ||
type: string | ||
example: "1688746895480511" | ||
description: | ||
type: object | ||
properties: | ||
text: | ||
type: string | ||
example: "WhatsApp’s official channel. Follow for our latest feature launches, updates, exclusive drops and more." | ||
id: | ||
type: string | ||
example: "1689653839450668" | ||
update_time: | ||
type: string | ||
example: "1689653839450668" | ||
subscribers_count: | ||
type: string | ||
example: "0" | ||
verification: | ||
type: string | ||
example: "verified" | ||
picture: | ||
type: object | ||
properties: | ||
url: | ||
type: string | ||
example: "" | ||
id: | ||
type: string | ||
example: "1707950960975554" | ||
type: | ||
type: string | ||
example: "IMAGE" | ||
direct_path: | ||
type: string | ||
example: "/v/t61.24694-24/416962407_970228831134395_8869146381947923973_n.jpg?ccb=11-4&oh=01_Q5AaIIvOIeu3l0HCZWILrmr-dGR_vXFqnhUeytw0-ojPc4hL&oe=670D95B1&_nc_sid=5e03e0&_nc_cat=110" | ||
preview: | ||
type: object | ||
properties: | ||
url: | ||
type: string | ||
example: "" | ||
id: | ||
type: string | ||
example: "1707950960975554" | ||
type: | ||
type: string | ||
example: "PREVIEW" | ||
direct_path: | ||
type: string | ||
example: "/v/t61.24694-24/416962407_970228831134395_8869146381947923973_n.jpg?stp=dst-jpg_s192x192&ccb=11-4&oh=01_Q5AaIHO-DQklqm3q3awF7xwji_WAn9DkgZASQA0B2Ct0qbSa&oe=670D95B1&_nc_sid=5e03e0&_nc_cat=110" | ||
settings: | ||
type: object | ||
properties: | ||
reaction_codes: | ||
type: object | ||
properties: | ||
value: | ||
type: string | ||
example: "ALL" | ||
viewer_metadata: | ||
type: object | ||
properties: | ||
mute: | ||
type: string | ||
example: "off" | ||
role: | ||
type: string | ||
example: "subscriber" | ||
GroupResponse: | ||
type: object | ||
properties: | ||
code: | ||
type: string | ||
example: "SUCCESS" | ||
message: | ||
type: string | ||
example: "Success get list groups" | ||
results: | ||
type: object | ||
properties: | ||
data: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Group' | ||
Group: | ||
type: object | ||
properties: | ||
JID: | ||
type: string | ||
example: "[email protected]" | ||
OwnerJID: | ||
type: string | ||
example: "[email protected]" | ||
Name: | ||
type: string | ||
example: "Example Group" | ||
NameSetAt: | ||
type: string | ||
format: date-time | ||
example: "2024-10-11T21:27:29+07:00" | ||
NameSetBy: | ||
type: string | ||
example: "[email protected]" | ||
Topic: | ||
type: string | ||
example: "" | ||
TopicID: | ||
type: string | ||
example: "" | ||
TopicSetAt: | ||
type: string | ||
format: date-time | ||
example: "0001-01-01T00:00:00Z" | ||
TopicSetBy: | ||
type: string | ||
example: "" | ||
TopicDeleted: | ||
type: boolean | ||
example: false | ||
IsLocked: | ||
type: boolean | ||
example: false | ||
IsAnnounce: | ||
type: boolean | ||
example: false | ||
AnnounceVersionID: | ||
type: string | ||
example: "1728656849439709" | ||
IsEphemeral: | ||
type: boolean | ||
example: false | ||
DisappearingTimer: | ||
type: integer | ||
example: 0 | ||
IsIncognito: | ||
type: boolean | ||
example: false | ||
IsParent: | ||
type: boolean | ||
example: false | ||
DefaultMembershipApprovalMode: | ||
type: string | ||
example: "" | ||
LinkedParentJID: | ||
type: string | ||
example: "" | ||
IsDefaultSubGroup: | ||
type: boolean | ||
example: false | ||
IsJoinApprovalRequired: | ||
type: boolean | ||
example: false | ||
GroupCreated: | ||
type: string | ||
format: date-time | ||
example: "2024-10-11T21:27:29+07:00" | ||
ParticipantVersionID: | ||
type: string | ||
example: "1728656849439790" | ||
Participants: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Participant' | ||
MemberAddMode: | ||
type: string | ||
example: "admin_add" | ||
|
||
Participant: | ||
type: object | ||
properties: | ||
JID: | ||
type: string | ||
example: "[email protected]" | ||
LID: | ||
type: string | ||
example: "20036609675500@lid" | ||
IsAdmin: | ||
type: boolean | ||
example: true | ||
IsSuperAdmin: | ||
type: boolean | ||
example: true | ||
DisplayName: | ||
type: string | ||
example: "" | ||
Error: | ||
type: integer | ||
example: 0 | ||
AddRequest: | ||
type: string | ||
example: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package newsletter | ||
|
||
import "context" | ||
|
||
type INewsletterService interface { | ||
Unfollow(ctx context.Context, request UnfollowRequest) (err error) | ||
} | ||
|
||
type UnfollowRequest struct { | ||
NewsletterID string `json:"newsletter_id" form:"newsletter_id"` | ||
} |
Oops, something went wrong.