1.0.12 • Published 5 years ago

portal-api-creator v1.0.12

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

#portal-api-creator

##How to install

npm i portal-api-creator

###Define :

createPortalAPI(modules==>{ <name> : 'api list' },
 (m)=>"https://myspace.com/space/v1/" ,   ===> prefix will be added for all urls + dynamic changable
 (m)=>globalParameters,                   ===> params will be added for all urls + dynamic changable
 (m)=>headers                             ===> header will be added for all urls + dynamic changable
)

##How to use in your code - example

import createPortalAPI, { kb , community } from 'portal-api-creator'; 

const portalAPIS = createPortalAPI({ kb, community}, (m)=>{
	
	return 'https://myspace.com/api/v1/'

} , (m)=>{

	return { appId : "dsdlfo39o3ksjkskso90939o33i38i383i" }
	
} , (m)=>{

	return {
		hash : "sdflsflsdkfsdkfiwelelqweoqwelqweqkewpelqweqkenqw8j33jj3bnbbdsfhfhdshfshdf"
	}
});


portalAPIS.kb.articles()
portalAPIS.community.topics()
import creatorPortalAPI, { kb } from 'portal-api-creator';
global.portalAPI = creatorPortalAPI({ kb },()=>{
	return "https://my.allows.com/v1/api/"
},()=>{
	return {
		"appPortalId" : "4659fc50aa0a07b8cd88c9af18ee0eb36cf32c3dda4b4401afb6719abeecaa48"
	}
});

global.portalAPI.kb.articles();

##How to use dynamic/custom modules code - example

import APIBuilder from 'portal-api-creator'; 

const builder = APIBuilder((m)=>{
	
	return 'https://myspace.com/api/v1/'

} , (m)=>{

	return { appId : "dsdlfo39o3ksjkskso90939o33i38i383i" }
	
} , (m)=>{

	return {
		hash : "sdflsflsdkfsdkfiwelelqweoqwelqweqkewpelqweqkenqw8j33jj3bnbbdsfhfhdshfshdf"
	}
});

let module1 =  builder.create({ <module1> : <module1 apis> });
let module2  = builder.create({ <module2> : <module2 apis> });
let module3  = builder.create({ <module3> : <module3 apis> });

module3.books()
module2.people()

##Next Works - inside the pattern changes js-api-creator soon.

	entity : {
		
		name : "communityTopics",
		type : ["get","update","delete","create"],
		entity : {
			name : "attachments",
			type : ["get","delete","create"],
			actions : [
				{ name : "content", type : ["get"]  }
			]
		},
		actions : [
			{ name : "like" , type : ["update"]  },
			{ name : "dislike" ,  type : ["update"] },
		]
	}
	
1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago