Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@ryb73/bs-google-apis
Advanced tools
A Bucklescript implementation of various Google REST APIs.
Very incomplete, unstable API. The published version may lag behind the GitHub repo – feel free to file a bug if this is the case.
npm i @ryb73/bs-google-apis
More info:
https://developers.google.com/identity/protocols/OAuth2UserAgent https://developers.google.com/identity/protocols/OpenIDConnect
Builds a URL to which you can redirect the user to begin the client-side OAuth2 flow.
let getAuthUrl:
(~state: string=?, ~accessType: accessType=?, ~prompt: prompt=?, string,
Js.Array.t(scope), string, responseType) => string;
GoogleApis.Auth.getAuthUrl(
~state="<STATE>", clientId, [| YouTube |],
"https://my.app/", Code);
/* https://accounts.google.com/o/oauth2/v2/auth?client_id=<CLIENT_ID>&redirect_uri=https%3A%2F%2Fmy.app%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&response_type=code&state=<STATE> */
Retrieves access and refresh tokens given an OAuth2 code.
type tokens = {
access_token: string,
refresh_token: option(string),
expires_in: int,
};
let getTokensFromCode:
(~accessType: accessType=?, string, string, string, string) =>
Js.Promise.t(tokens);
GoogleApis.Auth.getTokensFromCode("<client id>", "<client secret>", code, "https://my.app/");
Retrieve access and refresh tokens for a service account.
let getTokensForServiceAccount:
(Js.Array.t(scope), string, string) => Js.Promise.t(tokens);
GoogleApis.Auth.getTokensForServiceAccount([| Profile |], "me@my.app", "<private key>");
let refreshAccessToken:
(string, string, string) => Js.Promise.t(tokens);
GoogleApis.Auth.refreshAccessToken(clientId, secret, refreshToken);
More info: https://developers.google.com/people/api/rest/v1/people
type name = { displayName: string, };
type t = {
resourceName: string,
etag: string,
names: option(array(name)),
};
let getMe: (string, Js.Array.t(field)) => Js.Promise.t(t);
GoogleApis.People.getMe(accessToken, [| Names |]);
More info: https://developers.google.com/youtube/v3/docs/
In this section you can assume open GoogleApis.YouTube
is included.
Represents the parts of the resource that are being requested. The parts are typed such that the type of the response you get from an API call will match the parts
that you pass in.
let parts = PlaylistItems.(parts |> withSnippet);
PlaylistItems.listByPlaylistId(~parts, ~playlistId, accessToken);
/*
{
...,
items: [|
...,
{
id: "playlistitem123",
contentDetails: (), /* `contentDetails` is typed as unit because `withContentDetails` was omitted */
snippet: { /* while `snippet` is typed with the actual response data */
channelId: string,
channelTitle: string,
title: string,
description: string,
playlistId: string,
position: int,
}
}
|]
}
*/
type pageInfo = {
resultsPerPage: int,
totalResults: int,
};
type result('item) = {
items: array('item),
nextPageToken: option(string),
prevPageToken: option(string),
pageInfo: pageInfo,
};
let listByPlaylistId:
(~maxResults: int=?, ~pageToken: string=?,
~parts: parts('a, 'b), ~playlistId: string, string)
=> Js.Promise.t(List.result('a, 'b));
/* (see `parts` section above for example usage) */
let listById:
(~maxResults: int=?, ~parts: parts('a, 'b), ~ids: Js.Array.t(id),
string) => Js.Promise.t(List.result('a, 'b));
Playlists.listById(~parts, ~ids=[|"<playlist ID>"|], accessToken);
List the authenticated user's playlists.
let listMine:
(~maxResults: int=?, ~pageToken: string=?, ~parts: parts('a, 'b), string) =>
Js.Promise.t(List.result('a, 'b));
Playlists.listMine(~parts, accessToken);
let list:
(~maxResults: int=?, ~pageToken: string=?, ~query: string, string) =>
Js.Promise.t(List.result);
Search.list(~query, accessToken);
let listById:
(~maxResults: int=?, ~pageToken: string=?, ~parts: parts('a, 'b),
~ids: Js.Array.t(id), string) => Js.Promise.t(List.result('a, 'b));
Videos.listById(~parts, ~ids=[|"<video ID>"|], accessToken);
FAQs
Bucklescript bindings for Google REST Apis
The npm package @ryb73/bs-google-apis receives a total of 0 weekly downloads. As such, @ryb73/bs-google-apis popularity was classified as not popular.
We found that @ryb73/bs-google-apis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.