Skip to content

Instantly share code, notes, and snippets.

@iamdustan
Last active May 5, 2016 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamdustan/9dd288e4dd0dda7fad0b17d88dbb6e7e to your computer and use it in GitHub Desktop.
Save iamdustan/9dd288e4dd0dda7fad0b17d88dbb6e7e to your computer and use it in GitHub Desktop.
/**
* File generated on 2015-01-01T00:00:00.000Z against https://path.to.swaggerdocs.com/example
*
* @flow
**/
/* eslint-disable */
import type {Action} from 'redux';
import {apiBase} from '../../../config';
import bind from 'bind-effect';
import {fetch} from 'redux-effects-fetch';
import {createAction} from 'redux-actions';
import {assert, serialize} from './_utils';
import {GET_EXAMPLE_ENDPOINT_REQUEST, GET_EXAMPLE_ENDPOINT_SUCCESS, GET_EXAMPLE_ENDPOINT_ERROR} from '../../constants/actions';
const onGetExampleEndpointRequest = createAction(GET_EXAMPLE_ENDPOINT_REQUEST);
const onGetExampleEndpointSuccess = createAction(GET_EXAMPLE_ENDPOINT_SUCCESS);
const onGetExampleEndpointError = createAction(GET_EXAMPLE_ENDPOINT_ERROR);
export type GetExampleEndpoint = {someParam: string};
export function getExampleEndpoint(options: GetExampleEndpoint): Array<Action> {
assert(options, getAccessPoint.optionTypes, 'ExampleEndpointActions.getExampleEndpoint');
const url = `${apiBase}/example/${options.someParam}`;
return [onGetExampleEndpointRequest({
options,
url
}), bind(fetch(url, {
method: 'get'
}), res => onGetExampleEndpointSuccess(Object.assign({
options,
url
}, res)), res => onGetExampleEndpointError(Object.assign({
options,
url
}, res)))];
};
getExampleEndpoint.optionTypes = {
someParam: {
required: true,
paramType: 'path',
type: 'string'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment