imgflip.com 3.5.4 → 3.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,10 +17,9 @@ import {Imgflip} from 'imgflip.com';
17
17
 
18
18
  const imgflip = new Imgflip();
19
19
 
20
- imgflip.api
21
- .getMemes().then(response => {
22
- //
23
- });
20
+ imgflip.api.getMemes().then(response => {
21
+ //
22
+ });
24
23
 
25
24
  imgflip.api
26
25
  .captionImage({
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "author": "Florian Imdahl <git@ffflorian.de>",
3
3
  "dependencies": {
4
- "@ffflorian/api-client": "2.2.0",
5
- "qs": "6.14.1"
4
+ "@ffflorian/api-client": "2.5.0",
5
+ "qs": "6.15.0"
6
6
  },
7
7
  "description": "A imgflip.com API client",
8
8
  "devDependencies": {
9
9
  "@types/node": "~24",
10
- "@types/qs": "6.14.0",
11
- "rimraf": "6.1.2",
12
- "typedoc": "0.28.15",
13
- "typescript": "5.9.3"
10
+ "@types/qs": "6.15.0",
11
+ "rimraf": "6.1.3",
12
+ "typedoc": "0.28.18",
13
+ "typescript": "6.0.2"
14
14
  },
15
15
  "engines": {
16
16
  "node": ">= 21"
@@ -37,6 +37,5 @@
37
37
  "dist": "yarn clean && yarn build:ts",
38
38
  "test": "exit 0"
39
39
  },
40
- "version": "3.5.4",
41
- "gitHead": "12bebfb90528bb894bccb99670373af33c6a5159"
40
+ "version": "3.5.6"
42
41
  }
@@ -1,6 +0,0 @@
1
- export declare const Endpoint: {
2
- CAPTION_IMAGE: string;
3
- GET_MEMES: string;
4
- captionImage(): string;
5
- getMemes(): string;
6
- };
package/dist/Endpoints.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Endpoint = void 0;
4
- exports.Endpoint = {
5
- CAPTION_IMAGE: 'caption_image',
6
- GET_MEMES: 'get_memes',
7
- captionImage() {
8
- return `/${exports.Endpoint.CAPTION_IMAGE}`;
9
- },
10
- getMemes() {
11
- return `/${exports.Endpoint.GET_MEMES}`;
12
- },
13
- };
package/dist/Imgflip.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import type { API } from './interfaces';
2
- export declare class Imgflip {
3
- private static readonly BASE_URL;
4
- readonly api: API;
5
- private readonly apiClient;
6
- constructor(apiUrl?: string);
7
- private readonly captionImage;
8
- private readonly getMemes;
9
- /**
10
- * Set a new API URL.
11
- * @param newURL The new API url
12
- */
13
- setApiUrl(newURL: string): void;
14
- }
package/dist/Imgflip.js DELETED
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.Imgflip = void 0;
46
- const api_client_1 = require("@ffflorian/api-client");
47
- const qs = __importStar(require("qs"));
48
- const Endpoints_1 = require("./Endpoints");
49
- class Imgflip {
50
- constructor(apiUrl) {
51
- this.captionImage = (params) => __awaiter(this, void 0, void 0, function* () {
52
- const endpoint = Endpoints_1.Endpoint.captionImage();
53
- const config = {
54
- data: qs.stringify(params, { arrayFormat: 'indices' }),
55
- headers: {
56
- 'Content-Type': 'application/x-www-form-urlencoded',
57
- },
58
- method: 'POST',
59
- };
60
- const response = yield this.apiClient.request(endpoint, config);
61
- return response.json();
62
- });
63
- this.getMemes = () => __awaiter(this, void 0, void 0, function* () {
64
- const endpoint = Endpoints_1.Endpoint.getMemes();
65
- const { data } = yield this.apiClient.get(endpoint);
66
- return data;
67
- });
68
- this.apiClient = new api_client_1.APIClient(apiUrl || Imgflip.BASE_URL);
69
- this.api = {
70
- captionImage: this.captionImage,
71
- getMemes: this.getMemes,
72
- };
73
- }
74
- /**
75
- * Set a new API URL.
76
- * @param newURL The new API url
77
- */
78
- setApiUrl(newURL) {
79
- this.apiClient.setBaseURL(newURL);
80
- }
81
- }
82
- exports.Imgflip = Imgflip;
83
- Imgflip.BASE_URL = 'https://api.imgflip.com';
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './Imgflip';
2
- export * from './interfaces';
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Imgflip"), exports);
18
- __exportStar(require("./interfaces"), exports);
@@ -1,95 +0,0 @@
1
- export interface API {
2
- /**
3
- * Add a caption to an Imgflip meme template.
4
- * Images created with this API will be publicly accessible by anyone
5
- * through the url in the response - there is no "private" option.
6
- * This does not mean these memes will be posted publicly though,
7
- * one still needs to know the exact URL to find the image.
8
- * If the image hangs around on Imgflip servers for a while and
9
- * gets very few views (direct image views and image page views both
10
- * count), it will be auto-deleted to save space.
11
- */
12
- captionImage(options: ImageCaptionOptions): Promise<Response<Image>>;
13
- /**
14
- * Gets an array of popular memes that may be captioned with this API.
15
- * The size of this array and the order of memes may change at any time.
16
- */
17
- getMemes(): Promise<Response<Memes>>;
18
- }
19
- export type Response<T> = {
20
- data: T;
21
- success: true;
22
- } | {
23
- error_message: string;
24
- success: false;
25
- };
26
- export interface Image {
27
- page_url: string;
28
- url: string;
29
- }
30
- export interface Memes {
31
- memes: Meme[];
32
- }
33
- export interface Meme {
34
- box_count: number;
35
- height: number;
36
- id: string;
37
- name: string;
38
- url: string;
39
- width: number;
40
- }
41
- /**
42
- * `x`, `y`, `width`, and `height` are for the bounding box of the text box. `x` and
43
- * `y` are the coordinates of the top left corner. If you specify bounding
44
- * coordinates, be sure to specify all four (`x`, `y`, `width`, `height`), otherwise
45
- * your text may not show up correctly. If you do not specify bounding box
46
- * coordinates, the same automatic default coordinates from
47
- * https://imgflip.com/memegenerator will be used, which is very useful for memes
48
- * with special text box positioning other than the simple top/bottom.
49
- */
50
- export interface Box {
51
- color?: string;
52
- height?: number;
53
- outline_color?: string;
54
- text: string;
55
- width?: number;
56
- x?: number;
57
- y?: number;
58
- }
59
- interface ImageCaptionBase {
60
- /** The font family to use for the text. Defaults to `impact`. */
61
- font?: 'impact' | 'arial';
62
- /** Maximum font size in pixels. Defaults to `50px`. */
63
- max_font_size?: string;
64
- /** password for the imgflip account */
65
- password: string;
66
- /**
67
- * A template ID as returned by the `get_memes` response. Any ID that was
68
- * ever returned from the `get_memes` response should work for this parameter.
69
- * For custom template uploads, the template ID can be found in the
70
- * memegenerator URL, e.g.
71
- * https://imgflip.com/memegenerator/14859329/Charlie-Sheen-DERP.
72
- */
73
- template_id: number | string;
74
- /** username of a valid imgflip account. This is used to track where API requests are coming from. */
75
- username: string;
76
- }
77
- export interface ImageCaptionWithBoxes extends ImageCaptionBase {
78
- /**
79
- * For creating memes with more than two text boxes, or for further
80
- * customization. If boxes is specified, text will not be automatically
81
- * converted to uppercase, so you'll have to handle capitalization yourself
82
- * if you want the standard uppercase meme text. You may specify up to 5
83
- * text boxes. You may leave the first box completely empty, so that the
84
- * second box will automatically be used for the bottom text.
85
- */
86
- boxes: Box[];
87
- }
88
- export interface ImageCaptionWithTexts extends ImageCaptionBase {
89
- /** Top text for the meme */
90
- text0: string;
91
- /** Bottom text for the meme */
92
- text1: string;
93
- }
94
- export type ImageCaptionOptions = ImageCaptionWithBoxes | ImageCaptionWithTexts;
95
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });