# Post

> **Package : spaceone.api.board.v1**

## Post

{% hint style="info" %}
**Post Methods:**
{% endhint %}

| Method                                       | Request                                             | Response                                                                                                           |
| -------------------------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create)                        | [CreatePostRequest](#createpostrequest)             | [PostInfo](#postinfo)                                                                                              |
| [**update**](#update)                        | [UpdatePostRequest](#updatepostrequest)             | [PostInfo](#postinfo)                                                                                              |
| [**send\_notification**](#send_notification) | [SendNotificationRequest](#sendnotificationrequest) | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**delete**](#delete)                        | [PostRequest](#postrequest)                         | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)                              | [GetPostRequest](#getpostrequest)                   | [PostInfo](#postinfo)                                                                                              |
| [**list**](#list)                            | [PostQuery](#postquery)                             | [PostsInfo](#postsinfo)                                                                                            |
| [**stat**](#stat)                            | [PostStatQuery](#poststatquery)                     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /board/v1/board/{board\_id}/posts

> Creates a new Post under a specific Board. You must specify the `board_id`, `title`, and `contents`. The parameter `category` is not required but can be set in the scope of `categories` specified in the parent Board. You can make the new Post pinned or pop up by adjusting the parameters.

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [CreatePostRequest](#createpostrequest) |
| Response | [PostInfo](#postinfo)                   |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "board_id": "board-123456789012",
    "category": "developer",
    "title": "title",
    "contents": "This is contents.",
    "options": {
        "is_popup": true
    },
    "writer": "user1",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "board_id": "board-123456789012",
    "post_id": "post-123456789012",
    "category": "developer",
    "title": "title",
    "contents": "This is contents.",
    "options": {
        "is_pinned": false,
        "is_popup": true
    },
    "view_count": 0,
    "writer": "user1",
    "scope": "DOMAIN",
    "domain_id": "domain-123456789012",
    "user_id": "user1@email.com",
    "created_at": "2022-01-01T01:06:23.732Z",
    "updated_at": "2022-01-01T01:06:23.732Z"
}
```

{% endtab %}
{% endtabs %}

### update

> **PUT** /board/v1/board/{board\_id}/post/{post\_id}

> Updates a specific Post. You can make changes in Post settings, except `board_id`, `post_id`, and `domain_id`.

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [UpdatePostRequest](#updatepostrequest) |
| Response | [PostInfo](#postinfo)                   |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "board_id": "board-123456789012",
    "post_id": "post-2118473ce15e",
    "category": "developer",
    "title": "title2",
    "contents": "this is contents2.",
    "options": {
        "is_popup": false,
        "is_pinned": true
    },
    "writer": "user1",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "board_id": "board-123456789012",
    "post_id": "post-123456789012",
    "category": "developer",
    "title": "title2",
    "contents": "this is contents2.",
    "options": {
        "is_popup": false,
        "is_pinned": true
    },
    "view_count": 1,
    "writer": "user1",
    "scope": "DOMAIN",
    "domain_id": "domain-123456789012",
    "user_id": "user1@email.com",
    "created_at": "2022-06-13T01:06:23.732Z",
    "updated_at": "2022-06-13T01:06:23.732Z"
}
```

{% endtab %}
{% endtabs %}

### send\_notification

> **POST** /board/v1/board/{board\_id}/post/{post\_id}/send-notification

> Not Implemented

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [SendNotificationRequest](#sendnotificationrequest)                                                              |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

### delete

> **DELETE** /board/v1/board/{board\_id}/post/{post\_id}

> Deletes a specific Post. You must specify the `post_id` of the Post to delete, and the `board_id` of the Board where the child Post to delete belongs.

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [PostRequest](#postrequest)                                                                                      |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "board_id": "board-b9aa34e65c60",
    "post_id": "post-2118473ce15e",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}
{% endtabs %}

### get

> **GET** /board/v1/board/{board\_id}/post/{post\_id}

> Gets a specific Post. You must specify the `post_id` of the Post to get, and the `board_id` of the Board where the child Post to get belongs. Prints detailed information about the Post.

| Type     | Message                           |
| -------- | --------------------------------- |
| Request  | [GetPostRequest](#getpostrequest) |
| Response | [PostInfo](#postinfo)             |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "board_id": "board-b9aa34e65c60",
    "post_id": "post-2118473ce15e",
    "domain_id": "domain-58010aa2e451"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "board_id": "board-b9aa34e65c60",
    "post_id": "post-2118473ce15e",
    "category": "flower",
    "title": "title",
    "contents": "this is contents.",
    "options": {
        "is_pinned": false,
        "is_popup": true
    },
    "view_count": 2,
    "writer": "seolmin",
    "scope": "DOMAIN",
    "domain_id": "domain-58010aa2e451",
    "user_id": "supervisor",
    "created_at": "2022-06-13T01:06:23.732Z",
    "updated_at": "2022-06-13T01:06:23.732Z"
}
```

{% endtab %}
{% endtabs %}

### list

> **GET** /board/v1/board/{board\_id}/posts
>
> **POST** /board/v1/board/{board\_id}/posts/search

> Gets a list of all Posts. You can use a query to get a filtered list of Posts.

| Type     | Message                 |
| -------- | ----------------------- |
| Request  | [PostQuery](#postquery) |
| Response | [PostsInfo](#postsinfo) |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "board_id": "board-b9aa34e65c60",
    "query": {}
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "results": [
        {
            "board_id": "board-b9aa34e65c60",
            "post_id": "post-2118473ce15e",
            "category": "spaceone",
            "title": "title2",
            "contents": "this is contents2.",
            "options": {
                "is_popup": false,
                "is_pinned": true
            },
            "view_count": 3,
            "writer": "seolmin2",
            "scope": "DOMAIN",
            "domain_id": "domain-58010aa2e451",
            "user_id": "user1@email.com",
            "created_at": "2022-06-13T01:06:23.732Z",
            "updated_at": "2022-06-13T01:06:23.732Z"
        },
        {
            "board_id": "board-b9aa34e65c60",
            "post_id": "post-532ae1191233",
            "category": "flower",
            "title": "\uc791\uc5c5\uacf5\uc9c0",
            "contents": "This is description",
            "options": {
                "is_pinned": true,
                "is_popup": true
            },
            "writer": "\uad8c\uc124\ubbfc",
            "user_id": "supervisor",
            "created_at": "2022-06-10T07:01:44.384Z",
            "updated_at": "2022-06-10T07:01:44.384Z"
        }
    ],
    "total_count": 2
}
```

{% endtab %}
{% endtabs %}

### stat

> **POST** /board/v1/board/{board\_id}/posts/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [PostStatQuery](#poststatquery)                                                                                    |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

##

## Message

### CreatePostRequest

| Field      | Type                                                                                                               | Required | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| board\_id  | string                                                                                                             |     ✔    |             |
| category   | string                                                                                                             |     ✘    |             |
| title      | string                                                                                                             |     ✔    |             |
| contents   | string                                                                                                             |     ✔    |             |
| options    | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| writer     | string                                                                                                             |     ✘    |             |
| domain\_id | string                                                                                                             |     ✘    |             |

### GetPostRequest

| Field      | Type           | Required | Description |
| ---------- | -------------- | :------: | ----------- |
| board\_id  | string         |     ✔    |             |
| post\_id   | string         |     ✔    |             |
| only       | list of string |     ✘    |             |
| domain\_id | string         |     ✘    |             |

### PostInfo

| Field            | Type                                                                                                               | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| board\_id        | string                                                                                                             |             |
| post\_id         | string                                                                                                             |             |
| category         | string                                                                                                             |             |
| title            | string                                                                                                             |             |
| contents         | string                                                                                                             |             |
| options          | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| view\_count      | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto)                    |             |
| writer           | string                                                                                                             |             |
| scope            | <ul><li>SYSTEM</li><li>DOMAIN</li></ul>                                                                            |             |
| domain\_id       | string                                                                                                             |             |
| user\_id         | string                                                                                                             |             |
| user\_domain\_id | string                                                                                                             |             |
| created\_at      | string                                                                                                             |             |
| updated\_at      | string                                                                                                             |             |

### PostQuery

| Field            | Type                                                                                               | Required | Description |
| ---------------- | -------------------------------------------------------------------------------------------------- | :------: | ----------- |
| board\_id        | string                                                                                             |     ✔    |             |
| post\_id         | string                                                                                             |     ✘    |             |
| category         | string                                                                                             |     ✘    |             |
| writer           | string                                                                                             |     ✘    |             |
| user\_id         | string                                                                                             |     ✘    |             |
| user\_domain\_id | string                                                                                             |     ✘    |             |
| domain\_id       | string                                                                                             |     ✘    |             |
| query            | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) |     ✘    |             |

### PostRequest

| Field      | Type   | Required | Description |
| ---------- | ------ | :------: | ----------- |
| board\_id  | string |     ✔    |             |
| post\_id   | string |     ✔    |             |
| domain\_id | string |     ✘    |             |

### PostStatQuery

| Field      | Type                                                                                                             | Required | Description |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    |             |
| domain\_id | string                                                                                                           |     ✔    |             |

### PostsInfo

| Field        | Type                                                                                            | Description |
| ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| results      | [list of PostInfo](#postinfo)                                                                   |             |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### SendNotificationRequest

| Field      | Type   | Required | Description |
| ---------- | ------ | :------: | ----------- |
| board\_id  | string |     ✔    |             |
| post\_id   | string |     ✔    |             |
| domain\_id | string |     ✘    |             |

### UpdatePostRequest

| Field      | Type                                                                                                               | Required | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| board\_id  | string                                                                                                             |     ✔    |             |
| post\_id   | string                                                                                                             |     ✔    |             |
| category   | string                                                                                                             |     ✘    |             |
| title      | string                                                                                                             |     ✘    |             |
| contents   | string                                                                                                             |     ✘    |             |
| options    | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| writer     | string                                                                                                             |     ✘    |             |
| domain\_id | string                                                                                                             |     ✘    |             |
