discourse-js
Advanced tools
Comparing version 3.0.6 to 3.0.7
@@ -677,3 +677,2 @@ 'use strict'; | ||
var _this = this; | ||
if (apiKey === void 0) { apiKey = null; } | ||
this.config = function (_a) { | ||
@@ -723,2 +722,8 @@ var _b = _a === void 0 ? { | ||
var body = options.body, method = options.method, path = options.path, headers = options.headers; | ||
if (!_this._BASE_URL) { | ||
console.error('Please provide a valid `BASE_URL`.'); | ||
} | ||
if (!_this._API_KEY && !_this._USER_API_KEY) { | ||
console.error('Please provide either an API key or User API key.'); | ||
} | ||
var fetchOptions = { | ||
@@ -725,0 +730,0 @@ method: method, |
@@ -43,3 +43,3 @@ import { ICategories } from './resources/Categories'; | ||
users: IUsers; | ||
constructor(userApiKey: string, baseUrl: string, apiKey?: string | null); | ||
constructor(userApiKey?: string, baseUrl?: string, apiKey?: string | null); | ||
config: ({ userApiKey, baseUrl, apiUsername, apiKey }?: ConfigInterface) => void; | ||
@@ -46,0 +46,0 @@ requestHeaders(): Record<string, string>; |
@@ -675,3 +675,2 @@ import { camelizeKeys } from 'humps'; | ||
var _this = this; | ||
if (apiKey === void 0) { apiKey = null; } | ||
this.config = function (_a) { | ||
@@ -721,2 +720,8 @@ var _b = _a === void 0 ? { | ||
var body = options.body, method = options.method, path = options.path, headers = options.headers; | ||
if (!_this._BASE_URL) { | ||
console.error('Please provide a valid `BASE_URL`.'); | ||
} | ||
if (!_this._API_KEY && !_this._USER_API_KEY) { | ||
console.error('Please provide either an API key or User API key.'); | ||
} | ||
var fetchOptions = { | ||
@@ -723,0 +728,0 @@ method: method, |
@@ -829,3 +829,2 @@ (function (global, factory) { | ||
var _this = this; | ||
if (apiKey === void 0) { apiKey = null; } | ||
this.config = function (_a) { | ||
@@ -875,2 +874,8 @@ var _b = _a === void 0 ? { | ||
var body = options.body, method = options.method, path = options.path, headers = options.headers; | ||
if (!_this._BASE_URL) { | ||
console.error('Please provide a valid `BASE_URL`.'); | ||
} | ||
if (!_this._API_KEY && !_this._USER_API_KEY) { | ||
console.error('Please provide either an API key or User API key.'); | ||
} | ||
var fetchOptions = { | ||
@@ -877,0 +882,0 @@ method: method, |
import Discourse from '../index'; | ||
import { Post, PostActionType } from '../types/Posts'; | ||
import { Post, Reply, PostActionType } from '../types/Posts'; | ||
export interface CreatePostBody { | ||
@@ -18,3 +18,3 @@ [key: string]: any; | ||
reply_to_post_number: number; | ||
}): Promise<Post>; | ||
}): Promise<Reply>; | ||
postAction(params: { | ||
@@ -21,0 +21,0 @@ method: string; |
@@ -0,1 +1,2 @@ | ||
import { CreatePostBody } from './Posts'; | ||
import Discourse from '../index'; | ||
@@ -20,4 +21,4 @@ import { Topic, TopicPosts, TopicByUserName, TopicByTag, TopicByCategoryAndTag } from '../types/Topics'; | ||
deleteTopic(params: TopicParams): Promise<string>; | ||
createTopic(params: TopicParams): Promise<Post>; | ||
createTopic(inputs: CreatePostBody): Promise<Post>; | ||
} | ||
export default function Topics(discourse: Discourse): void; |
@@ -85,1 +85,5 @@ export declare enum PostActions { | ||
} | ||
export interface Reply extends Post { | ||
action: 'create_post'; | ||
success: boolean; | ||
} |
{ | ||
"name": "discourse-js", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"description": "A client-side javascript wrapper for the discourse API.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -66,7 +66,3 @@ import Categories, { ICategories } from './resources/Categories'; | ||
constructor( | ||
userApiKey: string, | ||
baseUrl: string, | ||
apiKey: string | null = null, | ||
) { | ||
constructor(userApiKey?: string, baseUrl?: string, apiKey?: string | null) { | ||
this._BASE_URL = baseUrl; | ||
@@ -163,2 +159,10 @@ this._USER_API_KEY = userApiKey; | ||
if (!this._BASE_URL) { | ||
console.error('Please provide a valid `BASE_URL`.'); | ||
} | ||
if (!this._API_KEY && !this._USER_API_KEY) { | ||
console.error('Please provide either an API key or User API key.'); | ||
} | ||
const fetchOptions = { | ||
@@ -165,0 +169,0 @@ method, |
import Discourse from '../index'; | ||
import { Post, PostActions, PostActionType } from '../types/Posts'; | ||
import { Post, Reply, PostActions, PostActionType } from '../types/Posts'; | ||
@@ -22,3 +22,3 @@ export interface CreatePostBody { | ||
reply_to_post_number: number; | ||
}): Promise<Post>; | ||
}): Promise<Reply>; | ||
postAction(params: { | ||
@@ -25,0 +25,0 @@ method: string; |
@@ -0,1 +1,3 @@ | ||
import { CreatePostBody } from './Posts'; | ||
import Discourse from '../index'; | ||
@@ -34,3 +36,3 @@ import { buildQueryString } from '../utils'; | ||
deleteTopic(params: TopicParams): Promise<string>; | ||
createTopic(params: TopicParams): Promise<Post>; | ||
createTopic(inputs: CreatePostBody): Promise<Post>; | ||
} | ||
@@ -37,0 +39,0 @@ |
@@ -87,1 +87,6 @@ export enum PostActions { | ||
} | ||
export interface Reply extends Post { | ||
action: 'create_post'; | ||
success: boolean; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
341112
4459