Search in sources :

Example 1 with MapType

use of com.palantir.conjure.spec.MapType in project conjure-postman by palantir.

the class BodyParameterTypeVisitor method visitBody.

@Override
public Optional<PostmanRequest.Body> visitBody(BodyParameterType _value) {
    TemplateTypeVisitor visitor = new TemplateTypeVisitor(types);
    Type type = argumentDefinition.getType();
    return type.accept(new Type.Visitor<Optional<PostmanRequest.Body>>() {

        @Override
        public Optional<PostmanRequest.Body> visitPrimitive(PrimitiveType value) {
            switch(value.get()) {
                case BINARY:
                    return Optional.of(PostmanRequest.FileBody.builder().build());
                default:
                    return rawBody(visitor.visitPrimitive(value));
            }
        }

        @Override
        public Optional<PostmanRequest.Body> visitOptional(OptionalType value) {
            return rawBody(visitor.visitOptional(value));
        }

        @Override
        public Optional<PostmanRequest.Body> visitList(ListType value) {
            return rawBody(visitor.visitList(value));
        }

        @Override
        public Optional<PostmanRequest.Body> visitSet(SetType value) {
            return rawBody(visitor.visitSet(value));
        }

        @Override
        public Optional<PostmanRequest.Body> visitMap(MapType value) {
            return rawBody(visitor.visitMap(value));
        }

        @Override
        public Optional<PostmanRequest.Body> visitReference(TypeName value) {
            return rawBody(visitor.visitReference(value));
        }

        @Override
        public Optional<PostmanRequest.Body> visitExternal(ExternalReference value) {
            return rawBody(visitor.visitExternal(value));
        }

        @Override
        public Optional<PostmanRequest.Body> visitUnknown(String _unknownType) {
            return Optional.empty();
        }
    });
}
Also used : TypeName(com.palantir.conjure.spec.TypeName) Optional(java.util.Optional) MapType(com.palantir.conjure.spec.MapType) ListType(com.palantir.conjure.spec.ListType) Type(com.palantir.conjure.spec.Type) BodyParameterType(com.palantir.conjure.spec.BodyParameterType) MapType(com.palantir.conjure.spec.MapType) OptionalType(com.palantir.conjure.spec.OptionalType) SetType(com.palantir.conjure.spec.SetType) PrimitiveType(com.palantir.conjure.spec.PrimitiveType) OptionalType(com.palantir.conjure.spec.OptionalType) ExternalReference(com.palantir.conjure.spec.ExternalReference) SetType(com.palantir.conjure.spec.SetType) ListType(com.palantir.conjure.spec.ListType) PrimitiveType(com.palantir.conjure.spec.PrimitiveType) PostmanRequest(com.palantir.conjure.postman.api.PostmanRequest)

Aggregations

PostmanRequest (com.palantir.conjure.postman.api.PostmanRequest)1 BodyParameterType (com.palantir.conjure.spec.BodyParameterType)1 ExternalReference (com.palantir.conjure.spec.ExternalReference)1 ListType (com.palantir.conjure.spec.ListType)1 MapType (com.palantir.conjure.spec.MapType)1 OptionalType (com.palantir.conjure.spec.OptionalType)1 PrimitiveType (com.palantir.conjure.spec.PrimitiveType)1 SetType (com.palantir.conjure.spec.SetType)1 Type (com.palantir.conjure.spec.Type)1 TypeName (com.palantir.conjure.spec.TypeName)1 Optional (java.util.Optional)1