MJSU
Plugin API for uploading images to imgur.com

Supported Games

Configuration

{
  "Imgur Client ID": "https://api.imgur.com/oauth2/addclient"
}

Getting Client ID

  1. Create an account on Imgur
  2. Register your application
    A. Application Name: Pick any name you want
    B. Click the radio fields in this order

    C. Authorization Callback URL: ignore this field
    D. Application website: Ignore this field
    E. Email: enter your email
    F. Description enter any description
  3. Copy the Client Id to the client Id in the config.

Developer API

Input Data

Album Upload

Contains a list of images to be upload to imgur List<Hash<string, object>>

The hash has the following keys
Image - byte[] of the image to be uploaded
Title - Title of the image (Optional)
Description - Description of the image (Optional)

Returned Data

API Response

Returns the response from the API Call as a Hash<string, object>

The hash has the following keys
Status - HTTP Response code (int)
Success - Was the API call successful (bool)
Data - Data returned from the API call (Hash<string, object>)
Errors - List of all errors returned from the API (List<Hash<string, object>>)

Error Message

Contains the errors that the API returned as a List<Hash<string, object>>

The hash has the following keys
Id - ID of the error (string)
Code - Error Code (string)
Status - Errors Status (string)
Defailt - Details about the error (string)

Upload Response

Response returned to the calling plugin as a Hash<string, object> after a successful image upload

The hash has the following keys
Id - Id of the image (string)
DeleteHash - delete hash of the image (string)
Link - URL Link to the image (string)

Album Response

Response returned to the calling plugin as a Hash<string, object> after a successful album creation

The hash has the following keys
Id - Id of the Album (string)
DeleteHash - delete hash of the Album (string)
Link - URL Link to the Album (string)

Methods

Uploads an image to imgur
image - the byte[] of the image
callback - the action to call on the calling plugin after the upload occurs contains Api Response with Upload Response as the data from Returned Datatitle - title of the image (optional)
description - description of the image (optional)

private void UploadImage(byte[] image, Action<Hash<string, object>> callback, string title = null, string description = null)

Deletes an image from Imgur using the deletehash
deleteHash - deletehash of the image to be deleted
callback - the action to call on the calling plugin after the upload occurs contains Api Response as the data from Returned Data

private void DeleteSingleImage(string deleteHash, Action<Hash<string, object>> callback)

Uploads an album to imgur
images - List of images to be uploaded. Hash information can be found in Album Upload under Input Data
callback - the action to call on the calling plugin after uploading all the images and creating the album
The callback hash contains the Album Hash under the Album key with the images success under Image{index} key

private void UploadAlbum(List<Hash<string, object>> images, Action<Hash<string, Hash<string, object>>> callback, string title = null, string description = null)

Deletes an album from Imgur using the deletehash
deleteHash - deletehash of the album to be deleted
callback - the action to call on the calling plugin after the upload occurs contains Api Response as the data from Returned Data

private void DeleteAlbum(string deleteHash, Action<Hash<string, object>> callback)
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.