@forge/api
Advanced tools
Comparing version 1.1.0-next.0 to 1.1.0-next.1
# @forge/api | ||
## 1.1.0-next.1 | ||
### Minor Changes | ||
- ba442a3: Add requestGraph method to fetch api. | ||
## 1.1.0-next.0 | ||
@@ -4,0 +10,0 @@ |
@@ -6,2 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "transformResponse", { enumerable: true, get: function () { return polyfill_response_1.transformResponse; } }); | ||
const wrapRequestGraph = (requestGraphApi) => (query, variables) => requestGraphApi('/graphql', { | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: JSON.stringify(Object.assign({ query }, (variables ? { variables } : {}))) | ||
}); | ||
exports.wrapFetchApiMethods = (api, wrapFetch) => { | ||
@@ -14,9 +19,11 @@ return { | ||
requestJira: wrapFetch(api.asUser().requestJira), | ||
requestConfluence: wrapFetch(api.asUser().requestConfluence) | ||
requestConfluence: wrapFetch(api.asUser().requestConfluence), | ||
requestGraph: wrapRequestGraph(wrapFetch(api.asUser().requestGraph)) | ||
}), | ||
asApp: () => ({ | ||
requestJira: wrapFetch(api.asApp().requestJira), | ||
requestConfluence: wrapFetch(api.asApp().requestConfluence) | ||
requestConfluence: wrapFetch(api.asApp().requestConfluence), | ||
requestGraph: wrapRequestGraph(wrapFetch(api.asApp().requestGraph)) | ||
}) | ||
}; | ||
}; |
@@ -10,2 +10,5 @@ import { RequestInit, Response } from 'node-fetch'; | ||
} | ||
export interface GraphQLFetchMethods { | ||
requestGraph: (query: string, variables?: any) => Promise<APIResponse>; | ||
} | ||
export interface StorageMethods { | ||
@@ -31,4 +34,4 @@ get: (key: string) => Promise<any>; | ||
export interface FetchAPI extends FetchMethods { | ||
asUser(): FetchMethods; | ||
asApp(): FetchMethods; | ||
asUser(): FetchMethods & GraphQLFetchMethods; | ||
asApp(): FetchMethods & GraphQLFetchMethods; | ||
fetch: FetchMethod; | ||
@@ -39,4 +42,4 @@ } | ||
} | ||
declare const asUser: () => FetchMethods; | ||
declare const asApp: () => FetchMethods; | ||
declare const asUser: () => FetchMethods & GraphQLFetchMethods; | ||
declare const asApp: () => FetchMethods & GraphQLFetchMethods; | ||
declare const fetch: FetchMethod; | ||
@@ -43,0 +46,0 @@ declare const requestJira: FetchMethod; |
@@ -11,3 +11,3 @@ import { StorageAdapter } from './storage-adapter'; | ||
protected buildSetRequestOptions(requestBody: any, requestMethod: 'PUT' | 'POST'): { | ||
method: "PUT" | "POST"; | ||
method: "POST" | "PUT"; | ||
body: string; | ||
@@ -14,0 +14,0 @@ headers: { |
{ | ||
"name": "@forge/api", | ||
"version": "1.1.0-next.0", | ||
"version": "1.1.0-next.1", | ||
"description": "Forge API methods", | ||
@@ -5,0 +5,0 @@ "author": "Atlassian", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31108
402