Reddit.NET  1.5
Reddit.NET is a .NET Standard library that provides easy access to the Reddit API with virtually no boilerplate code required.
Reddit.Models.Widgets Class Reference
Inheritance diagram for Reddit.Models.Widgets:
Reddit.Models.BaseModel Reddit.Models.Internal.Request

Public Member Functions

 Widgets (string appId, string appSecret, string refreshToken, string accessToken, ref RestClient restClient, string deviceId=null, string userAgent=null)
 
Add< T > (string json, string subreddit=null)
 Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
WidgetTextArea Add (WidgetTextArea widgetTextArea, string subreddit=null)
 Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
WidgetCalendar Add (WidgetCalendar widgetCalendar, string subreddit=null)
 Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
WidgetCommunityListDetailed Add (WidgetCommunityList widgetCommunityList, string subreddit=null)
 Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
void Delete (string widgetId, string subreddit=null)
 Delete a widget from the specified subreddit (if it exists). More...
 
Update< T > (string widgetId, string json, string subreddit=null)
 Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
WidgetTextArea Update (string widgetId, WidgetTextArea widgetTextArea, string subreddit=null)
 Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
WidgetCalendar Update (string widgetId, WidgetCalendar widgetCalendar, string subreddit=null)
 Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
WidgetCommunityList Update (string widgetId, WidgetCommunityList widgetCommunityList, string subreddit=null)
 Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind. More...
 
object WidgetImageUploadS3 (string filePath, string mimeType)
 Acquire and return an upload lease to s3 temp bucket. The return value of this function is a json object containing credentials for uploading assets to S3 bucket, S3 url for upload request and the key to use for uploading. Using this lease the client will upload the emoji image to S3 temp bucket (included as part of the S3 URL). This lease is used by S3 to verify that the upload is authorized. More...
 
void UpdateOrder (string section, string json, string subreddit=null)
 Update the order of widget_ids in the specified subreddit. More...
 
void UpdateOrder (string section, List< string > widgetIds, string subreddit=null)
 Update the order of widget_ids in the specified subreddit. More...
 
WidgetResults Get (bool progressiveImages, string subreddit=null)
 Return all widgets for the given subreddit. More...
 
- Public Member Functions inherited from Reddit.Models.BaseModel
 BaseModel (string appId, string appSecret, string refreshToken, string accessToken, ref RestClient restClient, string deviceId=null, string userAgent=null)
 
string Sr (string subreddit)
 
- Public Member Functions inherited from Reddit.Models.Internal.Request
 Request (string appId, string appSecret, string refreshToken, string accessToken, ref RestClient restClient, string deviceId=null, string userAgent=null)
 
SendRequest< T > (string url, dynamic parameters, Method method=Method.GET, string contentType="application/x-www-form-urlencoded")
 
async Task< T > SendRequestAsync< T > (string url, dynamic parameters, Method method=Method.GET, string contentType="application/x-www-form-urlencoded")
 
RestRequest PrepareIDRequest (string path, string id, Method method=Method.POST)
 
RestRequest PrepareJSONRequest (string path, Method method=Method.POST)
 
RestRequest PrepareRequest (string url, Method method=Method.GET, string contentType="application/x-www-form-urlencoded")
 
RestRequest PrepareRequest (string url, Method method, List< Parameter > parameters, List< FileParameter > files, string contentType="application/x-www-form-urlencoded")
 
RestRequest PrepareRequest (RestRequest restRequest, string contentType="application/x-www-form-urlencoded")
 
string GetVersion ()
 
string ExecuteRequest (string url, Method method=Method.GET)
 
async Task< string > ExecuteRequestAsync (string url, Method method=Method.GET)
 
string ExecuteRequest (RestRequest restRequest)
 
async Task< string > ExecuteRequestAsync (RestRequest restRequest)
 
void UpdateAccessToken (string accessToken)
 
void UpdateRequests (List< DateTime > requests)
 
void AddParamIfNotNull (string name, dynamic value, ref RestRequest restRequest)
 

Additional Inherited Members

- Protected Member Functions inherited from Reddit.Models.Internal.Request
virtual void OnTokenUpdated (TokenUpdateEventArgs e)
 
virtual void OnRequestsUpdated (RequestsUpdateEventArgs e)
 
- Events inherited from Reddit.Models.Internal.Request
EventHandler< TokenUpdateEventArgsTokenUpdated
 
EventHandler< RequestsUpdateEventArgsRequestsUpdated
 

Constructor & Destructor Documentation

◆ Widgets()

Reddit.Models.Widgets.Widgets ( string  appId,
string  appSecret,
string  refreshToken,
string  accessToken,
ref RestClient  restClient,
string  deviceId = null,
string  userAgent = null 
)

Member Function Documentation

◆ Add() [1/3]

WidgetCalendar Reddit.Models.Widgets.Add ( WidgetCalendar  widgetCalendar,
string  subreddit = null 
)

Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
widgetCalendarSee https://www.reddit.com/dev/api/#POST_api_widget for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ Add() [2/3]

WidgetCommunityListDetailed Reddit.Models.Widgets.Add ( WidgetCommunityList  widgetCommunityList,
string  subreddit = null 
)

Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
widgetCommunityListSee https://www.reddit.com/dev/api/#POST_api_widget for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ Add() [3/3]

WidgetTextArea Reddit.Models.Widgets.Add ( WidgetTextArea  widgetTextArea,
string  subreddit = null 
)

Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
widgetTextAreaSee https://www.reddit.com/dev/api/#POST_api_widget for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ Add< T >()

T Reddit.Models.Widgets.Add< T > ( string  json,
string  subreddit = null 
)

Add and return a widget to the specified subreddit. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
jsonSee https://www.reddit.com/dev/api/#POST_api_widget for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ Delete()

void Reddit.Models.Widgets.Delete ( string  widgetId,
string  subreddit = null 
)

Delete a widget from the specified subreddit (if it exists).

Parameters
widgetIdid of an existing widget
subredditThe subreddit with the widgets

◆ Get()

WidgetResults Reddit.Models.Widgets.Get ( bool  progressiveImages,
string  subreddit = null 
)

Return all widgets for the given subreddit.

Parameters
progressiveImagesboolean value
subredditThe subreddit with the widgets
Returns
The requested widgets.

◆ Update() [1/3]

WidgetCalendar Reddit.Models.Widgets.Update ( string  widgetId,
WidgetCalendar  widgetCalendar,
string  subreddit = null 
)

Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
widgetIda valid widget id
widgetCalendarSee https://www.reddit.com/dev/api/#PUT_api_widget_{widget_id} for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ Update() [2/3]

WidgetCommunityList Reddit.Models.Widgets.Update ( string  widgetId,
WidgetCommunityList  widgetCommunityList,
string  subreddit = null 
)

Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
widgetIda valid widget id
widgetCommunityListSee https://www.reddit.com/dev/api/#PUT_api_widget_{widget_id} for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ Update() [3/3]

WidgetTextArea Reddit.Models.Widgets.Update ( string  widgetId,
WidgetTextArea  widgetTextArea,
string  subreddit = null 
)

Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
widgetIda valid widget id
widgetTextAreaSee https://www.reddit.com/dev/api/#PUT_api_widget_{widget_id} for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ Update< T >()

T Reddit.Models.Widgets.Update< T > ( string  widgetId,
string  json,
string  subreddit = null 
)

Update and return the data of a widget. Accepts a JSON payload representing the widget data to be saved. Valid payloads differ in shape based on the "kind" attribute passed on the root object, which must be a valid widget kind.

Parameters
widgetIda valid widget id
jsonSee https://www.reddit.com/dev/api/#PUT_api_widget_{widget_id} for expected format
subredditThe subreddit with the widgets
Returns
The result payload.

◆ UpdateOrder() [1/2]

void Reddit.Models.Widgets.UpdateOrder ( string  section,
List< string >  widgetIds,
string  subreddit = null 
)

Update the order of widget_ids in the specified subreddit.

Parameters
sectionone of (sidebar)
widgetIdsa list of widget ids
subredditThe subreddit with the widgets

◆ UpdateOrder() [2/2]

void Reddit.Models.Widgets.UpdateOrder ( string  section,
string  json,
string  subreddit = null 
)

Update the order of widget_ids in the specified subreddit.

Parameters
sectionone of (sidebar)
jsonjson data: [ a string, ... ]
subredditThe subreddit with the widgets

◆ WidgetImageUploadS3()

object Reddit.Models.Widgets.WidgetImageUploadS3 ( string  filePath,
string  mimeType 
)

Acquire and return an upload lease to s3 temp bucket. The return value of this function is a json object containing credentials for uploading assets to S3 bucket, S3 url for upload request and the key to use for uploading. Using this lease the client will upload the emoji image to S3 temp bucket (included as part of the S3 URL). This lease is used by S3 to verify that the upload is authorized.

Parameters
filePathname and extension of the image file e.g. image1.png
mimeTypemime type of the image e.g. image/png
Returns
(TODO - Untested)

The documentation for this class was generated from the following file: