PrivateMessageService
1. Import the service from our library:
import {PrivateMessageService} from "@selfcommunity/api-services";
2. Create a function and put the service inside it!
The async function `getAllSnippets` will return the paginated list of snippets.
async getAllSnippets() {
return await PrivateMessageService.getAllSnippets();
}
In case of required `params`, just add them inside the brackets.
async getASingleMessage(messageId) {
return await PrivateMessageService.getASingleMessage(messageId);
}
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
1. Declare it(or declare them, it is possible to add multiple params)
const headers = headers: {Authorization: `Bearer ${yourToken}`}
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
Constructors
Constructor
new PrivateMessageService():
PrivateMessageService
Returns
PrivateMessageService
Methods
chunkUploadDone()
static
chunkUploadDone(data
,config?
):Promise
<SCPrivateMessageUploadMediaType
>
Parameters
Parameter | Type |
---|---|
data | MessageChunkUploadDoneParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPrivateMessageUploadMediaType
>
deleteAMessage()
static
deleteAMessage(id
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
deleteAThread()
static
deleteAThread(params
,config?
):Promise
<any
>
Parameters
Parameter | Type |
---|---|
params | ThreadDeleteParams |
config? | AxiosRequestConfig |
Returns
Promise
<any
>
getAllSnippets()
static
getAllSnippets(config?
):Promise
<SCPaginatedResponse
<SCPrivateMessageSnippetType
>>
Parameters
Parameter | Type |
---|---|
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCPrivateMessageSnippetType
>>
getASingleMessage()
static
getASingleMessage(id
,config?
):Promise
<SCPrivateMessageThreadType
>
Parameters
Parameter | Type |
---|---|
id | string | number |
config? | AxiosRequestConfig |
Returns
Promise
<SCPrivateMessageThreadType
>
getAThread()
static
getAThread(params
,config?
):Promise
<SCPaginatedResponse
<SCPrivateMessageThreadType
>>
Parameters
Parameter | Type |
---|---|
params | ThreadParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCPrivateMessageThreadType
>>
searchUser()
static
searchUser(search
,config?
):Promise
<SCPaginatedResponse
<SCUserType
>>
Parameters
Parameter | Type |
---|---|
search | string |
config? | AxiosRequestConfig |
Returns
Promise
<SCPaginatedResponse
<SCUserType
>>
sendAMessage()
static
sendAMessage(data
,config?
):Promise
<SCPrivateMessageThreadType
>
Parameters
Parameter | Type |
---|---|
data | MessageCreateParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPrivateMessageThreadType
>
uploadMedia()
static
uploadMedia(data
,config?
):Promise
<SCPrivateMessageUploadMediaType
>
Parameters
Parameter | Type |
---|---|
data | MessageMediaUploadParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPrivateMessageUploadMediaType
>
uploadMediaInChunks()
static
uploadMediaInChunks(data
,config?
):Promise
<SCPrivateMessageUploadMediaChunkType
>
Parameters
Parameter | Type |
---|---|
data | MessageMediaChunksParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPrivateMessageUploadMediaChunkType
>
uploadThumbnail()
static
uploadThumbnail(data
,config?
):Promise
<SCPrivateMessageUploadThumbnailType
>
Parameters
Parameter | Type |
---|---|
data | MessageThumbnailUploadParams |
config? | AxiosRequestConfig |
Returns
Promise
<SCPrivateMessageUploadThumbnailType
>