Skip to content

Commit

Permalink
renamed topElementStyle to top_element_style
Browse files Browse the repository at this point in the history
  • Loading branch information
chentsulin committed Aug 28, 2017
1 parent b925fd2 commit 6840ec7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
14 changes: 11 additions & 3 deletions packages/messaging-api-messenger/README.md
Expand Up @@ -360,6 +360,8 @@ Value: `horizontal | square`

###### options

Type: `Object`

###### options.tag

Type: `String`
Expand Down Expand Up @@ -404,7 +406,7 @@ client.sendGenericTemplate(
);
```

#### sendListTemplate(userId, items, buttons, topElementStyle) - [Official Docs](https://developers.facebook.com/docs/messenger-platform/send-api-reference/list-template)
#### sendListTemplate(userId, items, buttons, options) - [Official Docs](https://developers.facebook.com/docs/messenger-platform/send-api-reference/list-template)

<img src="https://scontent-tpe1-1.xx.fbcdn.net/v/t39.2365-6/14858155_1136082199802015_362293724211838976_n.png?oh=46900eb955ff8ea1040fc5353d9be2fa&oe=59F245DD" alt="sendListTemplate" width="500" />

Expand All @@ -422,9 +424,15 @@ Type: `Array<Object>`

Type: `Array<Object>`

###### topElementStyle
###### options

Type: `Object`

###### options.top_element_style

Type: `String`
Value: `large | compact`
Default: `large`

```js
client.sendListTemplate(
Expand Down Expand Up @@ -460,7 +468,7 @@ client.sendListTemplate(
payload: 'USER_DEFINED_PAYLOAD',
},
],
'compact'
{ top_element_style: 'compact' }
);
```

Expand Down
4 changes: 2 additions & 2 deletions packages/messaging-api-messenger/src/MessengerClient.js
Expand Up @@ -534,13 +534,13 @@ export default class MessengerClient {
recipient: UserID | Recipient,
elements: Array<TemplateElement>,
buttons: Array<TemplateButton>,
topElementStyle: string = 'large'
options?: { top_element_style?: 'large' | 'compact' } = {}
): Promise<SendMessageSucessResponse> =>
this.sendTemplate(recipient, {
template_type: 'list',
elements,
buttons,
top_element_style: topElementStyle,
top_element_style: options.top_element_style || 'large',
});

// https://developers.facebook.com/docs/messenger-platform/open-graph-template
Expand Down
Expand Up @@ -2065,13 +2065,13 @@ describe('send api', () => {
payload: 'USER_DEFINED_PAYLOAD',
},
],
'compact'
{ top_element_style: 'compact' }
);

expect(res).toEqual(reply);
});

it('should use topElementStyle default value', async () => {
it('should use top_element_style default value', async () => {
const { client, mock } = createMock();

const reply = {
Expand Down

0 comments on commit 6840ec7

Please sign in to comment.