Skip to content

Commit cf41b04

Browse files
author
Doug Black
committed
Regenerate
1 parent e57b1d2 commit cf41b04

File tree

9 files changed

+1455
-0
lines changed

9 files changed

+1455
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/// This code was generated by
2+
/// \ / _ _ _| _ _
3+
/// | (_)\/(_)(_|\/| |(/_ v1.0.0
4+
/// / /
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using Twilio.Base;
9+
using Twilio.Converters;
10+
11+
namespace Twilio.Rest.Sync.V1.Service.SyncStream
12+
{
13+
14+
/// <summary>
15+
/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16+
///
17+
/// Create a new Stream Message.
18+
/// </summary>
19+
public class CreateStreamMessageOptions : IOptions<StreamMessageResource>
20+
{
21+
/// <summary>
22+
/// The service_sid
23+
/// </summary>
24+
public string PathServiceSid { get; }
25+
/// <summary>
26+
/// The stream_sid
27+
/// </summary>
28+
public string PathStreamSid { get; }
29+
/// <summary>
30+
/// Stream Message body.
31+
/// </summary>
32+
public object Data { get; }
33+
34+
/// <summary>
35+
/// Construct a new CreateStreamMessageOptions
36+
/// </summary>
37+
///
38+
/// <param name="pathServiceSid"> The service_sid </param>
39+
/// <param name="pathStreamSid"> The stream_sid </param>
40+
/// <param name="data"> Stream Message body. </param>
41+
public CreateStreamMessageOptions(string pathServiceSid, string pathStreamSid, object data)
42+
{
43+
PathServiceSid = pathServiceSid;
44+
PathStreamSid = pathStreamSid;
45+
Data = data;
46+
}
47+
48+
/// <summary>
49+
/// Generate the necessary parameters
50+
/// </summary>
51+
public List<KeyValuePair<string, string>> GetParams()
52+
{
53+
var p = new List<KeyValuePair<string, string>>();
54+
if (Data != null)
55+
{
56+
p.Add(new KeyValuePair<string, string>("Data", Serializers.JsonObject(Data)));
57+
}
58+
59+
return p;
60+
}
61+
}
62+
63+
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/// This code was generated by
2+
/// \ / _ _ _| _ _
3+
/// | (_)\/(_)(_|\/| |(/_ v1.0.0
4+
/// / /
5+
/// <summary>
6+
/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
7+
///
8+
/// StreamMessageResource
9+
/// </summary>
10+
11+
using Newtonsoft.Json;
12+
using System;
13+
using System.Collections.Generic;
14+
using Twilio.Base;
15+
using Twilio.Clients;
16+
using Twilio.Converters;
17+
using Twilio.Exceptions;
18+
using Twilio.Http;
19+
20+
namespace Twilio.Rest.Sync.V1.Service.SyncStream
21+
{
22+
23+
public class StreamMessageResource : Resource
24+
{
25+
private static Request BuildCreateRequest(CreateStreamMessageOptions options, ITwilioRestClient client)
26+
{
27+
return new Request(
28+
HttpMethod.Post,
29+
Rest.Domain.Sync,
30+
"/v1/Services/" + options.PathServiceSid + "/Streams/" + options.PathStreamSid + "/Messages",
31+
client.Region,
32+
postParams: options.GetParams()
33+
);
34+
}
35+
36+
/// <summary>
37+
/// Create a new Stream Message.
38+
/// </summary>
39+
///
40+
/// <param name="options"> Create StreamMessage parameters </param>
41+
/// <param name="client"> Client to make requests to Twilio </param>
42+
/// <returns> A single instance of StreamMessage </returns>
43+
public static StreamMessageResource Create(CreateStreamMessageOptions options, ITwilioRestClient client = null)
44+
{
45+
client = client ?? TwilioClient.GetRestClient();
46+
var response = client.Request(BuildCreateRequest(options, client));
47+
return FromJson(response.Content);
48+
}
49+
50+
#if !NET35
51+
/// <summary>
52+
/// Create a new Stream Message.
53+
/// </summary>
54+
///
55+
/// <param name="options"> Create StreamMessage parameters </param>
56+
/// <param name="client"> Client to make requests to Twilio </param>
57+
/// <returns> Task that resolves to A single instance of StreamMessage </returns>
58+
public static async System.Threading.Tasks.Task<StreamMessageResource> CreateAsync(CreateStreamMessageOptions options, ITwilioRestClient client = null)
59+
{
60+
client = client ?? TwilioClient.GetRestClient();
61+
var response = await client.RequestAsync(BuildCreateRequest(options, client));
62+
return FromJson(response.Content);
63+
}
64+
#endif
65+
66+
/// <summary>
67+
/// Create a new Stream Message.
68+
/// </summary>
69+
///
70+
/// <param name="pathServiceSid"> The service_sid </param>
71+
/// <param name="pathStreamSid"> The stream_sid </param>
72+
/// <param name="data"> Stream Message body. </param>
73+
/// <param name="client"> Client to make requests to Twilio </param>
74+
/// <returns> A single instance of StreamMessage </returns>
75+
public static StreamMessageResource Create(string pathServiceSid, string pathStreamSid, object data, ITwilioRestClient client = null)
76+
{
77+
var options = new CreateStreamMessageOptions(pathServiceSid, pathStreamSid, data);
78+
return Create(options, client);
79+
}
80+
81+
#if !NET35
82+
/// <summary>
83+
/// Create a new Stream Message.
84+
/// </summary>
85+
///
86+
/// <param name="pathServiceSid"> The service_sid </param>
87+
/// <param name="pathStreamSid"> The stream_sid </param>
88+
/// <param name="data"> Stream Message body. </param>
89+
/// <param name="client"> Client to make requests to Twilio </param>
90+
/// <returns> Task that resolves to A single instance of StreamMessage </returns>
91+
public static async System.Threading.Tasks.Task<StreamMessageResource> CreateAsync(string pathServiceSid, string pathStreamSid, object data, ITwilioRestClient client = null)
92+
{
93+
var options = new CreateStreamMessageOptions(pathServiceSid, pathStreamSid, data);
94+
return await CreateAsync(options, client);
95+
}
96+
#endif
97+
98+
/// <summary>
99+
/// Converts a JSON string into a StreamMessageResource object
100+
/// </summary>
101+
///
102+
/// <param name="json"> Raw JSON string </param>
103+
/// <returns> StreamMessageResource object represented by the provided JSON </returns>
104+
public static StreamMessageResource FromJson(string json)
105+
{
106+
// Convert all checked exceptions to Runtime
107+
try
108+
{
109+
return JsonConvert.DeserializeObject<StreamMessageResource>(json);
110+
}
111+
catch (JsonException e)
112+
{
113+
throw new ApiException(e.Message, e);
114+
}
115+
}
116+
117+
/// <summary>
118+
/// Stream Message SID.
119+
/// </summary>
120+
[JsonProperty("sid")]
121+
public string Sid { get; private set; }
122+
/// <summary>
123+
/// Stream Message body.
124+
/// </summary>
125+
[JsonProperty("data")]
126+
public object Data { get; private set; }
127+
128+
private StreamMessageResource()
129+
{
130+
131+
}
132+
}
133+
134+
}
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/// This code was generated by
2+
/// \ / _ _ _| _ _
3+
/// | (_)\/(_)(_|\/| |(/_ v1.0.0
4+
/// / /
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using Twilio.Base;
9+
using Twilio.Converters;
10+
11+
namespace Twilio.Rest.Sync.V1.Service
12+
{
13+
14+
/// <summary>
15+
/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16+
///
17+
/// Fetch a specific Stream.
18+
/// </summary>
19+
public class FetchSyncStreamOptions : IOptions<SyncStreamResource>
20+
{
21+
/// <summary>
22+
/// The service_sid
23+
/// </summary>
24+
public string PathServiceSid { get; }
25+
/// <summary>
26+
/// Stream SID or unique name.
27+
/// </summary>
28+
public string PathSid { get; }
29+
30+
/// <summary>
31+
/// Construct a new FetchSyncStreamOptions
32+
/// </summary>
33+
///
34+
/// <param name="pathServiceSid"> The service_sid </param>
35+
/// <param name="pathSid"> Stream SID or unique name. </param>
36+
public FetchSyncStreamOptions(string pathServiceSid, string pathSid)
37+
{
38+
PathServiceSid = pathServiceSid;
39+
PathSid = pathSid;
40+
}
41+
42+
/// <summary>
43+
/// Generate the necessary parameters
44+
/// </summary>
45+
public List<KeyValuePair<string, string>> GetParams()
46+
{
47+
var p = new List<KeyValuePair<string, string>>();
48+
return p;
49+
}
50+
}
51+
52+
/// <summary>
53+
/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
54+
///
55+
/// Delete a specific Stream.
56+
/// </summary>
57+
public class DeleteSyncStreamOptions : IOptions<SyncStreamResource>
58+
{
59+
/// <summary>
60+
/// The service_sid
61+
/// </summary>
62+
public string PathServiceSid { get; }
63+
/// <summary>
64+
/// Stream SID or unique name.
65+
/// </summary>
66+
public string PathSid { get; }
67+
68+
/// <summary>
69+
/// Construct a new DeleteSyncStreamOptions
70+
/// </summary>
71+
///
72+
/// <param name="pathServiceSid"> The service_sid </param>
73+
/// <param name="pathSid"> Stream SID or unique name. </param>
74+
public DeleteSyncStreamOptions(string pathServiceSid, string pathSid)
75+
{
76+
PathServiceSid = pathServiceSid;
77+
PathSid = pathSid;
78+
}
79+
80+
/// <summary>
81+
/// Generate the necessary parameters
82+
/// </summary>
83+
public List<KeyValuePair<string, string>> GetParams()
84+
{
85+
var p = new List<KeyValuePair<string, string>>();
86+
return p;
87+
}
88+
}
89+
90+
/// <summary>
91+
/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
92+
///
93+
/// Create a new Stream.
94+
/// </summary>
95+
public class CreateSyncStreamOptions : IOptions<SyncStreamResource>
96+
{
97+
/// <summary>
98+
/// The service_sid
99+
/// </summary>
100+
public string PathServiceSid { get; }
101+
/// <summary>
102+
/// Stream unique name.
103+
/// </summary>
104+
public string UniqueName { get; set; }
105+
106+
/// <summary>
107+
/// Construct a new CreateSyncStreamOptions
108+
/// </summary>
109+
///
110+
/// <param name="pathServiceSid"> The service_sid </param>
111+
public CreateSyncStreamOptions(string pathServiceSid)
112+
{
113+
PathServiceSid = pathServiceSid;
114+
}
115+
116+
/// <summary>
117+
/// Generate the necessary parameters
118+
/// </summary>
119+
public List<KeyValuePair<string, string>> GetParams()
120+
{
121+
var p = new List<KeyValuePair<string, string>>();
122+
if (UniqueName != null)
123+
{
124+
p.Add(new KeyValuePair<string, string>("UniqueName", UniqueName));
125+
}
126+
127+
return p;
128+
}
129+
}
130+
131+
/// <summary>
132+
/// PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
133+
///
134+
/// Retrieve a list of all Streams in a Service Instance.
135+
/// </summary>
136+
public class ReadSyncStreamOptions : ReadOptions<SyncStreamResource>
137+
{
138+
/// <summary>
139+
/// The service_sid
140+
/// </summary>
141+
public string PathServiceSid { get; }
142+
143+
/// <summary>
144+
/// Construct a new ReadSyncStreamOptions
145+
/// </summary>
146+
///
147+
/// <param name="pathServiceSid"> The service_sid </param>
148+
public ReadSyncStreamOptions(string pathServiceSid)
149+
{
150+
PathServiceSid = pathServiceSid;
151+
}
152+
153+
/// <summary>
154+
/// Generate the necessary parameters
155+
/// </summary>
156+
public override List<KeyValuePair<string, string>> GetParams()
157+
{
158+
var p = new List<KeyValuePair<string, string>>();
159+
if (PageSize != null)
160+
{
161+
p.Add(new KeyValuePair<string, string>("PageSize", PageSize.ToString()));
162+
}
163+
164+
return p;
165+
}
166+
}
167+
168+
}

0 commit comments

Comments
 (0)