Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape new line characters during snippet generation #1016

Closed
Tracked by #96
rkodev opened this issue May 30, 2022 · 0 comments · Fixed by #1008
Closed
Tracked by #96

Escape new line characters during snippet generation #1016

rkodev opened this issue May 30, 2022 · 0 comments · Fixed by #1008
Assignees

Comments

@rkodev
Copy link
Contributor

rkodev commented May 30, 2022

Escape new line characters when generation snippets with possible new line characters

Sample Link : https://docs.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-beta&tabs=go

Expected

const graphServiceClient = GraphServiceClient.init({authProvider});

const requestBody : ChatMessage = {
	subject : null,
	body : {
		contentType : BodyType.Html,
		content : "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>",
	},
	attachments : [
		{
			id : "74d20c7f34aa4a7fb74e2b30004247c5",
			contentType : "application/vnd.microsoft.card.thumbnail",
			contentUrl : null,
			content : "{\r\n  \"title\": \"This is an example of posting a card\",\r\n  \"subtitle\": \"<h3>This is the subtitle</h3>\",\r\n  \"text\": \"Here is some body text. <br>\r\nAnd a <a href=\\"http://microsoft.com/\\">hyperlink</a>. <br>\r\nAnd below that is some buttons:\",\r\n  \"buttons\": [\r\n    {\r\n      \"type\": \"messageBack\",\r\n      \"title\": \"Login to FakeBot\",\r\n      \"text\": \"login\",\r\n      \"displayText\": \"login\",\r\n      \"value\": \"login\"\r\n    }\r\n  ]\r\n}",
			name : null,
			thumbnailUrl : null,
		},
	],
};

const result = async () => {
	await graphServiceClient.teamsById("team-id").channelsById("channel-id").messages.post(requestBody);
}
@rkodev rkodev self-assigned this May 30, 2022
@rkodev rkodev transferred this issue from microsoftgraph/msgraph-sdk-typescript May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant