0.0.46 • Published 3 years ago

jquery-eclipsefdn-api v0.0.46

Weekly downloads
80
License
MIT
Repository
github
Last release
3 years ago

jquery-eclipsefdn-api Build Status

About

A jQuery plugin that fetches and display data from various Eclipse Foundation APIs.

Options

Here's a list of available settings.

$("div").eclipseFdnApi({
  username: "cguindon",
  type: "mpFavoritesCount"
});
AttributeTypeDefaultDescription
apiUrlStringhttps://api.eclipse.orgEclipse Api URL.
gerritUrlStringhttps://git.eclipse.org/rEclipse Gerrit URL.
eventUrlStringhttps://events.eclipse.org/data/EclipseEvents.jsonEclipse event json feed URL.
forumsUrlStringhttps://www.eclipse.org/forumsEclipse Forums URL.
marketplaceUrlStringhttps://marketplace.eclipse.orgEclipse Marketplace URL.
errorMsgString<i class=\"fa red fa-exclamation-triangle\" aria-hidden=\"true\"></i> An unexpected error has occurred.Error message for when the ajax request fails.
gerritUserNotFoundMsgString<i class=\"fa red fa-exclamation-triangle\" aria-hidden=\"true\"></i> An unexpected error has occurred.Error message for when a user is not found on Gerrit.
usernameStringcguindonThe username to fetch Eclipse Favorites or Gerrit reviews for.
currentUsernameString | The user making the request this page. Useful if content changed if the user is viewing his own page.
typeStringValid values are gerritReviews, gerritReviewsCount, mpFavorites, projectsList, forumsMsg and recentEvents.
itemsPerPageInteger20Number of fetched items to display per page.

Contributing

Check CONTRIBUTING.md for more information.

License

MIT License © Christopher Guindon

Thanks to https://github.com/jquery-boilerplate/jquery-boilerplate, MIT License © Zeno Rocha

jquery-eclipsefdn-igc README

About

A jQuery plugin to provide OAUTH2 Implicit Grant Flow authorization functionality for API requests to client scripts and plugins

Options

Here's an example of how to use the client.

// set delayed response handlers

// delayed request was completed after authorization, and these were the results
$(document).on("igcRequestComplete", function(event, eventData) {
  if (eventData.clientName === "myScript") {
    // returned result data will be stored in eventData.data
    // you can determine which request you made by checking eventData.requestOptions
  }
});

// delayed request failed
$(document).on("igcRequestFailed", function(event, eventError) {
  if (eventError.clientName === "myScript") {
    // request failed.  the details ajax response is stored in eventError.jqXHR
  }
});

// authorization failed (ie. authorization was denied or there was a validation failed)
$(document).on("igcAuthFailed", function(event, authError) {
  if (authError.clientName === "myScript") {
    // authError.error will show any status code, if available.
    // authError.error_description will contain a test description of what went wrong
    // authError.error_from will indicate which area in the processes the failure occured
  }
});

// initialize the client - any delayed responses will be triggered during initialization
$(document).eclipseFdnIgc({
  clientName: "myScript",
  authURL: "https://accounts.example.com",
  apiURL: "https://api.example.com",
  username: "darmstrong"
});

// make a request
requestOptions = {
  // api service end-point path
  path: "marketplace/favorites/12345",
  method: "PUT",
  cid: "myClientID",
  scope: "scopeToRequest",
  // callbacks are used for non-delayed responses (client already authorized) 
  // for immediate response without broadcasting to all clients
  successCallback: function(data) {
    // we can do something now and call a function script to process the data
  },
  errorCallback: function(jqXHR) {
    // the request failed.  status code and error message is in the jqXHR object
    // it is important to check the response to determine if this is a soft error (action already performed)
    // or if there is something wrong with the request that needs to be corrected before attempting again.
  }
};
// send the request to the eclipseFdnIgc plugin. If the client does not have an authorization token, or it has become expired,
// it will make a request for a new one.
$(document).eclipseFdnIgc.makeRequest(requestOptions);
AttributeTypeDefaultDescription
clientNameStringunknownIdentifying name for client. Used to separate stored items.
authUrlStringhttps://accounts.eclipse.orgEclipse Authorization base URL.
apiUrlStringhttps://api.eclipse.orgEclipse API base url.
redirectUriStringlocation.protocol, "//", location.host, "/site_login_implicit_grant".join("")redirect landing page for authorization response. defaults to current site and path of "/site_login_implicit_grant"
baseStorageNameStringeclipseIGCbase name to build storage name from.
redirectIfValidBooleantrueredirect to originating page after validating authorization response
validateUserBooleantrueValidates authorization token matches currently logged in user
useOpenWinBooleanfalseOpens a new window for authorization flow instead of using current window.
encodeStorageBooleantrueBase64 encode data placed in storage
userNameString''currently logged in username, used for validation purposes and to clear items if user logs out or other account is logged in
completeOnAuthorizationBooleantruefinish the request that triggered authorization after completing validation

License

MIT License © Christopher Guindon

Thanks to https://github.com/jquery-boilerplate/jquery-boilerplate, MIT License © Zeno Rocha

0.0.46

3 years ago

0.0.45

3 years ago

0.0.44

3 years ago

0.0.43

3 years ago

0.0.42

3 years ago

0.0.41

3 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.38

4 years ago

0.0.37

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.32

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.27

4 years ago

0.0.28

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.24

4 years ago