TracePushResponseUnmarshaller.cs 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. using Aliyun.Acs.Core.Transform;
  20. using Aliyun.Acs.Push.Model.V20160801;
  21. using System;
  22. using System.Collections.Generic;
  23. namespace Aliyun.Acs.Push.Transform.V20160801
  24. {
  25. public class TracePushResponseUnmarshaller
  26. {
  27. public static TracePushResponse Unmarshall(UnmarshallerContext context)
  28. {
  29. TracePushResponse tracePushResponse = new TracePushResponse();
  30. tracePushResponse.HttpResponse = context.HttpResponse;
  31. tracePushResponse.RequestId = context.StringValue("TracePush.RequestId");
  32. TracePushResponse.PushBasicInfo_ pushBasicInfo = new TracePushResponse.PushBasicInfo_();
  33. pushBasicInfo.AppId = context.LongValue("TracePush.PushBasicInfo.AppId");
  34. pushBasicInfo.Title = context.StringValue("TracePush.PushBasicInfo.Title");
  35. pushBasicInfo.TargetType = context.StringValue("TracePush.PushBasicInfo.TargetType");
  36. pushBasicInfo.PushType = context.StringValue("TracePush.PushBasicInfo.PushType");
  37. pushBasicInfo.PushTime = context.StringValue("TracePush.PushBasicInfo.PushTime");
  38. pushBasicInfo.ExpireTime = context.StringValue("TracePush.PushBasicInfo.ExpireTime");
  39. tracePushResponse.PushBasicInfo = pushBasicInfo;
  40. TracePushResponse.PushTaskInfo_ pushTaskInfo = new TracePushResponse.PushTaskInfo_();
  41. pushTaskInfo.Broadcast = context.BooleanValue("TracePush.PushTaskInfo.Broadcast");
  42. pushTaskInfo.AcceptTime = context.StringValue("TracePush.PushTaskInfo.AcceptTime");
  43. pushTaskInfo.AndroidTaskStatus = context.StringValue("TracePush.PushTaskInfo.AndroidTaskStatus");
  44. pushTaskInfo.IOSTaskStatus = context.StringValue("TracePush.PushTaskInfo.IOSTaskStatus");
  45. pushTaskInfo.AndroidTaskErrCode = context.StringValue("TracePush.PushTaskInfo.AndroidTaskErrCode");
  46. pushTaskInfo.IOSTaskErrCode = context.StringValue("TracePush.PushTaskInfo.IOSTaskErrCode");
  47. List<string> deviceSet = new List<string>();
  48. for (int i = 0; i < context.Length("TracePush.PushTaskInfo.DeviceSet.Length"); i++) {
  49. deviceSet.Add(context.StringValue("TracePush.PushTaskInfo.DeviceSet["+ i +"]"));
  50. }
  51. pushTaskInfo.DeviceSet = deviceSet;
  52. tracePushResponse.PushTaskInfo = pushTaskInfo;
  53. TracePushResponse.PushDeviceInfo_ pushDeviceInfo = new TracePushResponse.PushDeviceInfo_();
  54. pushDeviceInfo.Online = context.BooleanValue("TracePush.PushDeviceInfo.Online");
  55. pushDeviceInfo.CreateTime = context.StringValue("TracePush.PushDeviceInfo.CreateTime");
  56. pushDeviceInfo.SentTime = context.StringValue("TracePush.PushDeviceInfo.SentTime");
  57. pushDeviceInfo.ArriveTime = context.StringValue("TracePush.PushDeviceInfo.ArriveTime");
  58. pushDeviceInfo.ClickTime = context.StringValue("TracePush.PushDeviceInfo.ClickTime");
  59. pushDeviceInfo.CleanTime = context.StringValue("TracePush.PushDeviceInfo.CleanTime");
  60. pushDeviceInfo.DeviceStatus = context.StringValue("TracePush.PushDeviceInfo.DeviceStatus");
  61. pushDeviceInfo.DeviceErrCode = context.StringValue("TracePush.PushDeviceInfo.DeviceErrCode");
  62. tracePushResponse.PushDeviceInfo = pushDeviceInfo;
  63. return tracePushResponse;
  64. }
  65. }
  66. }