Socket
Socket
Sign inDemoInstall

@umbraco/headless-client

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@umbraco/headless-client - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

.editorconfig

34

dist/ApiRequest.js

@@ -50,4 +50,4 @@ "use strict";

var Endpoint_1 = require("./Endpoint");
var node_fetch_1 = __importDefault(require("node-fetch"));
var APIRequestError_1 = require("./APIRequestError");
var axios_1 = __importDefault(require("axios"));
var FormData = __importStar(require("form-data"));

@@ -63,3 +63,3 @@ var debug_1 = __importDefault(require("debug"));

this.promise = function () { return __awaiter(_this, void 0, void 0, function () {
var projectAlias, headers, requestInit, options, url, method, requestOptions, response, jsonResponse;
var projectAlias, headers, requestInit, options, method, requestOptions, response, err_1;
return __generator(this, function (_a) {

@@ -73,3 +73,3 @@ switch (_a.label) {

'umb-project-alias': projectAlias,
'api-version': '2'
'api-version': '2.1'
};

@@ -80,2 +80,4 @@ if (this.client.options.language) {

requestInit = {
url: Endpoint_1.Endpoint.getURLAddress(this.endpoint),
method: this.endpoint.method,
headers: {}

@@ -94,3 +96,2 @@ };

}
url = Endpoint_1.Endpoint.getURLAddress(this.endpoint);
method = this.endpoint.method.toLowerCase();

@@ -103,3 +104,3 @@ if ((method === "post" || method === 'put') && !!this.data) {

headers["Content-Type"] = "multipart/form-data; boundary=" + this.data.getBoundary();
requestInit.body = this.data;
requestInit.data = this.data;
}

@@ -111,21 +112,20 @@ else {

}
if (!requestInit.body) {
requestInit.body = JSON.stringify(this.data);
if (!requestInit.data) {
requestInit.data = JSON.stringify(this.data);
}
}
requestInit.headers = headers;
requestInit.method = method;
log("Request init");
log(requestInit);
return [4 /*yield*/, node_fetch_1.default(url, requestInit)];
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, axios_1.default(requestInit)];
case 2:
response = _a.sent();
return [4 /*yield*/, response.json()];
case 2:
jsonResponse = _a.sent();
if (!response.ok) {
console.log(requestInit);
throw new APIRequestError_1.APIRequestError(response.statusText, response, jsonResponse);
}
return [2 /*return*/, jsonResponse];
return [2 /*return*/, response.data];
case 3:
err_1 = _a.sent();
throw new APIRequestError_1.APIRequestError(err_1.statusText, err_1.response, err_1.response.data);
case 4: return [2 /*return*/];
}

@@ -132,0 +132,0 @@ });

@@ -1,6 +0,6 @@

import { Response } from "node-fetch";
import { AxiosResponse } from "axios";
export declare class APIRequestError extends Error {
response: Response;
response: AxiosResponse;
jsonData: any;
constructor(message: string, response: Response, jsonData: any);
constructor(message: string, response: AxiosResponse, jsonData: any);
}
import { Client } from "../Client";
import { CDNContentByContentTypeOptions, CDNContentByIdOptions, CDNContentChildrenOptions, CDNContentRootOptions } from "../RequestOptions";
import { ContentResponseElement } from "../Responses";
import { ContentFilter } from '../RequestOptions/ContentFilterOptions';
/**

@@ -54,2 +55,9 @@ * CDNClient is used to fetch content related objects from Umbraco headless

/**
* Filter for content containing specific property values
* TODO: Fix add missing types all around this call
* @param contentFilter Filter
* @param options Request options
*/
filter: (body: ContentFilter, options?: CDNContentByContentTypeOptions | undefined) => Promise<import("../Responses").PagedResponse<ContentResponseElement>>;
/**
* Search for content containing term

@@ -56,0 +64,0 @@ * TODO: Fix add missing types all around this call

@@ -71,2 +71,11 @@ "use strict";

/**
* Filter for content containing specific property values
* TODO: Fix add missing types all around this call
* @param contentFilter Filter
* @param options Request options
*/
this.filter = function (body, options) {
return _this.makeRequest(Endpoints_1.Endpoints.delivery.content.filter(options), body);
};
/**
* Search for content containing term

@@ -73,0 +82,0 @@ * TODO: Fix add missing types all around this call

@@ -269,2 +269,19 @@ import { Client } from "../Client";

};
/**
* Forms API
*/
readonly forms: {
/**
* Fetch all forms
*/
all: () => Promise<import("../Responses").Form[]>;
/**
* Get form by id
*/
byId: (id: string) => Promise<import("../Responses").Form>;
/**
* Submit a new form entry
*/
submitEntry: (formId: string, data: object) => Promise<any>;
};
}

@@ -345,2 +345,26 @@ "use strict";

});
Object.defineProperty(ManagementClient.prototype, "forms", {
/**
* Forms API
*/
get: function () {
var _this = this;
return {
/**
* Fetch all forms
*/
all: function () { return _this.makeRequest(Endpoints_1.Endpoints.management.forms.all()); },
/**
* Get form by id
*/
byId: function (id) { return _this.makeRequest(Endpoints_1.Endpoints.management.forms.byId(id)); },
/**
* Submit a new form entry
*/
submitEntry: function (formId, data) { return _this.makeRequest(Endpoints_1.Endpoints.management.forms.submitEntry(formId), data); }
};
},
enumerable: true,
configurable: true
});
return ManagementClient;

@@ -347,0 +371,0 @@ }());

@@ -14,5 +14,5 @@ export declare enum EndpointSource {

readonly urlParams: any;
readonly method: string;
readonly method: 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'delete' | 'DELETE';
readonly options?: Options | undefined;
constructor(source: EndpointSource, path: string, urlParams: any, method: string, options?: Options | undefined);
constructor(source: EndpointSource, path: string, urlParams: any, method: 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'delete' | 'DELETE', options?: Options | undefined);
/**

@@ -19,0 +19,0 @@ * Replace path with urlParams

import { Endpoint } from "./Endpoint";
import { CDNContentByContentTypeOptions, CDNContentByIdOptions, CDNContentChildrenOptions, CDNContentRootOptions, MultipartOptions } from "./RequestOptions";
import { ContentLanguageType, ContentManagerMediaType, ContentMemberGroupType, ContentMemberType, ContentMemberTypeType, ContentRelationType, ContentRelationTypeType, ContentResponseElement, ContentTypeBase, MediaTypeContentManager, MediaTypeContentManagerRoot, PagedResponse } from "./Responses";
import { ContentLanguageType, ContentManagerMediaType, ContentMemberGroupType, ContentMemberType, ContentMemberTypeType, ContentRelationType, ContentRelationTypeType, ContentResponseElement, ContentTypeBase, MediaTypeContentManager, MediaTypeContentManagerRoot, PagedResponse, Form } from "./Responses";
export declare const Endpoints: {

@@ -14,3 +14,4 @@ delivery: {

byContentType: <T_6 extends ContentResponseElement>(contentType: string, options?: CDNContentByContentTypeOptions | undefined) => Endpoint<PagedResponse<T_6>, any>;
search: <T_7 extends ContentResponseElement>(term: string, options?: CDNContentByContentTypeOptions | undefined) => Endpoint<PagedResponse<T_7>, any>;
filter: <T_7 extends ContentResponseElement>(options?: CDNContentByContentTypeOptions | undefined) => Endpoint<PagedResponse<T_7>, any>;
search: <T_8 extends ContentResponseElement>(term: string, options?: CDNContentByContentTypeOptions | undefined) => Endpoint<PagedResponse<T_8>, any>;
};

@@ -85,3 +86,8 @@ media: {

};
forms: {
all: () => Endpoint<Form[], any>;
byId: (id: string) => Endpoint<Form, any>;
submitEntry: (id: string) => Endpoint<any, any>;
};
};
};

@@ -14,2 +14,3 @@ "use strict";

byContentType: function (contentType, options) { return new Endpoint_1.Endpoint(Endpoint_1.EndpointSource.CDN, '/content/type?contentType={contentType}', { contentType: contentType }, 'get', options); },
filter: function (options) { return new Endpoint_1.Endpoint(Endpoint_1.EndpointSource.CDN, '/content/filter', {}, 'post', options); },
search: function (term, options) { return new Endpoint_1.Endpoint(Endpoint_1.EndpointSource.CDN, '/content/search?term={term}', { term: term }, 'get', options); },

@@ -86,2 +87,7 @@ },

byAlias: function (alias) { return new Endpoint_1.Endpoint(Endpoint_1.EndpointSource.ContentManagement, '/member/type/{alias}', { alias: alias }, 'get'); }
},
forms: {
all: function () { return new Endpoint_1.Endpoint(Endpoint_1.EndpointSource.ContentManagement, '/forms', {}, 'get'); },
byId: function (id) { return new Endpoint_1.Endpoint(Endpoint_1.EndpointSource.ContentManagement, '/forms/{id}', { id: id }, 'get'); },
submitEntry: function (id) { return new Endpoint_1.Endpoint(Endpoint_1.EndpointSource.ContentManagement, '/forms/{id}/entries', { id: id }, 'post'); }
}

@@ -88,0 +94,0 @@ }

@@ -16,2 +16,3 @@ "use strict";

__export(require("./Endpoint"));
__export(require("./Responses/index"));
__export(require("./APIRequestError"));

@@ -18,0 +19,0 @@ var FormData = __importStar(require("form-data"));

@@ -8,1 +8,2 @@ export * from './DepthOptions';

export * from './CultureOptions';
export * from './ContentFilterOptions';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./ContentFilterOptions"));
//# sourceMappingURL=index.js.map

@@ -13,2 +13,3 @@ import { HyperlinksOption } from "./HyperlinksOption";

export declare type CDNContentByContentTypeOptions = HyperlinksOption & PageOptions & CultureOptions;
export declare type CDNContentFilterOptions = HyperlinksOption & PageOptions & CultureOptions;
export declare type CDNContentSearchOptions = HyperlinksOption & PageOptions & CultureOptions;

@@ -15,0 +16,0 @@ export declare type CDNMediaChildrenOptions = PageOptions;

@@ -12,1 +12,2 @@ export * from './RootContentResponse';

export * from './PagedResponse';
export * from './Form';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./Form"));
//# sourceMappingURL=index.js.map
{
"name": "@umbraco/headless-client",
"version": "0.3.1",
"version": "0.4.0",
"description": "Node.js client library for the Umbraco Headless APIs",

@@ -14,2 +14,3 @@ "license": "MIT",

"headless",
"heartcore",
"cloud"

@@ -29,8 +30,8 @@ ],

"build": "tsc",
"build-dev": "tsc -w"
"start": "tsc -w"
},
"dependencies": {
"axios": "^0.19.0",
"debug": "^4.1.1",
"form-data": "^2.5.1",
"node-fetch": "^2.6.0"
"form-data": "^2.5.1"
},

@@ -40,5 +41,5 @@ "devDependencies": {

"@types/form-data": "^2.5.0",
"@types/node-fetch": "^2.5.2",
"@types/node": "^12.12.18",
"typescript": "^3.6.3"
}
}
import {Endpoint, EndpointSource} from "./Endpoint";
import {Client} from "./Client";
import fetch, {RequestInit} from "node-fetch";
import {APIRequestError} from "./APIRequestError";
import axios, { AxiosRequestConfig } from 'axios'
import * as FormData from 'form-data'

@@ -14,79 +14,74 @@ import debug from 'debug'

constructor(
private client: Client,
public endpoint: Endpoint,
public data?: any
) {}
constructor(
private client: Client,
public endpoint: Endpoint,
public data?: any
) {}
public promise = async (): Promise<R> => {
const projectAlias = this.client.options.projectAlias
const headers: any = {
'Content-Type': 'application/json',
'Accept': 'application/json+hal;v=2',
'umb-project-alias': projectAlias,
'api-version': '2'
}
public promise = async (): Promise<R> => {
const projectAlias = this.client.options.projectAlias
const headers: any = {
'Content-Type': 'application/json',
'Accept': 'application/json+hal;v=2',
'umb-project-alias': projectAlias,
'api-version': '2.1'
}
if (this.client.options.language) {
headers["Accept-Language"] = this.client.options.language
}
if (this.client.options.language) {
headers["Accept-Language"] = this.client.options.language
}
const requestInit: RequestInit = {
headers: {}
}
const requestInit: AxiosRequestConfig= {
url: Endpoint.getURLAddress(this.endpoint),
method: this.endpoint.method,
headers: {}
}
if(this.endpoint.source === EndpointSource.ContentManagement) {
if(this.client.getAPIKey() === null) {
throw new Error("API Key is missing")
}
if(this.endpoint.source === EndpointSource.ContentManagement) {
if(this.client.getAPIKey() === null) {
throw new Error("API Key is missing")
}
headers["api-key"] = `${this.client.getAPIKey()}`
}
headers["api-key"] = `${this.client.getAPIKey()}`
}
const options = this.endpoint.options
log("options", options)
if(options && options.culture) {
headers["Accept-Language"] = options.culture
}
const options = this.endpoint.options
log("options", options)
if(options && options.culture) {
headers["Accept-Language"] = options.culture
}
const url = Endpoint.getURLAddress(this.endpoint)
const method = this.endpoint.method.toLowerCase()
if((method === "post" || method === 'put') && !!this.data) {
const requestOptions = this.endpoint.options
if(typeof requestOptions !== "undefined") {
if((requestOptions as MultipartOptions).usingMultipart) {
if(this.data.prototype === FormData.prototype) {
headers["Content-Type"] = `multipart/form-data; boundary=${this.data.getBoundary()}`
requestInit.body = this.data
} else {
throw new Error("Expected a FormData as body")
}
}
}
if(!requestInit.body) {
requestInit.body = JSON.stringify(this.data)
}
const method = this.endpoint.method.toLowerCase()
if((method === "post" || method === 'put') && !!this.data) {
const requestOptions = this.endpoint.options
if(typeof requestOptions !== "undefined") {
if((requestOptions as MultipartOptions).usingMultipart) {
if(this.data.prototype === FormData.prototype) {
headers["Content-Type"] = `multipart/form-data; boundary=${this.data.getBoundary()}`
requestInit.data = this.data
} else {
throw new Error("Expected a FormData as body")
}
}
requestInit.headers = headers
}
requestInit.method = method
log("Request init")
log(requestInit)
const response = await fetch(url, requestInit)
const jsonResponse = await response.json()
if(!requestInit.data) {
requestInit.data = JSON.stringify(this.data)
}
}
requestInit.headers = headers
if(!response.ok) {
console.log(requestInit)
throw new APIRequestError(response.statusText, response, jsonResponse)
}
log("Request init")
log(requestInit)
return jsonResponse as R
try {
const response = await axios(requestInit)
return response.data as R
} catch (err) {
throw new APIRequestError(err.statusText, err.response, err.response.data)
}
}
}

@@ -1,6 +0,6 @@

import {Response} from "node-fetch";
import { AxiosResponse } from "axios"
export class APIRequestError extends Error {
constructor(message: string, public response: Response, public jsonData: any) {
constructor(message: string, public response: AxiosResponse, public jsonData: any) {
super(message)

@@ -7,0 +7,0 @@ this.name = "APIRequestError"

@@ -8,7 +8,7 @@ import {Client} from "../Client";

CDNContentByURLOptions, CDNContentChildrenOptions, CDNContentDescendantsOptions,
CDNContentRootOptions, CDNContentSearchOptions,
CDNContentRootOptions, CDNContentSearchOptions, CDNContentFilterOptions
} from "../RequestOptions";
import {ContentResponseElement} from "../Responses";
import {ContentFilter} from '../RequestOptions/ContentFilterOptions';
/**

@@ -91,2 +91,12 @@ * CDNClient is used to fetch content related objects from Umbraco headless

/**
* Filter for content containing specific property values
* TODO: Fix add missing types all around this call
* @param contentFilter Filter
* @param options Request options
*/
public filter = (body: ContentFilter, options?: CDNContentFilterOptions) => {
return this.makeRequest(Endpoints.delivery.content.filter(options), body)
}
/**
* Search for content containing term

@@ -93,0 +103,0 @@ * TODO: Fix add missing types all around this call

@@ -5,17 +5,17 @@ import {Client} from "../Client";

import {
APIContentChildrenOptions,
APIContentPublishOptions,
APIContentUnPublishOptions, APIMediaChildrenOptions,
APIContentChildrenOptions,
APIContentPublishOptions,
APIContentUnPublishOptions, APIMediaChildrenOptions,
} from "../RequestOptions/index";
import {
ContentCreateMemberType,
ContentLanguageType,
ContentManagerMediaType,
ContentMemberCreateGroupType,
ContentMemberGroupType,
ContentMemberType, ContentMemberTypeType,
ContentResponseElement,
ContentTypeBase,
CreateContentBody,
CreateContentLanguageType,
ContentCreateMemberType,
ContentLanguageType,
ContentManagerMediaType,
ContentMemberCreateGroupType,
ContentMemberGroupType,
ContentMemberType, ContentMemberTypeType,
ContentResponseElement,
ContentTypeBase,
CreateContentBody,
CreateContentLanguageType,
} from "../Responses/index";

@@ -29,338 +29,358 @@

constructor(
private readonly client: Client
) {
constructor(
private readonly client: Client
) {
}
}
private makeRequest = <R>(endpoint: Endpoint<R>, data?: any) => {
return this.client.makeRequest(endpoint, data)
}
private makeRequest = <R>(endpoint: Endpoint<R>, data?: any) => {
return this.client.makeRequest(endpoint, data)
}
/**
* Content API
*/
get content() {
return {
/**
* Gets all published content at the root of the tree
*/
root: <R extends ContentResponseElement>() => this.makeRequest(Endpoints.management.content.root<R>()),
/**
* Content API
*/
get content() {
return {
/**
* Gets all published content at the root of the tree
*/
root: <R extends ContentResponseElement>() => this.makeRequest(Endpoints.management.content.root<R>()),
/**
* Gets a single published content by its id
* @param id GUID part of an Umbraco UDI
*/
byId: <R extends ContentResponseElement>(id: string|number) => this.makeRequest(Endpoints.management.content.byId<R>(id)),
/**
* Gets a single published content by its id
* @param id GUID part of an Umbraco UDI
*/
byId: <R extends ContentResponseElement>(id: string|number) => this.makeRequest(Endpoints.management.content.byId<R>(id)),
/**
* Get all children of a content object
* @param id GUID part of an Umbraco UDI
* @param options Request options if with page
*/
children: <R extends ContentResponseElement>(id: string|number, options?: APIContentChildrenOptions) => this.makeRequest(Endpoints.management.content.children(id, options)),
/**
* Get all children of a content object
* @param id GUID part of an Umbraco UDI
* @param options Request options if with page
*/
children: <R extends ContentResponseElement>(id: string|number, options?: APIContentChildrenOptions) => this.makeRequest(Endpoints.management.content.children(id, options)),
/**
* Create a content object
* @param body Data which needs to be used for creating Content
*/
create: <R extends ContentResponseElement>(body: CreateContentBody) => this.makeRequest(Endpoints.management.content.create<R>(), body),
/**
* Create a content object
* @param body Data which needs to be used for creating Content
*/
create: <R extends ContentResponseElement>(body: CreateContentBody) => this.makeRequest(Endpoints.management.content.create<R>(), body),
/**
* Publish a content object
* @param id GUID part of an Umbraco UDI
* @param options Request options
*/
publish: <R extends ContentResponseElement>(id: string, options?: APIContentPublishOptions) => this.makeRequest(Endpoints.management.content.publish<R>(id, options) as Endpoint<R, APIContentPublishOptions>),
/**
* Publish a content object
* @param id GUID part of an Umbraco UDI
* @param options Request options
*/
publish: <R extends ContentResponseElement>(id: string, options?: APIContentPublishOptions) => this.makeRequest(Endpoints.management.content.publish<R>(id, options) as Endpoint<R, APIContentPublishOptions>),
/**
* Un-publish a content object
* @param id GUID part of an Umbraco UDI
* @param options Request options
*/
unPublish: <R extends ContentResponseElement>(id: string, options?: APIContentUnPublishOptions) => this.makeRequest(Endpoints.management.content.unPublish<R>(id, options)),
/**
* Un-publish a content object
* @param id GUID part of an Umbraco UDI
* @param options Request options
*/
unPublish: <R extends ContentResponseElement>(id: string, options?: APIContentUnPublishOptions) => this.makeRequest(Endpoints.management.content.unPublish<R>(id, options)),
/**
* Update a content object
* @param id GUID part of an Umbraco UDI
* @param body Data which needs to be used for updating content
*/
update: <R extends ContentResponseElement>(id: string|number, body: Partial<R>) => this.makeRequest(Endpoints.management.content.update<R>(id), body),
/**
* Update a content object
* @param id GUID part of an Umbraco UDI
* @param body Data which needs to be used for updating content
*/
update: <R extends ContentResponseElement>(id: string|number, body: Partial<R>) => this.makeRequest(Endpoints.management.content.update<R>(id), body),
/**
* Delete a content object
* @param id GUID part of an Umbraco UDI
*/
delete: (id: string|number) => this.makeRequest(Endpoints.management.content.delete(id))
}
/**
* Delete a content object
* @param id GUID part of an Umbraco UDI
*/
delete: (id: string|number) => this.makeRequest(Endpoints.management.content.delete(id))
}
}
/**
* ContentType API
*/
get contentType() {
return {
/**
* Fetch all content types
*/
all: <R extends ContentTypeBase>() => this.makeRequest(Endpoints.management.contentType.all<R>()),
/**
* ContentType API
*/
get contentType() {
return {
/**
* Fetch all content types
*/
all: <R extends ContentTypeBase>() => this.makeRequest(Endpoints.management.contentType.all<R>()),
/**
* Find content type by alias
* @param alias Alias for the content type
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.contentType.byAlias(alias)),
}
/**
* Find content type by alias
* @param alias Alias for the content type
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.contentType.byAlias(alias)),
}
}
//TODO: Needs a interface for body
/**
* Media API
*/
get media() {
return {
/**
* Fetch all media objects
*/
root: <R extends ContentManagerMediaType>() => this.makeRequest(Endpoints.management.media.root<R>()),
//TODO: Needs a interface for body
/**
* Media API
*/
get media() {
return {
/**
* Fetch all media objects
*/
root: <R extends ContentManagerMediaType>() => this.makeRequest(Endpoints.management.media.root<R>()),
/**
* Find media object by id
* @param id GUID part of an Umbraco UDI
*/
byId: <R extends ContentManagerMediaType>(id: string|number) => this.makeRequest(Endpoints.management.media.byId<R>(id)),
/**
* Find media object by id
* @param id GUID part of an Umbraco UDI
*/
byId: <R extends ContentManagerMediaType>(id: string|number) => this.makeRequest(Endpoints.management.media.byId<R>(id)),
/**
* Fetch all children for content object
* @param id GUID part of an Umbraco UDI
* @param options Request options if with page
*/
children: <R extends ContentManagerMediaType>(id: string|number, options?: APIMediaChildrenOptions) => this.makeRequest(Endpoints.management.media.children<R>(id, options)),
/**
* Fetch all children for content object
* @param id GUID part of an Umbraco UDI
* @param options Request options if with page
*/
children: <R extends ContentManagerMediaType>(id: string|number, options?: APIMediaChildrenOptions) => this.makeRequest(Endpoints.management.media.children<R>(id, options)),
/**
* Create a media object
* @param data Data for creating media object
*/
create: (data: any) => this.makeRequest(Endpoints.management.media.create(), data),
/**
* Create a media object
* @param data Data for creating media object
*/
create: (data: any) => this.makeRequest(Endpoints.management.media.create(), data),
/**
* Update media object
* @param id GUID part of an Umbraco UDI
* @param data Data for updating media object
*/
update: (id: string|number, data: any) => this.makeRequest(Endpoints.management.media.update(id), data),
/**
* Update media object
* @param id GUID part of an Umbraco UDI
* @param data Data for updating media object
*/
update: (id: string|number, data: any) => this.makeRequest(Endpoints.management.media.update(id), data),
/**
* Delete media object
* @param id GUID part of an Umbraco UDI
*/
delete: (id: string|number) => this.makeRequest(Endpoints.management.media.delete(id)),
}
/**
* Delete media object
* @param id GUID part of an Umbraco UDI
*/
delete: (id: string|number) => this.makeRequest(Endpoints.management.media.delete(id)),
}
}
/**
* Media API
*/
get mediaType() {
return {
/**
* Fetch all media types
*/
all: () => this.makeRequest(Endpoints.management.mediaType.all()),
/**
* Media API
*/
get mediaType() {
return {
/**
* Fetch all media types
*/
all: () => this.makeRequest(Endpoints.management.mediaType.all()),
/**
* Find media type by alias
* @param alias Alias of the media type querying for
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.mediaType.byAlias(alias))
}
/**
* Find media type by alias
* @param alias Alias of the media type querying for
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.mediaType.byAlias(alias))
}
}
/**
* Language API
*/
get language() {
return {
/**
* Fetch all languages
*/
all: <R extends ContentLanguageType>() => this.makeRequest(Endpoints.management.language.all<R>()),
/**
* Language API
*/
get language() {
return {
/**
* Fetch all languages
*/
all: <R extends ContentLanguageType>() => this.makeRequest(Endpoints.management.language.all<R>()),
/**
* Find language by ISO code
* @param id ISO Code for the language (e.g. en-US)
*/
byISOCode: <R extends ContentLanguageType>(id: string) => this.makeRequest(Endpoints.management.language.byISOCode<R>(id)),
/**
* Find language by ISO code
* @param id ISO Code for the language (e.g. en-US)
*/
byISOCode: <R extends ContentLanguageType>(id: string) => this.makeRequest(Endpoints.management.language.byISOCode<R>(id)),
/**
* Create a language
* @param data Data for creating language object
*/
create: <R extends ContentLanguageType>(data: CreateContentLanguageType) => this.makeRequest(Endpoints.management.language.create<R>(), data),
/**
* Create a language
* @param data Data for creating language object
*/
create: <R extends ContentLanguageType>(data: CreateContentLanguageType) => this.makeRequest(Endpoints.management.language.create<R>(), data),
/**
* Update a language
* @param id ISO Code for the language (e.g. en-US)
* @param data Data for updating language object
*/
update: <R extends ContentLanguageType>(id: string, data: CreateContentLanguageType) => this.makeRequest(Endpoints.management.language.update<R>(id), data),
/**
* Update a language
* @param id ISO Code for the language (e.g. en-US)
* @param data Data for updating language object
*/
update: <R extends ContentLanguageType>(id: string, data: CreateContentLanguageType) => this.makeRequest(Endpoints.management.language.update<R>(id), data),
/**
* Delete a language
* @param id ISO Code for the language (e.g. en-US)
*/
delete: <R extends ContentLanguageType>(id: string) => this.makeRequest(Endpoints.management.language.delete<R>(id)),
/**
* Delete a language
* @param id ISO Code for the language (e.g. en-US)
*/
delete: <R extends ContentLanguageType>(id: string) => this.makeRequest(Endpoints.management.language.delete<R>(id)),
}
}
}
/**
* Relation API
*/
get relation() {
return {
/**
* Find relation by id
* @param id GUID part of an Umbraco UDI
*/
byId: (id: string) => this.makeRequest(Endpoints.management.relation.byId(id)),
/**
* Relation API
*/
get relation() {
return {
/**
* Find relation by id
* @param id GUID part of an Umbraco UDI
*/
byId: (id: string) => this.makeRequest(Endpoints.management.relation.byId(id)),
/**
* Find relation by alias
* @param alias Alias of the relation querying for
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.relation.byAlias(alias)),
/**
* Find relation by alias
* @param alias Alias of the relation querying for
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.relation.byAlias(alias)),
/**
* Fetch child for relation with id
* @param id GUID part of an Umbraco UDI
*/
byChild: (id: string) => this.makeRequest(Endpoints.management.relation.byChild(id)),
/**
* Fetch child for relation with id
* @param id GUID part of an Umbraco UDI
*/
byChild: (id: string) => this.makeRequest(Endpoints.management.relation.byChild(id)),
/**
* Fetch parent for relation with id
* @param id GUID part of an Umbraco UDI
*/
byParent: (id: string) => this.makeRequest(Endpoints.management.relation.byParent(id)),
/**
* Fetch parent for relation with id
* @param id GUID part of an Umbraco UDI
*/
byParent: (id: string) => this.makeRequest(Endpoints.management.relation.byParent(id)),
/**
* Create a relation
* @param data Data for creating relation object
*/
create: (data: any) => this.makeRequest(Endpoints.management.relation.create(), data),
/**
* Create a relation
* @param data Data for creating relation object
*/
create: (data: any) => this.makeRequest(Endpoints.management.relation.create(), data),
/**
* Delete relation with id
* @param id GUID part of an Umbraco UDI
*/
delete: (id: string) => this.makeRequest(Endpoints.management.relation.delete(id))
}
/**
* Delete relation with id
* @param id GUID part of an Umbraco UDI
*/
delete: (id: string) => this.makeRequest(Endpoints.management.relation.delete(id))
}
}
/**
* RelationType API
*/
get relationType() {
return {
/**
* Fetch relation type by alias
* @param alias Alias for the relation type queryed for
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.relationType.byAlias(alias))
}
/**
* RelationType API
*/
get relationType() {
return {
/**
* Fetch relation type by alias
* @param alias Alias for the relation type queryed for
*/
byAlias: (alias: string) => this.makeRequest(Endpoints.management.relationType.byAlias(alias))
}
}
/**
* Member API
*/
get member() {
return {
/**
* Find member by username
* @param username Username for the user querying for
*/
byUsername: <R extends ContentMemberType>(username: string) => this.makeRequest(Endpoints.management.member.byUsername<R>(username)),
/**
* Member API
*/
get member() {
return {
/**
* Find member by username
* @param username Username for the user querying for
*/
byUsername: <R extends ContentMemberType>(username: string) => this.makeRequest(Endpoints.management.member.byUsername<R>(username)),
/**
* Create a new member
* @param data Data for creating a new member
*/
create: <R extends ContentMemberType>(data: ContentCreateMemberType) => this.makeRequest(Endpoints.management.member.create<R>(), data),
/**
* Create a new member
* @param data Data for creating a new member
*/
create: <R extends ContentMemberType>(data: ContentCreateMemberType) => this.makeRequest(Endpoints.management.member.create<R>(), data),
/**
* Update user by username
* @param username Username for the user to be updated
* @param data Data for the user to be updated
*/
update: <R extends ContentMemberType>(username: string, data: ContentCreateMemberType) => this.makeRequest(Endpoints.management.member.update<R>(username), data),
/**
* Update user by username
* @param username Username for the user to be updated
* @param data Data for the user to be updated
*/
update: <R extends ContentMemberType>(username: string, data: ContentCreateMemberType) => this.makeRequest(Endpoints.management.member.update<R>(username), data),
/**
* Add group to user
* @param username Username on the user who gets the group added
* @param group Group name of the group which the user needs to be added to
*/
addGroup: (username: string, group: string) => this.makeRequest(Endpoints.management.member.addGroup(username, group)),
/**
* Add group to user
* @param username Username on the user who gets the group added
* @param group Group name of the group which the user needs to be added to
*/
addGroup: (username: string, group: string) => this.makeRequest(Endpoints.management.member.addGroup(username, group)),
/**
* Remove group from user
* @param username Username on the user who need to get a group removed
* @param group Group name of the group which need to be removed.
*/
removeGroup: (username: string, group: string) => this.makeRequest(Endpoints.management.member.removeGroup(username, group)),
/**
* Remove group from user
* @param username Username on the user who need to get a group removed
* @param group Group name of the group which need to be removed.
*/
removeGroup: (username: string, group: string) => this.makeRequest(Endpoints.management.member.removeGroup(username, group)),
/**
* Delete a user
* @param username Username for the user that needs to be deleted
*/
delete: (username: string) => this.makeRequest(Endpoints.management.member.delete(username)),
}
/**
* Delete a user
* @param username Username for the user that needs to be deleted
*/
delete: (username: string) => this.makeRequest(Endpoints.management.member.delete(username)),
}
}
/**
* MemberGroup API
*/
get memberGroup() {
return {
/**
* Fetch member group by name
* @param name The name of the group
*/
byName: (name: string) => this.makeRequest<ContentMemberGroupType>(Endpoints.management.memberGroup.byName(name)),
/**
* MemberGroup API
*/
get memberGroup() {
return {
/**
* Fetch member group by name
* @param name The name of the group
*/
byName: (name: string) => this.makeRequest<ContentMemberGroupType>(Endpoints.management.memberGroup.byName(name)),
/**
* Create a member group
* @param data Data for creating a member group
*/
create: (data: ContentMemberCreateGroupType) => this.makeRequest(Endpoints.management.memberGroup.create(), data),
/**
* Create a member group
* @param data Data for creating a member group
*/
create: (data: ContentMemberCreateGroupType) => this.makeRequest(Endpoints.management.memberGroup.create(), data),
/**
* Delete member group
* @param name Name of the member group to be removed
*/
delete: (name: string) => this.makeRequest(Endpoints.management.memberGroup.delete(name)),
}
/**
* Delete member group
* @param name Name of the member group to be removed
*/
delete: (name: string) => this.makeRequest(Endpoints.management.memberGroup.delete(name)),
}
}
/**
* MemberType API
*/
get memberType() {
return {
/**
* Fetch all member types
*/
all: <R extends ContentMemberTypeType>() => this.makeRequest(Endpoints.management.memberType.all<R>()),
/**
* MemberType API
*/
get memberType() {
return {
/**
* Fetch all member types
*/
all: <R extends ContentMemberTypeType>() => this.makeRequest(Endpoints.management.memberType.all<R>()),
/**
* Find by alias
* @param alias Alias for the member type to be found.
*/
byAlias: <R extends ContentMemberTypeType>(alias: string) => this.makeRequest(Endpoints.management.memberType.byAlias<R>(alias))
}
/**
* Find by alias
* @param alias Alias for the member type to be found.
*/
byAlias: <R extends ContentMemberTypeType>(alias: string) => this.makeRequest(Endpoints.management.memberType.byAlias<R>(alias))
}
}
/**
* Forms API
*/
get forms() {
return {
/**
* Fetch all forms
*/
all: () => this.makeRequest(Endpoints.management.forms.all()),
/**
* Get form by id
*/
byId: (id: string) => this.makeRequest(Endpoints.management.forms.byId(id)),
/**
* Submit a new form entry
*/
submitEntry: (formId: string, data: object) => this.makeRequest(Endpoints.management.forms.submitEntry(formId), data)
}
}
}

@@ -19,3 +19,3 @@ export enum EndpointSource {

public readonly urlParams: any,
public readonly method: string,
public readonly method: 'get'|'GET'|'post'|'POST'|'put'|'PUT'|'delete'|'DELETE',
public readonly options?: Options

@@ -22,0 +22,0 @@ ) {

import {Endpoint, EndpointSource} from "./Endpoint";
import {
APIContentChildrenOptions,
APIContentPublishOptions,
APIContentUnPublishOptions,
APIMediaChildrenOptions,
CDNContentAncestorsOptions, CDNContentByContentTypeOptions,
CDNContentByIdOptions,
CDNContentByURLOptions,
CDNContentChildrenOptions,
CDNContentDescendantsOptions,
CDNContentRootOptions, CDNContentSearchOptions,
CDNMediaChildrenOptions,
MultipartOptions
APIContentChildrenOptions,
APIContentPublishOptions,
APIContentUnPublishOptions,
APIMediaChildrenOptions,
CDNContentAncestorsOptions, CDNContentByContentTypeOptions,
CDNContentByIdOptions,
CDNContentByURLOptions,
CDNContentChildrenOptions,
CDNContentDescendantsOptions,
CDNContentRootOptions,
CDNContentFilterOptions,
CDNContentSearchOptions,
CDNMediaChildrenOptions,
MultipartOptions
} from "./RequestOptions";
import {
ContentLanguageType,
ContentManagerMediaType,
ContentMemberGroupType,
ContentMemberType,
ContentMemberTypeType,
ContentRelationType,
ContentRelationTypeType,
ContentResponseElement,
ContentTypeBase,
MediaTypeContentManager,
MediaTypeContentManagerRoot,
PagedResponse
ContentLanguageType,
ContentManagerMediaType,
ContentMemberGroupType,
ContentMemberType,
ContentMemberTypeType,
ContentRelationType,
ContentRelationTypeType,
ContentResponseElement,
ContentTypeBase,
MediaTypeContentManager,
MediaTypeContentManagerRoot,
PagedResponse,
Form
} from "./Responses";
import {ContentFilter} from './RequestOptions/ContentFilterOptions';
export const Endpoints = {
delivery: {
delivery: {
content: {
root: <T extends ContentResponseElement>(options?: CDNContentRootOptions) => new Endpoint<T[]>(EndpointSource.CDN, '/content', {}, 'get', options),
byId: <T extends ContentResponseElement>(id: string | number, options?: CDNContentByIdOptions) => new Endpoint<T>(EndpointSource.CDN, '/content/{id}', {id}, 'get', options),
byUrl: <T extends ContentResponseElement>(url: string, options?: CDNContentByURLOptions) => new Endpoint<T>(EndpointSource.CDN, '/content/url?url={url}', {url}, 'get', options),
children: <T extends ContentResponseElement>(id: string | number, options?: CDNContentChildrenOptions) => new Endpoint<PagedResponse<T>>(EndpointSource.CDN, '/content/{id}/children', {id}, 'get', options),
ancestors: <T extends ContentResponseElement>(id: string | number, options?: CDNContentAncestorsOptions) => new Endpoint<T[]>(EndpointSource.CDN, '/content/{id}/ancestors', {id}, 'get', options),
descendants: <T extends ContentResponseElement>(id: string | number, options?: CDNContentDescendantsOptions) => new Endpoint<T[]>(EndpointSource.CDN, '/content/{id}/descendants', {id}, 'get', options),
byContentType: <T extends ContentResponseElement>(contentType: string, options?: CDNContentByContentTypeOptions) => new Endpoint<PagedResponse<T>>(EndpointSource.CDN, '/content/type?contentType={contentType}',{contentType}, 'get', options),
search: <T extends ContentResponseElement>(term: string, options?: CDNContentSearchOptions) => new Endpoint<PagedResponse<T>>(EndpointSource.CDN, '/content/search?term={term}',{term}, 'get', options),
},
content: {
root: <T extends ContentResponseElement>(options?: CDNContentRootOptions) => new Endpoint<T[]>(EndpointSource.CDN, '/content', {}, 'get', options),
byId: <T extends ContentResponseElement>(id: string | number, options?: CDNContentByIdOptions) => new Endpoint<T>(EndpointSource.CDN, '/content/{id}', {id}, 'get', options),
byUrl: <T extends ContentResponseElement>(url: string, options?: CDNContentByURLOptions) => new Endpoint<T>(EndpointSource.CDN, '/content/url?url={url}', {url}, 'get', options),
children: <T extends ContentResponseElement>(id: string | number, options?: CDNContentChildrenOptions) => new Endpoint<PagedResponse<T>>(EndpointSource.CDN, '/content/{id}/children', {id}, 'get', options),
ancestors: <T extends ContentResponseElement>(id: string | number, options?: CDNContentAncestorsOptions) => new Endpoint<T[]>(EndpointSource.CDN, '/content/{id}/ancestors', {id}, 'get', options),
descendants: <T extends ContentResponseElement>(id: string | number, options?: CDNContentDescendantsOptions) => new Endpoint<T[]>(EndpointSource.CDN, '/content/{id}/descendants', {id}, 'get', options),
byContentType: <T extends ContentResponseElement>(contentType: string, options?: CDNContentByContentTypeOptions) => new Endpoint<PagedResponse<T>>(EndpointSource.CDN, '/content/type?contentType={contentType}',{contentType}, 'get', options),
filter: <T extends ContentResponseElement>(options?: CDNContentFilterOptions) => new Endpoint<PagedResponse<T>>(EndpointSource.CDN, '/content/filter', {}, 'post', options ),
search: <T extends ContentResponseElement>(term: string, options?: CDNContentSearchOptions) => new Endpoint<PagedResponse<T>>(EndpointSource.CDN, '/content/search?term={term}',{term}, 'get', options),
},
media: {
root: () => new Endpoint(EndpointSource.CDN, "/media", {}, 'get'),
byId: (id: string | number) => new Endpoint(EndpointSource.CDN, '/media/{id}', {id}, 'get'),
children: (id: string | number, options?: CDNMediaChildrenOptions) => new Endpoint(EndpointSource.CDN, '/media/{id}/children', {id}, 'get', options),
},
media: {
root: () => new Endpoint(EndpointSource.CDN, "/media", {}, 'get'),
byId: (id: string | number) => new Endpoint(EndpointSource.CDN, '/media/{id}', {id}, 'get'),
children: (id: string | number, options?: CDNMediaChildrenOptions) => new Endpoint(EndpointSource.CDN, '/media/{id}/children', {id}, 'get', options),
},
},
management: {
content: {
root: <R extends ContentResponseElement>() => new Endpoint<R[]>(EndpointSource.ContentManagement, "/content", {}, 'get'),
byId: <R extends ContentResponseElement>(id: string | number) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}', {id}, 'get'),
children: <R extends ContentResponseElement>(id: string | number, options?: APIContentChildrenOptions) => new Endpoint<PagedResponse<R>>(EndpointSource.ContentManagement, '/content/{id}/children', {id}, 'get', options),
create: <R extends ContentResponseElement>() => new Endpoint<R>(EndpointSource.ContentManagement, '/content', {}, 'post'),
publish: <R extends ContentResponseElement>(id: string | number, options?: APIContentPublishOptions) => {
return new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}/publish', {id}, 'put', options) as Endpoint<R, APIContentPublishOptions>
},
unPublish: <R extends ContentResponseElement>(id: number|string, options?: APIContentUnPublishOptions) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}/unpublish', {id}, 'put', options),
update: <R extends ContentResponseElement>(id: number | string) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}', {id}, 'put'),
delete: (id: number | string) => new Endpoint(EndpointSource.ContentManagement, '/content/{id}', {id}, 'delete'),
},
contentType: {
all: <R extends ContentTypeBase>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/content/type', {}, 'get'),
byAlias: <R extends ContentTypeBase>(alias: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/type/{alias}', {alias}, 'get'),
},
media: {
root: <R extends ContentManagerMediaType>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/media', {}, 'get'),
byId: <R extends ContentManagerMediaType>(id: string|number) => new Endpoint<R>(EndpointSource.ContentManagement, '/media/{id}', {id}, 'get'),
children: <R extends ContentManagerMediaType>(id: string|number, options?: APIMediaChildrenOptions) => new Endpoint<PagedResponse<R>>(EndpointSource.ContentManagement, '/media/{id}/children', {id}, 'get', options),
create: () => new Endpoint<any, MultipartOptions>(EndpointSource.ContentManagement, '/media', {}, 'post', {usingMultipart: true}),
update: (id: string|number) => new Endpoint(EndpointSource.ContentManagement, '/media/{id}', {id}, 'put'),
delete: (id: string|number) => new Endpoint(EndpointSource.ContentManagement, '/media/{id}', {id}, 'delete'),
},
mediaType: {
all: () => new Endpoint<MediaTypeContentManagerRoot>(EndpointSource.ContentManagement, '/media/type', {}, 'get'),
byAlias: (alias: string) => new Endpoint<MediaTypeContentManager>(EndpointSource.ContentManagement, '/media/type/{alias}', {alias}, 'get'),
},
management: {
content: {
root: <R extends ContentResponseElement>() => new Endpoint<R[]>(EndpointSource.ContentManagement, "/content", {}, 'get'),
byId: <R extends ContentResponseElement>(id: string | number) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}', {id}, 'get'),
children: <R extends ContentResponseElement>(id: string | number, options?: APIContentChildrenOptions) => new Endpoint<PagedResponse<R>>(EndpointSource.ContentManagement, '/content/{id}/children', {id}, 'get', options),
create: <R extends ContentResponseElement>() => new Endpoint<R>(EndpointSource.ContentManagement, '/content', {}, 'post'),
publish: <R extends ContentResponseElement>(id: string | number, options?: APIContentPublishOptions) => {
return new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}/publish', {id}, 'put', options) as Endpoint<R, APIContentPublishOptions>
},
unPublish: <R extends ContentResponseElement>(id: number|string, options?: APIContentUnPublishOptions) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}/unpublish', {id}, 'put', options),
update: <R extends ContentResponseElement>(id: number | string) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/{id}', {id}, 'put'),
delete: (id: number | string) => new Endpoint(EndpointSource.ContentManagement, '/content/{id}', {id}, 'delete'),
},
contentType: {
all: <R extends ContentTypeBase>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/content/type', {}, 'get'),
byAlias: <R extends ContentTypeBase>(alias: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/content/type/{alias}', {alias}, 'get'),
},
media: {
root: <R extends ContentManagerMediaType>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/media', {}, 'get'),
byId: <R extends ContentManagerMediaType>(id: string|number) => new Endpoint<R>(EndpointSource.ContentManagement, '/media/{id}', {id}, 'get'),
children: <R extends ContentManagerMediaType>(id: string|number, options?: APIMediaChildrenOptions) => new Endpoint<PagedResponse<R>>(EndpointSource.ContentManagement, '/media/{id}/children', {id}, 'get', options),
create: () => new Endpoint<any, MultipartOptions>(EndpointSource.ContentManagement, '/media', {}, 'post', {usingMultipart: true}),
update: (id: string|number) => new Endpoint(EndpointSource.ContentManagement, '/media/{id}', {id}, 'put'),
delete: (id: string|number) => new Endpoint(EndpointSource.ContentManagement, '/media/{id}', {id}, 'delete'),
},
language: {
all: <R extends ContentLanguageType>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/language', {}, 'get'),
byISOCode: <R extends ContentLanguageType>(id: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/language/{id}', {id}, 'get'),
create: <R extends ContentLanguageType>() => new Endpoint<R>(EndpointSource.ContentManagement, '/language', {}, 'post'),
update: <R extends ContentLanguageType>(id: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/language/{id}', {id}, 'put'),
delete: <R extends ContentLanguageType>(id: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/language/{id}', {id}, 'delete'),
mediaType: {
all: () => new Endpoint<MediaTypeContentManagerRoot>(EndpointSource.ContentManagement, '/media/type', {}, 'get'),
byAlias: (alias: string) => new Endpoint<MediaTypeContentManager>(EndpointSource.ContentManagement, '/media/type/{alias}', {alias}, 'get'),
},
},
language: {
all: <R extends ContentLanguageType>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/language', {}, 'get'),
byISOCode: <R extends ContentLanguageType>(id: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/language/{id}', {id}, 'get'),
create: <R extends ContentLanguageType>() => new Endpoint<R>(EndpointSource.ContentManagement, '/language', {}, 'post'),
update: <R extends ContentLanguageType>(id: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/language/{id}', {id}, 'put'),
delete: <R extends ContentLanguageType>(id: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/language/{id}', {id}, 'delete'),
relation: {
byId: (id: string|number) => new Endpoint<ContentRelationType>(EndpointSource.ContentManagement, '/relation/{id}', {id}, 'get'),
byParent: (id: string) => new Endpoint<ContentRelationType[]>(EndpointSource.ContentManagement, '/relation/parent/{id}', {id}, 'get'),
byChild: (id: string) => new Endpoint<ContentRelationType[]>(EndpointSource.ContentManagement, '/relation/child/{id}', {id}, 'get'),
byAlias: (alias: string) => new Endpoint<ContentRelationType[]>(EndpointSource.ContentManagement, '/relation/{alias}', {alias}, 'get'),
create: () => new Endpoint<ContentRelationType>(EndpointSource.ContentManagement, '/relation', {}, 'post'),
delete: (id: string|number) => new Endpoint<ContentRelationType>(EndpointSource.ContentManagement, '/relation/{id}', {id}, 'delete'),
},
},
relationType: {
byAlias: (alias: string) => new Endpoint<ContentRelationTypeType>(EndpointSource.ContentManagement, '/relation/type/{alias}', {alias}, 'get')
},
relation: {
byId: (id: string|number) => new Endpoint<ContentRelationType>(EndpointSource.ContentManagement, '/relation/{id}', {id}, 'get'),
byParent: (id: string) => new Endpoint<ContentRelationType[]>(EndpointSource.ContentManagement, '/relation/parent/{id}', {id}, 'get'),
byChild: (id: string) => new Endpoint<ContentRelationType[]>(EndpointSource.ContentManagement, '/relation/child/{id}', {id}, 'get'),
byAlias: (alias: string) => new Endpoint<ContentRelationType[]>(EndpointSource.ContentManagement, '/relation/{alias}', {alias}, 'get'),
create: () => new Endpoint<ContentRelationType>(EndpointSource.ContentManagement, '/relation', {}, 'post'),
delete: (id: string|number) => new Endpoint<ContentRelationType>(EndpointSource.ContentManagement, '/relation/{id}', {id}, 'delete'),
},
relationType: {
byAlias: (alias: string) => new Endpoint<ContentRelationTypeType>(EndpointSource.ContentManagement, '/relation/type/{alias}', {alias}, 'get')
},
member: {
byUsername: <R extends ContentMemberType>(username: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/member/{username}', {username}, 'get'),
create: <R extends ContentMemberType>() => new Endpoint<R>(EndpointSource.ContentManagement, '/member', {}, 'post'),
update: <R extends ContentMemberType>(username: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/member/{username}', {username}, 'put'),
addGroup: (username: string, group: string) => new Endpoint(EndpointSource.ContentManagement, '/member/{username}/groups/{group}', {username, group}, 'put'),
removeGroup: (username: string, group: string) => new Endpoint(EndpointSource.ContentManagement, '/member/{username}/groups/{group}', {username, group}, 'delete'),
delete: (username: string) => new Endpoint(EndpointSource.ContentManagement, '/member/{username}', {username}, 'delete'),
},
memberGroup: {
byName: (name: string) => new Endpoint<ContentMemberGroupType>(EndpointSource.ContentManagement, '/member/group/{name}', {name}, 'get'),
create: () => new Endpoint<ContentMemberGroupType>(EndpointSource.ContentManagement, '/member/group', {}, 'post'),
delete: (name: string) => new Endpoint<ContentMemberGroupType>(EndpointSource.ContentManagement, '/member/group/{name}', {name}, 'delete'),
},
member: {
byUsername: <R extends ContentMemberType>(username: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/member/{username}', {username}, 'get'),
create: <R extends ContentMemberType>() => new Endpoint<R>(EndpointSource.ContentManagement, '/member', {}, 'post'),
update: <R extends ContentMemberType>(username: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/member/{username}', {username}, 'put'),
addGroup: (username: string, group: string) => new Endpoint(EndpointSource.ContentManagement, '/member/{username}/groups/{group}', {username, group}, 'put'),
removeGroup: (username: string, group: string) => new Endpoint(EndpointSource.ContentManagement, '/member/{username}/groups/{group}', {username, group}, 'delete'),
delete: (username: string) => new Endpoint(EndpointSource.ContentManagement, '/member/{username}', {username}, 'delete'),
},
memberType: {
all: <R extends ContentMemberTypeType>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/member/type', {}, 'get'),
byAlias: <R extends ContentMemberTypeType>(alias: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/member/type/{alias}', {alias}, 'get')
},
memberGroup: {
byName: (name: string) => new Endpoint<ContentMemberGroupType>(EndpointSource.ContentManagement, '/member/group/{name}', {name}, 'get'),
create: () => new Endpoint<ContentMemberGroupType>(EndpointSource.ContentManagement, '/member/group', {}, 'post'),
delete: (name: string) => new Endpoint<ContentMemberGroupType>(EndpointSource.ContentManagement, '/member/group/{name}', {name}, 'delete'),
},
memberType: {
all: <R extends ContentMemberTypeType>() => new Endpoint<R[]>(EndpointSource.ContentManagement, '/member/type', {}, 'get'),
byAlias: <R extends ContentMemberTypeType>(alias: string) => new Endpoint<R>(EndpointSource.ContentManagement, '/member/type/{alias}', {alias}, 'get')
}
forms: {
all: () => new Endpoint<Form[]>(EndpointSource.ContentManagement, '/forms', {}, 'get'),
byId: (id: string) => new Endpoint<Form>(EndpointSource.ContentManagement, '/forms/{id}', {id}, 'get'),
submitEntry: (id: string) => new Endpoint(EndpointSource.ContentManagement, '/forms/{id}/entries', {id}, 'post')
}
}
}

@@ -8,1 +8,2 @@ export * from './DepthOptions'

export * from './CultureOptions'
export * from './ContentFilterOptions'

@@ -15,2 +15,3 @@ import {HyperlinksOption} from "./HyperlinksOption";

export type CDNContentByContentTypeOptions = HyperlinksOption & PageOptions & CultureOptions
export type CDNContentFilterOptions = HyperlinksOption & PageOptions & CultureOptions
export type CDNContentSearchOptions = HyperlinksOption & PageOptions & CultureOptions

@@ -17,0 +18,0 @@

@@ -12,1 +12,2 @@ export * from './RootContentResponse'

export * from './PagedResponse'
export * from './Form'

@@ -12,3 +12,3 @@ {

"strict": true,
"lib": ["es2015"]
"lib": ["es2015", "dom"]
},

@@ -15,0 +15,0 @@ "exclude": [

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc