Best JavaScript code snippet using argos
services.js
Source:services.js
1/* @flow */2import { GET, PUT, POST, DELETE } from "metabase/lib/api";3import { IS_EMBED_PREVIEW } from "metabase/lib/embed";4// use different endpoints for embed previews5const embedBase = IS_EMBED_PREVIEW ? "/api/preview_embed" : "/api/embed";6// $FlowFixMe: Flow doesn't understand webpack loader syntax7import getGAMetadata from "promise-loader?global!metabase/lib/ga-metadata"; // eslint-disable-line import/default8import type { Data, Options } from "metabase/lib/api";9import type { DatabaseId } from "metabase-types/types/Database";10import type { DatabaseCandidates } from "metabase-types/types/Auto";11import type { DashboardWithCards } from "metabase-types/types/Dashboard";12export const ActivityApi = {13 list: GET("/api/activity"),14 recent_views: GET("/api/activity/recent_views"),15};16export const CardApi = {17 list: GET("/api/card", (cards, { data }) =>18 // HACK: support for the "q" query param until backend implements it19 cards.filter(20 card =>21 !data.q || card.name.toLowerCase().indexOf(data.q.toLowerCase()) >= 0,22 ),23 ),24 create: POST("/api/card"),25 get: GET("/api/card/:cardId"),26 update: PUT("/api/card/:id"),27 delete: DELETE("/api/card/:cardId"),28 query: POST("/api/card/:cardId/query"),29 // isfavorite: GET("/api/card/:cardId/favorite"),30 favorite: POST("/api/card/:cardId/favorite"),31 unfavorite: DELETE("/api/card/:cardId/favorite"),32 listPublic: GET("/api/card/public"),33 listEmbeddable: GET("/api/card/embeddable"),34 createPublicLink: POST("/api/card/:id/public_link"),35 deletePublicLink: DELETE("/api/card/:id/public_link"),36 // related37 related: GET("/api/card/:cardId/related"),38 adHocRelated: POST("/api/card/related"),39};40export const DashboardApi = {41 list: GET("/api/dashboard"),42 // creates a new empty dashboard43 create: POST("/api/dashboard"),44 // saves a complete transient dashboard45 save: POST("/api/dashboard/save"),46 get: GET("/api/dashboard/:dashId"),47 update: PUT("/api/dashboard/:id"),48 delete: DELETE("/api/dashboard/:dashId"),49 addcard: POST("/api/dashboard/:dashId/cards"),50 removecard: DELETE("/api/dashboard/:dashId/cards"),51 reposition_cards: PUT("/api/dashboard/:dashId/cards"),52 favorite: POST("/api/dashboard/:dashId/favorite"),53 unfavorite: DELETE("/api/dashboard/:dashId/favorite"),54 listPublic: GET("/api/dashboard/public"),55 listEmbeddable: GET("/api/dashboard/embeddable"),56 createPublicLink: POST("/api/dashboard/:id/public_link"),57 deletePublicLink: DELETE("/api/dashboard/:id/public_link"),58};59export const CollectionsApi = {60 list: GET("/api/collection"),61 create: POST("/api/collection"),62 get: GET("/api/collection/:id"),63 // Temporary route for getting things not in a collection64 getRoot: GET("/api/collection/root"),65 update: PUT("/api/collection/:id"),66 graph: GET("/api/collection/graph"),67 updateGraph: PUT("/api/collection/graph"),68};69export const PublicApi = {70 card: GET("/api/public/card/:uuid"),71 cardQuery: GET("/api/public/card/:uuid/query"),72 dashboard: GET("/api/public/dashboard/:uuid"),73 dashboardCardQuery: GET("/api/public/dashboard/:uuid/card/:cardId"),74};75export const EmbedApi = {76 card: GET(embedBase + "/card/:token"),77 cardQuery: GET(embedBase + "/card/:token/query"),78 dashboard: GET(embedBase + "/dashboard/:token"),79 dashboardCardQuery: GET(80 embedBase + "/dashboard/:token/dashcard/:dashcardId/card/:cardId",81 ),82};83type $AutoApi = {84 dashboard: ({ subPath: string }) => DashboardWithCards,85 db_candidates: ({ id: DatabaseId }) => DatabaseCandidates,86};87export const AutoApi: $AutoApi = {88 dashboard: GET("/api/automagic-dashboards/:subPath", {89 // this prevents the `subPath` parameter from being URL encoded90 raw: { subPath: true },91 }),92 db_candidates: GET("/api/automagic-dashboards/database/:id/candidates"),93};94export const EmailApi = {95 updateSettings: PUT("/api/email"),96 sendTest: POST("/api/email/test"),97 clear: DELETE("/api/email"),98};99export const SlackApi = {100 updateSettings: PUT("/api/slack/settings"),101};102export const LdapApi = {103 updateSettings: PUT("/api/ldap/settings"),104};105export const MetabaseApi = {106 db_list: GET("/api/database"),107 db_create: POST("/api/database"),108 db_validate: POST("/api/database/validate"),109 db_add_sample_dataset: POST("/api/database/sample_dataset"),110 db_get: GET("/api/database/:dbId"),111 db_update: PUT("/api/database/:id"),112 db_delete: DELETE("/api/database/:dbId"),113 db_metadata: GET("/api/database/:dbId/metadata"),114 db_schemas: GET("/api/database/:dbId/schemas"),115 db_schema_tables: GET("/api/database/:dbId/schema/:schemaName"),116 //db_tables: GET("/api/database/:dbId/tables"),117 db_fields: GET("/api/database/:dbId/fields"),118 db_idfields: GET("/api/database/:dbId/idfields"),119 db_autocomplete_suggestions: GET(120 "/api/database/:dbId/autocomplete_suggestions?prefix=:prefix",121 ),122 db_sync_schema: POST("/api/database/:dbId/sync_schema"),123 db_rescan_values: POST("/api/database/:dbId/rescan_values"),124 db_discard_values: POST("/api/database/:dbId/discard_values"),125 table_list: GET("/api/table"),126 // table_get: GET("/api/table/:tableId"),127 table_update: PUT("/api/table/:id"),128 // table_fields: GET("/api/table/:tableId/fields"),129 table_fks: GET("/api/table/:tableId/fks"),130 // table_reorder_fields: POST("/api/table/:tableId/reorder"),131 table_query_metadata: GET(132 "/api/table/:tableId/query_metadata",133 async table => {134 // HACK: inject GA metadata that we don't have intergrated on the backend yet135 if (table && table.db && table.db.engine === "googleanalytics") {136 const GA = await getGAMetadata();137 table.fields = table.fields.map(field => ({138 ...field,139 ...GA.fields[field.name],140 }));141 table.metrics.push(142 ...GA.metrics.map(metric => ({143 ...metric,144 table_id: table.id,145 googleAnalyics: true,146 })),147 );148 table.segments.push(149 ...GA.segments.map(segment => ({150 ...segment,151 table_id: table.id,152 googleAnalyics: true,153 })),154 );155 }156 if (table && table.fields) {157 // replace dimension_options IDs with objects158 for (const field of table.fields) {159 if (field.dimension_options) {160 field.dimension_options = field.dimension_options.map(161 id => table.dimension_options[id],162 );163 }164 if (field.default_dimension_option) {165 field.default_dimension_option =166 table.dimension_options[field.default_dimension_option];167 }168 }169 }170 return table;171 },172 ),173 // table_sync_metadata: POST("/api/table/:tableId/sync"),174 table_rescan_values: POST("/api/table/:tableId/rescan_values"),175 table_discard_values: POST("/api/table/:tableId/discard_values"),176 field_get: GET("/api/field/:fieldId"),177 // field_summary: GET("/api/field/:fieldId/summary"),178 field_values: GET("/api/field/:fieldId/values"),179 field_values_update: POST("/api/field/:fieldId/values"),180 field_update: PUT("/api/field/:id"),181 field_dimension_update: POST("/api/field/:fieldId/dimension"),182 field_dimension_delete: DELETE("/api/field/:fieldId/dimension"),183 field_rescan_values: POST("/api/field/:fieldId/rescan_values"),184 field_discard_values: POST("/api/field/:fieldId/discard_values"),185 field_search: GET("/api/field/:fieldId/search/:searchFieldId"),186 field_remapping: GET("/api/field/:fieldId/remapping/:remappedFieldId"),187 dataset: POST("/api/dataset"),188 dataset_duration: POST("/api/dataset/duration"),189 native: POST("/api/dataset/native"),190 // to support audit app allow the endpoint to be provided in the query191 datasetEndpoint: POST("/api/:endpoint", {192 // this prevents the `endpoint` parameter from being URL encoded193 raw: { endpoint: true },194 }),195};196export const PulseApi = {197 list: GET("/api/pulse"),198 create: POST("/api/pulse"),199 get: GET("/api/pulse/:pulseId"),200 update: PUT("/api/pulse/:id"),201 delete: DELETE("/api/pulse/:pulseId"),202 test: POST("/api/pulse/test"),203 form_input: GET("/api/pulse/form_input"),204 preview_card: GET("/api/pulse/preview_card_info/:id"),205};206export const AlertApi = {207 list: GET("/api/alert"),208 list_for_question: GET("/api/alert/question/:questionId"),209 create: POST("/api/alert"),210 update: PUT("/api/alert/:id"),211 delete: DELETE("/api/alert/:id"),212 unsubscribe: PUT("/api/alert/:id/unsubscribe"),213};214export const SegmentApi = {215 list: GET("/api/segment"),216 create: POST("/api/segment"),217 get: GET("/api/segment/:segmentId"),218 update: PUT("/api/segment/:id"),219 delete: DELETE("/api/segment/:segmentId"),220};221export const MetricApi = {222 list: GET("/api/metric"),223 create: POST("/api/metric"),224 get: GET("/api/metric/:metricId"),225 update: PUT("/api/metric/:id"),226 update_important_fields: PUT("/api/metric/:metricId/important_fields"),227 delete: DELETE("/api/metric/:metricId"),228};229export const RevisionApi = {230 list: GET("/api/revision"),231 revert: POST("/api/revision/revert"),232};233export const RevisionsApi = {234 get: GET("/api/:entity/:id/revisions"),235};236export const SessionApi = {237 create: POST("/api/session"),238 createWithGoogleAuth: POST("/api/session/google_auth"),239 delete: DELETE("/api/session"),240 properties: GET("/api/session/properties"),241 forgot_password: POST("/api/session/forgot_password"),242 reset_password: POST("/api/session/reset_password"),243 password_reset_token_valid: GET("/api/session/password_reset_token_valid"),244};245export const SettingsApi = {246 list: GET("/api/setting"),247 put: PUT("/api/setting/:key"),248 putAll: PUT("/api/setting"),249 // setAll: PUT("/api/setting"),250 // delete: DELETE("/api/setting/:key"),251};252export const PermissionsApi = {253 groups: GET("/api/permissions/group"),254 groupDetails: GET("/api/permissions/group/:id"),255 graph: GET("/api/permissions/graph"),256 updateGraph: PUT("/api/permissions/graph"),257 createGroup: POST("/api/permissions/group"),258 memberships: GET("/api/permissions/membership"),259 createMembership: POST("/api/permissions/membership"),260 deleteMembership: DELETE("/api/permissions/membership/:id"),261 updateGroup: PUT("/api/permissions/group/:id"),262 deleteGroup: DELETE("/api/permissions/group/:id"),263};264export const GettingStartedApi = {265 get: GET("/api/getting_started"),266};267export const SetupApi = {268 create: POST("/api/setup"),269 validate_db: POST("/api/setup/validate"),270 admin_checklist: GET("/api/setup/admin_checklist"),271};272export const UserApi = {273 create: POST("/api/user"),274 list: GET("/api/user"),275 current: GET("/api/user/current"),276 // get: GET("/api/user/:userId"),277 update: PUT("/api/user/:id"),278 update_password: PUT("/api/user/:id/password"),279 update_qbnewb: PUT("/api/user/:id/qbnewb"),280 delete: DELETE("/api/user/:userId"),281 reactivate: PUT("/api/user/:userId/reactivate"),282 send_invite: POST("/api/user/:id/send_invite"),283};284export const UtilApi = {285 password_check: POST("/api/util/password_check"),286 random_token: GET("/api/util/random_token"),287 logs: GET("/api/util/logs"),288 bug_report_details: GET("/api/util/bug_report_details"),289};290export const GeoJSONApi = {291 get: GET("/api/geojson/:id"),292};293export const I18NApi = {294 locale: GET("/app/locales/:locale.json"),295};296export const TaskApi = {297 get: GET("/api/task"),298 getJobsInfo: GET("/api/task/info"),299};300export function setPublicQuestionEndpoints(uuid: string) {301 setFieldEndpoints("/api/public/card/:uuid", { uuid });302}303export function setPublicDashboardEndpoints(uuid: string) {304 setFieldEndpoints("/api/public/dashboard/:uuid", { uuid });305}306export function setEmbedQuestionEndpoints(token: string) {307 if (!IS_EMBED_PREVIEW) {308 setFieldEndpoints("/api/embed/card/:token", { token });309 }310}311export function setEmbedDashboardEndpoints(token: string) {312 if (!IS_EMBED_PREVIEW) {313 setFieldEndpoints("/api/embed/dashboard/:token", { token });314 }315}316function GET_with(url: string, params: Data) {317 return (data: Data, options?: Options) =>318 GET(url)({ ...params, ...data }, options);319}320export function setFieldEndpoints(prefix: string, params: Data) {321 MetabaseApi.field_values = GET_with(322 prefix + "/field/:fieldId/values",323 params,324 );325 MetabaseApi.field_search = GET_with(326 prefix + "/field/:fieldId/search/:searchFieldId",327 params,328 );329 MetabaseApi.field_remapping = GET_with(330 prefix + "/field/:fieldId/remapping/:remappedFieldId",331 params,332 );333}...
characters.js
Source:characters.js
1const characters = {2 "results": [3 {4 "id": 1,5 "name": "Rick Sanchez",6 "status": "Alive",7 "species": "Human",8 "type": "",9 "gender": "Male",10 "origin": {11 "name": "Earth (C-137)",12 "url": "https://rickandmortyapi.com/api/location/1"13 },14 "location": {15 "name": "Citadel of Ricks",16 "url": "https://rickandmortyapi.com/api/location/3"17 },18 "image": "https://rickandmortyapi.com/api/character/avatar/1.jpeg",19 "episode": [20 "https://rickandmortyapi.com/api/episode/1",21 "https://rickandmortyapi.com/api/episode/2",22 "https://rickandmortyapi.com/api/episode/3",23 "https://rickandmortyapi.com/api/episode/4",24 "https://rickandmortyapi.com/api/episode/5",25 "https://rickandmortyapi.com/api/episode/6",26 "https://rickandmortyapi.com/api/episode/7",27 "https://rickandmortyapi.com/api/episode/8",28 "https://rickandmortyapi.com/api/episode/9",29 "https://rickandmortyapi.com/api/episode/10",30 "https://rickandmortyapi.com/api/episode/11",31 "https://rickandmortyapi.com/api/episode/12",32 "https://rickandmortyapi.com/api/episode/13",33 "https://rickandmortyapi.com/api/episode/14",34 "https://rickandmortyapi.com/api/episode/15",35 "https://rickandmortyapi.com/api/episode/16",36 "https://rickandmortyapi.com/api/episode/17",37 "https://rickandmortyapi.com/api/episode/18",38 "https://rickandmortyapi.com/api/episode/19",39 "https://rickandmortyapi.com/api/episode/20",40 "https://rickandmortyapi.com/api/episode/21",41 "https://rickandmortyapi.com/api/episode/22",42 "https://rickandmortyapi.com/api/episode/23",43 "https://rickandmortyapi.com/api/episode/24",44 "https://rickandmortyapi.com/api/episode/25",45 "https://rickandmortyapi.com/api/episode/26",46 "https://rickandmortyapi.com/api/episode/27",47 "https://rickandmortyapi.com/api/episode/28",48 "https://rickandmortyapi.com/api/episode/29",49 "https://rickandmortyapi.com/api/episode/30",50 "https://rickandmortyapi.com/api/episode/31",51 "https://rickandmortyapi.com/api/episode/32",52 "https://rickandmortyapi.com/api/episode/33",53 "https://rickandmortyapi.com/api/episode/34",54 "https://rickandmortyapi.com/api/episode/35",55 "https://rickandmortyapi.com/api/episode/36",56 "https://rickandmortyapi.com/api/episode/37",57 "https://rickandmortyapi.com/api/episode/38",58 "https://rickandmortyapi.com/api/episode/39",59 "https://rickandmortyapi.com/api/episode/40",60 "https://rickandmortyapi.com/api/episode/41",61 "https://rickandmortyapi.com/api/episode/42",62 "https://rickandmortyapi.com/api/episode/43",63 "https://rickandmortyapi.com/api/episode/44",64 "https://rickandmortyapi.com/api/episode/45",65 "https://rickandmortyapi.com/api/episode/46",66 "https://rickandmortyapi.com/api/episode/47",67 "https://rickandmortyapi.com/api/episode/48",68 "https://rickandmortyapi.com/api/episode/49",69 "https://rickandmortyapi.com/api/episode/50",70 "https://rickandmortyapi.com/api/episode/51"71 ],72 "url": "https://rickandmortyapi.com/api/character/1",73 "created": "2017-11-04T18:48:46.250Z"74 },75 {76 "id": 2,77 "name": "Morty Smith",78 "status": "Alive",79 "species": "Human",80 "type": "",81 "gender": "Male",82 "origin": {83 "name": "unknown",84 "url": ""85 },86 "location": {87 "name": "Citadel of Ricks",88 "url": "https://rickandmortyapi.com/api/location/3"89 },90 "image": "https://rickandmortyapi.com/api/character/avatar/2.jpeg",91 "episode": [92 "https://rickandmortyapi.com/api/episode/1",93 "https://rickandmortyapi.com/api/episode/2",94 "https://rickandmortyapi.com/api/episode/3",95 "https://rickandmortyapi.com/api/episode/4",96 "https://rickandmortyapi.com/api/episode/5",97 "https://rickandmortyapi.com/api/episode/6",98 "https://rickandmortyapi.com/api/episode/7",99 "https://rickandmortyapi.com/api/episode/8",100 "https://rickandmortyapi.com/api/episode/9",101 "https://rickandmortyapi.com/api/episode/10",102 "https://rickandmortyapi.com/api/episode/11",103 "https://rickandmortyapi.com/api/episode/12",104 "https://rickandmortyapi.com/api/episode/13",105 "https://rickandmortyapi.com/api/episode/14",106 "https://rickandmortyapi.com/api/episode/15",107 "https://rickandmortyapi.com/api/episode/16",108 "https://rickandmortyapi.com/api/episode/17",109 "https://rickandmortyapi.com/api/episode/18",110 "https://rickandmortyapi.com/api/episode/19",111 "https://rickandmortyapi.com/api/episode/20",112 "https://rickandmortyapi.com/api/episode/21",113 "https://rickandmortyapi.com/api/episode/22",114 "https://rickandmortyapi.com/api/episode/23",115 "https://rickandmortyapi.com/api/episode/24",116 "https://rickandmortyapi.com/api/episode/25",117 "https://rickandmortyapi.com/api/episode/26",118 "https://rickandmortyapi.com/api/episode/27",119 "https://rickandmortyapi.com/api/episode/28",120 "https://rickandmortyapi.com/api/episode/29",121 "https://rickandmortyapi.com/api/episode/30",122 "https://rickandmortyapi.com/api/episode/31",123 "https://rickandmortyapi.com/api/episode/32",124 "https://rickandmortyapi.com/api/episode/33",125 "https://rickandmortyapi.com/api/episode/34",126 "https://rickandmortyapi.com/api/episode/35",127 "https://rickandmortyapi.com/api/episode/36",128 "https://rickandmortyapi.com/api/episode/37",129 "https://rickandmortyapi.com/api/episode/38",130 "https://rickandmortyapi.com/api/episode/39",131 "https://rickandmortyapi.com/api/episode/40",132 "https://rickandmortyapi.com/api/episode/41",133 "https://rickandmortyapi.com/api/episode/42",134 "https://rickandmortyapi.com/api/episode/43",135 "https://rickandmortyapi.com/api/episode/44",136 "https://rickandmortyapi.com/api/episode/45",137 "https://rickandmortyapi.com/api/episode/46",138 "https://rickandmortyapi.com/api/episode/47",139 "https://rickandmortyapi.com/api/episode/48",140 "https://rickandmortyapi.com/api/episode/49",141 "https://rickandmortyapi.com/api/episode/50",142 "https://rickandmortyapi.com/api/episode/51"143 ],144 "url": "https://rickandmortyapi.com/api/character/2",145 "created": "2017-11-04T18:50:21.651Z"146 },147 {148 "id": 3,149 "name": "Summer Smith",150 "status": "Alive",151 "species": "Human",152 "type": "",153 "gender": "Female",154 "origin": {155 "name": "Earth (Replacement Dimension)",156 "url": "https://rickandmortyapi.com/api/location/20"157 },158 "location": {159 "name": "Earth (Replacement Dimension)",160 "url": "https://rickandmortyapi.com/api/location/20"161 },162 "image": "https://rickandmortyapi.com/api/character/avatar/3.jpeg",163 "episode": [164 "https://rickandmortyapi.com/api/episode/6",165 "https://rickandmortyapi.com/api/episode/7",166 "https://rickandmortyapi.com/api/episode/8",167 "https://rickandmortyapi.com/api/episode/9",168 "https://rickandmortyapi.com/api/episode/10",169 "https://rickandmortyapi.com/api/episode/11",170 "https://rickandmortyapi.com/api/episode/12",171 "https://rickandmortyapi.com/api/episode/14",172 "https://rickandmortyapi.com/api/episode/15",173 "https://rickandmortyapi.com/api/episode/16",174 "https://rickandmortyapi.com/api/episode/17",175 "https://rickandmortyapi.com/api/episode/18",176 "https://rickandmortyapi.com/api/episode/19",177 "https://rickandmortyapi.com/api/episode/20",178 "https://rickandmortyapi.com/api/episode/21",179 "https://rickandmortyapi.com/api/episode/22",180 "https://rickandmortyapi.com/api/episode/23",181 "https://rickandmortyapi.com/api/episode/24",182 "https://rickandmortyapi.com/api/episode/25",183 "https://rickandmortyapi.com/api/episode/26",184 "https://rickandmortyapi.com/api/episode/27",185 "https://rickandmortyapi.com/api/episode/29",186 "https://rickandmortyapi.com/api/episode/30",187 "https://rickandmortyapi.com/api/episode/31",188 "https://rickandmortyapi.com/api/episode/32",189 "https://rickandmortyapi.com/api/episode/33",190 "https://rickandmortyapi.com/api/episode/34",191 "https://rickandmortyapi.com/api/episode/35",192 "https://rickandmortyapi.com/api/episode/36",193 "https://rickandmortyapi.com/api/episode/38",194 "https://rickandmortyapi.com/api/episode/39",195 "https://rickandmortyapi.com/api/episode/40",196 "https://rickandmortyapi.com/api/episode/41",197 "https://rickandmortyapi.com/api/episode/42",198 "https://rickandmortyapi.com/api/episode/43",199 "https://rickandmortyapi.com/api/episode/44",200 "https://rickandmortyapi.com/api/episode/45",201 "https://rickandmortyapi.com/api/episode/46",202 "https://rickandmortyapi.com/api/episode/47",203 "https://rickandmortyapi.com/api/episode/48",204 "https://rickandmortyapi.com/api/episode/49",205 "https://rickandmortyapi.com/api/episode/51"206 ],207 "url": "https://rickandmortyapi.com/api/character/3",208 "created": "2017-11-04T19:09:56.428Z"209 },210 {211 "id": 4,212 "name": "Beth Smith",213 "status": "Alive",214 "species": "Human",215 "type": "",216 "gender": "Female",217 "origin": {218 "name": "Earth (Replacement Dimension)",219 "url": "https://rickandmortyapi.com/api/location/20"220 },221 "location": {222 "name": "Earth (Replacement Dimension)",223 "url": "https://rickandmortyapi.com/api/location/20"224 },225 "image": "https://rickandmortyapi.com/api/character/avatar/4.jpeg",226 "episode": [227 "https://rickandmortyapi.com/api/episode/6",228 "https://rickandmortyapi.com/api/episode/7",229 "https://rickandmortyapi.com/api/episode/8",230 "https://rickandmortyapi.com/api/episode/9",231 "https://rickandmortyapi.com/api/episode/10",232 "https://rickandmortyapi.com/api/episode/11",233 "https://rickandmortyapi.com/api/episode/12",234 "https://rickandmortyapi.com/api/episode/14",235 "https://rickandmortyapi.com/api/episode/15",236 "https://rickandmortyapi.com/api/episode/16",237 "https://rickandmortyapi.com/api/episode/18",238 "https://rickandmortyapi.com/api/episode/19",239 "https://rickandmortyapi.com/api/episode/20",240 "https://rickandmortyapi.com/api/episode/21",241 "https://rickandmortyapi.com/api/episode/22",242 "https://rickandmortyapi.com/api/episode/23",243 "https://rickandmortyapi.com/api/episode/24",244 "https://rickandmortyapi.com/api/episode/25",245 "https://rickandmortyapi.com/api/episode/26",246 "https://rickandmortyapi.com/api/episode/27",247 "https://rickandmortyapi.com/api/episode/28",248 "https://rickandmortyapi.com/api/episode/29",249 "https://rickandmortyapi.com/api/episode/30",250 "https://rickandmortyapi.com/api/episode/31",251 "https://rickandmortyapi.com/api/episode/32",252 "https://rickandmortyapi.com/api/episode/33",253 "https://rickandmortyapi.com/api/episode/34",254 "https://rickandmortyapi.com/api/episode/35",255 "https://rickandmortyapi.com/api/episode/36",256 "https://rickandmortyapi.com/api/episode/38",257 "https://rickandmortyapi.com/api/episode/39",258 "https://rickandmortyapi.com/api/episode/40",259 "https://rickandmortyapi.com/api/episode/41",260 "https://rickandmortyapi.com/api/episode/42",261 "https://rickandmortyapi.com/api/episode/43",262 "https://rickandmortyapi.com/api/episode/44",263 "https://rickandmortyapi.com/api/episode/45",264 "https://rickandmortyapi.com/api/episode/46",265 "https://rickandmortyapi.com/api/episode/47",266 "https://rickandmortyapi.com/api/episode/48",267 "https://rickandmortyapi.com/api/episode/49",268 "https://rickandmortyapi.com/api/episode/51"269 ],270 "url": "https://rickandmortyapi.com/api/character/4",271 "created": "2017-11-04T19:22:43.665Z"272 },273 ],274}...
3project.js
Source:3project.js
1/**2 * @apiDefine 3project 3.0 项ç®æ¨¡å3 */4/**5 *6 *7 * @api {post} /project/create.htm 3.01 å建项ç®8 *9 * @apiVersion 0.0.110 *11 * @apiName create12 *13 * @apiGroup 3project14 *15 * @apiParam {String} userToken ç¨æ·ä»¤ç16 *17 * @apiParam {String} name 项ç®å称18 *19 * @apiParam {Long} charger 项ç®è´è´£äºº20 *21 * @apiParam {Long} beginDate 项ç®å¼å§æ¶é´22 *23 * @apiParam {Long} deadline 项ç®ç»ææ¶é´24 *25 * @apiPermission none26 *27 * @apiDescription å建项ç®28 *29 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)30 *31 * @apiSuccess {String} msg ç¶ææ¶æ¯32 *33 */34/**35 * @api {post} /project/my.htm 3.02 åæç¸å
³ç项ç®36 *37 * @apiVersion 0.0.138 *39 * @apiName my40 *41 * @apiGroup 3project42 *43 * @apiParam {String} userToken ç¨æ·ä»¤ç44 *45 * @apiParam {int} no 页ç 46 *47 * @apiParam {int} size å页大å°48 *49 *50 * @apiPermission none51 *52 * @apiDescription åæç¸å
³ç项ç®53 *54 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)55 *56 * @apiSuccess {String} msg ç¶ææ¶æ¯57 *58 * @apiSuccess {array} list 项ç®éå59 *60 * @apiSuccess {long} list.id 项ç®id61 *62 * @apiSuccess {long} list.name 项ç®å称63 *64 * @apiSuccess {object} list.creater å建人信æ¯65 *66 * @apiSuccess {object} list.creater.name å建人å§å67 *68 * @apiSuccess {object} list.creater.avatar å建人å§å69 */70/**71 * @api {post} /project/delete.htm 3.03 å é¤æ个项ç®72 *73 * @apiVersion 0.0.174 *75 * @apiName delete76 *77 * @apiGroup 3project78 *79 * @apiParam {String} userToken ç¨æ·ä»¤ç80 *81 * @apiParam {long} id 项ç®id82 *83 *84 * @apiPermission none85 *86 * @apiDescription å é¤æ个项ç®87 *88 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)89 *90 * @apiSuccess {String} msg ç¶ææ¶æ¯91 *92 */93/**94 * @api {post} /project/findbyid.htm 3.04 项ç®è¯¦æ
95 *96 * @apiVersion 0.0.197 *98 * @apiName findbyid99 *100 * @apiGroup 3project101 *102 * @apiParam {String} userToken ç¨æ·ä»¤ç103 *104 * @apiParam {long} id 项ç®id105 *106 *107 * @apiPermission none108 *109 * @apiDescription 项ç®è¯¦æ
110 *111 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)112 *113 * @apiSuccess {String} msg ç¶ææ¶æ¯114 *115 * @apiSuccess {long} id 项ç®id116 *117 * @apiSuccess {String} name 项ç®å称118 *119 * @apiSuccess {String} note 项ç®å
容120 *121 * @apiSuccess {int} total 项ç®ä»»å¡æ»ä¸ªæ°122 *123 *@apiSuccess {int} finish 项ç®å®æä»»å¡æ°124 *125 *@apiSuccess {object} charger 项ç®è´è´£äºº126 *127 * @apiSuccess {object} charger.id 项ç®è´è´£äººid128 *129 * @apiSuccess {object} charger.name 项ç®è´è´£äººå§å130 *131 * @apiSuccess {object} charger.avatar 项ç®è´è´£äººå¤´å132 *133 * @apiSuccess {array} tasks 项ç®éé¢çä»»å¡134 *135 * @apiSuccess {long} tasks.id 项ç®éé¢çä»»å¡id136 *137 * @apiSuccess {String} tasks.note ä»»å¡å
容138 *139 * @apiSuccess {object} tasks.executor ä»»å¡æ§è¡è
140 *141 * @apiSuccess {long} tasks.executor.id ä»»å¡æ§è¡è
id142 *143 * @apiSuccess {String} tasks.executor.name ä»»å¡æ§è¡è
å§å144 *145 * @apiSuccess {String} tasks.executor.avatar ä»»å¡æ§è¡è
头å146 *147 */148/**149 * @api {post} /project/update.htm 3.05 æ´æ°æ个项ç®150 *151 * @apiVersion 0.0.1152 *153 * @apiName update154 *155 * @apiGroup 3project156 *157 * @apiParam {String} userToken ç¨æ·ä»¤ç158 *159 * @apiParam {long} id 项ç®id160 *161 * @apiParam {long} charger 项ç®è´è´£äººid162 *163 * @apiParam {long} deadline 项ç®ç»ææ¶é´164 *165 * @apiParam {long} beginDate 项ç®å¼å§æ¶é´166 *167 * @apiParam {long} name 项ç®å称168 *169 * @apiPermission none170 *171 * @apiDescription æ´æ°æ个项ç®172 *173 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)174 *175 * @apiSuccess {String} msg ç¶ææ¶æ¯176 *177 */178/**179 * @api {post} /project/members.htm 3.06 è·å项ç®æå180 *181 * @apiVersion 0.0.1182 *183 * @apiName members184 *185 * @apiGroup 3project186 *187 * @apiParam {String} userToken ç¨æ·ä»¤ç188 *189 * @apiParam {long} id 项ç®id190 *191 *192 * @apiPermission none193 *194 * @apiDescription è·å项ç®æå195 *196 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)197 *198 * @apiSuccess {String} msg ç¶ææ¶æ¯199 *200 * @apiSuccess {array} list 项ç®æåéå201 *202 * @apiSuccess {long} list.id æåid203 *204 * @apiSuccess {object} list.name å建人å§å205 *206 * @apiSuccess {object} list.avatar å建人å§å207 *208 */209/**210 * @api {post} /project/join.htm 3.07 èªå·±å å
¥æ个项ç®211 *212 * @apiVersion 0.0.1213 *214 * @apiName join215 *216 * @apiGroup 3project217 *218 * @apiParam {String} userToken ç¨æ·ä»¤ç219 *220 * @apiParam {long} id 项ç®id221 *222 * @apiPermission none223 *224 * @apiDescription èªå·±å å
¥æ个项ç®225 *226 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)227 *228 * @apiSuccess {String} msg ç¶ææ¶æ¯229 *230 */231/**232 * @api {post} /project/exit.htm 3.08 éåºæ个项ç®233 *234 * @apiVersion 0.0.1235 *236 * @apiName exit237 *238 * @apiGroup 3project239 *240 * @apiParam {String} userToken ç¨æ·ä»¤ç241 *242 * @apiParam {long} id 项ç®id243 *244 * @apiPermission none245 *246 * @apiDescription éåºæ个项ç®247 *248 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)249 *250 * @apiSuccess {String} msg ç¶ææ¶æ¯251 *...
4task.js
Source:4task.js
1/**2 * @apiDefine 4task 4.0 ä»»å¡æ¨¡å3 */4/**5 * 6 *7 * @api {post} /task/create.htm 4.01 å建任å¡8 *9 * @apiVersion 0.0.110 *11 * @apiName create12 *13 * @apiGroup 4task14 *15 * @apiParam {String} userToken ç¨æ·ä»¤ç16 *17 * @apiParam {String} name ä»»å¡å称18 *19 * @apiParam {String} note ä»»å¡è¯¦ç»å
容20 *21 * @apiParam {Long} project 项ç®id22 *23 * @apiParam {Long} beginDate ä»»å¡å¼å§æ¶é´24 *25 * @apiParam {Long} deadline ä»»å¡æªè³æ¥æ26 *27 *28 * @apiParam {Long} executor æ§è¡äººid29 *30 * @apiPermission none31 *32 * @apiDescription å建任å¡33 *34 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)35 *36 * @apiSuccess {String} msg ç¶ææ¶æ¯37 *38 */39/**40 * @api {post} /task/delete.htm 4.02 å é¤æ个任å¡41 *42 * @apiVersion 0.0.143 *44 * @apiName delete45 *46 * @apiGroup 4task47 *48 * @apiParam {String} userToken ç¨æ·ä»¤ç49 *50 * @apiParam {long} id ä»»å¡id51 *52 *53 * @apiPermission none54 *55 * @apiDescription å é¤æ个任å¡56 *57 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)58 *59 * @apiSuccess {String} msg ç¶ææ¶æ¯60 *61 */62/**63 * @api {post} /task/findbyid.htm 4.03 ä»»å¡è¯¦æ
64 *65 * @apiVersion 0.0.166 *67 * @apiName findbyid68 *69 * @apiGroup 4task70 *71 * @apiParam {String} userToken ç¨æ·ä»¤ç72 *73 * @apiParam {long} id ä»»å¡id74 *75 *76 * @apiPermission none77 *78 * @apiDescription ä»»å¡è¯¦æ
79 *80 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)81 *82 * @apiSuccess {String} msg ç¶ææ¶æ¯83 *84 * @apiSuccess {long} id ä»»å¡id85 *86 * @apiSuccess {int} state ä»»å¡ç¶æ 0为æªå®æ 1为å®æ87 *88 * @apiSuccess {String} note ä»»å¡å
容89 *90 * @apiSuccess {object} executor ä»»å¡æ§è¡è
91 *92 * @apiSuccess {long} executor.id ä»»å¡æ§è¡è
id93 *94 * @apiSuccess {String} executor.name ä»»å¡æ§è¡è
å§å95 *96 * @apiSuccess {String} executor.avatar ä»»å¡æ§è¡è
头å97 *98 * @apiSuccess {object} project 项ç®ä¿¡æ¯99 *100 * @apiSuccess {long} project.id 项ç®id101 *102 * @apiSuccess {String} project.name 项ç®å称103 *104 */105/**106 * @api {post} /task/update.htm 4.04 æ´æ°ä»»å¡107 *108 * @apiVersion 0.0.1109 *110 * @apiName update111 *112 * @apiGroup 4task113 *114 * @apiParam {String} userToken ç¨æ·ä»¤ç115 *116 * @apiParam {long} id ä»»å¡id117 *118 * @apiParam {Long} executor æ§è¡äººid119 *120 * @apiSuccess {String} note ä»»å¡å
容121 *122 * @apiParam {Long} deadline ä»»å¡æªè³æ¥æ123 *124 * @apiPermission none125 *126 * @apiDescription æ´æ°ä»»å¡127 *128 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)129 *130 * @apiSuccess {String} msg ç¶ææ¶æ¯131 *132 */133/**134 * @api {post} /task/comment.htm 4.05 è¯è®ºä»»å¡135 *136 * @apiVersion 0.0.1137 *138 * @apiName comment139 *140 * @apiGroup 4task141 *142 * @apiParam {String} userToken ç¨æ·ä»¤ç143 *144 * @apiParam {long} id ä»»å¡id145 *146 * @apiParam {String} note ä»»å¡å
容147 *148 * @apiPermission none149 *150 * @apiDescription è¯è®ºä»»å¡151 *152 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)153 *154 * @apiSuccess {String} msg ç¶ææ¶æ¯155 *156 */157/**158 * @api {post} /task/page.htm 4.06 è¯è®ºå页159 *160 * @apiVersion 0.0.1161 *162 * @apiName page163 *164 * @apiGroup 4task165 *166 * @apiParam {String} userToken ç¨æ·ä»¤ç167 *168 * @apiParam {long} id ä»»å¡id169 *170 * @apiParam {int} no 页ç 171 *172 * @apiParam {int} size å页大å°173 *174 * @apiPermission none175 *176 * @apiDescription è¯è®ºä»»å¡177 *178 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0)179 *180 * @apiSuccess {String} msg ç¶ææ¶æ¯181 *182 *183 * @apiSuccess {array} list æ°æ®éå184 *185 * @apiSuccess {long} list.id è¯è®ºid186 *187 * @apiSuccess {String} list.note è¯è®ºå
容188 *189 * @apiSuccess {object} list.member è¯è®ºäºº190 *191 * @apiSuccess {long} list.member.id è¯è®ºäººid192 *193 * @apiSuccess {String} list.member.name è¯è®ºäººå§å194 *195 * @apiSuccess {String} list.member.avatar è¯è®ºäººå¤´å196 *197 */198/**199 * @api {post} /task/toggle.htm 4.07 ä»»å¡ç¶æåæ¢200 *201 * @apiVersion 0.0.1202 *203 * @apiName toggle204 *205 * @apiGroup 4task206 *207 * @apiParam {String} userToken ç¨æ·ä»¤ç208 *209 * @apiParam {long} id ä»»å¡id210 *211 *212 * @apiPermission none213 *214 * @apiDescription ä»»å¡ç¶æåæ¢215 *216 * @apiSuccess {Int} code ç¶æç (é»è®¤ä¸º0) 0æªå®æ 1å®æ217 *218 * @apiSuccess {String} msg ç¶ææ¶æ¯219 *...
Using AI Code Generation
1var argosy = require('argosy')2var argosyPattern = require('argosy-pattern')3var argosyApi = require('argosy-api')4var argosyService = argosy()5argosyService.pipe(argosyService)6var api = argosyApi(argosyService)7var pattern = argosyPattern({8})9api.register(pattern, function (message, callback) {10 callback(null, {11 })12})13api.use(pattern, function (error, api) {14 api.add(2, function (error, result) {15 console.log('add result', result)16 })17 api.multiply(2, function (error, result) {18 console.log('multiply result', result)19 })20})21var argosy = require('argosy')22var argosyPattern = require('argosy-pattern')23var argosyApi = require('argosy-api')24var argosyService = argosy()25argosyService.pipe(argosyService)26var api = argosyApi(argosyService)27var pattern = argosyPattern({28})29api.register(pattern, function (message, callback) {30 callback(null, {31 })32})33api.use(pattern, function (error, api) {34 api.add(2, function (error, result) {35 console.log('add result', result)36 })37 api.multiply(2, function (error, result) {38 console.log('multiply result', result)39 })40})41var argosy = require('argosy')42var argosyPattern = require('argosy-pattern')43var argosyApi = require('argosy-api')44var argosyService = argosy()45argosyService.pipe(argosy
Using AI Code Generation
1var argosy = require('argosy')2var api = argosy()3api.accept({ role: 'math', cmd: 'sum' }).process(function (msg, cb) {4 cb(null, { answer: sum })5})6api.accept({ role: 'math', cmd: 'product' }).process(function (msg, cb) {7 cb(null, { answer: product })8})9api.listen()10var argosy = require('argosy')11var pattern = require('argosy-pattern')12var api = argosy()13api.pipe(pattern({ role: 'math', cmd: 'sum' }, function (msg, cb) {14 cb(null, { answer: sum })15}))16api.pipe(pattern({ role: 'math', cmd: 'product' }, function (msg, cb) {17 cb(null, { answer: product })18}))19api.listen()20var argosy = require('argosy')21var pattern = require('argosy-pattern')22var api = argosy()23api.pipe(pattern({24 cmd: pattern.match('sum', 'product')25}, function (msg, cb) {26 cb(null, { answer: answer })27}))28api.listen()29var argosy = require('argosy')30var pattern = require('argosy-pattern')31var api = argosy()32api.pipe(pattern({33 cmd: pattern.match('sum', 'product')34}, function (msg, cb) {35 cb(null, { answer: answer })36}))37api.listen()38var argosy = require('argosy')39var pattern = require('argosy-pattern')40var api = argosy()41api.pipe(pattern({
Using AI Code Generation
1const argosy = require('argosy')2const argosyPattern = require('argosy-pattern')3const argosyApi = require('argosy-api')4const argosyApiPattern = argosyPattern({5 greet: argosyApiMethod({6 })7})8const service = argosy()9service.use(argosyApiPattern({10}))11service.pipe(argosy.acceptor()).pipe(service)12service.on('error', console.error)13const argosy = require('argosy')14const argosyPattern = require('argosy-pattern')15const argosyApi = require('argosy-api')16const argosyApiPattern = argosyPattern({17 greet: argosyApiMethod({18 })19})20const service = argosy()21service.use(argosyApiPattern({22}))23service.pipe(argosy.acceptor()).pipe(service)24service.on('error', console.error)25const argosy = require('argosy')26const argosyPattern = require('argosy-pattern')27const argosyApi = require('argosy-api')28const argosyApiPattern = argosyPattern({29 greet: argosyApiMethod({30 })31})32const service = argosy()33service.use(argosyApiPattern({34}))35service.pipe(argosy.acceptor()).pipe(service)36service.on('error', console.error)37const argosy = require('argosy')38const argosyPattern = require('argosy-pattern')39const argosyApi = require('argosy-api')
Using AI Code Generation
1var argosyService = require('argosy-service')2var argosy = require('argosy')3var argosyPattern = require('argosy-pattern')4var argosyServiceApi = require('argosy-service-api')5var service = argosy()6service.pipe(argosyServiceApi()).pipe(service)7service.accept({ role: 'service', cmd: 'api' }, function (msg, cb) {8 cb(null, {9 sayHello: function (msg, cb) {10 cb(null, 'hello ' + msg.name)11 }12 })13})14service.accept({ role: 'service', cmd: 'api' }, function (msg, cb) {15 cb(null, {16 sayHello: function (msg, cb) {17 cb(null, 'hello ' + msg.name)18 }19 })20})21service.accept({ role: 'service', cmd: 'api' }, function (msg, cb) {22 cb(null, {23 sayHello: function (msg, cb) {24 cb(null, 'hello ' + msg.name)25 }26 })27})28var argosyService = require('argosy-service')29var argosy = require('argosy')30var argosyPattern = require('argosy-pattern')31var argosyServiceApi = require('argosy-service-api')32var service = argosy()33service.pipe(argosyServiceApi()).pipe(service)34service.accept({ role: 'service', cmd: 'api' }, function (msg, cb) {35 cb(null, {36 sayHello: function (msg, cb) {37 cb(null, 'hello ' + msg.name)38 }39 })40})41service.accept({ role: 'service', cmd: 'api' }, function (msg, cb) {42 cb(null, {43 sayHello: function (msg, cb) {44 cb(null, 'hello ' + msg.name)45 }46 })47})48service.accept({ role: 'service', cmd:
Using AI Code Generation
1var argos = require('argos');2api.get('/argos', function(err, res){3 console.log(err, res);4});5var argos = require('argos');6api.get('/argos', function(err, res){7 console.log(err, res);8});9var argos = require('argos');10api.get('/argos', function(err, res){11 console.log(err, res);12});13var argos = require('argos');14api.get('/argos', function(err, res){15 console.log(err, res);16});17var argos = require('argos');18api.get('/argos', function(err, res){19 console.log(err, res);20});21var argos = require('argos');22api.get('/argos', function(err, res){23 console.log(err, res);24});25var argos = require('argos');26api.get('/argos', function(err, res){27 console.log(err, res);28});29var argos = require('argos');30api.get('/argos', function(err, res){31 console.log(err, res);32});33var argos = require('argos');34api.get('/argos', function(err, res){35 console.log(err, res);36});37var argos = require('argos');
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!