Skip to content

Commit b6093d9

Browse files
irvinesundayMIchaelMainer
authored andcommitted
Fixed spacing indentation (#204)
* Updating template with response headers fix New changes will propagate the fix for having response headers and status codes in request objects when UpdateAsync method is called in entities * Adding exception description to documentation * Adding and refactoring exception documentation - Adding the exception documentation in IEntityRequest.Base - Refactoring in EntityRequest.Base to include this if includeSendParams == true so that it shows in the async UpdateAsync() method. * Space Indentation Fixes
1 parent ed77c7d commit b6093d9

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

Templates/CSharp/Base/EntityRequest.Base.template.tt

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ public void AppendUpdateAsyncHeader(string entityName, string lowerCaseEntityNam
350350
{
351351
stringBuilder.Append(Environment.NewLine);
352352
stringBuilder.Append(" /// <param name=\"cancellationToken\">The <see cref=\"CancellationToken\"/> for the request.</param>");
353-
stringBuilder.Append(Environment.NewLine);
354-
stringBuilder.Append(" /// <exception cref=\"ClientException\">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>");
353+
stringBuilder.Append(Environment.NewLine);
354+
stringBuilder.Append(" /// <exception cref=\"ClientException\">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>");
355355
}
356356

357357
stringBuilder.Append(Environment.NewLine);
@@ -419,6 +419,32 @@ public string GetEntityUpdateAsyncMethod(OdcmClass odcmClass, bool initializeCol
419419
stringBuilder.Append(Environment.NewLine);
420420
stringBuilder.Append(" }");
421421
stringBuilder.Append(Environment.NewLine);
422+
stringBuilder.AppendFormat(" if ({0}ToUpdate.AdditionalData != null)", lowerCaseEntityName);
423+
stringBuilder.Append(Environment.NewLine);
424+
stringBuilder.Append(" {");
425+
stringBuilder.Append(Environment.NewLine);
426+
stringBuilder.AppendFormat(" if ({0}ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||", lowerCaseEntityName);
427+
stringBuilder.Append(Environment.NewLine);
428+
stringBuilder.AppendFormat(" {0}ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))", lowerCaseEntityName);
429+
stringBuilder.Append(Environment.NewLine);
430+
stringBuilder.Append(" {");
431+
stringBuilder.Append(Environment.NewLine);
432+
stringBuilder.Append(" throw new ClientException(");
433+
stringBuilder.Append(Environment.NewLine);
434+
stringBuilder.Append(" new Error");
435+
stringBuilder.Append(Environment.NewLine);
436+
stringBuilder.Append(" {");
437+
stringBuilder.Append(Environment.NewLine);
438+
stringBuilder.Append(" Code = GeneratedErrorConstants.Codes.NotAllowed,");
439+
stringBuilder.Append(Environment.NewLine);
440+
stringBuilder.AppendFormat(" Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, {0}ToUpdate.GetType().Name)", lowerCaseEntityName);
441+
stringBuilder.Append(Environment.NewLine);
442+
stringBuilder.Append(" });");
443+
stringBuilder.Append(Environment.NewLine);
444+
stringBuilder.Append(" }");
445+
stringBuilder.Append(Environment.NewLine);
446+
stringBuilder.Append(" }");
447+
stringBuilder.Append(Environment.NewLine);
422448
stringBuilder.AppendFormat(" this.ContentType = \"{0}\";", templateWriter.jsonContentType);
423449
stringBuilder.Append(Environment.NewLine);
424450
stringBuilder.Append(" this.Method = \"PATCH\";");

Templates/CSharp/Base/IEntityRequest.Base.template.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ public void AppendUpdateAsyncMethodHeader(string entityName, string lowerCaseEnt
274274
{
275275
stringBuilder.Append(Environment.NewLine);
276276
stringBuilder.Append(" /// <param name=\"cancellationToken\">The <see cref=\"CancellationToken\"/> for the request.</param>");
277-
stringBuilder.Append(Environment.NewLine);
278-
stringBuilder.Append(" /// <exception cref=\"ClientException\">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>");
279-
}
277+
stringBuilder.Append(Environment.NewLine);
278+
stringBuilder.Append(" /// <exception cref=\"ClientException\">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>");
279+
}
280280

281281
stringBuilder.Append(Environment.NewLine);
282282
stringBuilder.AppendFormat(" /// <returns>The updated {0}.</returns>", entityName);

0 commit comments

Comments
 (0)