improved output
[ppastats.git] / src / lp.h
1 /*
2     Copyright (C) 2011 jeanfi@gmail.com
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17     02110-1301 USA
18 */
19
20 #ifndef _PPASTATS_LP_H_
21 #define _PPASTATS_LP_H_
22
23 #define URL_BASE_LP "https://api.launchpad.net/1.0"
24
25 #define _XOPEN_SOURCE
26 #include <time.h>
27
28 struct daily_download_total {
29         int count;
30
31         struct tm date;
32 };
33
34 struct binary_package_publishing_history {
35         char *binary_package_name;
36         char *binary_package_version;
37         char *distro_arch_series_link;
38         char *self_link;
39 };
40
41 struct distro_arch_series {
42         char *display_name;
43         char *title;
44         char *architecture_tag;
45         int is_nominated_arch_indep;
46         char *distroseries_link;
47 };
48
49 struct distro_series {
50         char *displayname;
51         char *name;
52         char *version;
53         char *title;
54 };
55
56 struct distro_series *distro_series_new(const char *name,
57                                         const char *version,
58                                         const char *title,
59                                         const char *displayname);
60
61 void distro_series_free(struct distro_series *distro_series);
62
63 void daily_download_total_list_free(struct daily_download_total **);
64
65 struct distro_arch_series *
66 distro_arch_series_new(const char *display_name,
67                        const char *title,
68                        const char *architecture_tag,
69                        int is_nominated_arch_indep,
70                        const char *distroseries_link);
71
72 void distro_arch_series_free(struct distro_arch_series *);
73
74 void
75 binary_package_publishing_history_free
76 (struct binary_package_publishing_history *b);
77
78 struct binary_package_publishing_history *
79 binary_package_publishing_history_new(const char *binary_package_name,
80                                       const char *binary_package_version,
81                                       const char *distro_arch_series_link,
82                                       const char *self_link);
83
84 void binary_package_publishing_history_list_free
85 (struct binary_package_publishing_history **list);
86
87
88 char *get_archive_url(const char *owner, const char  *ppa);
89
90 #endif