api_guide 1.0.4 copy "api_guide: ^1.0.4" to clipboard
api_guide: ^1.0.4 copied to clipboard

API Guide is package to generate API calls documentations like OpenAPI schema.

API Guide Package

Pub License: MIT


API Guide #

Flutter package to generate API calls documentations like OpenAPI schema.

Screenshots #

Example Screenshot

About #

  • API Guide is package to generate API calls documentations like OpenAPI schema. For example, Get, Post, Put, Delete or Options Http requests and responses.

API Integration Guide Features #

  • Generative code model covers more than 30 snippet code types.
  • Possibility to copy sample code to the clipboard by clicking the button.
  • Responsive design supports large, medium and small screens.
  • Light and dark theme mode.
  • The beautiful introduction section can be modified as needed.
  • The Infinite FAQ section can be modified with any number of questions and answers.
  • Seamless scrollable sidebar.
  • It appears clear by version and last update date.
  • Optional Privacy Policy and Terms of Use API Integration Guide footer links.
  • Built in accordance with W3 Consortium and OpenAPI Schema recommendations.

Installation and Basic Usage #

First: Add to pubspec.yaml:

dependencies:
  api_guide: ^1.0.4

Second: import it to your project:

import 'package:api_guide/api_guide.dart';

Finally add APIGuide().display() into your target web pages with required parameters.

Here is a full usage example code:

import 'package:api_guide/api_guide.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    // Create the main application widget
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter API Guide Example',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Define API Items with all needed properties
    List<APIItem> apiItems = [
      // Define the first API item
      const APIItem(
        // Define the request for the first API item
        request: APIGuideRequest(
          method: HttpRequestMethod.GET,
          headers: [],
          params: [],
          body: [],
        ),
        // Define the response for the first API item
        response: [
          APIGuideResponse(
            statusCode: HttpResponseStatusCode.OK,
            headers: [],
            body: {
              "status": 200,
              "data": {
                "name": "Dash",
                "isFly": true,
              }
            },
          ),
        ],
        title: 'All Dashes',
        urlPath: '/dashes',
        description: 'All Dashes get example description',
      ),
      // Define the second API item
      const APIItem(
        // Define the request for the second API item
        request: APIGuideRequest(
          method: HttpRequestMethod.POST,
          headers: [],
          params: [],
          body: [
            APIGuideRequestBody(
              key: 'name',
              value: 'Dash',
              type: PropertyType.string,
              description: 'This is the name attribute',
              isRequired: true,
            ),
            APIGuideRequestBody(
              key: 'isFly',
              value: true,
              type: PropertyType.boolean,
              description: 'This is the isFly attribute',
              isRequired: true,
            ),
          ],
        ),
        // Define the response for the second API item
        response: [
          APIGuideResponse(
            statusCode: HttpResponseStatusCode.OK,
            headers: [],
            body: {
              "status": 200,
              "data": {
                "message": "Data Stored Successfully",
              }
            },
          ),
          APIGuideResponse(
            statusCode: HttpResponseStatusCode.BadRequest,
            headers: [],
            body: {
              "status": 400,
              "data": {
                "message": "Error Data Not Stored!",
              }
            },
          ),
        ],
        title: 'Create',
        urlPath: '/create',
        description: 'Store Dash post example description',
      ),
    ];

    // Define API FAQs items as needed
    List<APIGuideFAQ> apiFaqs = [
      APIGuideFAQ(
        question: 'Can Dash Fly?',
        answer: 'Yes, Dash can Fly.',
      ),
    ];

    // Use APIGuide package with display method and pass needed parameters
    return APIGuide().display(
      context: context,
      urlHost: 'https://example.com',
      apiItems: apiItems,
      apiFaqs: apiFaqs,
      version: 1.0,
      latestUpdate: DateTime.parse('2023-10-10'),
      apiIntro: 'This is some introduction to API Guide.',
    );
  }
}

Thank you #

Make sure to check out example project. If you find this package useful, star my GitHub repository.

Flutter plugin was developed by: Mouaz M. Al-Shahmeh

15
likes
0
pub points
20%
popularity

Publisher

unverified uploader

API Guide is package to generate API calls documentations like OpenAPI schema.

Repository (GitHub)
View/report issues

Topics

#api #documentation #guide #http

License

unknown (LICENSE)

Dependencies

flutter, flutter_lints, lints, url_launcher

More

Packages that depend on api_guide